@ringcentral/juno 2.4.1 → 2.5.0

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 (145) hide show
  1. package/components/Buttons/IconButton/IconButton.d.ts +6 -2
  2. package/components/Buttons/IconButton/IconButton.js +9 -7
  3. package/components/Buttons/IconButton/styles/StyledIconButton.js +15 -7
  4. package/components/Buttons/IconButton/utils/IconButtonUtils.d.ts +1 -1
  5. package/components/Buttons/IconButton/utils/IconButtonUtils.js +9 -1
  6. package/components/Dialer/DialPad/DialPad.d.ts +25 -7
  7. package/components/Dialer/DialPad/DialPad.js +6 -6
  8. package/components/Dialer/DialPad/utils/useDialKeyboard.d.ts +8 -9
  9. package/components/Dialer/DialTextField/DialTextField.d.ts +3 -1
  10. package/components/Dialer/DialTextField/DialTextField.js +7 -6
  11. package/components/Downshift/SuggestionList/SuggestionList.d.ts +74 -2
  12. package/components/Downshift/SuggestionList/SuggestionList.js +4 -1
  13. package/components/Downshift/styles/DownshiftStyle.d.ts +1 -1
  14. package/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.d.ts +1 -1
  15. package/components/Forms/Picker/DatePicker/styles/StyledYear.d.ts +1 -1
  16. package/components/Forms/Picker/TimePicker/styles/StyledSelectionItem.d.ts +1 -1
  17. package/components/Forms/Picker/TimePicker/styles/StyledTimeIconButton.d.ts +1 -1
  18. package/components/Forms/Picker/styles/PickerBaseIconButton.d.ts +1 -1
  19. package/components/Forms/TextField/styles/ClearIconButton.d.ts +2 -2
  20. package/components/Grid/Grid.d.ts +1 -1
  21. package/components/Pagination/Pagination/Pagination.d.ts +1 -1
  22. package/components/Stepper/StepButton/StepButton.d.ts +1 -1
  23. package/components/Stepper/StepLabel/StepLabel.d.ts +1 -1
  24. package/components/Table/TableCell/styles/TableCellStyle.js +3 -1
  25. package/components/Table/types.d.ts +1 -1
  26. package/components/TablePagination/TablePagination.d.ts +1 -1
  27. package/components/VirtualizedMenu/VirtualizedMenu.js +11 -0
  28. package/components/VirtualizedMenu/VirtualizedMenuList.js +7 -14
  29. package/components/Virtuoso/react-virtuoso/AATree.js +15 -15
  30. package/components/Virtuoso/react-virtuoso/Grid.d.ts +193 -106
  31. package/components/Virtuoso/react-virtuoso/Grid.js +19 -24
  32. package/components/Virtuoso/react-virtuoso/List.d.ts +2664 -596
  33. package/components/Virtuoso/react-virtuoso/List.js +83 -70
  34. package/components/Virtuoso/react-virtuoso/Table.d.ts +6253 -0
  35. package/components/Virtuoso/react-virtuoso/Table.js +184 -0
  36. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +153 -37
  37. package/components/Virtuoso/react-virtuoso/components.d.ts +248 -41
  38. package/components/Virtuoso/react-virtuoso/components.js +2 -0
  39. package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +2 -4
  40. package/components/Virtuoso/react-virtuoso/domIOSystem.js +12 -10
  41. package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +146 -27
  42. package/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
  43. package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +67 -52
  44. package/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
  45. package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +17 -3
  46. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +2 -1
  47. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +32 -7
  48. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +1 -1
  49. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
  50. package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -2
  51. package/components/Virtuoso/react-virtuoso/hooks/useSize.js +26 -28
  52. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.d.ts +1 -1
  53. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
  54. package/components/Virtuoso/react-virtuoso/index.d.ts +1 -0
  55. package/components/Virtuoso/react-virtuoso/index.js +2 -0
  56. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +165 -35
  57. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
  58. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +160 -38
  59. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +54 -12
  60. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +26 -10
  61. package/components/Virtuoso/react-virtuoso/interfaces.d.ts +134 -28
  62. package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +141 -32
  63. package/components/Virtuoso/react-virtuoso/listStateSystem.js +1 -2
  64. package/components/Virtuoso/react-virtuoso/listSystem.d.ts +2123 -407
  65. package/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
  66. package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +17 -0
  67. package/components/Virtuoso/react-virtuoso/loggerSystem.js +37 -0
  68. package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +8 -1
  69. package/components/Virtuoso/react-virtuoso/propsReadySystem.js +8 -2
  70. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +641 -0
  71. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +42 -0
  72. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +52 -67
  73. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
  74. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +26 -5
  75. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
  76. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +11 -4
  77. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +44 -15
  78. package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +12 -2
  79. package/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
  80. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +17 -5
  81. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
  82. package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +145 -33
  83. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +149 -35
  84. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +183 -42
  85. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +37 -26
  86. package/components/Virtuoso/react-virtuoso/utils/correctItemSize.d.ts +1 -0
  87. package/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +6 -0
  88. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +7 -4
  89. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
  90. package/components/Virtuoso/utils/useHighlightScroll.d.ts +4 -0
  91. package/components/Virtuoso/utils/useHighlightScroll.js +17 -0
  92. package/es6/components/Buttons/IconButton/IconButton.js +11 -9
  93. package/es6/components/Buttons/IconButton/styles/StyledIconButton.js +16 -8
  94. package/es6/components/Buttons/IconButton/utils/IconButtonUtils.js +9 -1
  95. package/es6/components/Dialer/DialPad/DialPad.js +6 -6
  96. package/es6/components/Dialer/DialTextField/DialTextField.js +7 -6
  97. package/es6/components/Downshift/SuggestionList/SuggestionList.js +5 -2
  98. package/es6/components/Table/TableCell/TableCell.js +2 -2
  99. package/es6/components/Table/TableCell/styles/TableCellStyle.js +3 -1
  100. package/es6/components/VirtualizedMenu/VirtualizedMenu.js +13 -2
  101. package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +9 -16
  102. package/es6/components/Virtuoso/react-virtuoso/AATree.js +15 -15
  103. package/es6/components/Virtuoso/react-virtuoso/Grid.js +20 -25
  104. package/es6/components/Virtuoso/react-virtuoso/List.js +84 -72
  105. package/es6/components/Virtuoso/react-virtuoso/Table.js +182 -0
  106. package/es6/components/Virtuoso/react-virtuoso/components.js +2 -0
  107. package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +13 -10
  108. package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
  109. package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
  110. package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +31 -6
  111. package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
  112. package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +27 -29
  113. package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
  114. package/es6/components/Virtuoso/react-virtuoso/index.js +1 -0
  115. package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
  116. package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +25 -10
  117. package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +2 -3
  118. package/es6/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
  119. package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +34 -0
  120. package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +9 -2
  121. package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +40 -0
  122. package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
  123. package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
  124. package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +39 -11
  125. package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
  126. package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
  127. package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +39 -28
  128. package/es6/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +3 -0
  129. package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
  130. package/es6/components/Virtuoso/utils/useHighlightScroll.js +16 -0
  131. package/es6/foundation/hooks/useLongPress/useLongPress.js +7 -7
  132. package/es6/foundation/index.js +1 -1
  133. package/es6/foundation/isWebKit154.js +57 -0
  134. package/es6/foundation/theme/ThemeProvider.js +4 -4
  135. package/foundation/hooks/useLongPress/useLongPress.d.ts +3 -1
  136. package/foundation/hooks/useLongPress/useLongPress.js +7 -7
  137. package/foundation/index.d.ts +1 -1
  138. package/foundation/index.js +1 -1
  139. package/foundation/isWebKit154.d.ts +20 -0
  140. package/foundation/{isSafari154.js → isWebKit154.js} +22 -17
  141. package/foundation/theme/ThemeProvider.d.ts +1 -1
  142. package/foundation/theme/ThemeProvider.js +4 -4
  143. package/package.json +2 -2
  144. package/es6/foundation/isSafari154.js +0 -52
  145. package/foundation/isSafari154.d.ts +0 -15
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
5
+ var AATree_1 = require("./AATree");
6
+ var domIOSystem_1 = require("./domIOSystem");
7
+ var listStateSystem_1 = require("./listStateSystem");
8
+ var loggerSystem_1 = require("./loggerSystem");
9
+ var scrollToIndexSystem_1 = require("./scrollToIndexSystem");
10
+ var sizeSystem_1 = require("./sizeSystem");
11
+ exports.scrollIntoViewSystem = u.system(function (_a) {
12
+ var _b = tslib_1.__read(_a, 3), _c = _b[0], sizes = _c.sizes, totalCount = _c.totalCount, _d = _b[1], scrollTop = _d.scrollTop, viewportHeight = _d.viewportHeight, headerHeight = _d.headerHeight, scrollingInProgress = _d.scrollingInProgress, scrollToIndex = _b[2].scrollToIndex;
13
+ var scrollIntoView = u.stream();
14
+ u.connect(u.pipe(scrollIntoView, u.withLatestFrom(sizes, viewportHeight, totalCount, headerHeight, scrollTop), u.map(function (_a) {
15
+ var _b = tslib_1.__read(_a, 6), _c = _b[0], index = _c.index, _d = _c.behavior, behavior = _d === void 0 ? 'auto' : _d, done = _c.done, sizes = _b[1], viewportHeight = _b[2], totalCount = _b[3], headerHeight = _b[4], scrollTop = _b[5];
16
+ var lastIndex = totalCount - 1;
17
+ var location = null;
18
+ index = sizeSystem_1.originalIndexFromItemIndex(index, sizes);
19
+ index = Math.max(0, index, Math.min(lastIndex, index));
20
+ var itemTop = sizeSystem_1.offsetOf(index, sizes.offsetTree) + headerHeight;
21
+ if (itemTop < scrollTop) {
22
+ location = { index: index, behavior: behavior, align: 'start' };
23
+ }
24
+ else {
25
+ var itemBottom = itemTop + AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1];
26
+ if (itemBottom > scrollTop + viewportHeight) {
27
+ location = { index: index, behavior: behavior, align: 'end' };
28
+ }
29
+ }
30
+ if (location) {
31
+ done &&
32
+ u.handleNext(u.pipe(scrollingInProgress, u.skip(1), u.filter(function (value) { return value === false; })), done);
33
+ }
34
+ else {
35
+ done && done();
36
+ }
37
+ return location;
38
+ }), u.filter(function (value) { return value !== null; })), scrollToIndex);
39
+ return {
40
+ scrollIntoView: scrollIntoView,
41
+ };
42
+ }, u.tup(sizeSystem_1.sizeSystem, domIOSystem_1.domIOSystem, scrollToIndexSystem_1.scrollToIndexSystem, listStateSystem_1.listStateSystem, loggerSystem_1.loggerSystem), { singleton: true });
@@ -1,71 +1,56 @@
1
+ import * as u from '@virtuoso.dev/urx';
1
2
  import { ListRange, ScrollSeekConfiguration } from './interfaces';
