@fluentui/react-virtualizer 9.0.0-alpha.111 → 9.0.0-alpha.112
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 +12 -2
- package/lib/components/Virtualizer/Virtualizer.js +0 -1
- package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
- package/lib/components/Virtualizer/Virtualizer.types.js +3 -1
- package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
- package/lib/components/Virtualizer/useVirtualizerStyles.styles.raw.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js +0 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js +3 -1
- package/lib/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +0 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
- package/lib/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib/hooks/hooks.types.js +5 -1
- package/lib/hooks/hooks.types.js.map +1 -1
- package/lib/hooks/useDynamicPagination.js.map +1 -1
- package/lib/hooks/useDynamicVirtualizerMeasure.js +2 -4
- package/lib/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
- package/lib/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/hooks/useMeasureList.js.map +1 -1
- package/lib/hooks/useMutationObserver.js.map +1 -1
- package/lib/hooks/useResizeObserverRef.js.map +1 -1
- package/lib/hooks/useStaticPagination.js.map +1 -1
- package/lib/hooks/useVirtualizerMeasure.js +1 -2
- package/lib/hooks/useVirtualizerMeasure.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -1
- package/lib/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -1
- package/lib/utilities/VirtualizerContext/types.js +4 -1
- package/lib/utilities/VirtualizerContext/types.js.map +1 -1
- package/lib-commonjs/components/Virtualizer/Virtualizer.js +0 -2
- 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/useVirtualizerStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js +0 -2
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js +3 -3
- package/lib-commonjs/components/VirtualizerScrollView/VirtualizerScrollView.types.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js +0 -2
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js +0 -2
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/VirtualizerScrollViewDynamic.types.js.map +1 -1
- package/lib-commonjs/components/VirtualizerScrollViewDynamic/renderVirtualizerScrollViewDynamic.js.map +1 -1
- package/lib-commonjs/hooks/hooks.types.js +5 -3
- package/lib-commonjs/hooks/hooks.types.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicPagination.js.map +1 -1
- package/lib-commonjs/hooks/useDynamicVirtualizerMeasure.js.map +1 -1
- package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
- package/lib-commonjs/hooks/useMeasureList.js.map +1 -1
- package/lib-commonjs/hooks/useMutationObserver.js.map +1 -1
- package/lib-commonjs/hooks/useResizeObserverRef.js.map +1 -1
- package/lib-commonjs/hooks/useStaticPagination.js.map +1 -1
- package/lib-commonjs/hooks/useVirtualizerMeasure.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js +0 -2
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrolling.types.js.map +1 -1
- package/lib-commonjs/utilities/ImperativeScrolling/imperativeScrollingDynamic.js.map +1 -1
- package/lib-commonjs/utilities/VirtualizerContext/types.js +4 -3
- package/lib-commonjs/utilities/VirtualizerContext/types.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useMutationObserver.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nconst { useRef, useEffect } = React;\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useMutationObserver = (\n target: Element | Document | undefined,\n callback: MutationCallback,\n options?: MutationObserverInit,\n): {\n
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useMutationObserver.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nconst { useRef, useEffect } = React;\n\n/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useMutationObserver = (\n target: Element | Document | undefined,\n callback: MutationCallback,\n options?: MutationObserverInit,\n): {\n observer: React.MutableRefObject<MutationObserver | undefined>;\n} => {\n 'use no memo';\n\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n const observer = useRef<MutationObserver | undefined>(undefined);\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n useEffect(() => {\n if (!win) {\n return;\n }\n // Create an observer instance linked to the callback function\n observer.current = new win.MutationObserver(callback);\n }, [callback, win]);\n\n useEffect(() => {\n if (target) {\n // Start observing the target node for configured mutations\n observer.current?.observe(target, options);\n }\n\n return () => {\n observer.current?.disconnect();\n };\n }, [target, options]);\n\n return { observer };\n};\n"],"names":["React","useFluent_unstable","useFluent","useRef","useEffect","useMutationObserver","target","callback","options","observer","undefined","targetDocument","win","defaultView","current","MutationObserver","observe","disconnect"],"mappings":"AAAA;;;;;+BAUaK;;;;;;;iEARU,QAAQ;qCACiB,kCAAkC;AAElF,MAAM,EAAEF,MAAM,EAAEC,SAAS,EAAE,GAAGJ;AAKvB,4BAA4B,CACjCM,QACAC,UACAC;IAIA;IAEA,8FAA8F;IAE9F,MAAMC,WAAWN,OAAqCO;IACtD,MAAM,EAAEC,cAAc,EAAE,OAAGT,uCAAAA;IAC3B,MAAMU,MAAMD,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBE,WAAW;IAEvCT,UAAU;QACR,IAAI,CAACQ,KAAK;YACR;QACF;QACA,8DAA8D;QAC9DH,SAASK,OAAO,GAAG,IAAIF,IAAIG,gBAAgB,CAACR;IAC9C,GAAG;QAACA;QAAUK;KAAI;IAElBR,UAAU;QACR,IAAIE,QAAQ;gBACV,AACAG,2DAD2D;aAC3DA,oBAAAA,SAASK,OAAAA,AAAO,MAAA,QAAhBL,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAkBO,OAAO,CAACV,QAAQE;QACpC;QAEA,OAAO;gBACLC;aAAAA,oBAAAA,SAASK,OAAAA,AAAO,MAAA,QAAhBL,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAkBQ,UAAU;QAC9B;IACF,GAAG;QAACX;QAAQE;KAAQ;IAEpB,OAAO;QAAEC;IAAS;AACpB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useResizeObserverRef.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { debounce } from '../utilities/debounce';\nimport { createResizeObserverFromDocument } from '../utilities/createResizeObserverFromDocument';\nimport { ResizeCallbackWithRef } from './hooks.types';\n\n/**\n * useResizeObserverRef_unstable simplifies resize observer connection and ensures debounce/cleanup\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useResizeObserverRef_unstable = (\n resizeCallback: ResizeCallbackWithRef,\n): ((instance: HTMLElement | HTMLDivElement | null) => void) => {\n 'use no memo';\n\n const { targetDocument } = useFluent();\n const container = React.useRef<HTMLElement | null>(null);\n const containerHeightRef = React.useRef<number>(0);\n const containerWidthRef = React.useRef<number>(0);\n // the handler for resize observer\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n const handleResize = debounce((entries: ResizeObserverEntry[], observer: ResizeObserver) => {\n const containerHeight = container.current?.clientHeight;\n const containerWidth = container.current?.clientWidth;\n // Our resize observer will fire on scroll resize, let index change handle that instead.\n if (containerHeightRef.current !== containerHeight || containerWidth !== containerWidthRef.current) {\n containerWidthRef.current = containerWidth ?? 0;\n containerHeightRef.current = containerHeight ?? 0;\n resizeCallback(entries, observer, container);\n }\n });\n\n // Keep the reference of ResizeObserver in the state, as it should live through renders\n const [resizeObserver, setResizeObserver] = React.useState(() =>\n createResizeObserverFromDocument(targetDocument, handleResize),\n );\n\n React.useEffect(() => {\n // Update our state when resizeCallback changes\n container.current = null;\n resizeObserver?.disconnect();\n setResizeObserver(() => createResizeObserverFromDocument(targetDocument, handleResize));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [resizeCallback, targetDocument]);\n\n React.useEffect(() => {\n return () => {\n container.current = null;\n resizeObserver?.disconnect();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const scrollRef = React.useCallback(\n (instance: HTMLElement | HTMLDivElement | null) => {\n if (container.current !== instance) {\n if (container.current) {\n resizeObserver?.unobserve(container.current);\n }\n\n container.current = instance;\n if (container.current) {\n resizeObserver?.observe(container.current);\n }\n }\n },\n [resizeObserver],\n );\n\n return scrollRef;\n};\n"],"names":["React","useFluent_unstable","useFluent","debounce","createResizeObserverFromDocument","useResizeObserverRef_unstable","resizeCallback","targetDocument","container","useRef","containerHeightRef","containerWidthRef","handleResize","entries","observer","containerHeight","current","clientHeight","containerWidth","clientWidth","resizeObserver","setResizeObserver","useState","useEffect","disconnect","scrollRef","useCallback","instance","unobserve","observe"],"mappings":"AAAA;;;;;+BAYaK;;;;;;;iEAVU,QAAQ;qCACiB,kCAAkC;0BACzD,wBAAwB;kDACA,gDAAgD;AAO1F,sCAAsC,CAC3CC;IAEA;IAEA,MAAM,EAAEC,cAAc,EAAE,OAAGL,uCAAAA;IAC3B,MAAMM,YAAYR,OAAMS,MAAM,CAAqB;IACnD,MAAMC,qBAAqBV,OAAMS,MAAM,CAAS;IAChD,MAAME,oBAAoBX,OAAMS,MAAM,CAAS;IAC/C,kCAAkC;IAClC,8FAA8F;IAE9F,MAAMG,mBAAeT,kBAAAA,EAAS,CAACU,SAAgCC;YACrCN,oBACDA;QADvB,MAAMO,kBAAAA,CAAkBP,qBAAAA,UAAUQ,OAAAA,AAAO,MAAA,QAAjBR,uBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mBAAmBS,YAAY;QACvD,MAAMC,iBAAAA,CAAiBV,sBAAAA,UAAUQ,OAAAA,AAAO,MAAA,QAAjBR,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAmBW,WAAW;QACrD,wFAAwF;QACxF,IAAIT,mBAAmBM,OAAO,KAAKD,mBAAmBG,mBAAmBP,kBAAkBK,OAAO,EAAE;YAClGL,kBAAkBK,OAAO,GAAGE,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,iBAAkB;YAC9CR,mBAAmBM,OAAO,GAAGD,oBAAAA,QAAAA,oBAAAA,KAAAA,IAAAA,kBAAmB;YAChDT,eAAeO,SAASC,UAAUN;QACpC;IACF;IAEA,uFAAuF;IACvF,MAAM,CAACY,gBAAgBC,kBAAkB,GAAGrB,OAAMsB,QAAQ,CAAC,QACzDlB,kEAAAA,EAAiCG,gBAAgBK;IAGnDZ,OAAMuB,SAAS,CAAC;QACd,+CAA+C;QAC/Cf,UAAUQ,OAAO,GAAG;QACpBI,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBI,UAAU;QAC1BH,kBAAkB,QAAMjB,kEAAAA,EAAiCG,gBAAgBK;IACzE,uDAAuD;IACzD,GAAG;QAACN;QAAgBC;KAAe;IAEnCP,OAAMuB,SAAS,CAAC;QACd,OAAO;YACLf,UAAUQ,OAAO,GAAG;YACpBI,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBI,UAAU;QAC5B;IACA,uDAAuD;IACzD,GAAG,EAAE;IAEL,MAAMC,YAAYzB,OAAM0B,WAAW,CACjC,CAACC;QACC,IAAInB,UAAUQ,OAAO,KAAKW,UAAU;YAClC,IAAInB,UAAUQ,OAAO,EAAE;gBACrBI,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBQ,SAAS,CAACpB,UAAUQ,OAAO;YAC7C;YAEAR,UAAUQ,OAAO,GAAGW;YACpB,IAAInB,UAAUQ,OAAO,EAAE;gBACrBI,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBS,OAAO,CAACrB,UAAUQ,OAAO;YAC3C;QACF;IACF,GACA;QAACI;KAAe;IAGlB,OAAOK;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useResizeObserverRef.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { debounce } from '../utilities/debounce';\nimport { createResizeObserverFromDocument } from '../utilities/createResizeObserverFromDocument';\nimport type { ResizeCallbackWithRef } from './hooks.types';\n\n/**\n * useResizeObserverRef_unstable simplifies resize observer connection and ensures debounce/cleanup\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useResizeObserverRef_unstable = (\n resizeCallback: ResizeCallbackWithRef,\n): ((instance: HTMLElement | HTMLDivElement | null) => void) => {\n 'use no memo';\n\n const { targetDocument } = useFluent();\n const container = React.useRef<HTMLElement | null>(null);\n const containerHeightRef = React.useRef<number>(0);\n const containerWidthRef = React.useRef<number>(0);\n // the handler for resize observer\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n const handleResize = debounce((entries: ResizeObserverEntry[], observer: ResizeObserver) => {\n const containerHeight = container.current?.clientHeight;\n const containerWidth = container.current?.clientWidth;\n // Our resize observer will fire on scroll resize, let index change handle that instead.\n if (containerHeightRef.current !== containerHeight || containerWidth !== containerWidthRef.current) {\n containerWidthRef.current = containerWidth ?? 0;\n containerHeightRef.current = containerHeight ?? 0;\n resizeCallback(entries, observer, container);\n }\n });\n\n // Keep the reference of ResizeObserver in the state, as it should live through renders\n const [resizeObserver, setResizeObserver] = React.useState(() =>\n createResizeObserverFromDocument(targetDocument, handleResize),\n );\n\n React.useEffect(() => {\n // Update our state when resizeCallback changes\n container.current = null;\n resizeObserver?.disconnect();\n setResizeObserver(() => createResizeObserverFromDocument(targetDocument, handleResize));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [resizeCallback, targetDocument]);\n\n React.useEffect(() => {\n return () => {\n container.current = null;\n resizeObserver?.disconnect();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const scrollRef = React.useCallback(\n (instance: HTMLElement | HTMLDivElement | null) => {\n if (container.current !== instance) {\n if (container.current) {\n resizeObserver?.unobserve(container.current);\n }\n\n container.current = instance;\n if (container.current) {\n resizeObserver?.observe(container.current);\n }\n }\n },\n [resizeObserver],\n );\n\n return scrollRef;\n};\n"],"names":["React","useFluent_unstable","useFluent","debounce","createResizeObserverFromDocument","useResizeObserverRef_unstable","resizeCallback","targetDocument","container","useRef","containerHeightRef","containerWidthRef","handleResize","entries","observer","containerHeight","current","clientHeight","containerWidth","clientWidth","resizeObserver","setResizeObserver","useState","useEffect","disconnect","scrollRef","useCallback","instance","unobserve","observe"],"mappings":"AAAA;;;;;+BAYaK;;;;;;;iEAVU,QAAQ;qCACiB,kCAAkC;0BACzD,wBAAwB;kDACA,gDAAgD;AAO1F,sCAAsC,CAC3CC;IAEA;IAEA,MAAM,EAAEC,cAAc,EAAE,OAAGL,uCAAAA;IAC3B,MAAMM,YAAYR,OAAMS,MAAM,CAAqB;IACnD,MAAMC,qBAAqBV,OAAMS,MAAM,CAAS;IAChD,MAAME,oBAAoBX,OAAMS,MAAM,CAAS;IAC/C,kCAAkC;IAClC,8FAA8F;IAE9F,MAAMG,mBAAeT,kBAAAA,EAAS,CAACU,SAAgCC;YACrCN,oBACDA;QADvB,MAAMO,kBAAAA,CAAkBP,qBAAAA,UAAUQ,OAAAA,AAAO,MAAA,QAAjBR,uBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mBAAmBS,YAAY;QACvD,MAAMC,iBAAAA,CAAiBV,sBAAAA,UAAUQ,OAAAA,AAAO,MAAA,QAAjBR,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAmBW,WAAW;QACrD,wFAAwF;QACxF,IAAIT,mBAAmBM,OAAO,KAAKD,mBAAmBG,mBAAmBP,kBAAkBK,OAAO,EAAE;YAClGL,kBAAkBK,OAAO,GAAGE,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,iBAAkB;YAC9CR,mBAAmBM,OAAO,GAAGD,oBAAAA,QAAAA,oBAAAA,KAAAA,IAAAA,kBAAmB;YAChDT,eAAeO,SAASC,UAAUN;QACpC;IACF;IAEA,uFAAuF;IACvF,MAAM,CAACY,gBAAgBC,kBAAkB,GAAGrB,OAAMsB,QAAQ,CAAC,QACzDlB,kEAAAA,EAAiCG,gBAAgBK;IAGnDZ,OAAMuB,SAAS,CAAC;QACd,+CAA+C;QAC/Cf,UAAUQ,OAAO,GAAG;QACpBI,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBI,UAAU;QAC1BH,kBAAkB,QAAMjB,kEAAAA,EAAiCG,gBAAgBK;IACzE,uDAAuD;IACzD,GAAG;QAACN;QAAgBC;KAAe;IAEnCP,OAAMuB,SAAS,CAAC;QACd,OAAO;YACLf,UAAUQ,OAAO,GAAG;YACpBI,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBI,UAAU;QAC5B;IACA,uDAAuD;IACzD,GAAG,EAAE;IAEL,MAAMC,YAAYzB,OAAM0B,WAAW,CACjC,CAACC;QACC,IAAInB,UAAUQ,OAAO,KAAKW,UAAU;YAClC,IAAInB,UAAUQ,OAAO,EAAE;gBACrBI,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBQ,SAAS,CAACpB,UAAUQ,OAAO;YAC7C;YAEAR,UAAUQ,OAAO,GAAGW;YACpB,IAAInB,UAAUQ,OAAO,EAAE;gBACrBI,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBS,OAAO,CAACrB,UAAUQ,OAAO;YAC3C;QACF;IACF,GACA;QAACI;KAAe;IAGlB,OAAOK;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useStaticPagination.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { VirtualizerStaticPaginationProps } from './hooks.types';\nimport { useTimeout } from '@fluentui/react-utilities';\n\n/**\n * Optional hook that will enable pagination on the virtualizer so that it 'autoscrolls' to an items exact position\n * Sizes are uniform/static, we round to the nearest item on long scrolls\n * On short scrolls, we will go at minimum to the next/previous item so that arrow pagination works\n * All VirtualizerStaticPaginationProps can be grabbed from Virtualizer hooks externally and passed in/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useStaticVirtualizerPagination = (\n virtualizerProps: VirtualizerStaticPaginationProps,\n paginationEnabled: Boolean = true,\n): ((instance: HTMLElement | HTMLDivElement | null) => void) => {\n 'use no memo';\n\n const { itemSize, axis = 'vertical' } = virtualizerProps;\n\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const lastScrollPos = React.useRef<number>(0);\n const lastIndexScrolled = React.useRef<number>(0);\n\n const scrollContainer = React.useRef<HTMLElement | null>(null);\n\n const clearListeners = () => {\n if (scrollContainer.current) {\n scrollContainer.current.removeEventListener('scroll', onScroll);\n\n scrollContainer.current = null;\n clearScrollTimer();\n }\n };\n\n React.useEffect(() => {\n return () => {\n clearListeners();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /**\n * Handle scroll stop event and paginate to the closest item\n * If the closest item is the same as the previous scroll end\n * we paginate to the next/previous one based on direction\n */\n const onScrollEnd = React.useCallback(() => {\n if (!scrollContainer.current || !paginationEnabled) {\n // No container found\n return;\n }\n\n const currentScrollPos = Math.round(\n axis === 'vertical' ? scrollContainer.current.scrollTop : scrollContainer.current.scrollLeft,\n );\n const closestItem = Math.round(currentScrollPos / itemSize);\n\n let nextItem = 0;\n if (Math.round(closestItem - lastIndexScrolled.current) === 0) {\n // Special case for go to next/previous with minimum amount of scroll needed\n const nextTarget = lastScrollPos.current < currentScrollPos ? 1 : -1;\n const isSecondaryScroll = lastScrollPos.current === currentScrollPos;\n const posMod = isSecondaryScroll ? 0 : nextTarget;\n\n nextItem = closestItem + posMod;\n } else {\n // Pagination for anything else can just jump to the closest!\n nextItem = closestItem;\n }\n\n const nextItemPos = nextItem * itemSize;\n\n if (axis === 'vertical') {\n scrollContainer.current.scrollTo({ top: nextItemPos, behavior: 'smooth' });\n } else {\n scrollContainer.current.scrollTo({ left: nextItemPos, behavior: 'smooth' });\n }\n lastScrollPos.current = nextItemPos;\n lastIndexScrolled.current = nextItem;\n }, [paginationEnabled, axis, itemSize]);\n\n /**\n * On scroll timer that will continuously delay callback until scrolling stops\n */\n const onScroll = React.useCallback(() => {\n clearScrollTimer();\n setScrollTimer(onScrollEnd, 100);\n }, [onScrollEnd, clearScrollTimer, setScrollTimer]);\n\n /**\n * Pagination ref will ensure we attach listeners to containers on change\n * It is returned from hook and merged into the scroll container externally\n */\n const paginationRef = React.useCallback(\n (instance: HTMLElement | HTMLDivElement | null) => {\n if (!paginationEnabled) {\n clearListeners();\n scrollContainer.current = null;\n return;\n }\n if (scrollContainer.current !== instance) {\n clearListeners();\n\n scrollContainer.current = instance;\n if (scrollContainer.current) {\n scrollContainer.current.addEventListener('scroll', onScroll);\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [onScroll, onScrollEnd, paginationEnabled],\n );\n\n return paginationRef;\n};\n"],"names":["React","useTimeout","useStaticVirtualizerPagination","virtualizerProps","paginationEnabled","itemSize","axis","setScrollTimer","clearScrollTimer","lastScrollPos","useRef","lastIndexScrolled","scrollContainer","clearListeners","current","removeEventListener","onScroll","useEffect","onScrollEnd","useCallback","currentScrollPos","Math","round","scrollTop","scrollLeft","closestItem","nextItem","nextTarget","isSecondaryScroll","posMod","nextItemPos","scrollTo","top","behavior","left","paginationRef","instance","addEventListener"],"mappings":"AAAA;;;;;+BAaaE;;;;;;;iEAXU,QAAQ;gCAEJ,4BAA4B;AAShD,uCAAuC,CAC5CC,kBACAC,oBAA6B,IAAI;IAEjC;IAEA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,UAAU,EAAE,GAAGH;IAExC,MAAM,CAACI,gBAAgBC,iBAAiB,OAAGP,0BAAAA;IAC3C,MAAMQ,gBAAgBT,OAAMU,MAAM,CAAS;IAC3C,MAAMC,oBAAoBX,OAAMU,MAAM,CAAS;IAE/C,MAAME,kBAAkBZ,OAAMU,MAAM,CAAqB;IAEzD,MAAMG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AW,CAAC;QACjCX;QACAD,eAAeW,aAAa;IAC9B,GAAG;QAACA;QAAaV;QAAkBD;KAAe;IAElD;;;GAGC,GACD,MAAM4B,gBAAgBnC,OAAMmB,WAAW,CACrC,CAACiB;QACC,IAAI,CAAChC,mBAAmB;YACtBS;YACAD,gBAAgBE,OAAO,GAAG;YAC1B;QACF;QACA,IAAIF,gBAAgBE,OAAO,KAAKsB,UAAU;YACxCvB;YAEAD,gBAAgBE,OAAO,GAAGsB;YAC1B,IAAIxB,gBAAgBE,OAAO,EAAE;gBAC3BF,gBAAgBE,OAAO,CAACuB,gBAAgB,CAAC,UAAUrB;YACrD;QACF;IACF,GACA,AACA,uDADuD;QACtDA;QAAUE;QAAad;KAAkB;IAG5C,OAAO+B;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useStaticPagination.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { VirtualizerStaticPaginationProps } from './hooks.types';\nimport { useTimeout } from '@fluentui/react-utilities';\n\n/**\n * Optional hook that will enable pagination on the virtualizer so that it 'autoscrolls' to an items exact position\n * Sizes are uniform/static, we round to the nearest item on long scrolls\n * On short scrolls, we will go at minimum to the next/previous item so that arrow pagination works\n * All VirtualizerStaticPaginationProps can be grabbed from Virtualizer hooks externally and passed in/**\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useStaticVirtualizerPagination = (\n virtualizerProps: VirtualizerStaticPaginationProps,\n paginationEnabled: Boolean = true,\n): ((instance: HTMLElement | HTMLDivElement | null) => void) => {\n 'use no memo';\n\n const { itemSize, axis = 'vertical' } = virtualizerProps;\n\n const [setScrollTimer, clearScrollTimer] = useTimeout();\n const lastScrollPos = React.useRef<number>(0);\n const lastIndexScrolled = React.useRef<number>(0);\n\n const scrollContainer = React.useRef<HTMLElement | null>(null);\n\n const clearListeners = () => {\n if (scrollContainer.current) {\n scrollContainer.current.removeEventListener('scroll', onScroll);\n\n scrollContainer.current = null;\n clearScrollTimer();\n }\n };\n\n React.useEffect(() => {\n return () => {\n clearListeners();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /**\n * Handle scroll stop event and paginate to the closest item\n * If the closest item is the same as the previous scroll end\n * we paginate to the next/previous one based on direction\n */\n const onScrollEnd = React.useCallback(() => {\n if (!scrollContainer.current || !paginationEnabled) {\n // No container found\n return;\n }\n\n const currentScrollPos = Math.round(\n axis === 'vertical' ? scrollContainer.current.scrollTop : scrollContainer.current.scrollLeft,\n );\n const closestItem = Math.round(currentScrollPos / itemSize);\n\n let nextItem = 0;\n if (Math.round(closestItem - lastIndexScrolled.current) === 0) {\n // Special case for go to next/previous with minimum amount of scroll needed\n const nextTarget = lastScrollPos.current < currentScrollPos ? 1 : -1;\n const isSecondaryScroll = lastScrollPos.current === currentScrollPos;\n const posMod = isSecondaryScroll ? 0 : nextTarget;\n\n nextItem = closestItem + posMod;\n } else {\n // Pagination for anything else can just jump to the closest!\n nextItem = closestItem;\n }\n\n const nextItemPos = nextItem * itemSize;\n\n if (axis === 'vertical') {\n scrollContainer.current.scrollTo({ top: nextItemPos, behavior: 'smooth' });\n } else {\n scrollContainer.current.scrollTo({ left: nextItemPos, behavior: 'smooth' });\n }\n lastScrollPos.current = nextItemPos;\n lastIndexScrolled.current = nextItem;\n }, [paginationEnabled, axis, itemSize]);\n\n /**\n * On scroll timer that will continuously delay callback until scrolling stops\n */\n const onScroll = React.useCallback(() => {\n clearScrollTimer();\n setScrollTimer(onScrollEnd, 100);\n }, [onScrollEnd, clearScrollTimer, setScrollTimer]);\n\n /**\n * Pagination ref will ensure we attach listeners to containers on change\n * It is returned from hook and merged into the scroll container externally\n */\n const paginationRef = React.useCallback(\n (instance: HTMLElement | HTMLDivElement | null) => {\n if (!paginationEnabled) {\n clearListeners();\n scrollContainer.current = null;\n return;\n }\n if (scrollContainer.current !== instance) {\n clearListeners();\n\n scrollContainer.current = instance;\n if (scrollContainer.current) {\n scrollContainer.current.addEventListener('scroll', onScroll);\n }\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [onScroll, onScrollEnd, paginationEnabled],\n );\n\n return paginationRef;\n};\n"],"names":["React","useTimeout","useStaticVirtualizerPagination","virtualizerProps","paginationEnabled","itemSize","axis","setScrollTimer","clearScrollTimer","lastScrollPos","useRef","lastIndexScrolled","scrollContainer","clearListeners","current","removeEventListener","onScroll","useEffect","onScrollEnd","useCallback","currentScrollPos","Math","round","scrollTop","scrollLeft","closestItem","nextItem","nextTarget","isSecondaryScroll","posMod","nextItemPos","scrollTo","top","behavior","left","paginationRef","instance","addEventListener"],"mappings":"AAAA;;;;;+BAaaE;;;;;;;iEAXU,QAAQ;gCAEJ,4BAA4B;AAShD,uCAAuC,CAC5CC,kBACAC,oBAA6B,IAAI;IAEjC;IAEA,MAAM,EAAEC,QAAQ,EAAEC,OAAO,UAAU,EAAE,GAAGH;IAExC,MAAM,CAACI,gBAAgBC,iBAAiB,OAAGP,0BAAAA;IAC3C,MAAMQ,gBAAgBT,OAAMU,MAAM,CAAS;IAC3C,MAAMC,oBAAoBX,OAAMU,MAAM,CAAS;IAE/C,MAAME,kBAAkBZ,OAAMU,MAAM,CAAqB;IAEzD,MAAMG,iBAAiB;QACrB,IAAID,gBAAgBE,OAAO,EAAE;YAC3BF,gBAAgBE,OAAO,CAACC,mBAAmB,CAAC,UAAUC;YAEtDJ,gBAAgBE,OAAO,GAAG;YAC1BN;QACF;IACF;IAEAR,OAAMiB,SAAS,CAAC;QACd,OAAO;YACLJ;QACF;IACA,uDAAuD;IACzD,GAAG,EAAE;IAEL;;;;GAIC,GACD,MAAMK,cAAclB,OAAMmB,WAAW,CAAC;QACpC,IAAI,CAACP,gBAAgBE,OAAO,IAAI,CAACV,mBAAmB;YAClD,qBAAqB;YACrB;QACF;QAEA,MAAMgB,mBAAmBC,KAAKC,KAAK,CACjChB,SAAS,aAAaM,gBAAgBE,OAAO,CAACS,SAAS,GAAGX,gBAAgBE,OAAO,CAACU,U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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useVirtualizerMeasure.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { VirtualizerMeasureProps } from './hooks.types';\nimport { useResizeObserverRef_unstable } from './useResizeObserverRef';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * React hook that measures virtualized space based on a static size to ensure optimized virtualization length.\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useStaticVirtualizerMeasure = <TElement extends HTMLElement>(\n virtualizerProps: VirtualizerMeasureProps,\n): {\n virtualizerLength: number;\n bufferItems: number;\n bufferSize: number;\n scrollRef: (instance: TElement | null) => void;\n
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useVirtualizerMeasure.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { VirtualizerMeasureProps } from './hooks.types';\nimport { useResizeObserverRef_unstable } from './useResizeObserverRef';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\n/**\n * React hook that measures virtualized space based on a static size to ensure optimized virtualization length.\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport const useStaticVirtualizerMeasure = <TElement extends HTMLElement>(\n virtualizerProps: VirtualizerMeasureProps,\n): {\n virtualizerLength: number;\n bufferItems: number;\n bufferSize: number;\n scrollRef: (instance: TElement | null) => void;\n\n containerSizeRef: React.MutableRefObject<number>;\n} => {\n const { defaultItemSize, direction = 'vertical', bufferItems, bufferSize } = virtualizerProps;\n\n const [state, setState] = React.useState({\n virtualizerLength: 0,\n _bufferSize: 0,\n _bufferItems: 0,\n });\n\n const containerSizeRef = React.useRef<number>(0);\n const { targetDocument } = useFluent();\n\n const { virtualizerLength, _bufferItems, _bufferSize } = state;\n\n const resizeCallback = React.useCallback(\n (\n _entries: ResizeObserverEntry[],\n // TODO: exclude types from this lint rule: https://github.com/microsoft/fluentui/issues/31286\n\n _observer: ResizeObserver,\n\n scrollRef?: React.MutableRefObject<HTMLElement | null>,\n ) => {\n if (!scrollRef?.current) {\n return;\n }\n\n if (scrollRef.current !== targetDocument?.body) {\n // We have a local scroll container\n containerSizeRef.current =\n direction === 'vertical'\n ? scrollRef?.current.getBoundingClientRect().height\n : scrollRef?.current.getBoundingClientRect().width;\n } else if (targetDocument?.defaultView) {\n // If our scroll ref is the document body, we should check window height\n containerSizeRef.current =\n direction === 'vertical' ? targetDocument?.defaultView?.innerHeight : targetDocument?.defaultView?.innerWidth;\n }\n /*\n * Number of items required to cover viewport.\n */\n const length = Math.ceil(containerSizeRef.current / defaultItemSize + 1);\n\n /*\n * Number of items to append at each end, i.e. 'preload' each side before entering view.\n * Minimum: 1\n */\n const newBufferItems = bufferItems ?? Math.max(Math.ceil(length / 4), 1);\n\n /*\n * This is how far we deviate into the bufferItems to detect a redraw.\n */\n const newBufferSize = bufferSize ?? Math.max(defaultItemSize / 2.0, 1);\n\n const totalLength = length + newBufferItems * 2;\n\n setState({\n virtualizerLength: totalLength,\n _bufferItems: newBufferItems,\n _bufferSize: newBufferSize,\n });\n },\n [bufferItems, bufferSize, defaultItemSize, direction, targetDocument?.body, targetDocument?.defaultView],\n );\n\n const scrollRef = useResizeObserverRef_unstable(resizeCallback);\n\n return {\n virtualizerLength,\n bufferItems: _bufferItems,\n bufferSize: _bufferSize,\n scrollRef,\n containerSizeRef,\n };\n};\n"],"names":["React","useResizeObserverRef_unstable","useFluent_unstable","useFluent","useStaticVirtualizerMeasure","virtualizerProps","defaultItemSize","direction","bufferItems","bufferSize","state","setState","useState","virtualizerLength","_bufferSize","_bufferItems","containerSizeRef","useRef","targetDocument","resizeCallback","useCallback","_entries","_observer","scrollRef","current","body","getBoundingClientRect","height","width","defaultView","innerHeight","innerWidth","length","Math","ceil","newBufferItems","max","newBufferSize","totalLength"],"mappings":"AAAA;;;;;+BAWaI;;;;;;;iEATU,QAAQ;sCAEe,yBAAyB;qCACvB,kCAAkC;A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A,IAAAA,4BAA6BY,WAAW,GAAGZ,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,+BAAAA,eAAgBW,WAAAA,AAAW,MAAA,QAA3BX,iCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,6BAA6Ba,UAAU;QACjH;QACA;;OAEC,GACD,MAAMC,SAASC,KAAKC,IAAI,CAAClB,iBAAiBQ,OAAO,GAAGlB,kBAAkB;QAEtE;;;OAGC,GACD,MAAM6B,iBAAiB3B,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,cAAeyB,KAAKG,GAAG,CAACH,KAAKC,IAAI,CAACF,SAAS,IAAI;QAEtE;;OAEC,GACD,MAAMK,gBAAgB5B,eAAAA,QAAAA,eAAAA,KAAAA,IAAAA,aAAcwB,KAAKG,GAAG,CAAC9B,kBAAkB,KAAK;QAEpE,MAAMgC,cAAcN,SAASG,iBAAiB;QAE9CxB,SAAS;YACPE,mBAAmByB;YACnBvB,cAAcoB;YACdrB,aAAauB;QACf;IACF,GACA;QAAC7B;QAAaC;QAAYH;QAAiBC;QAAWW,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBO,IAAI;QAAEP,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBW,WAAW;KAAC;IAG1G,MAAMN,gBAAYtB,mDAAAA,EAA8BkB;IAEhD,OAAO;QACLN;QACAL,aAAaO;QACbN,YAAYK;QACZS;QACAP;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utilities/ImperativeScrolling/imperativeScrolling.ts"],"sourcesContent":["import { ScrollToItemStaticParams } from './imperativeScrolling.types';\n\nexport const scrollToItemStatic = (params: ScrollToItemStaticParams): void => {\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"],"mappings":";;;;+BAEaA;;;;;;AAAN,2BAA2B,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,OAAAA,AAAO,MAAA,QAArBJ,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAuBK,QAAQ,CAAC;gBAC9BC,MAAMP,aAAaD,WAAWA,WAAWD;gBACzCM;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BC,MAAMR,WAAWD;gBACjBM;YACF;QACF;IACF,OAAO;QACL,IAAID,UAAU;gBACZF;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BE,KAAKR,aAAaD,WAAWA,WAAWD;gBACxCM;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BE,KAAKT,WAAWD;gBAChBM;YACF;QACF;IACF;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/utilities/ImperativeScrolling/imperativeScrolling.ts"],"sourcesContent":["import type { ScrollToItemStaticParams } from './imperativeScrolling.types';\n\nexport const scrollToItemStatic = (params: ScrollToItemStaticParams): void => {\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"],"mappings":";;;;+BAEaA;;;;;;AAAN,2BAA2B,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,OAAAA,AAAO,MAAA,QAArBJ,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAuBK,QAAQ,CAAC;gBAC9BC,MAAMP,aAAaD,WAAWA,WAAWD;gBACzCM;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BC,MAAMR,WAAWD;gBACjBM;YACF;QACF;IACF,OAAO;QACL,IAAID,UAAU;gBACZF;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BE,KAAKR,aAAaD,WAAWA,WAAWD;gBACxCM;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBK,QAAQ,CAAC;gBAC9BE,KAAKT,WAAWD;gBAChBM;YACF;QACF;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utilities/ImperativeScrolling/imperativeScrolling.types.ts"],"sourcesContent":["import * as React from 'react';\n\nexport type ScrollToItemStaticParams = {\n index: number;\n itemSize: number;\n totalItems: number;\n scrollViewRef: React.RefObject<HTMLDivElement>;\n axis?: 'horizontal' | 'vertical';\n reversed?: boolean;\n behavior?: ScrollBehavior;\n};\n\nexport type ScrollToItemDynamicParams = {\n index: number;\n itemSizes: React.RefObject<number[]>;\n totalSize: number;\n scrollViewRef: React.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: React.RefObject<number>;\n currentIndex: React.RefObject<number> | undefined;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"sources":["../src/utilities/ImperativeScrolling/imperativeScrolling.types.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport type ScrollToItemStaticParams = {\n index: number;\n itemSize: number;\n totalItems: number;\n scrollViewRef: React.RefObject<HTMLDivElement>;\n axis?: 'horizontal' | 'vertical';\n reversed?: boolean;\n behavior?: ScrollBehavior;\n};\n\nexport type ScrollToItemDynamicParams = {\n index: number;\n itemSizes: React.RefObject<number[]>;\n totalSize: number;\n scrollViewRef: React.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: React.RefObject<number>;\n currentIndex: React.RefObject<number> | undefined;\n};\n"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utilities/ImperativeScrolling/imperativeScrollingDynamic.ts"],"sourcesContent":["import { ScrollToItemDynamicParams } from './imperativeScrolling.types';\n\nexport const scrollToItemDynamic = (params: ScrollToItemDynamicParams): void => {\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"],"mappings":";;;;+BAEaA;;;;;;AAAN,4BAA4B,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,OAAAA,AAAO,MAAA,QAArBJ,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAuBQ,QAAQ,CAAC;gBAC9BC,MAAMV,YAAYO;gBAClBH;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BC,MAAMH;gBACNH;YACF;QACF;IACF,OAAO;QACL,IAAID,UAAU;gBACZF;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BE,KAAKX,YAAYO;gBACjBH;YACF;QACF,OAAO;gBACLH;YAAAA,2BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BE,KAAKJ;gBACLH;YACF;QACF;IACF;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/utilities/ImperativeScrolling/imperativeScrollingDynamic.ts"],"sourcesContent":["import type { ScrollToItemDynamicParams } from './imperativeScrolling.types';\n\nexport const scrollToItemDynamic = (params: ScrollToItemDynamicParams): void => {\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"],"mappings":";;;;+BAEaA;;;;;;AAAN,4BAA4B,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,OAAAA,AAAO,MAAA,QAArBJ,2BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,uBAAuBQ,QAAQ,CAAC;gBAC9BC,MAAMV,YAAYO;gBAClBH;YACF;QACF,OAAO;gBACLH;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BC,MAAMH;gBACNH;YACF;QACF;IACF,OAAO;QACL,IAAID,UAAU;gBACZF;aAAAA,0BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BE,KAAKX,YAAYO;gBACjBH;YACF;QACF,OAAO;gBACLH;YAAAA,2BAAAA,cAAcI,OAAAA,AAAO,MAAA,QAArBJ,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAuBQ,QAAQ,CAAC;gBAC9BE,KAAKJ;gBACLH;YACF;QACF;IACF;AACF,EAAE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Some props are optional on static virtualizer, but required for dynamic.
|
|
3
|
+
* @deprecated migrated to \@fluentui\-contrib/react\-virtualizer for stable release.
|
|
4
|
+
*/ "use strict";
|
|
2
5
|
Object.defineProperty(exports, "__esModule", {
|
|
3
6
|
value: true
|
|
4
7
|
});
|
|
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,"sources":["../src/utilities/VirtualizerContext/types.ts"],"sourcesContent":["import * as React from 'react';\n/**\n * {@docCategory Virtualizer}\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerContextProps = {\n contextIndex: number;\n setContextIndex: (index: number) => void;\n /*\n * These optional props are used in dynamic virtualizer\n */\n
|
|
1
|
+
{"version":3,"sources":["../src/utilities/VirtualizerContext/types.ts"],"sourcesContent":["import type * as React from 'react';\n/**\n * {@docCategory Virtualizer}\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type VirtualizerContextProps = {\n contextIndex: number;\n setContextIndex: (index: number) => void;\n /*\n * These optional props are used in dynamic virtualizer\n */\n\n childProgressiveSizes?: React.MutableRefObject<number[]>;\n};\n\n/**\n * Some props are optional on static virtualizer, but required for dynamic.\n * @deprecated migrated to \\@fluentui\\-contrib/react\\-virtualizer for stable release.\n */\nexport type DynamicVirtualizerContextProps = Required<VirtualizerContextProps>;\n"],"names":[],"mappings":"AAeA;;;CAGC,GACD,WAA+E"}
|
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.112",
|
|
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",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui/react-jsx-runtime": "^9.4.
|
|
16
|
-
"@fluentui/react-utilities": "^9.26.
|
|
15
|
+
"@fluentui/react-jsx-runtime": "^9.4.2",
|
|
16
|
+
"@fluentui/react-utilities": "^9.26.3",
|
|
17
17
|
"@fluentui/react-shared-contexts": "^9.26.2",
|
|
18
18
|
"@griffel/react": "^1.5.32",
|
|
19
19
|
"@swc/helpers": "^0.5.1"
|