@fluentui/react-virtualizer 9.0.0-alpha.11 → 9.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +49 -1
  3. package/CHANGELOG.md +23 -2
  4. package/lib/Hooks.js.map +1 -1
  5. package/lib/Virtualizer.js.map +1 -1
  6. package/lib/components/Virtualizer/Virtualizer.js.map +1 -1
  7. package/lib/components/Virtualizer/Virtualizer.types.js +1 -1
  8. package/lib/components/Virtualizer/Virtualizer.types.js.map +1 -1
  9. package/lib/components/Virtualizer/index.js.map +1 -1
  10. package/lib/components/Virtualizer/renderVirtualizer.js +1 -9
  11. package/lib/components/Virtualizer/renderVirtualizer.js.map +1 -1
  12. package/lib/components/Virtualizer/useVirtualizer.js +3 -6
  13. package/lib/components/Virtualizer/useVirtualizer.js.map +1 -1
  14. package/lib/components/Virtualizer/useVirtualizerStyles.js.map +1 -1
  15. package/lib/hooks/index.js.map +1 -1
  16. package/lib/hooks/useIntersectionObserver.js +2 -2
  17. package/lib/hooks/useIntersectionObserver.js.map +1 -1
  18. package/lib/index.js.map +1 -1
  19. package/lib-commonjs/Hooks.js +5 -4
  20. package/lib-commonjs/Hooks.js.map +1 -1
  21. package/lib-commonjs/Virtualizer.js +5 -4
  22. package/lib-commonjs/Virtualizer.js.map +1 -1
  23. package/lib-commonjs/components/Virtualizer/Virtualizer.js +14 -17
  24. package/lib-commonjs/components/Virtualizer/Virtualizer.js.map +1 -1
  25. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js +5 -2
  26. package/lib-commonjs/components/Virtualizer/Virtualizer.types.js.map +1 -1
  27. package/lib-commonjs/components/Virtualizer/index.js +9 -8
  28. package/lib-commonjs/components/Virtualizer/index.js.map +1 -1
  29. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js +13 -21
  30. package/lib-commonjs/components/Virtualizer/renderVirtualizer.js.map +1 -1
  31. package/lib-commonjs/components/Virtualizer/useVirtualizer.js +348 -361
  32. package/lib-commonjs/components/Virtualizer/useVirtualizer.js.map +1 -1
  33. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js +112 -107
  34. package/lib-commonjs/components/Virtualizer/useVirtualizerStyles.js.map +1 -1
  35. package/lib-commonjs/hooks/index.js +5 -4
  36. package/lib-commonjs/hooks/index.js.map +1 -1
  37. package/lib-commonjs/hooks/useIntersectionObserver.js +49 -54
  38. package/lib-commonjs/hooks/useIntersectionObserver.js.map +1 -1
  39. package/lib-commonjs/index.js +18 -40
  40. package/lib-commonjs/index.js.map +1 -1
  41. package/package.json +6 -5
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
5
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
6
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
7
+ //# sourceMappingURL=Virtualizer.types.js.map
8
+
6
9
  //# sourceMappingURL=Virtualizer.types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/packages/react-components/react-virtualizer/src/components/Virtualizer/Virtualizer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\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 VirtualizerState = ComponentState<VirtualizerSlots> & {\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 * Tells the virtualizer how much\n */\n bufferSize: number;\n};\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) => React.ReactNode;\n\nexport type VirtualizerProps = ComponentProps<Partial<VirtualizerSlots>> & {\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 * @default null\n */\n intersectionObserverRoot?: 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 * Notify users of index changes\n */\n onUpdateIndex?: (index: number, prevIndex: number) => void;\n\n /**\n * Allow users to intervene in index calculation changes\n */\n onCalculateIndex?: (newIndex: number) => number;\n};\n"],"mappings":""}
