@fluentui/react-virtualizer 9.0.0-alpha.13 → 9.0.0-alpha.14
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.json +16 -1
- package/CHANGELOG.md +11 -2
- package/dist/index.d.ts +90 -27
- package/lib/VirtualizerScrollView.js +2 -0
- package/lib/VirtualizerScrollView.js.map +1 -0
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizer.js +10 -5
- package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +14 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +2 -0
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib/components/VirtualizerScrollView/index.js +6 -0
- package/lib/components/VirtualizerScrollView/index.js.map +1 -0
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js +11 -0
- package/lib/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js +38 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js +46 -0
- package/lib/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useIntersectionObserver.js +0 -8
- package/lib/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/hooks/useVirtualizerMeasure.js +76 -0
- package/lib/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib/hooks/useVirtualizerMeasure.types.js +2 -0
- package/lib/hooks/useVirtualizerMeasure.types.js.map +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/utilities/debounce.js +20 -0
- package/lib/utilities/debounce.js.map +1 -0
- package/lib-commonjs/VirtualizerScrollView.js +9 -0
- package/lib-commonjs/VirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js +15 -5
- package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
- 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 +7 -0
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js +13 -0
- package/lib-commonjs/components/VirtualizerScrollView/index.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js +18 -0
- package/lib-commonjs/components/VirtualizerScrollView/renderVirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js +43 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollView.js.map +1 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js +69 -0
- package/lib-commonjs/components/VirtualizerScrollView/useVirtualizerScrollViewStyles.js.map +1 -0
- package/lib-commonjs/hooks/index.js +1 -0
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useIntersectionObserver.js +0 -8
- package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
- package/lib-commonjs/hooks/useVirtualizerMeasure.js +75 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.types.js +7 -0
- package/lib-commonjs/hooks/useVirtualizerMeasure.types.js.map +1 -0
- package/lib-commonjs/index.js +8 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/debounce.js +29 -0
- package/lib-commonjs/utilities/debounce.js.map +1 -0
- package/package.json +2 -1
|
@@ -11,14 +11,6 @@ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
|
11
11
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
12
|
const { useState , useRef } = _react;
|
|
13
13
|
const useIntersectionObserver = (callback, options)=>{
|
|
14
|
-
// export const useIntersectionObserver = (
|
|
15
|
-
// callback: IntersectionObserverCallback,
|
|
16
|
-
// options?: IntersectionObserverInit,
|
|
17
|
-
// ): [
|
|
18
|
-
// Dispatch<SetStateAction<Element[] | undefined>>,
|
|
19
|
-
// Dispatch<SetStateAction<IntersectionObserverInit | undefined>>,
|
|
20
|
-
// MutableRefObject<IntersectionObserver | undefined>,
|
|
21
|
-
// ] => {
|
|
22
14
|
const observer = useRef();
|
|
23
15
|
const [observerList, setObserverList] = useState();
|
|
24
16
|
const [observerInit, setObserverInit] = useState(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../lib/hooks/useIntersectionObserver.js"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nconst {\n useState,\n useRef\n} = React;\n/**\n * React hook that allows easy usage of the browser API IntersectionObserver within React\n * @param callback - A function called when the percentage of the target element is visible crosses a threshold.\n * @param options - An optional object which customizes the observer. If options isn't specified, the observer uses the\n * document's viewport as the root, with no margin, and a 0% threshold (meaning that even a one-pixel change is\n * enough to trigger a callback).\n * @returns An array containing a callback to update the list of Elements the observer should listen to, a callback to\n * update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.\n */\nexport const useIntersectionObserver = (callback, options) => {\n
|
|
1
|
+
{"version":3,"sources":["../../lib/hooks/useIntersectionObserver.js"],"sourcesContent":["import * as React from 'react';\nimport { useIsomorphicLayoutEffect } from '@fluentui/react-utilities';\nconst {\n useState,\n useRef\n} = React;\n/**\n * React hook that allows easy usage of the browser API IntersectionObserver within React\n * @param callback - A function called when the percentage of the target element is visible crosses a threshold.\n * @param options - An optional object which customizes the observer. If options isn't specified, the observer uses the\n * document's viewport as the root, with no margin, and a 0% threshold (meaning that even a one-pixel change is\n * enough to trigger a callback).\n * @returns An array containing a callback to update the list of Elements the observer should listen to, a callback to\n * update the init options of the IntersectionObserver and a ref to the IntersectionObserver instance itself.\n */\nexport const useIntersectionObserver = (callback, options) => {\n const observer = useRef();\n const [observerList, setObserverList] = useState();\n const [observerInit, setObserverInit] = useState(options);\n // Observer elements in passed in list and clean up previous list\n // This effect is only triggered when observerList is updated\n useIsomorphicLayoutEffect(() => {\n observer.current = new IntersectionObserver(callback, observerInit);\n // If we have an instance of IO and a list with elements, observer the elements\n if (observer.current && observerList && observerList.length > 0) {\n observerList.forEach(element => {\n var _observer_current;\n (_observer_current = observer.current) === null || _observer_current === void 0 ? void 0 : _observer_current.observe(element);\n });\n }\n // clean up previous elements being listened to\n return () => {\n if (observer.current) {\n observer.current.disconnect();\n }\n };\n }, [observerList, observerInit, callback]);\n return {\n setObserverList,\n setObserverInit,\n observer\n };\n};\n//# sourceMappingURL=useIntersectionObserver.js.map"],"names":["useIntersectionObserver","useState","useRef","React","callback","options","observer","observerList","setObserverList","observerInit","setObserverInit","useIsomorphicLayoutEffect","current","IntersectionObserver","length","forEach","element","_observer_current","observe","disconnect"],"mappings":";;;;+BAeaA;;aAAAA;;;6DAfU;gCACmB;AAC1C,MAAM,EACJC,SAAQ,EACRC,OAAM,EACP,GAAGC;AAUG,MAAMH,0BAA0B,CAACI,UAAUC,UAAY;IAC5D,MAAMC,WAAWJ;IACjB,MAAM,CAACK,cAAcC,gBAAgB,GAAGP;IACxC,MAAM,CAACQ,cAAcC,gBAAgB,GAAGT,SAASI;IACjD,iEAAiE;IACjE,6DAA6D;IAC7DM,IAAAA,yCAAyB,EAAC,IAAM;QAC9BL,SAASM,OAAO,GAAG,IAAIC,qBAAqBT,UAAUK;QACtD,+EAA+E;QAC/E,IAAIH,SAASM,OAAO,IAAIL,gBAAgBA,aAAaO,MAAM,GAAG,GAAG;YAC/DP,aAAaQ,OAAO,CAACC,CAAAA,UAAW;gBAC9B,IAAIC;gBACHA,CAAAA,oBAAoBX,SAASM,OAAO,AAAD,MAAO,IAAI,IAAIK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,kBAAkBC,OAAO,CAACF,QAAQ;YAC/H;QACF,CAAC;QACD,+CAA+C;QAC/C,OAAO,IAAM;YACX,IAAIV,SAASM,OAAO,EAAE;gBACpBN,SAASM,OAAO,CAACO,UAAU;YAC7B,CAAC;QACH;IACF,GAAG;QAACZ;QAAcE;QAAcL;KAAS;IACzC,OAAO;QACLI;QACAE;QACAJ;IACF;AACF,GACA,mDAAmD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useStaticVirtualizerMeasure", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>useStaticVirtualizerMeasure
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
|
+
const _debounce = require("../utilities/debounce");
|
|
13
|
+
const useStaticVirtualizerMeasure = (virtualizerProps)=>{
|
|
14
|
+
const { defaultItemSize , direction ='vertical' } = virtualizerProps;
|
|
15
|
+
const [state, setState] = _react.useState({
|
|
16
|
+
virtualizerLength: 0,
|
|
17
|
+
bufferSize: 0,
|
|
18
|
+
bufferItems: 0
|
|
19
|
+
});
|
|
20
|
+
const { virtualizerLength , bufferItems , bufferSize } = state;
|
|
21
|
+
// The ref the user sets on their scrollView - Defaults to document.body to ensure no null on init
|
|
22
|
+
const container = _react.useRef(null);
|
|
23
|
+
const resizeCallback = ()=>{
|
|
24
|
+
if (!container.current) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const containerSize = direction === 'vertical' ? container.current.getBoundingClientRect().height : container.current.getBoundingClientRect().width;
|
|
28
|
+
/*
|
|
29
|
+
* Number of items required to cover viewport.
|
|
30
|
+
*/ const length = Math.ceil(containerSize / defaultItemSize + 1);
|
|
31
|
+
/*
|
|
32
|
+
* Number of items to append at each end, i.e. 'preload' each side before entering view.
|
|
33
|
+
*/ const newBufferItems = Math.max(Math.floor(length / 4), 2);
|
|
34
|
+
/*
|
|
35
|
+
* This is how far we deviate into the bufferItems to detect a redraw.
|
|
36
|
+
*/ const newBufferSize = Math.max(Math.floor(length / 8 * defaultItemSize), 1);
|
|
37
|
+
const totalLength = length + newBufferItems * 2 + 1;
|
|
38
|
+
setState({
|
|
39
|
+
virtualizerLength: totalLength,
|
|
40
|
+
bufferItems: newBufferItems,
|
|
41
|
+
bufferSize: newBufferSize
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
// the handler for resize observer
|
|
45
|
+
const handleResize = (0, _debounce.debounce)(resizeCallback);
|
|
46
|
+
// Keep the reference of ResizeObserver in the state, as it should live through renders
|
|
47
|
+
const [resizeObserver] = _react.useState((0, _reactUtilities.canUseDOM)() ? new ResizeObserver(handleResize) : undefined);
|
|
48
|
+
_react.useEffect(()=>{
|
|
49
|
+
return ()=>{
|
|
50
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
51
|
+
};
|
|
52
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
|
+
}, []);
|
|
54
|
+
const scrollRef = _react.useCallback((el)=>{
|
|
55
|
+
if (container.current !== el) {
|
|
56
|
+
if (container.current) {
|
|
57
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.unobserve(container.current);
|
|
58
|
+
}
|
|
59
|
+
container.current = el;
|
|
60
|
+
if (container.current) {
|
|
61
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe(container.current);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}, [
|
|
65
|
+
resizeObserver
|
|
66
|
+
]);
|
|
67
|
+
return {
|
|
68
|
+
virtualizerLength,
|
|
69
|
+
bufferItems,
|
|
70
|
+
bufferSize,
|
|
71
|
+
scrollRef
|
|
72
|
+
};
|
|
73
|
+
}; //# sourceMappingURL=useVirtualizerMeasure.js.map
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=useVirtualizerMeasure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../lib/hooks/useVirtualizerMeasure.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseDOM } from '@fluentui/react-utilities';\nimport { debounce } from '../utilities/debounce';\n/**\n * React hook that measures virtualized space based on a static size to ensure optimized virtualization length.\n */\nexport const useStaticVirtualizerMeasure = virtualizerProps => {\n const {\n defaultItemSize,\n direction = 'vertical'\n } = virtualizerProps;\n const [state, setState] = React.useState({\n virtualizerLength: 0,\n bufferSize: 0,\n bufferItems: 0\n });\n const {\n virtualizerLength,\n bufferItems,\n bufferSize\n } = state;\n // The ref the user sets on their scrollView - Defaults to document.body to ensure no null on init\n const container = React.useRef(null);\n const resizeCallback = () => {\n if (!container.current) {\n return;\n }\n const containerSize = direction === 'vertical' ? container.current.getBoundingClientRect().height : container.current.getBoundingClientRect().width;\n /*\n * Number of items required to cover viewport.\n */\n const length = Math.ceil(containerSize / defaultItemSize + 1);\n /*\n * Number of items to append at each end, i.e. 'preload' each side before entering view.\n */\n const newBufferItems = Math.max(Math.floor(length / 4), 2);\n /*\n * This is how far we deviate into the bufferItems to detect a redraw.\n */\n const newBufferSize = Math.max(Math.floor(length / 8 * defaultItemSize), 1);\n const totalLength = length + newBufferItems * 2 + 1;\n setState({\n virtualizerLength: totalLength,\n bufferItems: newBufferItems,\n bufferSize: newBufferSize\n });\n };\n // the handler for resize observer\n const handleResize = debounce(resizeCallback);\n // Keep the reference of ResizeObserver in the state, as it should live through renders\n const [resizeObserver] = React.useState(canUseDOM() ? new ResizeObserver(handleResize) : undefined);\n React.useEffect(() => {\n return () => {\n resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n const scrollRef = React.useCallback(el => {\n if (container.current !== el) {\n if (container.current) {\n resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.unobserve(container.current);\n }\n container.current = el;\n if (container.current) {\n resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe(container.current);\n }\n }\n }, [resizeObserver]);\n return {\n virtualizerLength,\n bufferItems,\n bufferSize,\n scrollRef\n };\n};\n//# sourceMappingURL=useVirtualizerMeasure.js.map"],"names":["useStaticVirtualizerMeasure","virtualizerProps","defaultItemSize","direction","state","setState","React","useState","virtualizerLength","bufferSize","bufferItems","container","useRef","resizeCallback","current","containerSize","getBoundingClientRect","height","width","length","Math","ceil","newBufferItems","max","floor","newBufferSize","totalLength","handleResize","debounce","resizeObserver","canUseDOM","ResizeObserver","undefined","useEffect","disconnect","scrollRef","useCallback","el","unobserve","observe"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;gCACG;0BACD;AAIlB,MAAMA,8BAA8BC,CAAAA,mBAAoB;IAC7D,MAAM,EACJC,gBAAe,EACfC,WAAY,WAAU,EACvB,GAAGF;IACJ,MAAM,CAACG,OAAOC,SAAS,GAAGC,OAAMC,QAAQ,CAAC;QACvCC,mBAAmB;QACnBC,YAAY;QACZC,aAAa;IACf;IACA,MAAM,EACJF,kBAAiB,EACjBE,YAAW,EACXD,WAAU,EACX,GAAGL;IACJ,kGAAkG;IAClG,MAAMO,YAAYL,OAAMM,MAAM,CAAC,IAAI;IACnC,MAAMC,iBAAiB,IAAM;QAC3B,IAAI,CAACF,UAAUG,OAAO,EAAE;YACtB;QACF,CAAC;QACD,MAAMC,gBAAgBZ,cAAc,aAAaQ,UAAUG,OAAO,CAACE,qBAAqB,GAAGC,MAAM,GAAGN,UAAUG,OAAO,CAACE,qBAAqB,GAAGE,KAAK;QACnJ;;IAEA,GACA,MAAMC,SAASC,KAAKC,IAAI,CAACN,gBAAgBb,kBAAkB;QAC3D;;IAEA,GACA,MAAMoB,iBAAiBF,KAAKG,GAAG,CAACH,KAAKI,KAAK,CAACL,SAAS,IAAI;QACxD;;IAEA,GACA,MAAMM,gBAAgBL,KAAKG,GAAG,CAACH,KAAKI,KAAK,CAACL,SAAS,IAAIjB,kBAAkB;QACzE,MAAMwB,cAAcP,SAASG,iBAAiB,IAAI;QAClDjB,SAAS;YACPG,mBAAmBkB;YACnBhB,aAAaY;YACbb,YAAYgB;QACd;IACF;IACA,kCAAkC;IAClC,MAAME,eAAeC,IAAAA,kBAAQ,EAACf;IAC9B,uFAAuF;IACvF,MAAM,CAACgB,eAAe,GAAGvB,OAAMC,QAAQ,CAACuB,IAAAA,yBAAS,MAAK,IAAIC,eAAeJ,gBAAgBK,SAAS;IAClG1B,OAAM2B,SAAS,CAAC,IAAM;QACpB,OAAO,IAAM;YACXJ,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeK,UAAU,EAAE;QAC7F;IACA,uDAAuD;IACzD,GAAG,EAAE;IACL,MAAMC,YAAY7B,OAAM8B,WAAW,CAACC,CAAAA,KAAM;QACxC,IAAI1B,UAAUG,OAAO,KAAKuB,IAAI;YAC5B,IAAI1B,UAAUG,OAAO,EAAE;gBACrBe,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeS,SAAS,CAAC3B,UAAUG,OAAO,CAAC;YAC7G,CAAC;YACDH,UAAUG,OAAO,GAAGuB;YACpB,IAAI1B,UAAUG,OAAO,EAAE;gBACrBe,mBAAmB,IAAI,IAAIA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAeU,OAAO,CAAC5B,UAAUG,OAAO,CAAC;YAC3G,CAAC;QACH,CAAC;IACH,GAAG;QAACe;KAAe;IACnB,OAAO;QACLrB;QACAE;QACAD;QACA0B;IACF;AACF,GACA,iDAAiD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../lib/hooks/useVirtualizerMeasure.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=useVirtualizerMeasure.types.js.map"],"names":[],"mappings":";;;;CACA,uDAAuD"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -14,10 +14,17 @@ _export(exports, {
|
|
|
14
14
|
useVirtualizer_unstable: ()=>_virtualizer.useVirtualizer_unstable,
|
|
15
15
|
renderVirtualizer_unstable: ()=>_virtualizer.renderVirtualizer_unstable,
|
|
16
16
|
useVirtualizerStyles_unstable: ()=>_virtualizer.useVirtualizerStyles_unstable,
|
|
17
|
-
useIntersectionObserver: ()=>_hooks.useIntersectionObserver
|
|
17
|
+
useIntersectionObserver: ()=>_hooks.useIntersectionObserver,
|
|
18
|
+
useStaticVirtualizerMeasure: ()=>_hooks.useStaticVirtualizerMeasure,
|
|
19
|
+
VirtualizerScrollView: ()=>_virtualizerScrollView.VirtualizerScrollView,
|
|
20
|
+
virtualizerScrollViewClassNames: ()=>_virtualizerScrollView.virtualizerScrollViewClassNames,
|
|
21
|
+
useVirtualizerScrollView_unstable: ()=>_virtualizerScrollView.useVirtualizerScrollView_unstable,
|
|
22
|
+
renderVirtualizerScrollView_unstable: ()=>_virtualizerScrollView.renderVirtualizerScrollView_unstable,
|
|
23
|
+
useVirtualizerScrollViewStyles_unstable: ()=>_virtualizerScrollView.useVirtualizerScrollViewStyles_unstable
|
|
18
24
|
});
|
|
19
25
|
const _virtualizer = require("./Virtualizer");
|
|
20
26
|
const _hooks = require("./Hooks");
|
|
27
|
+
const _virtualizerScrollView = require("./VirtualizerScrollView");
|
|
21
28
|
//# sourceMappingURL=index.js.map
|
|
22
29
|
|
|
23
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { Virtualizer, virtualizerClassNames, useVirtualizer_unstable, renderVirtualizer_unstable, useVirtualizerStyles_unstable } from './Virtualizer';\nexport { useIntersectionObserver } from './Hooks';\n//# sourceMappingURL=index.js.map"],"names":["Virtualizer","virtualizerClassNames","useVirtualizer_unstable","renderVirtualizer_unstable","useVirtualizerStyles_unstable","useIntersectionObserver"],"mappings":";;;;;;;;;;;IAASA,WAAW,MAAXA,wBAAW;IAAEC,qBAAqB,MAArBA,kCAAqB;IAAEC,uBAAuB,MAAvBA,oCAAuB;IAAEC,0BAA0B,MAA1BA,uCAA0B;IAAEC,6BAA6B,MAA7BA,0CAA6B;IACtHC,uBAAuB,MAAvBA,8BAAuB
|
|
1
|
+
{"version":3,"sources":["../lib/index.js"],"sourcesContent":["export { Virtualizer, virtualizerClassNames, useVirtualizer_unstable, renderVirtualizer_unstable, useVirtualizerStyles_unstable } from './Virtualizer';\nexport { useIntersectionObserver, useStaticVirtualizerMeasure } from './Hooks';\nexport { VirtualizerScrollView, virtualizerScrollViewClassNames, useVirtualizerScrollView_unstable, renderVirtualizerScrollView_unstable, useVirtualizerScrollViewStyles_unstable } from './VirtualizerScrollView';\n//# sourceMappingURL=index.js.map"],"names":["Virtualizer","virtualizerClassNames","useVirtualizer_unstable","renderVirtualizer_unstable","useVirtualizerStyles_unstable","useIntersectionObserver","useStaticVirtualizerMeasure","VirtualizerScrollView","virtualizerScrollViewClassNames","useVirtualizerScrollView_unstable","renderVirtualizerScrollView_unstable","useVirtualizerScrollViewStyles_unstable"],"mappings":";;;;;;;;;;;IAASA,WAAW,MAAXA,wBAAW;IAAEC,qBAAqB,MAArBA,kCAAqB;IAAEC,uBAAuB,MAAvBA,oCAAuB;IAAEC,0BAA0B,MAA1BA,uCAA0B;IAAEC,6BAA6B,MAA7BA,0CAA6B;IACtHC,uBAAuB,MAAvBA,8BAAuB;IAAEC,2BAA2B,MAA3BA,kCAA2B;IACpDC,qBAAqB,MAArBA,4CAAqB;IAAEC,+BAA+B,MAA/BA,sDAA+B;IAAEC,iCAAiC,MAAjCA,wDAAiC;IAAEC,oCAAoC,MAApCA,2DAAoC;IAAEC,uCAAuC,MAAvCA,8DAAuC;;6BAF1C;uBAClE;uCACoH;CACzL,iCAAiC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
*/ "use strict";
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, "debounce", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: ()=>debounce
|
|
13
|
+
});
|
|
14
|
+
function debounce(fn) {
|
|
15
|
+
let pending;
|
|
16
|
+
return ()=>{
|
|
17
|
+
if (!pending) {
|
|
18
|
+
pending = true;
|
|
19
|
+
queueMicrotask(()=>{
|
|
20
|
+
// Need to set pending to `false` before the debounced function is run.
|
|
21
|
+
// React can actually interrupt the function while it's running!
|
|
22
|
+
pending = false;
|
|
23
|
+
fn();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
} //# sourceMappingURL=debounce.js.map
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=debounce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../lib/utilities/debounce.js"],"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 */export function debounce(fn) {\n let pending;\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//# sourceMappingURL=debounce.js.map"],"names":["debounce","fn","pending","queueMicrotask"],"mappings":"AAAA;;;;;CAKC;;;;+BAAkBA;;aAAAA;;AAAT,SAASA,SAASC,EAAE,EAAE;IAC9B,IAAIC;IACJ,OAAO,IAAM;QACX,IAAI,CAACA,SAAS;YACZA,UAAU,IAAI;YACdC,eAAe,IAAM;gBACnB,uEAAuE;gBACvE,gEAAgE;gBAChED,UAAU,KAAK;gBACfD;YACF;QACF,CAAC;IACH;AACF,EACA,oCAAoC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-virtualizer",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.14",
|
|
4
4
|
"description": "Generic and composable virtualizer framework built on browser intersection observer",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fluentui/react-utilities": "^9.7.2",
|
|
35
|
+
"@fluentui/react": "^8.106.8",
|
|
35
36
|
"@griffel/react": "^1.5.2",
|
|
36
37
|
"@swc/helpers": "^0.4.14"
|
|
37
38
|
},
|