virtual-scroller 1.8.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (248) hide show
  1. package/.gitlab-ci.yml +1 -1
  2. package/CHANGELOG.md +57 -0
  3. package/README.md +337 -160
  4. package/bundle/virtual-scroller-dom.js +1 -1
  5. package/bundle/virtual-scroller-dom.js.map +1 -1
  6. package/bundle/virtual-scroller-react.js +1 -1
  7. package/bundle/virtual-scroller-react.js.map +1 -1
  8. package/bundle/virtual-scroller.js +1 -1
  9. package/bundle/virtual-scroller.js.map +1 -1
  10. package/commonjs/BeforeResize.js +23 -27
  11. package/commonjs/BeforeResize.js.map +1 -1
  12. package/commonjs/DOM/Engine.js +7 -7
  13. package/commonjs/DOM/Engine.js.map +1 -1
  14. package/commonjs/DOM/ItemsContainer.js +1 -1
  15. package/commonjs/DOM/ItemsContainer.js.map +1 -1
  16. package/commonjs/DOM/ListTopOffsetWatcher.js +15 -9
  17. package/commonjs/DOM/ListTopOffsetWatcher.js.map +1 -1
  18. package/commonjs/DOM/ScrollableContainer.js +28 -28
  19. package/commonjs/DOM/ScrollableContainer.js.map +1 -1
  20. package/commonjs/DOM/VirtualScroller.js +20 -17
  21. package/commonjs/DOM/VirtualScroller.js.map +1 -1
  22. package/commonjs/DOM/tbody.js +16 -10
  23. package/commonjs/DOM/tbody.js.map +1 -1
  24. package/commonjs/ItemHeights.js +23 -17
  25. package/commonjs/ItemHeights.js.map +1 -1
  26. package/commonjs/Layout.js +15 -13
  27. package/commonjs/Layout.js.map +1 -1
  28. package/commonjs/Layout.test.js +8 -3
  29. package/commonjs/Layout.test.js.map +1 -1
  30. package/commonjs/{ListHeightChangeWatcher.js → ListHeightMeasurement.js} +26 -28
  31. package/commonjs/ListHeightMeasurement.js.map +1 -0
  32. package/commonjs/Resize.js +38 -28
  33. package/commonjs/Resize.js.map +1 -1
  34. package/commonjs/Scroll.js +28 -44
  35. package/commonjs/Scroll.js.map +1 -1
  36. package/commonjs/VirtualScroller.columns.js +43 -0
  37. package/commonjs/VirtualScroller.columns.js.map +1 -0
  38. package/commonjs/VirtualScroller.constructor.js +408 -0
  39. package/commonjs/VirtualScroller.constructor.js.map +1 -0
  40. package/commonjs/VirtualScroller.items.js +305 -0
  41. package/commonjs/VirtualScroller.items.js.map +1 -0
  42. package/commonjs/VirtualScroller.js +132 -1872
  43. package/commonjs/VirtualScroller.js.map +1 -1
  44. package/commonjs/VirtualScroller.layout.js +562 -0
  45. package/commonjs/VirtualScroller.layout.js.map +1 -0
  46. package/commonjs/VirtualScroller.onRender.js +357 -0
  47. package/commonjs/VirtualScroller.onRender.js.map +1 -0
  48. package/commonjs/VirtualScroller.resize.js +186 -0
  49. package/commonjs/VirtualScroller.resize.js.map +1 -0
  50. package/commonjs/VirtualScroller.state.js +301 -0
  51. package/commonjs/VirtualScroller.state.js.map +1 -0
  52. package/commonjs/VirtualScroller.verticalSpacing.js +65 -0
  53. package/commonjs/VirtualScroller.verticalSpacing.js.map +1 -0
  54. package/commonjs/getItemCoordinates.js.map +1 -1
  55. package/commonjs/getItemsDiff.js.map +1 -1
  56. package/commonjs/getVerticalSpacing.js.map +1 -1
  57. package/commonjs/package.json +5 -0
  58. package/commonjs/react/VirtualScroller.js +184 -618
  59. package/commonjs/react/VirtualScroller.js.map +1 -1
  60. package/commonjs/react/useClassName.js +26 -0
  61. package/commonjs/react/useClassName.js.map +1 -0
  62. package/commonjs/react/useHandleItemsChange.js +116 -0
  63. package/commonjs/react/useHandleItemsChange.js.map +1 -0
  64. package/commonjs/react/useInstanceMethods.js +37 -0
  65. package/commonjs/react/useInstanceMethods.js.map +1 -0
  66. package/commonjs/react/useItemKeys.js +60 -0
  67. package/commonjs/react/useItemKeys.js.map +1 -0
  68. package/commonjs/react/useOnItemHeightChange.js +32 -0
  69. package/commonjs/react/useOnItemHeightChange.js.map +1 -0
  70. package/commonjs/react/useOnItemStateChange.js +32 -0
  71. package/commonjs/react/useOnItemStateChange.js.map +1 -0
  72. package/commonjs/react/useState.js +140 -0
  73. package/commonjs/react/useState.js.map +1 -0
  74. package/commonjs/react/useStyle.js +29 -0
  75. package/commonjs/react/useStyle.js.map +1 -0
  76. package/commonjs/react/useVirtualScroller.js +62 -0
  77. package/commonjs/react/useVirtualScroller.js.map +1 -0
  78. package/commonjs/react/useVirtualScrollerStartStop.js +20 -0
  79. package/commonjs/react/useVirtualScrollerStartStop.js.map +1 -0
  80. package/commonjs/test/Engine.js +23 -0
  81. package/commonjs/test/Engine.js.map +1 -0
  82. package/commonjs/test/ItemsContainer.js +127 -0
  83. package/commonjs/test/ItemsContainer.js.map +1 -0
  84. package/commonjs/test/ScrollableContainer.js +130 -0
  85. package/commonjs/test/ScrollableContainer.js.map +1 -0
  86. package/commonjs/test/VirtualScroller.js +281 -0
  87. package/commonjs/test/VirtualScroller.js.map +1 -0
  88. package/commonjs/utility/debounce.js +2 -2
  89. package/commonjs/utility/debounce.js.map +1 -1
  90. package/commonjs/utility/debug.js.map +1 -1
  91. package/commonjs/utility/getStateSnapshot.js +2 -2
  92. package/commonjs/utility/getStateSnapshot.js.map +1 -1
  93. package/commonjs/utility/px.js.map +1 -1
  94. package/commonjs/utility/px.test.js +1 -1
  95. package/commonjs/utility/px.test.js.map +1 -1
  96. package/commonjs/utility/shallowEqual.js +1 -1
  97. package/commonjs/utility/shallowEqual.js.map +1 -1
  98. package/commonjs/utility/throttle.js.map +1 -1
  99. package/dom/index.cjs +4 -0
  100. package/dom/index.cjs.js +9 -0
  101. package/dom/index.d.ts +6 -4
  102. package/dom/index.js +1 -1
  103. package/dom/package.json +10 -4
  104. package/index.cjs +4 -0
  105. package/index.cjs.js +9 -0
  106. package/index.d.ts +30 -15
  107. package/index.js +1 -1
  108. package/modules/BeforeResize.js +22 -27
  109. package/modules/BeforeResize.js.map +1 -1
  110. package/modules/DOM/Engine.js +6 -6
  111. package/modules/DOM/Engine.js.map +1 -1
  112. package/modules/DOM/ItemsContainer.js +1 -1
  113. package/modules/DOM/ItemsContainer.js.map +1 -1
  114. package/modules/DOM/ListTopOffsetWatcher.js +15 -9
  115. package/modules/DOM/ListTopOffsetWatcher.js.map +1 -1
  116. package/modules/DOM/ScrollableContainer.js +28 -28
  117. package/modules/DOM/ScrollableContainer.js.map +1 -1
  118. package/modules/DOM/VirtualScroller.js +19 -16
  119. package/modules/DOM/VirtualScroller.js.map +1 -1
  120. package/modules/DOM/tbody.js +11 -9
  121. package/modules/DOM/tbody.js.map +1 -1
  122. package/modules/ItemHeights.js +22 -16
  123. package/modules/ItemHeights.js.map +1 -1
  124. package/modules/Layout.js +14 -12
  125. package/modules/Layout.js.map +1 -1
  126. package/modules/Layout.test.js +8 -3
  127. package/modules/Layout.test.js.map +1 -1
  128. package/modules/{ListHeightChangeWatcher.js → ListHeightMeasurement.js} +25 -27
  129. package/modules/ListHeightMeasurement.js.map +1 -0
  130. package/modules/Resize.js +38 -28
  131. package/modules/Resize.js.map +1 -1
  132. package/modules/Scroll.js +28 -44
  133. package/modules/Scroll.js.map +1 -1
  134. package/modules/VirtualScroller.columns.js +36 -0
  135. package/modules/VirtualScroller.columns.js.map +1 -0
  136. package/modules/VirtualScroller.constructor.js +371 -0
  137. package/modules/VirtualScroller.constructor.js.map +1 -0
  138. package/modules/VirtualScroller.items.js +288 -0
  139. package/modules/VirtualScroller.items.js.map +1 -0
  140. package/modules/VirtualScroller.js +132 -1860
  141. package/modules/VirtualScroller.js.map +1 -1
  142. package/modules/VirtualScroller.layout.js +549 -0
  143. package/modules/VirtualScroller.layout.js.map +1 -0
  144. package/modules/VirtualScroller.onRender.js +337 -0
  145. package/modules/VirtualScroller.onRender.js.map +1 -0
  146. package/modules/VirtualScroller.resize.js +176 -0
  147. package/modules/VirtualScroller.resize.js.map +1 -0
  148. package/modules/VirtualScroller.state.js +283 -0
  149. package/modules/VirtualScroller.state.js.map +1 -0
  150. package/modules/VirtualScroller.verticalSpacing.js +54 -0
  151. package/modules/VirtualScroller.verticalSpacing.js.map +1 -0
  152. package/modules/getItemCoordinates.js.map +1 -1
  153. package/modules/getItemsDiff.js.map +1 -1
  154. package/modules/getVerticalSpacing.js.map +1 -1
  155. package/modules/react/VirtualScroller.js +176 -625
  156. package/modules/react/VirtualScroller.js.map +1 -1
  157. package/modules/react/useClassName.js +18 -0
  158. package/modules/react/useClassName.js.map +1 -0
  159. package/modules/react/useHandleItemsChange.js +108 -0
  160. package/modules/react/useHandleItemsChange.js.map +1 -0
  161. package/modules/react/useInstanceMethods.js +28 -0
  162. package/modules/react/useInstanceMethods.js.map +1 -0
  163. package/modules/react/useItemKeys.js +52 -0
  164. package/modules/react/useItemKeys.js.map +1 -0
  165. package/modules/react/useOnItemHeightChange.js +24 -0
  166. package/modules/react/useOnItemHeightChange.js.map +1 -0
  167. package/modules/react/useOnItemStateChange.js +24 -0
  168. package/modules/react/useOnItemStateChange.js.map +1 -0
  169. package/modules/react/useState.js +132 -0
  170. package/modules/react/useState.js.map +1 -0
  171. package/modules/react/useStyle.js +19 -0
  172. package/modules/react/useStyle.js.map +1 -0
  173. package/modules/react/useVirtualScroller.js +51 -0
  174. package/modules/react/useVirtualScroller.js.map +1 -0
  175. package/modules/react/useVirtualScrollerStartStop.js +12 -0
  176. package/modules/react/useVirtualScrollerStartStop.js.map +1 -0
  177. package/modules/test/Engine.js +11 -0
  178. package/modules/test/Engine.js.map +1 -0
  179. package/modules/test/ItemsContainer.js +120 -0
  180. package/modules/test/ItemsContainer.js.map +1 -0
  181. package/modules/test/ScrollableContainer.js +123 -0
  182. package/modules/test/ScrollableContainer.js.map +1 -0
  183. package/modules/test/VirtualScroller.js +270 -0
  184. package/modules/test/VirtualScroller.js.map +1 -0
  185. package/modules/utility/debounce.js +2 -2
  186. package/modules/utility/debounce.js.map +1 -1
  187. package/modules/utility/debug.js.map +1 -1
  188. package/modules/utility/getStateSnapshot.js +2 -2
  189. package/modules/utility/getStateSnapshot.js.map +1 -1
  190. package/modules/utility/px.js.map +1 -1
  191. package/modules/utility/px.test.js +1 -1
  192. package/modules/utility/px.test.js.map +1 -1
  193. package/modules/utility/shallowEqual.js +1 -1
  194. package/modules/utility/shallowEqual.js.map +1 -1
  195. package/modules/utility/throttle.js.map +1 -1
  196. package/package.json +46 -23
  197. package/react/index.cjs +4 -0
  198. package/react/index.cjs.js +9 -0
  199. package/react/index.d.ts +10 -9
  200. package/react/index.js +1 -1
  201. package/react/package.json +10 -4
  202. package/rollup.config.mjs +62 -0
  203. package/runnable/create-commonjs-package-json.js +11 -0
  204. package/source/BeforeResize.js +16 -21
  205. package/source/DOM/Engine.js +8 -10
  206. package/source/DOM/ListTopOffsetWatcher.js +13 -8
  207. package/source/DOM/ScrollableContainer.js +23 -21
  208. package/source/DOM/VirtualScroller.js +27 -11
  209. package/source/DOM/tbody.js +30 -21
  210. package/source/ItemHeights.js +19 -14
  211. package/source/Layout.js +12 -9
  212. package/source/Layout.test.js +8 -3
  213. package/source/{ListHeightChangeWatcher.js → ListHeightMeasurement.js} +21 -20
  214. package/source/Resize.js +41 -25
  215. package/source/Scroll.js +27 -35
  216. package/source/VirtualScroller.columns.js +26 -0
  217. package/source/VirtualScroller.constructor.js +336 -0
  218. package/source/VirtualScroller.items.js +302 -0
  219. package/source/VirtualScroller.js +144 -1872
  220. package/source/VirtualScroller.layout.js +539 -0
  221. package/source/VirtualScroller.onRender.js +345 -0
  222. package/source/VirtualScroller.resize.js +189 -0
  223. package/source/VirtualScroller.state.js +284 -0
  224. package/source/VirtualScroller.verticalSpacing.js +51 -0
  225. package/source/react/VirtualScroller.js +243 -587
  226. package/source/react/useClassName.js +14 -0
  227. package/source/react/useHandleItemsChange.js +115 -0
  228. package/source/react/useInstanceMethods.js +25 -0
  229. package/source/react/useItemKeys.js +59 -0
  230. package/source/react/useOnItemHeightChange.js +28 -0
  231. package/source/react/useOnItemStateChange.js +28 -0
  232. package/source/react/useState.js +114 -0
  233. package/source/react/useStyle.js +20 -0
  234. package/source/react/useVirtualScroller.js +59 -0
  235. package/source/react/useVirtualScrollerStartStop.js +12 -0
  236. package/source/test/Engine.js +11 -0
  237. package/source/test/ItemsContainer.js +87 -0
  238. package/source/test/ScrollableContainer.js +88 -0
  239. package/source/test/VirtualScroller.js +232 -0
  240. package/source/utility/debounce.js +2 -2
  241. package/source/utility/px.test.js +1 -1
  242. package/babel.config.js +0 -25
  243. package/babel.js +0 -5
  244. package/commonjs/ListHeightChangeWatcher.js.map +0 -1
  245. package/dom/index.commonjs.js +0 -4
  246. package/index.commonjs.js +0 -4
  247. package/modules/ListHeightChangeWatcher.js.map +0 -1
  248. package/react/index.commonjs.js +0 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualScroller.js","names":["VirtualScroller","Engine","DEBUG","TestVirtualScroller","scrollableContainerWidth","screenWidth","scrollableContainerHeight","screenHeight","columnsCount","verticalSpacing","items","initialState","state","expectedStateUpdates","scrollableContainerElement","width","height","containerElement","paddingTop","paddingBottom","children","setScrollableContainerWidth","setScrollableContainerHeight","getItemsContainerElement","__columnsCount","getColumnsCount","getItemWidth","hasPausedStateUpdates","undefined","pausedStateUpdate","pausedStateUpdateAction","onBeforeUpdateState","stateUpdate","length","expectedStateUpdate","shift","expect","to","deep","equal","callback","render","virtualScroller","getState","beforeItemsHeight","afterItemsHeight","firstShownItemIndex","lastShownItemIndex","console","log","slice","map","item","area","marginTop","scrollableContainer","engine","_waitForScrollingToStop","onStateChange","getInitialState","useState","updateState","stateUpdateAction","onRender","Error","expectedState","should","include","push","firstNonMeasuredItemIndex","getScrollY","scrollPosition","scrollToY","resize","_triggerResizeListener","JSON","stringify","stop","start","updateLayout","i","getItemScrollPosition","itemHeights","getAverage","newItems","options","setItems"],"sources":["../../source/test/VirtualScroller.js"],"sourcesContent":["import VirtualScroller from '../VirtualScroller.js'\r\nimport Engine from './Engine.js'\r\n\r\nconst DEBUG = false\r\n\r\nexport default class TestVirtualScroller {\r\n\tconstructor({\r\n\t\tscreenWidth: scrollableContainerWidth,\r\n\t\tscreenHeight: scrollableContainerHeight,\r\n\t\tcolumnsCount,\r\n\t\tverticalSpacing,\r\n\t\titems,\r\n\t\tstate: initialState\r\n\t}) {\r\n\t\tthis.expectedStateUpdates = []\r\n\r\n\t\tconst scrollableContainerElement = {\r\n\t\t\twidth: scrollableContainerWidth,\r\n\t\t\theight: scrollableContainerHeight\r\n\t\t}\r\n\r\n\t\tconst containerElement = {\r\n\t\t\tpaddingTop: 0,\r\n\t\t\tpaddingBottom: 0,\r\n\t\t\twidth: scrollableContainerElement.width,\r\n\t\t\tchildren: []\r\n\t\t}\r\n\r\n\t\tthis.setScrollableContainerWidth = (width) => {\r\n\t\t\tscrollableContainerElement.width = width\r\n\t\t\tcontainerElement.width = width\r\n\t\t}\r\n\r\n\t\tthis.setScrollableContainerHeight = (height) => {\r\n\t\t\tscrollableContainerElement.height = height\r\n\t\t}\r\n\r\n\t\tconst getItemsContainerElement = () => containerElement\r\n\r\n\t\tthis.__columnsCount = columnsCount\r\n\r\n\t\tconst getColumnsCount = () => this.__columnsCount\r\n\t\tconst getItemWidth = () => scrollableContainerElement.width / getColumnsCount()\r\n\r\n\t\tthis.hasPausedStateUpdates = undefined\r\n\t\tthis.pausedStateUpdate = undefined\r\n\t\tthis.pausedStateUpdateAction = undefined\r\n\r\n\t\tconst onBeforeUpdateState = (stateUpdate) => {\r\n\t\t\tif (this.expectedStateUpdates.length > 0) {\r\n\t\t\t\tconst expectedStateUpdate = this.expectedStateUpdates.shift()\r\n\t\t\t\texpect(stateUpdate).to.deep.equal(expectedStateUpdate.stateUpdate)\r\n\t\t\t\tif (expectedStateUpdate.callback) {\r\n\t\t\t\t\texpectedStateUpdate.callback()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tconst render = () => {\r\n\t\t\tconst {\r\n\t\t\t\titems,\r\n\t\t\t\tbeforeItemsHeight,\r\n\t\t\t\tafterItemsHeight,\r\n\t\t\t\tfirstShownItemIndex,\r\n\t\t\t\tlastShownItemIndex\r\n\t\t\t} = this.virtualScroller.getState()\r\n\r\n\t\t\tconsole.log('~ Render List ~')\r\n\r\n\t\t\tcontainerElement.paddingTop = beforeItemsHeight\r\n\t\t\tcontainerElement.paddingBottom = afterItemsHeight\r\n\r\n\t\t\tcontainerElement.children = items\r\n\t\t\t\t.slice(firstShownItemIndex, lastShownItemIndex + 1)\r\n\t\t\t\t.map((item) => ({\r\n\t\t\t\t\twidth: getItemWidth(),\r\n\t\t\t\t\theight: item.area / getItemWidth(),\r\n\t\t\t\t\tmarginTop: verticalSpacing\r\n\t\t\t\t}))\r\n\t\t}\r\n\r\n\t\tthis.virtualScroller = new VirtualScroller(getItemsContainerElement, items, {\r\n\t\t\tscrollableContainer: scrollableContainerElement,\r\n\t\t\tengine: Engine,\r\n\t\t\t_waitForScrollingToStop: false,\r\n\t\t\tgetColumnsCount,\r\n\t\t\tstate: initialState,\r\n\t\t\tonStateChange(state) {\r\n\t\t\t\tif (DEBUG) {\r\n\t\t\t\t\tconsole.log('~ Updated State ~')\r\n\t\t\t\t\tconsole.log(state)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\tlet state = this.virtualScroller.getInitialState()\r\n\r\n\t\tthis.virtualScroller.useState({\r\n\t\t\tgetState: () => state,\r\n\t\t\tupdateState: (stateUpdate) => {\r\n\t\t\t\tconst stateUpdateAction = (stateUpdate) => {\r\n\t\t\t\t\t// Is only used in tests.\r\n\t\t\t\t\tif (onBeforeUpdateState) {\r\n\t\t\t\t\t\tonBeforeUpdateState(stateUpdate)\r\n\t\t\t\t\t}\r\n\t\t\t\t\tstate = {\r\n\t\t\t\t\t\t...state,\r\n\t\t\t\t\t\t...stateUpdate\r\n\t\t\t\t\t}\r\n\t\t\t\t\trender()\r\n\t\t\t\t\tthis.virtualScroller.onRender()\r\n\t\t\t\t}\r\n\t\t\t\tif (this.hasPausedStateUpdates) {\r\n\t\t\t\t\tthis.pausedStateUpdate = {\r\n\t\t\t\t\t\t...this.pausedStateUpdate,\r\n\t\t\t\t\t\t...stateUpdate\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.pausedStateUpdateAction = stateUpdateAction\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstateUpdateAction(stateUpdate)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\trender()\r\n\t}\r\n\r\n\tpauseStateUpdates() {\r\n\t\tif (this.hasPausedStateUpdates) {\r\n\t\t\tthrow new Error('[virtual-scroller] State updates have already been paused')\r\n\t\t}\r\n\t\tthis.hasPausedStateUpdates = true\r\n\t}\r\n\r\n\tresumeStateUpdates() {\r\n\t\tif (this.pausedStateUpdate) {\r\n\t\t\tthis.pausedStateUpdateAction(this.pausedStateUpdate)\r\n\t\t\tthis.pausedStateUpdate = undefined\r\n\t\t\tthis.pausedStateUpdateAction = undefined\r\n\t\t}\r\n\t\tthis.hasPausedStateUpdates = false\r\n\t}\r\n\r\n\tverifyState(expectedState) {\r\n\t\t// `mocha`/`chai`.\r\n\t\tthis.virtualScroller.getState().should.deep.include(expectedState)\r\n\t}\r\n\r\n\texpectStateUpdate(stateUpdate, callback) {\r\n\t\tthis.expectedStateUpdates.push({\r\n\t\t\tstateUpdate,\r\n\t\t\tcallback\r\n\t\t})\r\n\t}\r\n\r\n\tgetFirstNonMeasuredItemIndex() {\r\n\t\treturn this.virtualScroller.firstNonMeasuredItemIndex\r\n\t}\r\n\r\n\tgetScrollY() {\r\n\t\treturn this.virtualScroller.scrollableContainer.getScrollY()\r\n\t}\r\n\r\n\tscrollTo(scrollPosition) {\r\n\t\tthis.virtualScroller.scrollableContainer.scrollToY(scrollPosition)\r\n\t}\r\n\r\n\tresize({\r\n\t\tscreenWidth: scrollableContainerWidth,\r\n\t\tscreenHeight: scrollableContainerHeight,\r\n\t\tcolumnsCount\r\n\t}) {\r\n\t\t// Resize scrollable container.\r\n\t\tthis.setScrollableContainerWidth(scrollableContainerWidth)\r\n\t\tthis.setScrollableContainerHeight(scrollableContainerHeight)\r\n\r\n\t\t// Update columns count.\r\n\t\tthis.__columnsCount = columnsCount\r\n\t}\r\n\r\n\t// Returns a `Promise`.\r\n\ttriggerResize({\r\n\t\tscreenWidth,\r\n\t\tscreenHeight,\r\n\t\tcolumnsCount,\r\n\t\tverticalSpacing\r\n\t}) {\r\n\t\tthis.resize({\r\n\t\t\tscreenWidth,\r\n\t\t\tscreenHeight,\r\n\t\t\tcolumnsCount,\r\n\t\t\tverticalSpacing\r\n\t\t})\r\n\r\n\t\t// Call \"on resize\" listener.\r\n\t\treturn this.virtualScroller.scrollableContainer._triggerResizeListener()\r\n\t}\r\n\r\n\tstop() {\r\n\t\tif (this.expectedStateUpdates.length > 0) {\r\n\t\t\tthrow new Error(`[virtual-scroller] Expected ${this.expectedStateUpdates.length} state updates which didn't happen:\\n${JSON.stringify(this.expectedStateUpdates, null, 2)}`)\r\n\t\t}\r\n\t\tif (this.pausedStateUpdate) {\r\n\t\t\tthrow new Error('[virtual-scroller] State updates were paused and haven\\'t been resumed afterwards')\r\n\t\t}\r\n\t\tthis.virtualScroller.stop()\r\n\t}\r\n\r\n\tstart() {\r\n\t\tthis.virtualScroller.start()\r\n\t}\r\n\r\n\tgetState() {\r\n\t\treturn this.virtualScroller.getState()\r\n\t}\r\n\r\n\tupdateLayout() {\r\n\t\tthis.virtualScroller.updateLayout()\r\n\t}\r\n\r\n\tgetItemScrollPosition(i) {\r\n\t\treturn this.virtualScroller.getItemScrollPosition(i)\r\n\t}\r\n\r\n\tgetAverageItemHeight() {\r\n\t\treturn this.virtualScroller.itemHeights.getAverage()\r\n\t}\r\n\r\n\tsetItems(newItems, options) {\r\n\t\tthis.virtualScroller.setItems(newItems, options)\r\n\t}\r\n}\r\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,eAAP,MAA4B,uBAA5B;AACA,OAAOC,MAAP,MAAmB,aAAnB;AAEA,IAAMC,KAAK,GAAG,KAAd;;IAEqBC,mB;EACpB,mCAOG;IAAA;;IAAA,IANWC,wBAMX,QANFC,WAME;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MAA1B,GAAmC,CAAvC,EAA0C;QACzC,MAAM,IAAI+B,KAAJ,uCAAyC,KAAKnD,oBAAL,CAA0BoB,MAAnE,kDAAiH0C,IAAI,CAACC,SAAL,CAAe,KAAK/D,oBAApB,EAA0C,IAA1C,EAAgD,CAAhD,CAAjH,EAAN;MACA;;MACD,IAAI,KAAKgB,iBAAT,EAA4B;QAC3B,MAAM,IAAImC,KAAJ,CAAU,mFAAV,CAAN;MACA;;MACD,KAAKtB,eAAL,CAAqBmC,IAArB;IACA;;;WAED,iBAAQ;MACP,KAAKnC,eAAL,CAAqBoC,KAArB;IACA;;;WAED,oBAAW;MACV,OAAO,KAAKpC,eAAL,CAAqBC,QAArB,EAAP;IACA;;;WAED,wBAAe;MACd,KAAKD,eAAL,CAAqBqC,YAArB;IACA;;;WAED,+BAAsBC,CAAtB,EAAyB;MACxB,OAAO,KAAKtC,eAAL,CAAqBuC,qBAArB,CAA2CD,CAA3C,CAAP;IACA;;;WAED,gCAAuB;MACtB,OAAO,KAAKtC,eAAL,CAAqBwC,WAArB,CAAiCC,UAAjC,EAAP;IACA;;;WAED,kBAASC,QAAT,EAAmBC,OAAnB,EAA4B;MAC3B,KAAK3C,eAAL,CAAqB4C,QAArB,CAA8BF,QAA9B,EAAwCC,OAAxC;IACA;;;;;;SAjOmBlF,mB"}
@@ -5,11 +5,11 @@
5
5
  import { setTimeout, clearTimeout } from 'request-animation-frame-timeout';
6
6
  /**
7
7
  * Same as `lodash`'s `debounce()` for functions with no arguments.
8
- * @param {function} func
8
+ * @param {function} func — The function.
9
9
  * @param {number} interval
10
10
  * @param {function} [options.onStart]
11
11
  * @param {function} [options.onStop]
12
- * @return {function}
12
+ * @return {function} A function that returns a `Promise` which resolves when the underlying (original) function gets executed.
13
13
  */
14
14
 
15
15
  export default function debounce(func, interval) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../source/utility/debounce.js"],"names":["setTimeout","clearTimeout","debounce","func","interval","onStart","onStop","timeout","args","Promise","resolve","undefined","apply"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,YAArB,QAAyC,iCAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,QAAT,CAAkBC,IAAlB,EAAwBC,QAAxB,EAA4D;AAAA,iFAAJ,EAAI;AAAA,MAAxBC,OAAwB,QAAxBA,OAAwB;AAAA,MAAfC,MAAe,QAAfA,MAAe;;AAC1E,MAAIC,OAAJ;AACA,SAAO,YAAkB;AAAA;;AAAA,sCAANC,IAAM;AAANA,MAAAA,IAAM;AAAA;;AACxB,WAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAa;AAC/B,UAAIH,OAAJ,EAAa;AACZN,QAAAA,YAAY,CAACM,OAAD,CAAZ;AACA,OAFD,MAEO;AACN,YAAIF,OAAJ,EAAa;AACZA,UAAAA,OAAO;AACP;AACD;;AACDE,MAAAA,OAAO,GAAGP,UAAU,CAAC,YAAM;AAC1BO,QAAAA,OAAO,GAAGI,SAAV;;AACA,YAAIL,MAAJ,EAAY;AACXA,UAAAA,MAAM;AACN;;AACDH,QAAAA,IAAI,CAACS,KAAL,CAAW,KAAX,EAAiBJ,IAAjB;AACAE,QAAAA,OAAO;AACP,OAPmB,EAOjBN,QAPiB,CAApB;AAQA,KAhBM,CAAP;AAiBA,GAlBD;AAmBA","sourcesContent":["// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\r\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\r\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\r\n// https://github.com/bvaughn/react-virtualized/issues/722\r\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout'\r\n\r\n/**\r\n * Same as `lodash`'s `debounce()` for functions with no arguments.\r\n * @param {function} func\r\n * @param {number} interval\r\n * @param {function} [options.onStart]\r\n * @param {function} [options.onStop]\r\n * @return {function}\r\n */\r\nexport default function debounce(func, interval, { onStart, onStop } = {}) {\r\n\tlet timeout\r\n\treturn function(...args) {\r\n\t\treturn new Promise((resolve) => {\r\n\t\t\tif (timeout) {\r\n\t\t\t\tclearTimeout(timeout)\r\n\t\t\t} else {\r\n\t\t\t\tif (onStart) {\r\n\t\t\t\t\tonStart()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ttimeout = setTimeout(() => {\r\n\t\t\t\ttimeout = undefined\r\n\t\t\t\tif (onStop) {\r\n\t\t\t\t\tonStop()\r\n\t\t\t\t}\r\n\t\t\t\tfunc.apply(this, args)\r\n\t\t\t\tresolve()\r\n\t\t\t}, interval)\r\n\t\t})\r\n\t}\r\n}\r\n"],"file":"debounce.js"}
1
+ {"version":3,"file":"debounce.js","names":["setTimeout","clearTimeout","debounce","func","interval","onStart","onStop","timeout","args","Promise","resolve","undefined","apply"],"sources":["../../source/utility/debounce.js"],"sourcesContent":["// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\r\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\r\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\r\n// https://github.com/bvaughn/react-virtualized/issues/722\r\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout'\r\n\r\n/**\r\n * Same as `lodash`'s `debounce()` for functions with no arguments.\r\n * @param {function} func — The function.\r\n * @param {number} interval\r\n * @param {function} [options.onStart]\r\n * @param {function} [options.onStop]\r\n * @return {function} A function that returns a `Promise` which resolves when the underlying (original) function gets executed.\r\n */\r\nexport default function debounce(func, interval, { onStart, onStop } = {}) {\r\n\tlet timeout\r\n\treturn function(...args) {\r\n\t\treturn new Promise((resolve) => {\r\n\t\t\tif (timeout) {\r\n\t\t\t\tclearTimeout(timeout)\r\n\t\t\t} else {\r\n\t\t\t\tif (onStart) {\r\n\t\t\t\t\tonStart()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\ttimeout = setTimeout(() => {\r\n\t\t\t\ttimeout = undefined\r\n\t\t\t\tif (onStop) {\r\n\t\t\t\t\tonStop()\r\n\t\t\t\t}\r\n\t\t\t\tfunc.apply(this, args)\r\n\t\t\t\tresolve()\r\n\t\t\t}, interval)\r\n\t\t})\r\n\t}\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,YAArB,QAAyC,iCAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,QAAT,CAAkBC,IAAlB,EAAwBC,QAAxB,EAA4D;EAAA,+EAAJ,EAAI;EAAA,IAAxBC,OAAwB,QAAxBA,OAAwB;EAAA,IAAfC,MAAe,QAAfA,MAAe;;EAC1E,IAAIC,OAAJ;EACA,OAAO,YAAkB;IAAA;;IAAA,kCAANC,IAAM;MAANA,IAAM;IAAA;;IACxB,OAAO,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAa;MAC/B,IAAIH,OAAJ,EAAa;QACZN,YAAY,CAACM,OAAD,CAAZ;MACA,CAFD,MAEO;QACN,IAAIF,OAAJ,EAAa;UACZA,OAAO;QACP;MACD;;MACDE,OAAO,GAAGP,UAAU,CAAC,YAAM;QAC1BO,OAAO,GAAGI,SAAV;;QACA,IAAIL,MAAJ,EAAY;UACXA,MAAM;QACN;;QACDH,IAAI,CAACS,KAAL,CAAW,KAAX,EAAiBJ,IAAjB;QACAE,OAAO;MACP,CAPmB,EAOjBN,QAPiB,CAApB;IAQA,CAhBM,CAAP;EAiBA,CAlBD;AAmBA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../source/utility/debug.js"],"names":["log","isDebug","args","console","concat","warn","isWarn","warningsAreErrors","reportError","apply","window","setTimeout","Error","join","error","debug","getDebug","undefined","getGlobalVariable","name","global"],"mappings":";;;;;;;;;;;;AAAA,eAAe,SAASA,GAAT,GAAsB;AACpC,MAAIC,OAAO,EAAX,EAAe;AAAA;;AAAA,sCADeC,IACf;AADeA,MAAAA,IACf;AAAA;;AACd,gBAAAC,OAAO,EA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A;;AAED,SAASU,QAAT,GAAoB;AACnB,SAAOE,iBAAiB,CAAC,sBAAD,CAAxB;AACA;;AAED,SAASX,iBAAT,GAA6B;AAC5B,SAAOW,iBAAiB,CAAC,kCAAD,CAAxB;AACA;;AAED,SAASA,iBAAT,CAA2BC,IAA3B,EAAiC;AAChC,MAAI,OAAOT,MAAP,KAAkB,WAAtB,EAAmC;AAClC,WAAOA,MAAM,CAACS,IAAD,CAAb;AACA,GAFD,MAEO,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;AACzC,WAAOA,MAAM,CAACD,IAAD,CAAb;AACA;AACD","sourcesContent":["export default function log(...args) {\r\n\tif (isDebug()) {\r\n\t\tconsole.log(...['[virtual-scroller]'].concat(args))\r\n\t}\r\n}\r\n\r\nexport function warn(...args) {\r\n\tif (isWarn()) {\r\n\t\tif (warningsAreErrors()) {\r\n\t\t\treturn reportError.apply(this, args)\r\n\t\t}\r\n\t\tconsole.warn(...['[virtual-scroller]'].concat(args))\r\n\t}\r\n}\r\n\r\nexport function reportError(...args) {\r\n\tif (typeof window !== 'undefined') {\r\n\t\t// In a web browser.\r\n\t\t// Output a debug message immediately so that it's known\r\n\t\t// at which point did the error occur between other debug logs.\r\n\t\tlog.apply(this, ['ERROR'].concat(args))\r\n\t\tsetTimeout(() => {\r\n\t\t\t// Throw an error in a timeout so that it doesn't interrupt the application's flow.\r\n\t\t\t// At the same time, by throwing a client-side error, such error could be spotted\r\n\t\t\t// in some error monitoring software like `sentry.io`, while also being visible\r\n\t\t\t// in the console.\r\n\t\t\t// The `.join(' ')` part doesn't support stringifying JSON objects,\r\n\t\t\t// but those don't seem to be used in any of the error messages.\r\n\t\t\tthrow new Error(['[virtual-scroller]'].concat(args).join(' '))\r\n\t\t}, 0)\r\n\t} else {\r\n\t\t// On a server.\r\n\t\tconsole.error(...['[virtual-scroller]'].concat(args))\r\n\t}\r\n}\r\n\r\nexport function isDebug() {\r\n\tconst debug = getDebug()\r\n\tif (debug !== undefined) {\r\n\t\treturn debug === true || debug === 'debug'\r\n\t}\r\n}\r\n\r\nexport function isWarn() {\r\n\t// const debug = getDebug()\r\n\t// return debug === undefined\r\n\t// \t|| debug === true\r\n\t// \t|| debug === 'debug'\r\n\t// \t|| debug === 'warn'\r\n\t//\r\n\treturn true\r\n}\r\n\r\nfunction getDebug() {\r\n\treturn getGlobalVariable('VirtualScrollerDebug')\r\n}\r\n\r\nfunction warningsAreErrors() {\r\n\treturn getGlobalVariable('VirtualScrollerWarningsAreErrors')\r\n}\r\n\r\nfunction getGlobalVariable(name) {\r\n\tif (typeof window !== 'undefined') {\r\n\t\treturn window[name]\r\n\t} else if (typeof global !== 'undefined') {\r\n\t\treturn global[name]\r\n\t}\r\n}"],"file":"debug.js"}
1
+ {"version":3,"file":"debug.js","names":["log","isDebug","args","console","concat","warn","isWarn","warningsAreErrors","reportError","apply","window","setTimeout","Error","join","error","debug","getDebug","undefined","getGlobalVariable","name","global"],"sources":["../../source/utility/debug.js"],"sourcesContent":["export default function log(...args) {\r\n\tif (isDebug()) {\r\n\t\tconsole.log(...['[virtual-scroller]'].concat(args))\r\n\t}\r\n}\r\n\r\nexport function warn(...args) {\r\n\tif (isWarn()) {\r\n\t\tif (warningsAreErrors()) {\r\n\t\t\treturn reportError.apply(this, args)\r\n\t\t}\r\n\t\tconsole.warn(...['[virtual-scroller]'].concat(args))\r\n\t}\r\n}\r\n\r\nexport function reportError(...args) {\r\n\tif (typeof window !== 'undefined') {\r\n\t\t// In a web browser.\r\n\t\t// Output a debug message immediately so that it's known\r\n\t\t// at which point did the error occur between other debug logs.\r\n\t\tlog.apply(this, ['ERROR'].concat(args))\r\n\t\tsetTimeout(() => {\r\n\t\t\t// Throw an error in a timeout so that it doesn't interrupt the application's flow.\r\n\t\t\t// At the same time, by throwing a client-side error, such error could be spotted\r\n\t\t\t// in some error monitoring software like `sentry.io`, while also being visible\r\n\t\t\t// in the console.\r\n\t\t\t// The `.join(' ')` part doesn't support stringifying JSON objects,\r\n\t\t\t// but those don't seem to be used in any of the error messages.\r\n\t\t\tthrow new Error(['[virtual-scroller]'].concat(args).join(' '))\r\n\t\t}, 0)\r\n\t} else {\r\n\t\t// On a server.\r\n\t\tconsole.error(...['[virtual-scroller]'].concat(args))\r\n\t}\r\n}\r\n\r\nexport function isDebug() {\r\n\tconst debug = getDebug()\r\n\tif (debug !== undefined) {\r\n\t\treturn debug === true || debug === 'debug'\r\n\t}\r\n}\r\n\r\nexport function isWarn() {\r\n\t// const debug = getDebug()\r\n\t// return debug === undefined\r\n\t// \t|| debug === true\r\n\t// \t|| debug === 'debug'\r\n\t// \t|| debug === 'warn'\r\n\t//\r\n\treturn true\r\n}\r\n\r\nfunction getDebug() {\r\n\treturn getGlobalVariable('VirtualScrollerDebug')\r\n}\r\n\r\nfunction warningsAreErrors() {\r\n\treturn getGlobalVariable('VirtualScrollerWarningsAreErrors')\r\n}\r\n\r\nfunction getGlobalVariable(name) {\r\n\tif (typeof window !== 'undefined') {\r\n\t\treturn window[name]\r\n\t} else if (typeof global !== 'undefined') {\r\n\t\treturn global[name]\r\n\t}\r\n}"],"mappings":";;;;;;;;;;;;AAAA,eAAe,SAASA,GAAT,GAAsB;EACpC,IAAIC,OAAO,EAAX,EAAe;IAAA;;IAAA,kCADeC,IACf;MADeA,IACf;IAAA;;IACd,YAAAC,OAAO,EAACH,GAAR,oCAAe,CAAC,oBAAD,EAAuBI,MAAvB,CAA8BF,IAA9B,CAAf;EACA;AACD;AAED,OAAO,SAASG,IAAT,GAAuB;EAC7B,IAAIC,MAAM,EAAV,EAAc;IAAA;;IAAA,mCADSJ,IACT;MADSA,IACT;IAAA;;IACb,IAAIK,iBAAiB,EAArB,EAAyB;MACxB,OAAOC,WAAW,CAACC,KAAZ,CAAkB,IAAlB,EAAwBP,IAAxB,CAAP;IACA;;IACD,aAAAC,OAAO,EAACE,IAAR,qCAAgB,CAAC,oBAAD,EAAuBD,MAAvB,CAA8BF,IAA9B,CAAhB;EACA;AACD;AAED,OAAO,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.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
2
 
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../source/utility/getStateSnapshot.js"],"names":["getStateSnapshot","state","stateSnapshot","itemHeights","slice","itemStates","beforeResize"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,gBAAT,CAA0BC,KAA1B,EAAiC;AAC/C,MAAIC,aAAa,qBACbD,KADa,CAAjB;;AAGA,MAAIA,KAAK,CAACE,WAAV,EAAuB;AACtBD,IAAAA,aAAa,CAACC,WAAd,GAA4BF,KAAK,CAACE,WAAN,CAAkBC,KAAlB,EAA5B;AACA;;AACD,MAAIH,KAAK,CAACI,UAAV,EAAsB;AACrBH,IAAAA,aAAa,CAACG,UAAd,GAA2BJ,KAAK,CAACI,UAAN,CAAiBD,KAAjB,EAA3B;AACA;;AACD,MAAIH,KAAK,CAACK,YAAV,EAAwB;AACvBJ,IAAAA,aAAa,CAACI,YAAd,qBACIL,KAAK,CAACK,YADV;AAGAJ,IAAAA,aAAa,CAACI,YAAd,CAA2BH,WAA3B,GAAyCF,KAAK,CAACK,YAAN,CAAmBH,WAAnB,CAA+BC,KAA/B,EAAzC;AACA;;AACD,SAAOF,aAAP;AACA","sourcesContent":["// Creates a snapshot of a `state` or a partial update of a `state`.\r\n// Is only used for logging state snapshots for later debug.\r\n//\r\n// When `state` is output to the browser console via `console.log()`,\r\n// it is explorable in real time. That also means that if that `state`\r\n// is modified later, the user will see the modified state, not the\r\n// original one. In the current implementation, `state` is not strictly\r\n// \"immutable\": things like individual item heights (including \"before resize\" ones)\r\n// or states are updated in-place — `state.itemHeights[i] = newItemHeight` or\r\n// `state.itemStates[i] = newItemState`. That's because those `state` properties\r\n// are the ones that don’t affect the presentation, so there's no need to re-render\r\n// the list when those do change — updating those properties is just an effect of\r\n// some change rather than cause for one.\r\n//\r\n// So, when outputting `state` via `console.log()` for debug, it makes sense to\r\n// snapshot it so that the developer, while debugging later, sees the correct\r\n// item heights or item states.\r\n//\r\nexport default function getStateSnapshot(state) {\r\n\tlet stateSnapshot = {\r\n\t\t...state\r\n\t}\r\n\tif (state.itemHeights) {\r\n\t\tstateSnapshot.itemHeights = state.itemHeights.slice()\r\n\t}\r\n\tif (state.itemStates) {\r\n\t\tstateSnapshot.itemStates = state.itemStates.slice()\r\n\t}\r\n\tif (state.beforeResize) {\r\n\t\tstateSnapshot.beforeResize = {\r\n\t\t\t...state.beforeResize\r\n\t\t}\r\n\t\tstateSnapshot.beforeResize.itemHeights = state.beforeResize.itemHeights.slice()\r\n\t}\r\n\treturn stateSnapshot\r\n}"],"file":"getStateSnapshot.js"}
1
+ {"version":3,"file":"getStateSnapshot.js","names":["getStateSnapshot","state","stateSnapshot","itemHeights","slice","itemStates","beforeResize"],"sources":["../../source/utility/getStateSnapshot.js"],"sourcesContent":["// Creates a snapshot of a `state` or a partial update of a `state`.\r\n// Is only used for logging state snapshots for later debug.\r\n//\r\n// When `state` is output to the browser console via `console.log()`,\r\n// it is explorable in real time. That also means that if that `state`\r\n// is modified later, the user will see the modified state, not the\r\n// original one. In the current implementation, `state` is not strictly\r\n// \"immutable\": things like individual item heights (including \"before resize\" ones)\r\n// or states are updated in-place — `state.itemHeights[i] = newItemHeight` or\r\n// `state.itemStates[i] = newItemState`. That's because those `state` properties\r\n// are the ones that don’t affect the presentation, so there's no need to re-render\r\n// the list when those do change — updating those properties is just an effect of\r\n// some change rather than cause for one.\r\n//\r\n// So, when outputting `state` via `console.log()` for debug, it makes sense to\r\n// snapshot it so that the developer, while debugging later, sees the correct\r\n// item heights or item states.\r\n//\r\nexport default function getStateSnapshot(state) {\r\n\tlet stateSnapshot = {\r\n\t\t...state\r\n\t}\r\n\tif (state.itemHeights) {\r\n\t\tstateSnapshot.itemHeights = state.itemHeights.slice()\r\n\t}\r\n\tif (state.itemStates) {\r\n\t\tstateSnapshot.itemStates = state.itemStates.slice()\r\n\t}\r\n\tif (state.beforeResize) {\r\n\t\tstateSnapshot.beforeResize = {\r\n\t\t\t...state.beforeResize\r\n\t\t}\r\n\t\tstateSnapshot.beforeResize.itemHeights = state.beforeResize.itemHeights.slice()\r\n\t}\r\n\treturn stateSnapshot\r\n}"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,gBAAT,CAA0BC,KAA1B,EAAiC;EAC/C,IAAIC,aAAa,qBACbD,KADa,CAAjB;;EAGA,IAAIA,KAAK,CAACE,WAAV,EAAuB;IACtBD,aAAa,CAACC,WAAd,GAA4BF,KAAK,CAACE,WAAN,CAAkBC,KAAlB,EAA5B;EACA;;EACD,IAAIH,KAAK,CAACI,UAAV,EAAsB;IACrBH,aAAa,CAACG,UAAd,GAA2BJ,KAAK,CAACI,UAAN,CAAiBD,KAAjB,EAA3B;EACA;;EACD,IAAIH,KAAK,CAACK,YAAV,EAAwB;IACvBJ,aAAa,CAACI,YAAd,qBACIL,KAAK,CAACK,YADV;IAGAJ,aAAa,CAACI,YAAd,CAA2BH,WAA3B,GAAyCF,KAAK,CAACK,YAAN,CAAmBH,WAAnB,CAA+BC,KAA/B,EAAzC;EACA;;EACD,OAAOF,aAAP;AACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../source/utility/px.js"],"names":["px","number","toFixed"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,EAAT,CAAYC,MAAZ,EAAoB;AAClC;AACC,SAAO,CAACA,MAAM,GAAG,CAAT,KAAe,CAAf,GAAmBA,MAAnB,GAA4BA,MAAM,CAACC,OAAP,CAAe,CAAf,CAA7B,IAAkD,IAAzD;AACD","sourcesContent":["/**\r\n * Rounds coordinates upto 4th decimal place (after dot) and appends \"px\".\r\n * Small numbers could be printed as `\"1.2345e-50\"` unless rounded:\r\n * that would be invalid \"px\" value in CSS.\r\n * @param {number}\r\n * @return {string}\r\n */\r\nexport default function px(number) {\r\n\t// Fractional pixels are used on \"retina\" screens.\r\n return (number % 1 === 0 ? number : number.toFixed(2)) + 'px'\r\n}"],"file":"px.js"}
1
+ {"version":3,"file":"px.js","names":["px","number","toFixed"],"sources":["../../source/utility/px.js"],"sourcesContent":["/**\r\n * Rounds coordinates upto 4th decimal place (after dot) and appends \"px\".\r\n * Small numbers could be printed as `\"1.2345e-50\"` unless rounded:\r\n * that would be invalid \"px\" value in CSS.\r\n * @param {number}\r\n * @return {string}\r\n */\r\nexport default function px(number) {\r\n\t// Fractional pixels are used on \"retina\" screens.\r\n return (number % 1 === 0 ? number : number.toFixed(2)) + 'px'\r\n}"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,EAAT,CAAYC,MAAZ,EAAoB;EAClC;EACC,OAAO,CAACA,MAAM,GAAG,CAAT,KAAe,CAAf,GAAmBA,MAAnB,GAA4BA,MAAM,CAACC,OAAP,CAAe,CAAf,CAA7B,IAAkD,IAAzD;AACD"}
@@ -1,4 +1,4 @@
1
- import px from './px';
1
+ import px from './px.js';
2
2
  describe('utility/px', function () {
3
3
  it('should truncate px values', function () {
4
4
  px(0).should.equal('0px');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../source/utility/px.test.js"],"names":["px","describe","it","should","equal"],"mappings":"AAAA,OAAOA,EAAP,MAAe,MAAf;AAEAC,QAAQ,CAAC,YAAD,EAAe,YAAW;AACjCC,EAAAA,EAAE,CAAC,2BAAD,EAA8B,YAAW;AAC1CF,IAAAA,EAAE,CAAC,CAAD,CAAF,CAAMG,MAAN,CAAaC,KAAb,CAAmB,KAAnB;AACAJ,IAAAA,EAAE,CAAC,CAAD,CAAF,CAAMG,MAAN,CAAaC,KAAb,CAAmB,KAAnB;AACAJ,IAAAA,EAAE,CAAC,MAAD,CAAF,CAAWG,MAAX,CAAkBC,KAAlB,CAAwB,QAAxB;AACA,GAJC,CAAF;AAKA,CANO,CAAR","sourcesContent":["import px from './px'\r\n\r\ndescribe('utility/px', function() {\r\n\tit('should truncate px values', function() {\r\n\t\tpx(0).should.equal('0px')\r\n\t\tpx(1).should.equal('1px')\r\n\t\tpx(1.2345).should.equal('1.23px')\r\n\t})\r\n})"],"file":"px.test.js"}
1
+ {"version":3,"file":"px.test.js","names":["px","describe","it","should","equal"],"sources":["../../source/utility/px.test.js"],"sourcesContent":["import px from './px.js'\r\n\r\ndescribe('utility/px', function() {\r\n\tit('should truncate px values', function() {\r\n\t\tpx(0).should.equal('0px')\r\n\t\tpx(1).should.equal('1px')\r\n\t\tpx(1.2345).should.equal('1.23px')\r\n\t})\r\n})"],"mappings":"AAAA,OAAOA,EAAP,MAAe,SAAf;AAEAC,QAAQ,CAAC,YAAD,EAAe,YAAW;EACjCC,EAAE,CAAC,2BAAD,EAA8B,YAAW;IAC1CF,EAAE,CAAC,CAAD,CAAF,CAAMG,MAAN,CAAaC,KAAb,CAAmB,KAAnB;IACAJ,EAAE,CAAC,CAAD,CAAF,CAAMG,MAAN,CAAaC,KAAb,CAAmB,KAAnB;IACAJ,EAAE,CAAC,MAAD,CAAF,CAAWG,MAAX,CAAkBC,KAAlB,CAAwB,QAAxB;EACA,CAJC,CAAF;AAKA,CANO,CAAR"}
@@ -15,7 +15,7 @@
15
15
  /*eslint-disable no-self-compare */
16
16
  'use strict';
17
17
 
18
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
18
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
19
19
 
20
20
  var hasOwnProperty = Object.prototype.hasOwnProperty;
21
21
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../source/utility/shallowEqual.js"],"names":["hasOwnProperty","Object","prototype","is","x","y","shallowEqual","objA","objB","keysA","keys","keysB","length","i","call"],"mappings":"AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AA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AK,CAACI,CAAD,CAAN,CAArB,CAFL,EAGE;AACA,aAAO,KAAP;AACD;AACF;;AAED,SAAO,IAAP;AACD","sourcesContent":["// https://github.com/lodash/lodash/issues/2340\r\n// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js\r\n\r\n/**\r\n * Copyright (c) 2013-present, Facebook, Inc.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * @providesModule shallowEqual\r\n * @typechecks\r\n * @flow\r\n */\r\n\r\n/*eslint-disable no-self-compare */\r\n\r\n'use strict';\r\n\r\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\r\n\r\n/**\r\n * inlined Object.is polyfill to avoid requiring consumers ship their own\r\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\r\n */\r\nfunction is(x, y) {\r\n // SameValue algorithm\r\n if (x === y) { // Steps 1-5, 7-10\r\n // Steps 6.b-6.e: +0 != -0\r\n // Added the nonzero y check to make Flow happy, but it is redundant\r\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\r\n } else {\r\n // Step 6.a: NaN == NaN\r\n return x !== x && y !== y;\r\n }\r\n}\r\n\r\n/**\r\n * Performs equality by iterating through keys on an object and returning false\r\n * when any key has values which are not strictly equal between the arguments.\r\n * Returns true when the values of all keys are strictly equal.\r\n */\r\nexport default function shallowEqual(objA, objB) {\r\n if (is(objA, objB)) {\r\n return true;\r\n }\r\n\r\n if (typeof objA !== 'object' || objA === null ||\r\n typeof objB !== 'object' || objB === null) {\r\n return false;\r\n }\r\n\r\n const keysA = Object.keys(objA);\r\n const keysB = Object.keys(objB);\r\n\r\n if (keysA.length !== keysB.length) {\r\n return false;\r\n }\r\n\r\n // Test for A's keys different from B.\r\n for (let i = 0; i < keysA.length; i++) {\r\n if (\r\n !hasOwnProperty.call(objB, keysA[i]) ||\r\n !is(objA[keysA[i]], objB[keysA[i]])\r\n ) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n}"],"file":"shallowEqual.js"}
1
+ {"version":3,"file":"shallowEqual.js","names":["hasOwnProperty","Object","prototype","is","x","y","shallowEqual","objA","objB","keysA","keys","keysB","length","i","call"],"sources":["../../source/utility/shallowEqual.js"],"sourcesContent":["// https://github.com/lodash/lodash/issues/2340\r\n// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js\r\n\r\n/**\r\n * Copyright (c) 2013-present, Facebook, Inc.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * @providesModule shallowEqual\r\n * @typechecks\r\n * @flow\r\n */\r\n\r\n/*eslint-disable no-self-compare */\r\n\r\n'use strict';\r\n\r\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\r\n\r\n/**\r\n * inlined Object.is polyfill to avoid requiring consumers ship their own\r\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\r\n */\r\nfunction is(x, y) {\r\n // SameValue algorithm\r\n if (x === y) { // Steps 1-5, 7-10\r\n // Steps 6.b-6.e: +0 != -0\r\n // Added the nonzero y check to make Flow happy, but it is redundant\r\n return x !== 0 || y !== 0 || 1 / x === 1 / y;\r\n } else {\r\n // Step 6.a: NaN == NaN\r\n return x !== x && y !== y;\r\n }\r\n}\r\n\r\n/**\r\n * Performs equality by iterating through keys on an object and returning false\r\n * when any key has values which are not strictly equal between the arguments.\r\n * Returns true when the values of all keys are strictly equal.\r\n */\r\nexport default function shallowEqual(objA, objB) {\r\n if (is(objA, objB)) {\r\n return true;\r\n }\r\n\r\n if (typeof objA !== 'object' || objA === null ||\r\n typeof objB !== 'object' || objB === null) {\r\n return false;\r\n }\r\n\r\n const keysA = Object.keys(objA);\r\n const keysB = Object.keys(objB);\r\n\r\n if (keysA.length !== keysB.length) {\r\n return false;\r\n }\r\n\r\n // Test for A's keys different from B.\r\n for (let i = 0; i < keysA.length; i++) {\r\n if (\r\n !hasOwnProperty.call(objB, keysA[i]) ||\r\n !is(objA[keysA[i]], objB[keysA[i]])\r\n ) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n}"],"mappings":"AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AAEA;;;;AAEA,IAAMA,cAAc,GAAGC,MAAM,CAACC,SAAP,CAAiBF,cAAxC;AAEA;AACA;AACA;AACA;;AACA,SAASG,EAAT,CAAYC,CAAZ,EAAeC,CAAf,EAAkB;EAChB;EACA,IAAID,CAAC,KAAKC,CAAV,EAAa;IAAE;IACb;IACA;IACA,OAAOD,CAAC,KAAK,CAAN,IAAWC,CAAC,KAAK,CAAjB,IAAsB,IAAID,CAAJ,KAAU,IAAIC,CAA3C;EACD,CAJD,MAIO;IACL;IACA,OAAOD,CAAC,KAAKA,CAAN,IAAWC,CAAC,KAAKA,CAAxB;EACD;AACF;AAED;AACA;AACA;AACA;AACA;;;AACA,eAAe,SAASC,YAAT,CAAsBC,IAAtB,EAA4BC,IAA5B,EAAkC;EAC/C,IAAIL,EAAE,CAACI,IAAD,EAAOC,IAAP,CAAN,EAAoB;IAClB,OAAO,IAAP;EACD;;EAED,IAAI,QAAOD,IAAP,MAAgB,QAAhB,IAA4BA,IAAI,KAAK,IAArC,IACA,QAAOC,IAAP,MAAgB,QADhB,IAC4BA,IAAI,KAAK,IADzC,EAC+C;IAC7C,OAAO,KAAP;EACD;;EAED,IAAMC,KAAK,GAAGR,MAAM,CAACS,IAAP,CAAYH,IAAZ,CAAd;EACA,IAAMI,KAAK,GAAGV,MAAM,CAACS,IAAP,CAAYF,IAAZ,CAAd;;EAEA,IAAIC,KAAK,CAACG,MAAN,KAAiBD,KAAK,CAACC,MAA3B,EAAmC;IACjC,OAAO,KAAP;EACD,CAf8C,CAiB/C;;;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,KAAK,CAACG,MAA1B,EAAkCC,CAAC,EAAnC,EAAuC;IACrC,IACE,CAACb,cAAc,CAACc,IAAf,CAAoBN,IAApB,EAA0BC,KAAK,CAACI,CAAD,CAA/B,CAAD,IACA,CAACV,EAAE,CAACI,IAAI,CAACE,KAAK,CAACI,CAAD,CAAN,CAAL,EAAiBL,IAAI,CAACC,KAAK,CAACI,CAAD,CAAN,CAArB,CAFL,EAGE;MACA,OAAO,KAAP;IACD;EACF;;EAED,OAAO,IAAP;AACD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../source/utility/throttle.js"],"names":["setTimeout","clearTimeout","throttle","func","interval","timeout","executedAt","scheduled","undefined","Date","now","remaining"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,YAArB,QAAyC,iCAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,QAAT,CAAkBC,IAAlB,EAAwBC,QAAxB,EAAkC;AAChD,MAAIC,OAAJ;AACA,MAAIC,UAAU,GAAG,CAAjB;;AACA,MAAIC,SAAS,GAAG,SAAZA,SAAY,GAAW;AAC1BF,IAAAA,OAAO,GAAGG,SAAV;AACAF,IAAAA,UAAU,GAAGG,IAAI,CAACC,GAAL,EAAb;AACAP,IAAAA,IAAI;AACJ,GAJD;;AAKA,SAAO,YAAW;AACjB,QAAMO,GAAG,GAAGD,IAAI,CAACC,GAAL,EAAZ;AACA,QAAMC,SAAS,GAAGP,QAAQ,IAAIM,GAAG,GAAGJ,UAAV,CAA1B;;AACA,QAAIK,SAAS,IAAI,CAAjB,EAAoB;AACnB,UAAIN,OAAJ,EAAa;AACZJ,QAAAA,YAAY,CAACI,OAAD,CAAZ;AACAA,QAAAA,OAAO,GAAGG,SAAV;AACA;;AACDF,MAAAA,UAAU,GAAGI,GAAb;AACAP,MAAAA,IAAI;AACJ,KAPD,MAOO,IAAI,CAACE,OAAL,EAAc;AACpBA,MAAAA,OAAO,GAAGL,UAAU,CAACO,SAAD,EAAYI,SAAZ,CAApB;AACA;AACD,GAbD;AAcA","sourcesContent":["// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\r\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\r\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\r\n// https://github.com/bvaughn/react-virtualized/issues/722\r\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout'\r\n\r\n/**\r\n * Same as `lodash`'s `throttle()` for functions with no arguments.\r\n * @param {function} func\r\n * @param {number} interval\r\n * @return {function}\r\n */\r\nexport default function throttle(func, interval) {\r\n\tlet timeout\r\n\tlet executedAt = 0\r\n\tlet scheduled = function() {\r\n\t\ttimeout = undefined\r\n\t\texecutedAt = Date.now()\r\n\t\tfunc()\r\n\t}\r\n\treturn function() {\r\n\t\tconst now = Date.now()\r\n\t\tconst remaining = interval - (now - executedAt)\r\n\t\tif (remaining <= 0) {\r\n\t\t\tif (timeout) {\r\n\t\t\t\tclearTimeout(timeout)\r\n\t\t\t\ttimeout = undefined\r\n\t\t\t}\r\n\t\t\texecutedAt = now\r\n\t\t\tfunc()\r\n\t\t} else if (!timeout) {\r\n\t\t\ttimeout = setTimeout(scheduled, remaining)\r\n\t\t}\r\n\t}\r\n}"],"file":"throttle.js"}
1
+ {"version":3,"file":"throttle.js","names":["setTimeout","clearTimeout","throttle","func","interval","timeout","executedAt","scheduled","undefined","Date","now","remaining"],"sources":["../../source/utility/throttle.js"],"sourcesContent":["// For some weird reason, in Chrome, `setTimeout()` would lag up to a second (or more) behind.\r\n// Turns out, Chrome developers have deprecated `setTimeout()` API entirely without asking anyone.\r\n// Replacing `setTimeout()` with `requestAnimationFrame()` can work around that Chrome bug.\r\n// https://github.com/bvaughn/react-virtualized/issues/722\r\nimport { setTimeout, clearTimeout } from 'request-animation-frame-timeout'\r\n\r\n/**\r\n * Same as `lodash`'s `throttle()` for functions with no arguments.\r\n * @param {function} func\r\n * @param {number} interval\r\n * @return {function}\r\n */\r\nexport default function throttle(func, interval) {\r\n\tlet timeout\r\n\tlet executedAt = 0\r\n\tlet scheduled = function() {\r\n\t\ttimeout = undefined\r\n\t\texecutedAt = Date.now()\r\n\t\tfunc()\r\n\t}\r\n\treturn function() {\r\n\t\tconst now = Date.now()\r\n\t\tconst remaining = interval - (now - executedAt)\r\n\t\tif (remaining <= 0) {\r\n\t\t\tif (timeout) {\r\n\t\t\t\tclearTimeout(timeout)\r\n\t\t\t\ttimeout = undefined\r\n\t\t\t}\r\n\t\t\texecutedAt = now\r\n\t\t\tfunc()\r\n\t\t} else if (!timeout) {\r\n\t\t\ttimeout = setTimeout(scheduled, remaining)\r\n\t\t}\r\n\t}\r\n}"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,YAArB,QAAyC,iCAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,QAAT,CAAkBC,IAAlB,EAAwBC,QAAxB,EAAkC;EAChD,IAAIC,OAAJ;EACA,IAAIC,UAAU,GAAG,CAAjB;;EACA,IAAIC,SAAS,GAAG,SAAZA,SAAY,GAAW;IAC1BF,OAAO,GAAGG,SAAV;IACAF,UAAU,GAAGG,IAAI,CAACC,GAAL,EAAb;IACAP,IAAI;EACJ,CAJD;;EAKA,OAAO,YAAW;IACjB,IAAMO,GAAG,GAAGD,IAAI,CAACC,GAAL,EAAZ;IACA,IAAMC,SAAS,GAAGP,QAAQ,IAAIM,GAAG,GAAGJ,UAAV,CAA1B;;IACA,IAAIK,SAAS,IAAI,CAAjB,EAAoB;MACnB,IAAIN,OAAJ,EAAa;QACZJ,YAAY,CAACI,OAAD,CAAZ;QACAA,OAAO,GAAGG,SAAV;MACA;;MACDF,UAAU,GAAGI,GAAb;MACAP,IAAI;IACJ,CAPD,MAOO,IAAI,CAACE,OAAL,EAAc;MACpBA,OAAO,GAAGL,UAAU,CAACO,SAAD,EAAYI,SAAZ,CAApB;IACA;EACD,CAbD;AAcA"}
package/package.json CHANGED
@@ -1,49 +1,72 @@
1
1
  {
2
2
  "name": "virtual-scroller",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "A component for efficiently rendering large lists of variable height items",
5
- "main": "index.commonjs.js",
5
+ "main": "index.cjs",
6
6
  "module": "index.js",
7
- "sideEffects": [
8
- "*.css"
9
- ],
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "import": "./index.js",
12
+ "require": "./index.cjs"
13
+ },
14
+ "./dom": {
15
+ "types": "./dom/index.d.ts",
16
+ "import": "./dom/index.js",
17
+ "require": "./dom/index.cjs"
18
+ },
19
+ "./react": {
20
+ "types": "./react/index.d.ts",
21
+ "import": "./react/index.js",
22
+ "require": "./react/index.cjs"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
26
+ "sideEffects": false,
10
27
  "dependencies": {
11
28
  "request-animation-frame-timeout": "^1.0.0"
12
29
  },
13
30
  "devDependencies": {
14
- "@babel/cli": "^7.16.0",
15
- "@babel/core": "^7.16.0",
16
- "@babel/node": "^7.16.0",
17
- "@babel/plugin-proposal-class-properties": "^7.16.0",
18
- "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
19
- "@babel/plugin-transform-destructuring": "^7.16.0",
31
+ "@babel/cli": "^7.17.10",
32
+ "@babel/core": "^7.17.12",
33
+ "@babel/node": "^7.17.10",
34
+ "@babel/plugin-transform-destructuring": "^7.17.12",
20
35
  "@babel/polyfill": "^7.0.0",
21
- "@babel/preset-env": "^7.16.4",
22
- "@babel/preset-react": "^7.16.0",
23
- "@babel/register": "^7.16.0",
36
+ "@babel/preset-env": "^7.17.12",
37
+ "@babel/preset-react": "^7.17.12",
38
+ "@babel/register": "^7.17.7",
24
39
  "babel-eslint": "^9.0.0",
25
- "babel-loader": "^8.2.3",
40
+ "babel-loader": "^8.2.5",
26
41
  "babel-plugin-istanbul": "^6.1.1",
27
- "chai": "^4.3.4",
42
+ "chai": "^4.3.6",
28
43
  "cross-env": "^7.0.3",
29
- "mocha": "^9.1.3",
44
+ "handlebars": "^4.5.3",
45
+ "istanbul": "^1.1.0-alpha.1",
46
+ "mocha": "^10.0.0",
30
47
  "npm-run-all": "^4.1.5",
31
48
  "nyc": "^15.1.0",
32
49
  "regenerator-runtime": "^0.13.9",
33
50
  "rimraf": "^3.0.2",
34
- "rollup": "^2.60.1",
51
+ "rollup": "^2.73.0",
35
52
  "rollup-plugin-commonjs": "^9.3.4",
36
53
  "rollup-plugin-node-resolve": "^4.2.3",
37
54
  "rollup-plugin-terser": "^7.0.2"
38
55
  },
39
56
  "scripts": {
40
- "test": "mocha --require ./babel.js --colors --bail --reporter spec --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
41
- "test-coverage": "cross-env NODE_ENV=test nyc mocha --require ./babel.js --bail --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\"",
57
+ "test": "mocha --colors --bail --reporter spec --require ./test/setup.js \"source/**/*.test.js\" \"test/**/*.test.js\" --recursive",
58
+ "test-coverage": "npm-run-all build:commonjs:clean build:commonjs build:commonjs:tests test-coverage:commonjs",
59
+ "test-coverage:commonjs": "node --experimental-json-modules node_modules/istanbul/lib/cli.js cover -x \"*.test.js\" -x \"commonjs/DOM/**/*.js\" -x \"react/DOM/**/*.js\" -x \"commonjs/utility/shallowEqual.js\" -x \"commonjs/utility/debounce.js\" -x \"commonjs/utility/debug.js\" node_modules/mocha/bin/_mocha -- --colors --reporter dot --require regenerator-runtime --require ./test/setup.js \"commonjs/**/*.test.js\" --recursive",
42
60
  "coveralls": "nyc report --reporter=text-lcov | coveralls",
43
- "build:browser": "rollup --config rollup.config.js",
44
- "build:clean": "rimraf ./commonjs/**/* ./modules/**/*",
45
- "build:commonjs": "cross-env babel ./source --out-dir ./commonjs --source-maps --ignore *.test.js",
61
+ "build:commonjs:tests": "cross-env babel ./test/**/*.js --out-dir ./commonjs/test --source-maps --ignore \"test/exports.test.js\",\"test/VirtualScroller.js\",\"test/setup.js\"",
62
+ "build:browser": "rollup --config rollup.config.mjs",
63
+ "build:clean": "npm-run-all build:commonjs:clean build:es6:clean",
64
+ "build:commonjs:clean": "rimraf ./commonjs/**/*",
65
+ "build:commonjs": "npm-run-all build:commonjs:modules build:commonjs:package.json",
66
+ "build:commonjs:modules": "cross-env babel ./source --out-dir ./commonjs --source-maps --ignore *.test.js",
67
+ "build:commonjs:package.json": "node runnable/create-commonjs-package-json.js",
46
68
  "build:es6": "cross-env BABEL_ENV=es6 babel ./source --out-dir ./modules --source-maps --ignore *.test.js",
69
+ "build:es6:clean": "rimraf ./modules/**/*",
47
70
  "build": "npm-run-all build:clean build:commonjs build:es6 build:browser",
48
71
  "prepublishOnly": "npm-run-all build test"
49
72
  },
@@ -0,0 +1,4 @@
1
+ 'use strict'
2
+
3
+ exports = module.exports = require('../commonjs/react/VirtualScroller.js').default
4
+ exports['default'] = require('../commonjs/react/VirtualScroller.js').default
@@ -0,0 +1,9 @@
1
+ 'use strict'
2
+
3
+ // This file is deprecated.
4
+ // It's the same as `index.cjs`, just with an added `.js` file extension.
5
+ // It only exists for compatibility with the software that doesn't like `*.cjs` file extension.
6
+ // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/61#note_950728292
7
+
8
+ exports = module.exports = require('../commonjs/react/VirtualScroller.js').default
9
+ exports['default'] = require('../commonjs/react/VirtualScroller.js').default
package/react/index.d.ts CHANGED
@@ -1,27 +1,28 @@
1
- import { State, VirtualScrollerCommonOptionsWithoutInitialState } from '../index.d.ts';
1
+ import { State, VirtualScrollerCommonOptions } from '../index.d.ts';
2
2
 
3
3
  export { State, ItemState } from '../index.d.ts';
4
4
 
5
5
  import * as React from 'react';
6
6
 
7
- interface Props<Item> extends VirtualScrollerCommonOptionsWithoutInitialState<HTMLElement, Item> {
8
- as?: React.ReactType;
7
+ interface Props<Item> extends VirtualScrollerCommonOptions<HTMLElement, Item>, React.HTMLAttributes<HTMLElement> {
8
+ as?: React.ElementType;
9
9
  items: Item[];
10
- itemComponent: React.ReactType;
10
+ itemComponent: React.ElementType;
11
11
  itemComponentProps?: object;
12
- className?: string;
13
- initialCustomState?: object;
14
12
  initialState?: State<Item>;
15
13
  preserveScrollPositionOnPrependItems?: boolean;
16
- onMount?: () => void;
14
+ getScrollableContainer?(): HTMLElement;
17
15
  }
18
16
 
19
- type ReactVirtualScroller<Item> = React.ComponentClass<Props<Item>, State<Item>>
17
+ type ReactVirtualScroller<Item> = (props: Props<Item>) => JSX.Element;
20
18
 
21
19
  // TypeScript doesn't know how to receive `<Item>` "generic":
22
20
  // declare const VirtualScroller<Item>: ReactVirtualScroller<Item>;
23
21
  //
24
- // Uses `<any>` instead:
22
+ // Uses `<any>` instead.
23
+ //
24
+ // If someone finds a fix for this, create an issue.
25
+ //
25
26
  declare const VirtualScroller: ReactVirtualScroller<any>;
26
27
 
27
28
  export default VirtualScroller;
package/react/index.js CHANGED
@@ -1 +1 @@
1
- export { default } from '../modules/react/VirtualScroller'
1
+ export { default } from '../modules/react/VirtualScroller.js'
@@ -1,9 +1,15 @@
1
1
  {
2
2
  "private": true,
3
3
  "name": "virtual-scroller/react",
4
- "main": "index.commonjs.js",
4
+ "main": "index.cjs",
5
5
  "module": "index.js",
6
- "sideEffects": [
7
- "*.css"
8
- ]
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./index.d.ts",
10
+ "import": "./index.js",
11
+ "require": "./index.cjs"
12
+ }
13
+ },
14
+ "sideEffects": false
9
15
  }
@@ -0,0 +1,62 @@
1
+ // import json from 'rollup-plugin-json'
2
+ import commonjs from 'rollup-plugin-commonjs'
3
+ import resolve from 'rollup-plugin-node-resolve'
4
+ import { terser } from 'rollup-plugin-terser'
5
+
6
+ const resolveModules = resolve()
7
+
8
+ export default [
9
+ {
10
+ input: 'index.js',
11
+ plugins: [
12
+ resolveModules,
13
+ commonjs(),
14
+ // json(),
15
+ terser()
16
+ ],
17
+ output: {
18
+ format: 'umd',
19
+ name: 'VirtualScroller',
20
+ file: 'bundle/virtual-scroller.js',
21
+ sourcemap: true
22
+ }
23
+ },
24
+ {
25
+ input: 'dom/index.js',
26
+ plugins: [
27
+ resolveModules,
28
+ commonjs(),
29
+ // json(),
30
+ terser()
31
+ ],
32
+ output: {
33
+ format: 'umd',
34
+ name: 'VirtualScroller',
35
+ file: 'bundle/virtual-scroller-dom.js',
36
+ sourcemap: true
37
+ }
38
+ },
39
+ {
40
+ input: 'react/index.js',
41
+ plugins: [
42
+ resolveModules,
43
+ commonjs(),
44
+ // json(),
45
+ terser()
46
+ ],
47
+ external: [
48
+ 'react',
49
+ 'prop-types'
50
+ ],
51
+ output: {
52
+ format: 'umd',
53
+ name: 'VirtualScroller',
54
+ file: 'bundle/virtual-scroller-react.js',
55
+ sourcemap: true,
56
+ globals: {
57
+ 'react': 'React',
58
+ 'prop-types': 'PropTypes'
59
+ }
60
+ }
61
+ }
62
+ ]
@@ -0,0 +1,11 @@
1
+ // Creates a `package.json` file in the CommonJS `build` folder.
2
+ // That marks that whole folder as CommonJS so that Node.js doesn't complain
3
+ // about `require()`-ing those files.
4
+
5
+ import fs from 'fs'
6
+
7
+ fs.writeFileSync('./commonjs/package.json', JSON.stringify({
8
+ name: 'virtual-scroller/commonjs',
9
+ type: 'commonjs',
10
+ private: true
11
+ }, null, 2), 'utf8')
@@ -1,4 +1,4 @@
1
- import log from './utility/debug'
1
+ import log from './utility/debug.js'
2
2
 
3
3
  export default class BeforeResize {
4
4
  constructor({
@@ -11,22 +11,8 @@ export default class BeforeResize {
11
11
  this.getColumnsCount = getColumnsCount
12
12
  }
13
13
 
14
- // Possibly clean up "before resize" property in state.
15
- // "Before resize" state property is cleaned up when all "before resize" item heights
16
- // have been re-measured in an asynchronous `this.setState({ beforeResize: undefined })` call.
17
- // If `VirtualScroller` state was snapshotted externally before that `this.setState()` call
18
- // has been applied, then "before resize" property might have not been cleaned up properly.
19
- onInitialState(state) {
20
- if (state) {
21
- if (state.beforeResize) {
22
- if (state.beforeResize.itemHeights.length === 0) {
23
- state.beforeResize = undefined
24
- }
25
- }
26
- if (state.beforeResize) {
27
- this._includesBeforeResizeInState = true
28
- }
29
- }
14
+ initializeFromState(state) {
15
+ this._includesBeforeResizeInState = Boolean(state.beforeResize)
30
16
  }
31
17
 
32
18
  // Cleans up "before resize" item heights and adjusts the scroll position accordingly.
@@ -45,7 +31,7 @@ export default class BeforeResize {
45
31
  //
46
32
  // But, seems like it works fine as it is and there's no need to rewrite anything.
47
33
  //
48
- cleanUpBeforeResizeItemHeights(prevState) {
34
+ cleanUpBeforeResizeItemHeights() {
49
35
  const {
50
36
  firstShownItemIndex,
51
37
  lastShownItemIndex,
@@ -138,9 +124,9 @@ export default class BeforeResize {
138
124
  k++
139
125
  }
140
126
 
141
- // Schedule an asynchronous `this.setState()` call that will update
127
+ // Schedule an asynchronous `this.updateState()` call that will update
142
128
  // `beforeResize` property of `state`. Ideally, it should be updated
143
- // immediately, but since `this.setState()` calls are asynchronous,
129
+ // immediately, but since `this.updateState()` calls are asynchronous,
144
130
  // the code updates just the underlying `beforeResize.itemHeights`
145
131
  // array immediately instead, which is still a hack but still a lesser one.
146
132
  if (firstShownItemIndex === 0) {
@@ -157,7 +143,7 @@ export default class BeforeResize {
157
143
 
158
144
  // Immediately update `beforeResize.itemHeights`
159
145
  // so that the component isn't left in an inconsistent state
160
- // before a `this.setState()` call below is applied.
146
+ // before a `this.updateState()` call below is applied.
161
147
  beforeResize.itemHeights.splice(
162
148
  firstShownItemIndex,
163
149
  beforeResize.itemHeights.length - firstShownItemIndex
@@ -314,4 +300,13 @@ function equalizeItemHeights(itemHeights, maxItemsCount, columnsCount) {
314
300
  }
315
301
 
316
302
  return itemHeights.slice(0, maxItemsCount)
303
+ }
304
+
305
+ export function cleanUpBeforeResizeState(state) {
306
+ if (state.beforeResize) {
307
+ if (state.beforeResize.itemHeights.length === 0) {
308
+ state.beforeResize = undefined
309
+ }
310
+ }
311
+ return state
317
312
  }
@@ -1,25 +1,23 @@
1
- import ItemsContainer from './ItemsContainer'
2
-
3
- import ScrollableContainer, {
4
- ScrollableWindowContainer
5
- } from './ScrollableContainer'
6
-
7
- import ListTopOffsetWatcher from './ListTopOffsetWatcher'
1
+ import ItemsContainer from './ItemsContainer.js'
2
+ import ScrollableContainer, { ScrollableWindowContainer } from './ScrollableContainer.js'
3
+ import ListTopOffsetWatcher from './ListTopOffsetWatcher.js'
8
4
 
9
5
  export default {
10
6
  createItemsContainer(getItemsContainerElement) {
11
7
  return new ItemsContainer(getItemsContainerElement)
12
8
  },
9
+
13
10
  // Creates a `scrollableContainer`.
14
11
  // On client side, `scrollableContainer` is always created.
15
12
  // On server side, `scrollableContainer` is not created (and not used).
16
- createScrollableContainer(scrollableContainer, getItemsContainerElement) {
17
- if (scrollableContainer) {
18
- return new ScrollableContainer(scrollableContainer, getItemsContainerElement)
13
+ createScrollableContainer(getScrollableContainerElement, getItemsContainerElement) {
14
+ if (getScrollableContainerElement) {
15
+ return new ScrollableContainer(getScrollableContainerElement, getItemsContainerElement)
19
16
  } else if (typeof window !== 'undefined') {
20
17
  return new ScrollableWindowContainer(getItemsContainerElement)
21
18
  }
22
19
  },
20
+
23
21
  watchListTopOffset({
24
22
  getListTopOffset,
25
23
  onListTopOffsetChange
@@ -18,18 +18,19 @@ const WATCH_LIST_TOP_OFFSET_MAX_DURATION = 3000
18
18
  // returns "incorrect" `top` position because the styles haven't been applied yet.
19
19
  //
20
20
  // For example, consider a page:
21
+ //
21
22
  // <div class="page">
22
23
  // <nav class="sidebar">...</nav>
23
24
  // <main>...</main>
24
25
  // </div>
25
26
  //
26
- // The sidebar is styled as `position: fixed`, but until
27
- // the page styles have been applied it's gonna be a regular `<div/>`
27
+ // The sidebar is styled as `position: fixed`, but, until
28
+ // the page styles have been applied, it's gonna be a regular `<div/>`
28
29
  // meaning that `<main/>` will be rendered below the sidebar
29
- // and will appear offscreen and so it will only render the first item.
30
+ // and will appear offscreen, and so it will only render the first item.
30
31
  //
31
- // Then, the page styles are loaded and applied and the sidebar
32
- // is now `position: fixed` so `<main/>` is now rendered at the top of the page
32
+ // Then, the page styles are loaded and applied, and the sidebar
33
+ // is now `position: fixed`, so `<main/>` is now rendered at the top of the page,
33
34
  // but `VirtualScroller`'s `.render()` has already been called
34
35
  // and it won't re-render until the user scrolls or the window is resized.
35
36
  //
@@ -77,12 +78,16 @@ export default class ListTopOffsetWatcher {
77
78
  }
78
79
 
79
80
  start() {
80
- this.isRendered = true
81
+ this._isActive = true
81
82
  this.watchListTopOffset()
82
83
  }
83
84
 
85
+ isStarted() {
86
+ return this._isActive
87
+ }
88
+
84
89
  stop() {
85
- this.isRendered = false
90
+ this._isActive = false
86
91
 
87
92
  if (this.watchListTopOffsetTimer) {
88
93
  clearTimeout(this.watchListTopOffsetTimer)
@@ -95,7 +100,7 @@ export default class ListTopOffsetWatcher {
95
100
  const check = () => {
96
101
  // If `VirtualScroller` has been unmounted
97
102
  // while `setTimeout()` was waiting, then exit.
98
- if (!this.isRendered) {
103
+ if (!this._isActive) {
99
104
  return
100
105
  }
101
106
  // Skip comparing `top` coordinate of the list