2
- export declare const scrollSeekSystem: import("@virtuoso.dev/urx").SystemSpec<[import("@virtuoso.dev/urx").SystemSpec<never[], () => {
3
- scrollTop: import("@virtuoso.dev/urx").Stream<number>;
4
- viewportHeight: import("@virtuoso.dev/urx").Stream<number>;
5
- headerHeight: import("@virtuoso.dev/urx").StatefulStream<number>;
6
- footerHeight: import("@virtuoso.dev/urx").StatefulStream<number>;
7
- smoothScrollTargetReached: import("@virtuoso.dev/urx").Stream<true>;
8
- scrollTo: import("@virtuoso.dev/urx").Stream<ScrollToOptions>;
9
- scrollBy: import("@virtuoso.dev/urx").Stream<ScrollToOptions>;
10
- scrollDirection: import("@virtuoso.dev/urx").StatefulStream<import("./domIOSystem").ScrollDirection>;
11
- statefulScrollTop: import("@virtuoso.dev/urx").StatefulStream<number>;
12
- deviation: import("@virtuoso.dev/urx").StatefulStream<number>;
13
- scrollingInProgress: import("@virtuoso.dev/urx").StatefulStream<boolean>;
14
- }>, import("@virtuoso.dev/urx").SystemSpec<[import("@virtuoso.dev/urx").SystemSpec<never[], () => {
15
- scrollTop: import("@virtuoso.dev/urx").Stream<number>;
16
- viewportHeight: import("@virtuoso.dev/urx").Stream<number>;
17
- headerHeight: import("@virtuoso.dev/urx").StatefulStream<number>;
18
- footerHeight: import("@virtuoso.dev/urx").StatefulStream<number>;
19
- smoothScrollTargetReached: import("@virtuoso.dev/urx").Stream<true>;
20
- scrollTo: import("@virtuoso.dev/urx").Stream<ScrollToOptions>;
21
- scrollBy: import("@virtuoso.dev/urx").Stream<ScrollToOptions>;
22
- scrollDirection: import("@virtuoso.dev/urx").StatefulStream<import("./domIOSystem").ScrollDirection>;
23
- statefulScrollTop: import("@virtuoso.dev/urx").StatefulStream<number>;
24
- deviation: import("@virtuoso.dev/urx").StatefulStream<number>;
25
- scrollingInProgress: import("@virtuoso.dev/urx").StatefulStream<boolean>;
26
- }>], ([{ scrollTop, viewportHeight }]: [{
27
- scrollTop: import("@virtuoso.dev/urx").Stream<number>;
28
- viewportHeight: import("@virtuoso.dev/urx").Stream<number>;
29
- headerHeight: import("@virtuoso.dev/urx").StatefulStream<number>;
30
- footerHeight: import("@virtuoso.dev/urx").StatefulStream<number>;
31
- smoothScrollTargetReached: import("@virtuoso.dev/urx").Stream<true>;
32
- scrollTo: import("@virtuoso.dev/urx").Stream<ScrollToOptions>;
33
- scrollBy: import("@virtuoso.dev/urx").Stream<ScrollToOptions>;
34
- scrollDirection: import("@virtuoso.dev/urx").StatefulStream<import("./domIOSystem").ScrollDirection>;
35
- statefulScrollTop: import("@virtuoso.dev/urx").StatefulStream<number>;
36
- deviation: import("@virtuoso.dev/urx").StatefulStream<number>;
37
- scrollingInProgress: import("@virtuoso.dev/urx").StatefulStream<boolean>;
3
+ export declare const scrollSeekSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSpec<never[], () => {
4
+ scrollContainerState: u.Stream<[number, number]>;
5
+ scrollTop: u.Stream<number>;
6
+ viewportHeight: u.Stream<number>;
7
+ headerHeight: u.StatefulStream<number>;
8
+ footerHeight: u.StatefulStream<number>;
9
+ scrollHeight: u.Stream<number>;
10
+ smoothScrollTargetReached: u.Stream<true>;
11
+ scrollTo: u.Stream<ScrollToOptions>;
12
+ scrollBy: u.Stream<ScrollToOptions>;
13
+ statefulScrollTop: u.StatefulStream<number>;
14
+ deviation: u.StatefulStream<number>;
15
+ scrollingInProgress: u.StatefulStream<boolean>;
16
+ }>], ([{ scrollContainerState, scrollTop, viewportHeight, headerHeight, footerHeight, scrollBy, },]: [{
17
+ scrollContainerState: u.Stream<[number, number]>;
18
+ scrollTop: u.Stream<number>;
19
+ viewportHeight: u.Stream<number>;
20
+ headerHeight: u.StatefulStream<number>;
21
+ footerHeight: u.StatefulStream<number>;
22
+ scrollHeight: u.Stream<number>;
23
+ smoothScrollTargetReached: u.Stream<true>;
24
+ scrollTo: u.Stream<ScrollToOptions>;
25
+ scrollBy: u.Stream<ScrollToOptions>;
26
+ statefulScrollTop: u.StatefulStream<number>;
27
+ deviation: u.StatefulStream<number>;
28
+ scrollingInProgress: u.StatefulStream<boolean>;
38
29
  }]) => {
39
- isScrolling: import("@virtuoso.dev/urx").Stream<boolean>;
40
- isAtTop: import("@virtuoso.dev/urx").StatefulStream<boolean>;
41
- isAtBottom: import("@virtuoso.dev/urx").StatefulStream<boolean>;
42
- atBottomState: import("@virtuoso.dev/urx").Stream<import("./stateFlagsSystem").AtBottomState>;
43
- atTopStateChange: import("@virtuoso.dev/urx").Stream<boolean>;
44
- atBottomStateChange: import("@virtuoso.dev/urx").Stream<boolean>;
45
- listStateListener: import("@virtuoso.dev/urx").Stream<import("./stateFlagsSystem").ListBottomInfo>;
46
- }>], ([{ scrollTop }, { isScrolling }]: [{
47
- scrollTop: import("@virtuoso.dev/urx").Stream<number>;
48
- viewportHeight: import("@virtuoso.dev/urx").Stream<number>;
49
- headerHeight: import("@virtuoso.dev/urx").StatefulStream<number>;
50
- footerHeight: import("@virtuoso.dev/urx").StatefulStream<number>;
51
- smoothScrollTargetReached: import("@virtuoso.dev/urx").Stream<true>;
52
- scrollTo: import("@virtuoso.dev/urx").Stream<ScrollToOptions>;
53
- scrollBy: import("@virtuoso.dev/urx").Stream<ScrollToOptions>;
54
- scrollDirection: import("@virtuoso.dev/urx").StatefulStream<import("./domIOSystem").ScrollDirection>;
55
- statefulScrollTop: import("@virtuoso.dev/urx").StatefulStream<number>;
56
- deviation: import("@virtuoso.dev/urx").StatefulStream<number>;
57
- scrollingInProgress: import("@virtuoso.dev/urx").StatefulStream<boolean>;
58
- }, {
59
- isScrolling: import("@virtuoso.dev/urx").Stream<boolean>;
60
- isAtTop: import("@virtuoso.dev/urx").StatefulStream<boolean>;
61
- isAtBottom: import("@virtuoso.dev/urx").StatefulStream<boolean>;
62
- atBottomState: import("@virtuoso.dev/urx").Stream<import("./stateFlagsSystem").AtBottomState>;
63
- atTopStateChange: import("@virtuoso.dev/urx").Stream<boolean>;
64
- atBottomStateChange: import("@virtuoso.dev/urx").Stream<boolean>;
65
- listStateListener: import("@virtuoso.dev/urx").Stream<import("./stateFlagsSystem").ListBottomInfo>;
30
+ isScrolling: u.Stream<boolean>;
31
+ isAtTop: u.StatefulStream<boolean>;
32
+ isAtBottom: u.StatefulStream<boolean>;
33
+ atBottomState: u.Stream<import("./stateFlagsSystem").AtBottomState>;
34
+ atTopStateChange: u.Stream<boolean>;
35
+ atBottomStateChange: u.Stream<boolean>;
36
+ scrollDirection: u.StatefulStream<import("./stateFlagsSystem").ScrollDirection>;
37
+ atBottomThreshold: u.StatefulStream<number>;
38
+ scrollVelocity: u.StatefulStream<number>;
39
+ lastJumpDueToItemResize: u.StatefulStream<number>;
40
+ }>], ([{ scrollVelocity }]: [{
41
+ isScrolling: u.Stream<boolean>;
42
+ isAtTop: u.StatefulStream<boolean>;
43
+ isAtBottom: u.StatefulStream<boolean>;
44
+ atBottomState: u.Stream<import("./stateFlagsSystem").AtBottomState>;
45
+ atTopStateChange: u.Stream<boolean>;
46
+ atBottomStateChange: u.Stream<boolean>;
47
+ scrollDirection: u.StatefulStream<import("./stateFlagsSystem").ScrollDirection>;
48
+ atBottomThreshold: u.StatefulStream<number>;
49
+ scrollVelocity: u.StatefulStream<number>;
50
+ lastJumpDueToItemResize: u.StatefulStream<number>;
66
51
  }]) => {
67
- isSeeking: import("@virtuoso.dev/urx").StatefulStream<boolean>;
68
- scrollSeekConfiguration: import("@virtuoso.dev/urx").StatefulStream<false | ScrollSeekConfiguration | undefined>;
69
- scrollVelocity: import("@virtuoso.dev/urx").StatefulStream<number>;
70
- scrollSeekRangeChanged: import("@virtuoso.dev/urx").Stream<ListRange>;
52
+ isSeeking: u.StatefulStream<boolean>;
53
+ scrollSeekConfiguration: u.StatefulStream<false | ScrollSeekConfiguration | undefined>;
54
+ scrollVelocity: u.StatefulStream<number>;
55
+ scrollSeekRangeChanged: u.Stream<ListRange>;
71
56
  }>;
@@ -1,31 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- var urx_1 = require("@virtuoso.dev/urx");
5
- var domIOSystem_1 = require("./domIOSystem");
4
+ var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
6
5
  var stateFlagsSystem_1 = require("./stateFlagsSystem");
7
- exports.scrollSeekSystem = urx_1.system(function (_a) {
8
- var _b = tslib_1.__read(_a, 2), scrollTop = _b[0].scrollTop, isScrolling = _b[1].isScrolling;
9
- var scrollVelocity = urx_1.statefulStream(0);
10
- var isSeeking = urx_1.statefulStream(false);
11
- var rangeChanged = urx_1.stream();
12
- var scrollSeekConfiguration = urx_1.statefulStream(false);
13
- urx_1.connect(urx_1.pipe(isScrolling, urx_1.filter(function (value) { return !value; }), urx_1.mapTo(0)), scrollVelocity);
14
- urx_1.connect(urx_1.pipe(scrollTop, urx_1.throttleTime(100), urx_1.withLatestFrom(isScrolling), urx_1.filter(function (_a) {
15
- var _b = tslib_1.__read(_a, 2), isScrolling = _b[1];
16
- return !!isScrolling;
17
- }), urx_1.scan(function (_a, _b) {
18
- var _c = tslib_1.__read(_a, 2), prev = _c[1];
19
- var _d = tslib_1.__read(_b, 1), next = _d[0];
20
- return [prev, next];
21
- }, [0, 0]), urx_1.map(function (_a) {
22
- var _b = tslib_1.__read(_a, 2), prev = _b[0], next = _b[1];
23
- return next - prev;
24
- })), scrollVelocity);
25
- urx_1.connect(urx_1.pipe(scrollVelocity, urx_1.withLatestFrom(scrollSeekConfiguration, isSeeking, rangeChanged), urx_1.filter(function (_a) {
6
+ exports.scrollSeekSystem = u.system(function (_a) {
7
+ var _b = tslib_1.__read(_a, 1), scrollVelocity = _b[0].scrollVelocity;
8
+ var isSeeking = u.statefulStream(false);
9
+ var rangeChanged = u.stream();
10
+ var scrollSeekConfiguration = u.statefulStream(false);
11
+ u.connect(u.pipe(scrollVelocity, u.withLatestFrom(scrollSeekConfiguration, isSeeking, rangeChanged), u.filter(function (_a) {
26
12
  var _b = tslib_1.__read(_a, 2), config = _b[1];
27
13
  return !!config;
28
- }), urx_1.map(function (_a) {
14
+ }), u.map(function (_a) {
29
15
  var _b = tslib_1.__read(_a, 4), speed = _b[0], config = _b[1], isSeeking = _b[2], range = _b[3];
30
16
  var _c = config, exit = _c.exit, enter = _c.enter;
31
17
  if (isSeeking) {
@@ -37,8 +23,8 @@ exports.scrollSeekSystem = urx_1.system(function (_a) {
37
23
  return true;
38
24
  }
39
25
  return isSeeking;
40
- }), urx_1.distinctUntilChanged()), isSeeking);
41
- urx_1.subscribe(urx_1.pipe(urx_1.combineLatest(isSeeking, scrollVelocity, rangeChanged), urx_1.withLatestFrom(scrollSeekConfiguration)), function (_a) {
26
+ }), u.distinctUntilChanged()), isSeeking);
27
+ u.subscribe(u.pipe(u.combineLatest(isSeeking, scrollVelocity, rangeChanged), u.withLatestFrom(scrollSeekConfiguration)), function (_a) {
42
28
  var _b = tslib_1.__read(_a, 2), _c = tslib_1.__read(_b[0], 3), isSeeking = _c[0], velocity = _c[1], range = _c[2], config = _b[1];
43
29
  return isSeeking && config && config.change && config.change(velocity, range);
44
30
  });
@@ -48,4 +34,4 @@ exports.scrollSeekSystem = urx_1.system(function (_a) {
48
34
  scrollVelocity: scrollVelocity,
49
35
  scrollSeekRangeChanged: rangeChanged,
50
36
  };
51
- }, urx_1.tup(domIOSystem_1.domIOSystem, stateFlagsSystem_1.stateFlagsSystem), { singleton: true });
37
+ }, u.tup(stateFlagsSystem_1.stateFlagsSystem), { singleton: true });
@@ -1,8 +1,15 @@
1
1
  import * as u from '@virtuoso.dev/urx';
2
2
  import { IndexLocationWithAlign } from './interfaces';
3
+ import { LogLevel } from './loggerSystem';
3
4
  export declare type IndexLocation = number | IndexLocationWithAlign;
4
5
  export declare function normalizeIndexLocation(location: IndexLocation): Required<IndexLocationWithAlign>;
5
- export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<never[], () => {
6
+ export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSpec<never[], () => {
7
+ log: u.StatefulStream<import("./loggerSystem").Log>;
8
+ logLevel: u.StatefulStream<LogLevel>;
9
+ }>], ([{ log }]: [{
10
+ log: u.StatefulStream<import("./loggerSystem").Log>;
11
+ logLevel: u.StatefulStream<LogLevel>;
12
+ }]) => {
6
13
  data: u.StatefulStream<import("./sizeSystem").Data>;
7
14
  totalCount: u.Stream<number>;
8
15
  sizeRanges: u.Stream<import("./sizeSystem").SizeRange[]>;
@@ -10,25 +17,32 @@ export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<never[], ()
10
17
  defaultItemSize: u.StatefulStream<number | undefined>;
11
18
  fixedItemSize: u.StatefulStream<number | undefined>;
12
19
  unshiftWith: u.Stream<number>;
20
+ shiftWith: u.Stream<number>;
21
+ shiftWithOffset: u.Stream<number>;
13
22
  beforeUnshiftWith: u.Stream<number>;
14
23
  firstItemIndex: u.StatefulStream<number>;
15
24
  sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
16
25
  listRefresh: u.Stream<boolean>;
26
+ statefulTotalCount: u.StatefulStream<number>;
17
27
  trackItemSizes: u.StatefulStream<boolean>;
18
28
  itemSize: u.StatefulStream<import("./sizeSystem").SizeFunction>;
19
29
  }>, u.SystemSpec<never[], () => {
30
+ scrollContainerState: u.Stream<[number, number]>;
20
31
  scrollTop: u.Stream<number>;
21
32
  viewportHeight: u.Stream<number>;
22
33
  headerHeight: u.StatefulStream<number>;
23
34
  footerHeight: u.StatefulStream<number>;
35
+ scrollHeight: u.Stream<number>;
24
36
  smoothScrollTargetReached: u.Stream<true>;
25
37
  scrollTo: u.Stream<ScrollToOptions>;
26
38
  scrollBy: u.Stream<ScrollToOptions>;
27
- scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
28
39
  statefulScrollTop: u.StatefulStream<number>;
29
40
  deviation: u.StatefulStream<number>;
30
41
  scrollingInProgress: u.StatefulStream<boolean>;
31
- }>], ([{ sizes, totalCount, listRefresh }, { scrollingInProgress, viewportHeight, scrollTo, smoothScrollTargetReached, headerHeight, footerHeight, },]: [{
42
+ }>, u.SystemSpec<never[], () => {
43
+ log: u.StatefulStream<import("./loggerSystem").Log>;
44
+ logLevel: u.StatefulStream<LogLevel>;
45
+ }>], ([{ sizes, totalCount, listRefresh }, { scrollingInProgress, viewportHeight, scrollTo, smoothScrollTargetReached, headerHeight, footerHeight, }, { log },]: [{
32
46
  data: u.StatefulStream<import("./sizeSystem").Data>;
33
47
  totalCount: u.Stream<number>;
34
48
  sizeRanges: u.Stream<import("./sizeSystem").SizeRange[]>;
@@ -36,25 +50,32 @@ export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<never[], ()
36
50
  defaultItemSize: u.StatefulStream<number | undefined>;
37
51
  fixedItemSize: u.StatefulStream<number | undefined>;
38
52
  unshiftWith: u.Stream<number>;
53
+ shiftWith: u.Stream<number>;
54
+ shiftWithOffset: u.Stream<number>;
39
55
  beforeUnshiftWith: u.Stream<number>;
40
56
  firstItemIndex: u.StatefulStream<number>;
41
57
  sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
42
58
  listRefresh: u.Stream<boolean>;
59
+ statefulTotalCount: u.StatefulStream<number>;
43
60
  trackItemSizes: u.StatefulStream<boolean>;
44
61
  itemSize: u.StatefulStream<import("./sizeSystem").SizeFunction>;
45
62
  }, {
63
+ scrollContainerState: u.Stream<[number, number]>;
46
64
  scrollTop: u.Stream<number>;
47
65
  viewportHeight: u.Stream<number>;
48
66
  headerHeight: u.StatefulStream<number>;
49
67
  footerHeight: u.StatefulStream<number>;
68
+ scrollHeight: u.Stream<number>;
50
69
  smoothScrollTargetReached: u.Stream<true>;
51
70
  scrollTo: u.Stream<ScrollToOptions>;
52
71
  scrollBy: u.Stream<ScrollToOptions>;
53
- scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
54
72
  statefulScrollTop: u.StatefulStream<number>;
55
73
  deviation: u.StatefulStream<number>;
56
74
  scrollingInProgress: u.StatefulStream<boolean>;
75
+ }, {
76
+ log: u.StatefulStream<import("./loggerSystem").Log>;
77
+ logLevel: u.StatefulStream<LogLevel>;
57
78
  }]) => {
58
- scrollToIndex: u.Stream<IndexLocation>;
79
+ scrollToIndex: u.Stream<number | IndexLocationWithAlign>;
59
80
  topListHeight: u.StatefulStream<number>;
60
81
  }>;
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
5
5
  var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
6
6
  var AATree_1 = require("./AATree");
7
7
  var domIOSystem_1 = require("./domIOSystem");
8
+ var loggerSystem_1 = require("./loggerSystem");
8
9
  var sizeSystem_1 = require("./sizeSystem");
9
10
  var SUPPORTS_SCROLL_TO_OPTIONS = typeof document !== 'undefined' &&
10
11
  'scrollBehavior' in document.documentElement.style;
@@ -23,13 +24,13 @@ function normalizeIndexLocation(location) {
23
24
  }
24
25
  exports.normalizeIndexLocation = normalizeIndexLocation;
25
26
  exports.scrollToIndexSystem = u.system(function (_a) {
26
- var _b = tslib_1.__read(_a, 2), _c = _b[0], sizes = _c.sizes, totalCount = _c.totalCount, listRefresh = _c.listRefresh, _d = _b[1], scrollingInProgress = _d.scrollingInProgress, viewportHeight = _d.viewportHeight, scrollTo = _d.scrollTo, smoothScrollTargetReached = _d.smoothScrollTargetReached, headerHeight = _d.headerHeight, footerHeight = _d.footerHeight;
27
+ var _b = tslib_1.__read(_a, 3), _c = _b[0], sizes = _c.sizes, totalCount = _c.totalCount, listRefresh = _c.listRefresh, _d = _b[1], scrollingInProgress = _d.scrollingInProgress, viewportHeight = _d.viewportHeight, scrollTo = _d.scrollTo, smoothScrollTargetReached = _d.smoothScrollTargetReached, headerHeight = _d.headerHeight, footerHeight = _d.footerHeight, log = _b[2].log;
27
28
  var scrollToIndex = u.stream();
28
29
  var topListHeight = u.statefulStream(0);
29
30
  var unsubscribeNextListRefresh = null;
30
31
  var cleartTimeoutRef = null;
31
32
  var unsubscribeListRefresh = null;
32
- var cleanup = function () {
33
+ function cleanup() {
33
34
  if (unsubscribeNextListRefresh) {
34
35
  unsubscribeNextListRefresh();
35
36
  unsubscribeNextListRefresh = null;
@@ -43,28 +44,33 @@ exports.scrollToIndexSystem = u.system(function (_a) {
43
44
  cleartTimeoutRef = null;
44
45
  }
45
46
  u.publish(scrollingInProgress, false);
46
- };
47
- u.connect(u.pipe(scrollToIndex, u.withLatestFrom(sizes, viewportHeight, totalCount, topListHeight, headerHeight, footerHeight), u.map(function (_a) {
48
- var _b = tslib_1.__read(_a, 7), location = _b[0], sizes = _b[1], viewportHeight = _b[2], totalCount = _b[3], topListHeight = _b[4], headerHeight = _b[5], footerHeight = _b[6];
47
+ }
48
+ u.connect(u.pipe(scrollToIndex, u.withLatestFrom(sizes, viewportHeight, totalCount, topListHeight, headerHeight, footerHeight, log), u.map(function (_a) {
49
+ var _b = tslib_1.__read(_a, 8), location = _b[0], sizes = _b[1], viewportHeight = _b[2], totalCount = _b[3], topListHeight = _b[4], headerHeight = _b[5], footerHeight = _b[6], log = _b[7];
49
50
  var normalLocation = normalizeIndexLocation(location);
50
51
  var align = normalLocation.align, behavior = normalLocation.behavior, offset = normalLocation.offset;
51
52
  var lastIndex = totalCount - 1;
52
53
  var index = normalLocation.index;
54
+ if (index === 'LAST') {
55
+ index = lastIndex;
56
+ }
53
57
  index = sizeSystem_1.originalIndexFromItemIndex(index, sizes);
54
58
  index = Math.max(0, index, Math.min(lastIndex, index));
55
59
  var top = sizeSystem_1.offsetOf(index, sizes.offsetTree) + headerHeight;
56
60
  if (align === 'end') {
57
- top = Math.round(top -
58
- viewportHeight +
59
- AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1]);
61
+ top =
62
+ top -
63
+ viewportHeight +
64
+ AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1];
60
65
  if (index === lastIndex) {
61
66
  top += footerHeight;
62
67
  }
63
68
  }
64
69
  else if (align === 'center') {
65
- top = Math.round(top -
66
- viewportHeight / 2 +
67
- AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1] / 2);
70
+ top =
71
+ top -
72
+ viewportHeight / 2 +
73
+ AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1] / 2;
68
74
  }
69
75
  else {
70
76
  top -= topListHeight;
@@ -75,8 +81,12 @@ exports.scrollToIndexSystem = u.system(function (_a) {
75
81
  var retry = function (listChanged) {
76
82
  cleanup();
77
83
  if (listChanged) {
84
+ log('retrying to scroll to', { location: location }, loggerSystem_1.LogLevel.DEBUG);
78
85
  u.publish(scrollToIndex, location);
79
86
  }
87
+ else {
88
+ log('list did not change, scroll successful', {}, loggerSystem_1.LogLevel.DEBUG);
89
+ }
80
90
  };
81
91
  cleanup();
82
92
  if (behavior === 'smooth') {
@@ -89,7 +99,7 @@ exports.scrollToIndexSystem = u.system(function (_a) {
89
99
  });
90
100
  }
91
101
  else {
92
- unsubscribeNextListRefresh = u.handleNext(listRefresh, retry);
102
+ unsubscribeNextListRefresh = u.handleNext(u.pipe(listRefresh, watchChangesFor(50)), retry);
93
103
  }
94
104
  // if the scroll jump is too small, the list won't get rerendered.
95
105
  // clean this listener
@@ -97,10 +107,24 @@ exports.scrollToIndexSystem = u.system(function (_a) {
97
107
  cleanup();
98
108
  }, 1200);
99
109
  u.publish(scrollingInProgress, true);
110
+ log('scrolling from index to', { index: index, top: top, behavior: behavior }, loggerSystem_1.LogLevel.DEBUG);
100
111
  return { top: top, behavior: behavior };
101
112
  })), scrollTo);
102
113
  return {
103
114
  scrollToIndex: scrollToIndex,
104
115
  topListHeight: topListHeight,
105
116
  };
106
- }, u.tup(sizeSystem_1.sizeSystem, domIOSystem_1.domIOSystem), { singleton: true });
117
+ }, u.tup(sizeSystem_1.sizeSystem, domIOSystem_1.domIOSystem, loggerSystem_1.loggerSystem), { singleton: true });
118
+ function watchChangesFor(limit) {
119
+ return function (done) {
120
+ var timeoutRef = setTimeout(function () {
121
+ done(false);
122
+ }, limit);
123
+ return function (value) {
124
+ if (value) {
125
+ done(true);
126
+ clearTimeout(timeoutRef);
127
+ }
128
+ };
129
+ };
130
+ }
@@ -1,5 +1,5 @@
1
1
  import * as u from '@virtuoso.dev/urx';
2
- import { DOWN, ScrollDirection, UP } from './domIOSystem';
2
+ import { DOWN, ScrollDirection, UP } from './stateFlagsSystem';
3
3
  export declare type NumberTuple = [number, number];
4
4
  export declare type Overscan = number | {
5
5
  main: number;
@@ -9,29 +9,34 @@ export declare const TOP: "top";
9
9
  export declare const BOTTOM: "bottom";
10
10
  export declare const NONE: "none";
11
11
  export declare type ListEnd = typeof TOP | typeof BOTTOM;
12
+ export declare type ViewportIncrease = number | {
13
+ [k in ListEnd]?: number;
14
+ };
12
15
  export declare type ChangeDirection = typeof UP | typeof DOWN | typeof NONE;
13
- export declare const getOverscan: (overscan: Overscan, end: "bottom" | "top", direction: ScrollDirection) => number;
16
+ export declare function getOverscan(overscan: Overscan, end: ListEnd, direction: ScrollDirection): number;
14
17
  export declare const sizeRangeSystem: u.SystemSpec<[u.SystemSpec<never[], () => {
18
+ scrollContainerState: u.Stream<[number, number]>;
15
19
  scrollTop: u.Stream<number>;
16
20
  viewportHeight: u.Stream<number>;
17
21
  headerHeight: u.StatefulStream<number>;
18
22
  footerHeight: u.StatefulStream<number>;
23
+ scrollHeight: u.Stream<number>;
19
24
  smoothScrollTargetReached: u.Stream<true>;
20
25
  scrollTo: u.Stream<ScrollToOptions>;
21
26
  scrollBy: u.Stream<ScrollToOptions>;
22
- scrollDirection: u.StatefulStream<ScrollDirection>;
23
27
  statefulScrollTop: u.StatefulStream<number>;
24
28
  deviation: u.StatefulStream<number>;
25
29
  scrollingInProgress: u.StatefulStream<boolean>;
26
30
  }>], ([{ scrollTop, viewportHeight, deviation, headerHeight }]: [{
31
+ scrollContainerState: u.Stream<[number, number]>;
27
32
  scrollTop: u.Stream<number>;
28
33
  viewportHeight: u.Stream<number>;
29
34
  headerHeight: u.StatefulStream<number>;
30
35
  footerHeight: u.StatefulStream<number>;
36
+ scrollHeight: u.Stream<number>;
31
37
  smoothScrollTargetReached: u.Stream<true>;
32
38
  scrollTo: u.Stream<ScrollToOptions>;
33
39
  scrollBy: u.Stream<ScrollToOptions>;
34
- scrollDirection: u.StatefulStream<ScrollDirection>;
35
40
  statefulScrollTop: u.StatefulStream<number>;
36
41
  deviation: u.StatefulStream<number>;
37
42
  scrollingInProgress: u.StatefulStream<boolean>;
@@ -39,5 +44,7 @@ export declare const sizeRangeSystem: u.SystemSpec<[u.SystemSpec<never[], () =>
39
44
  listBoundary: u.Stream<NumberTuple>;
40
45
  overscan: u.StatefulStream<Overscan>;
41
46
  topListHeight: u.StatefulStream<number>;
47
+ fixedHeaderHeight: u.StatefulStream<number>;
48
+ increaseViewportBy: u.StatefulStream<ViewportIncrease>;
42
49
  visibleRange: u.StatefulStream<NumberTuple>;
43
50
  }>;
@@ -4,44 +4,71 @@ var tslib_1 = require("tslib");
4
4
  var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
5
5
  var comparators_1 = require("./comparators");
6
6
  var domIOSystem_1 = require("./domIOSystem");
7
+ var stateFlagsSystem_1 = require("./stateFlagsSystem");
7
8
  exports.TOP = 'top';
8
9
  exports.BOTTOM = 'bottom';
9
10
  exports.NONE = 'none';
10
- exports.getOverscan = function (overscan, end, direction) {
11
+ function getOverscan(overscan, end, direction) {
11
12
  if (typeof overscan === 'number') {
12
- return (direction === domIOSystem_1.UP && end === exports.TOP) ||
13
- (direction === domIOSystem_1.DOWN && end === exports.BOTTOM)
13
+ return (direction === stateFlagsSystem_1.UP && end === exports.TOP) ||
14
+ (direction === stateFlagsSystem_1.DOWN && end === exports.BOTTOM)
14
15
  ? overscan
15
16
  : 0;
16
17
  }
17
- if (direction === domIOSystem_1.UP) {
18
+ if (direction === stateFlagsSystem_1.UP) {
18
19
  return end === exports.TOP ? overscan.main : overscan.reverse;
19
20
  }
20
21
  return end === exports.BOTTOM ? overscan.main : overscan.reverse;
21
- };
22
+ }
23
+ exports.getOverscan = getOverscan;
24
+ function getViewportIncrease(value, end) {
25
+ return typeof value === 'number' ? value : value[end] || 0;
26
+ }
22
27
  exports.sizeRangeSystem = u.system(function (_a) {
23
28
  var _b = tslib_1.__read(_a, 1), _c = _b[0], scrollTop = _c.scrollTop, viewportHeight = _c.viewportHeight, deviation = _c.deviation, headerHeight = _c.headerHeight;
24
29
  var listBoundary = u.stream();
25
30
  var topListHeight = u.statefulStream(0);
31
+ var fixedHeaderHeight = u.statefulStream(0);
32
+ var increaseViewportBy = u.statefulStream(0);
26
33
  var overscan = u.statefulStream(0);
27
- var visibleRange = u.statefulStreamFromEmitter(u.pipe(u.combineLatest(u.duc(scrollTop), u.duc(viewportHeight), u.duc(headerHeight), u.duc(listBoundary, comparators_1.tupleComparator), u.duc(overscan), u.duc(topListHeight), u.duc(deviation)), u.map(function (_a) {
28
- var _b = tslib_1.__read(_a, 7), scrollTop = _b[0], viewportHeight = _b[1], headerHeight = _b[2],
34
+ var visibleRange = u.statefulStreamFromEmitter(u.pipe(u.combineLatest(u.duc(scrollTop), u.duc(viewportHeight), u.duc(headerHeight), u.duc(listBoundary, comparators_1.tupleComparator), u.duc(overscan), u.duc(topListHeight), u.duc(fixedHeaderHeight), u.duc(deviation), u.duc(increaseViewportBy)), u.map(function (_a) {
35
+ var _b = tslib_1.__read(_a, 9), scrollTop = _b[0], viewportHeight = _b[1], headerHeight = _b[2],
29
36
  // @ts-ignore
30
- _c = tslib_1.__read(_b[3], 2), listTop = _c[0], listBottom = _c[1], overscan = _b[4], topListHeight = _b[5], deviation = _b[6];
31
- var top = scrollTop - headerHeight - deviation;
37
+ _c = tslib_1.__read(_b[3], 2), listTop = _c[0], listBottom = _c[1], overscan = _b[4], topListHeight = _b[5], fixedHeaderHeight = _b[6], deviation = _b[7], increaseViewportBy = _b[8];
38
+ var top = scrollTop - deviation;
39
+ var stickyHeaderHeight = topListHeight + fixedHeaderHeight;
40
+ var headerVisible = Math.max(headerHeight - top, 0);
32
41
  var direction = exports.NONE;
42
+ var topViewportAddition = getViewportIncrease(increaseViewportBy, exports.TOP);
43
+ var bottomViewportAddition = getViewportIncrease(increaseViewportBy, exports.BOTTOM);
33
44
  listTop -= deviation;
45
+ listTop += headerHeight + fixedHeaderHeight;
46
+ listBottom += headerHeight + fixedHeaderHeight;
34
47
  listBottom -= deviation;
35
- if (listTop > scrollTop + topListHeight) {
36
- direction = domIOSystem_1.UP;
48
+ // console.log({ listTop, scrollTop, stickyHeaderHeight, topViewportAddition })
49
+ if (listTop >
50
+ scrollTop + stickyHeaderHeight - topViewportAddition) {
51
+ direction = stateFlagsSystem_1.UP;
37
52
  }
38
- if (listBottom < scrollTop + viewportHeight) {
39
- direction = domIOSystem_1.DOWN;
53
+ if (listBottom <
54
+ scrollTop -
55
+ headerVisible +
56
+ viewportHeight +
57
+ bottomViewportAddition) {
58
+ direction = stateFlagsSystem_1.DOWN;
40
59
  }
41
60
  if (direction !== exports.NONE) {
42
61
  return [
43
- Math.max(top - exports.getOverscan(overscan, exports.TOP, direction), 0),
44
- top + viewportHeight + exports.getOverscan(overscan, exports.BOTTOM, direction),
62
+ Math.max(top -
63
+ headerHeight -
64
+ getOverscan(overscan, exports.TOP, direction) -
65
+ topViewportAddition, 0),
66
+ top -
67
+ headerVisible -
68
+ fixedHeaderHeight +
69
+ viewportHeight +
70
+ getOverscan(overscan, exports.BOTTOM, direction) +
71
+ bottomViewportAddition,
45
72
  ];
46
73
  }
47
74
  return null;
@@ -51,6 +78,8 @@ exports.sizeRangeSystem = u.system(function (_a) {
51
78
  listBoundary: listBoundary,
52
79
  overscan: overscan,
53
80
  topListHeight: topListHeight,
81
+ fixedHeaderHeight: fixedHeaderHeight,
82
+ increaseViewportBy: increaseViewportBy,
54
83
  // output
55
84
  visibleRange: visibleRange,
56
85
  };
@@ -1,5 +1,6 @@
1
1
  import * as u from '@virtuoso.dev/urx';
2
2
  import { AANode } from './AATree';
3
+ import { Log, LogLevel } from './loggerSystem';
3
4
  export interface SizeRange {
4
5
  startIndex: number;
5
6
  endIndex: number;
@@ -33,13 +34,19 @@ export declare function rangesWithinOffsets(tree: Array<OffsetPoint>, startOffse
33
34
  index: number;
34
35
  };
35
36
  }>;
36
- export declare function sizeStateReducer(state: SizeState, [ranges, groupIndices]: [SizeRange[], number[]]): SizeState;
37
+ export declare function sizeStateReducer(state: SizeState, [ranges, groupIndices, log]: [SizeRange[], number[], Log]): SizeState;
37
38
  export declare function offsetOf(index: number, tree: Array<OffsetPoint>): number;
38
39
  export declare function originalIndexFromItemIndex(itemIndex: number, sizes: SizeState): number;
39
40
  export declare function hasGroups(sizes: SizeState): boolean;
40
41
  /** Calculates the height of `el`, which will be the `Item` element in the DOM. */
41
42
  export declare type SizeFunction = (el: HTMLElement, field: 'offsetHeight' | 'offsetWidth') => number;
42
- export declare const sizeSystem: u.SystemSpec<never[], () => {
43
+ export declare const sizeSystem: u.SystemSpec<[u.SystemSpec<never[], () => {
44
+ log: u.StatefulStream<Log>;
45
+ logLevel: u.StatefulStream<LogLevel>;
46
+ }>], ([{ log }]: [{
47
+ log: u.StatefulStream<Log>;
48
+ logLevel: u.StatefulStream<LogLevel>;
49
+ }]) => {
43
50
  data: u.StatefulStream<Data>;
44
51
  totalCount: u.Stream<number>;
45
52
  sizeRanges: u.Stream<SizeRange[]>;
@@ -47,10 +54,13 @@ export declare const sizeSystem: u.SystemSpec<never[], () => {
47
54
  defaultItemSize: u.StatefulStream<number | undefined>;
48
55
  fixedItemSize: u.StatefulStream<number | undefined>;
49
56
  unshiftWith: u.Stream<number>;
57
+ shiftWith: u.Stream<number>;
58
+ shiftWithOffset: u.Stream<number>;
50
59
  beforeUnshiftWith: u.Stream<number>;
51
60
  firstItemIndex: u.StatefulStream<number>;
52
61
  sizes: u.StatefulStream<SizeState>;
53
62
  listRefresh: u.Stream<boolean>;
63
+ statefulTotalCount: u.StatefulStream<number>;
54
64
  trackItemSizes: u.StatefulStream<boolean>;
55
65
  itemSize: u.StatefulStream<SizeFunction>;
56
66
  }>;