1
+ {"version":3,"sources":["../../../lib/components/Virtualizer/Virtualizer.types.js"],"sourcesContent":["import * as React from 'react';\n//# sourceMappingURL=Virtualizer.types.js.map"],"names":[],"mappings":";;;;;6DAAuB;CACvB,6CAA6C"}
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./Virtualizer"), exports);
8
- tslib_1.__exportStar(require("./Virtualizer.types"), exports);
9
- tslib_1.__exportStar(require("./useVirtualizer"), exports);
10
- tslib_1.__exportStar(require("./renderVirtualizer"), exports);
11
- tslib_1.__exportStar(require("./useVirtualizerStyles"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./Virtualizer"), exports);
7
+ _exportStar(require("./Virtualizer.types"), exports);
8
+ _exportStar(require("./useVirtualizer"), exports);
9
+ _exportStar(require("./renderVirtualizer"), exports);
10
+ _exportStar(require("./useVirtualizerStyles"), exports);
11
+ //# sourceMappingURL=index.js.map
12
+
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-virtualizer/src/components/Virtualizer/index.ts"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,mBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,sBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,4BAAAC,OAAA"}
1
+ {"version":3,"sources":["../../../lib/components/Virtualizer/index.js"],"sourcesContent":["export * from './Virtualizer';\nexport * from './Virtualizer.types';\nexport * from './useVirtualizer';\nexport * from './renderVirtualizer';\nexport * from './useVirtualizerStyles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
@@ -1,25 +1,17 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderVirtualizer_unstable", {
6
+ enumerable: true,
7
+ get: ()=>renderVirtualizer_unstable
5
8
  });
6
- exports.renderVirtualizer_unstable = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
- const renderVirtualizer_unstable = state => {
10
- const {
11
- slots,
12
- slotProps
13
- } = react_utilities_1.getSlots(state);
14
- return React.createElement(React.Fragment, null, React.createElement(slots.beforeContainer, {
15
- ...slotProps.beforeContainer
16
- }, React.createElement(slots.before, {
17
- ...slotProps.before
18
- })), state.virtualizedChildren, React.createElement(slots.afterContainer, {
19
- ...slotProps.afterContainer
20
- }, React.createElement(slots.after, {
21
- ...slotProps.after
22
- })));
23
- };
24
- exports.renderVirtualizer_unstable = renderVirtualizer_unstable;
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 renderVirtualizer_unstable = (state)=>{
13
+ const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
14
+ return /*#__PURE__*/ _react.createElement(_react.Fragment, null, /*#__PURE__*/ _react.createElement(slots.beforeContainer, slotProps.beforeContainer, /*#__PURE__*/ _react.createElement(slots.before, slotProps.before)), state.virtualizedChildren, /*#__PURE__*/ _react.createElement(slots.afterContainer, slotProps.afterContainer, /*#__PURE__*/ _react.createElement(slots.after, slotProps.after)));
15
+ }; //# sourceMappingURL=renderVirtualizer.js.map
16
+
25
17
  //# sourceMappingURL=renderVirtualizer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","react_utilities_1","renderVirtualizer_unstable","state","slots","slotProps","getSlots","createElement","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after","exports"],"sources":["../src/packages/react-components/react-virtualizer/src/components/Virtualizer/renderVirtualizer.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { VirtualizerSlots, VirtualizerState } from './Virtualizer.types';\n\nexport const renderVirtualizer_unstable = (state: VirtualizerState) => {\n const { slots, slotProps } = getSlots<VirtualizerSlots>(state);\n\n return (\n <React.Fragment>\n {/* The 'before' bookend to hold items in place and detect scroll previous */}\n <slots.beforeContainer {...slotProps.beforeContainer}>\n <slots.before {...slotProps.before} />\n </slots.beforeContainer>\n {/* The reduced list of non-virtualized children to be rendered */}\n {state.virtualizedChildren}\n {/* The 'after' bookend to hold items in place and detect scroll next */}\n <slots.afterContainer {...slotProps.afterContainer}>\n <slots.after {...slotProps.after} />\n </slots.afterContainer>\n </React.Fragment>\n );\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAGO,MAAME,0BAA0B,GAAIC,KAAuB,IAAI;EACpE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,iBAAA,CAAAK,QAAQ,CAAmBH,KAAK,CAAC;EAE9D,OACEJ,KAAA,CAAAQ,aAAA,CAACR,KAAK,CAACS,QAAQ,QAEbT,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACK,eAAe;IAAA,GAAKJ,SAAS,CAACI;EAAe,GAClDV,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACM,MAAM;IAAA,GAAKL,SAAS,CAACK;EAAM,EAAI,CAChB,EAEvBP,KAAK,CAACQ,mBAAmB,EAE1BZ,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACQ,cAAc;IAAA,GAAKP,SAAS,CAACO;EAAc,GAChDb,KAAA,CAAAQ,aAAA,CAACH,KAAK,CAACS,KAAK;IAAA,GAAKR,SAAS,CAACQ;EAAK,EAAI,CACf,CACR;AAErB,CAAC;AAjBYC,OAAA,CAAAZ,0BAA0B,GAAAA,0BAAA"}
1
+ {"version":3,"sources":["../../../lib/components/Virtualizer/renderVirtualizer.js"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nexport const renderVirtualizer_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(slots.beforeContainer, slotProps.beforeContainer, /*#__PURE__*/React.createElement(slots.before, slotProps.before)), state.virtualizedChildren, /*#__PURE__*/React.createElement(slots.afterContainer, slotProps.afterContainer, /*#__PURE__*/React.createElement(slots.after, slotProps.after)));\n};\n//# sourceMappingURL=renderVirtualizer.js.map"],"names":["renderVirtualizer_unstable","state","slots","slotProps","getSlots","React","createElement","Fragment","beforeContainer","before","virtualizedChildren","afterContainer","after"],"mappings":";;;;+BAEaA;;aAAAA;;;6DAFU;gCACE;AAClB,MAAMA,6BAA6BC,CAAAA,QAAS;IACjD,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,OAAO,WAAW,GAAEI,OAAMC,aAAa,CAACD,OAAME,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAEF,OAAMC,aAAa,CAACJ,MAAMM,eAAe,EAAEL,UAAUK,eAAe,EAAE,WAAW,GAAEH,OAAMC,aAAa,CAACJ,MAAMO,MAAM,EAAEN,UAAUM,MAAM,IAAIR,MAAMS,mBAAmB,EAAE,WAAW,GAAEL,OAAMC,aAAa,CAACJ,MAAMS,cAAc,EAAER,UAAUQ,cAAc,EAAE,WAAW,GAAEN,OAAMC,aAAa,CAACJ,MAAMU,KAAK,EAAET,UAAUS,KAAK;AAC/X,GACA,6CAA6C"}