@protobase/ui 0.55.0 → 0.55.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.
@@ -46,7 +46,7 @@ const VirtualCards = ({ source, label, initialIndex, onScrollIndex, minHeight, c
46
46
  if (changed) scroll.scrollTo(scroll.top);
47
47
  anchor.current = {
48
48
  layout,
49
- top: scroll.top
49
+ top: scroll.started() ? scroll.top : 0
50
50
  };
51
51
  });
52
52
  const range = recordRange(scroll.first, scroll.last, columns, total);
@@ -18,7 +18,8 @@ const viewRows = (view, total, rowHeight) => {
18
18
  * scrolling ancestor, or the page. Only the rows in view, and `overscan` more on each side, are drawn: `ref` goes on the
19
19
  * list's element, `geometry.contentHeight` tall, and each drawn row sits at `offset` from its top. Nothing listens for
20
20
  * wheel or touch: the list follows the scroll position, and draws again only when other rows come into view.
21
- * `first` and `last` are the indexes of the drawn rows, overscan included.
21
+ * `first` and `last` are the indexes of the drawn rows, overscan included; `started` says whether the list has started
22
+ * at `initialIndex`, read after the list's layout effects.
22
23
  */
23
24
  const useVirtualRows = ({ total, rowHeight, initialIndex, inset = 0, settle, ready = true, onScroll }) => {
24
25
  const ref = useRef(null);
@@ -117,6 +118,7 @@ const useVirtualRows = ({ total, rowHeight, initialIndex, inset = 0, settle, rea
117
118
  scroller.current.scrollTop += scrollFromTop(geometry, top) - current.position;
118
119
  measure();
119
120
  }, [read, measure]);
121
+ const started = useCallback(() => !start.current.pending, []);
120
122
  const drawn = viewRows(view, total, rowHeight);
121
123
  const top = settle ? settle(drawn.top) : drawn.top;
122
124
  const { first, last } = settle ? rowsInView(total, top, rowHeight, view.height, overscan) : drawn;
@@ -132,7 +134,8 @@ const useVirtualRows = ({ total, rowHeight, initialIndex, inset = 0, settle, rea
132
134
  rows,
133
135
  first,
134
136
  last,
135
- scrollTo
137
+ scrollTo,
138
+ started
136
139
  };
137
140
  };
138
141
  //#endregion
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.55.0";
2
+ var version = "0.55.1";
3
3
  var protobase = { "pluginApi": 1 };
4
4
  //#endregion
5
5
  export { protobase, version };