@jsenv/navi 0.29.114 → 0.29.115

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.
@@ -60586,6 +60586,7 @@ const ListUI = props => {
60586
60586
  overflow,
60587
60587
  overflowX,
60588
60588
  overflowY,
60589
+ virtual,
60589
60590
  ...rest
60590
60591
  } = props;
60591
60592
  // Accept a string (e.g. from an HTML attribute: renderBudget="50") the
@@ -60636,20 +60637,8 @@ const ListUI = props => {
60636
60637
  onListVisibleItemsChange?.(tracker.visibleItemsSignal.peek());
60637
60638
  }
60638
60639
  });
60639
- // A new pass every time the list's children are walked: they are about to
60640
- // say again, in order, which rows of the collection they stand for. Given
60641
- // back the very vnodes it already holds, preact skips them — the list
60642
- // re-rendered on its own and nothing is said again, so nothing is asked
60643
- // again either (see openPass).
60644
- const virtualRef = useRef(null);
60645
- if (!virtualRef.current) {
60646
- virtualRef.current = createListVirtual();
60647
- }
60648
- const virtual = virtualRef.current;
60649
- const childrenPreviousRef = useRef(undefined);
60650
- const childrenWalked = childrenPreviousRef.current !== children;
60651
- childrenPreviousRef.current = children;
60652
- virtual.openPass(renderBudget, scrolled ?? defaultScrolled, childrenWalked);
60640
+ virtual.renderBudget = renderBudget;
60641
+ virtual.scrolled = scrolled ?? defaultScrolled;
60653
60642
  const {
60654
60643
  virtualItemSizeSignal,
60655
60644
  renderWindow,
@@ -60865,6 +60854,24 @@ const ListFirstResolver = props => {
60865
60854
  props.ref = props.ref || refDefault;
60866
60855
  const idDefault = useId();
60867
60856
  props.id = props.id || idDefault;
60857
+ // A new pass every time the caller walks the children: they are about to
60858
+ // say again, in order, which rows of the collection they stand for. Decided
60859
+ // here, on the children as the caller gave them. Further down the chain a
60860
+ // resolver re-rendering on its own hands the rows down inside a vnode of its
60861
+ // own (ListSelectable wraps them in the group's contexts) — but the rows are
60862
+ // the very vnodes preact already holds, and it skips them: nothing is said
60863
+ // again, so nothing may be asked again either (see createListVirtual).
60864
+ const virtualRef = useRef(null);
60865
+ if (!virtualRef.current) {
60866
+ virtualRef.current = createListVirtual();
60867
+ }
60868
+ const virtual = virtualRef.current;
60869
+ const childrenPreviousRef = useRef(undefined);
60870
+ if (childrenPreviousRef.current !== props.children) {
60871
+ childrenPreviousRef.current = props.children;
60872
+ virtual.openPass();
60873
+ }
60874
+ props.virtual = virtual;
60868
60875
  return jsx(Next, {
60869
60876
  ...props
60870
60877
  });
@@ -62878,19 +62885,13 @@ const ListItemUI = props => {
62878
62885
  const listItemVnode = jsx(ListItemReal, {
62879
62886
  ...props
62880
62887
  });
62881
- // For separator decision, we need to know "am I the first visible item?".
62882
- // We deliberately do NOT use tracker's visibleIndex here because, during a
62883
- // reorder render pass (e.g. items resorted by search score), other items
62884
- // still have stale keyToExplicitOrder values the binary search reads
62885
- // those stale values and computes wrong indices. The result is that no
62886
- // item gets visibleIndex === 0 and a spurious <hr> appears at the top.
62887
- //
62888
- // Instead we use the parent-provided index, which is race-free:
62889
- // - global list: props.index === 0 means "first by explicit order"
62890
- // (parent passes sequential indices starting at 0; filtered items
62891
- // are already pushed to the end by useSearchText)
62892
- // - inside a group: each group has its own item tracker and group
62893
- // items don't reorder, so groupVisibleIndex is reliable
62888
+ // "Am I the first visible item?" is answered by the place the list handed
62889
+ // out (virtual.take above), not by the tracker's visibleIndex: during a
62890
+ // reorder render pass (items resorted by search score) the other items still
62891
+ // carry stale keyToExplicitOrder values, the binary search reads them, no
62892
+ // item comes out at 0 and a spurious separator appears at the top. Inside a
62893
+ // group, each group has its own tracker and its items do not reorder, so
62894
+ // groupVisibleIndex is reliable.
62894
62895
  const isFirstInList = groupVisibleIndex === null ? index === 0 : groupVisibleIndex === 0;
62895
62896
  if (!separator || isFirstInList) {
62896
62897
  return listItemVnode;
@@ -63204,9 +63205,10 @@ List.Item = ListItem;
63204
63205
  // A child knows how many rows it stands for but not what was declared before
63205
63206
  // it, so the list hands out the places as its children render — in order, which
63206
63207
  // is the only thing needed to place them. A child re-rendering ON ITS OWN (its
63207
- // own state changed, the list did not render) keeps the place it was given:
63208
- // nothing before it moved. Hence the pass — only a render of the list itself
63209
- // opens a new one, and within a pass a child takes its place exactly once.
63208
+ // own state changed, the list was not given its children again) keeps the
63209
+ // place it was given: nothing before it moved. Hence the pass — only the
63210
+ // caller walking the children again opens a new one (see ListFirstResolver),
63211
+ // and within a pass a child takes its place exactly once.
63210
63212
  const createListVirtual = () => {
63211
63213
  const totalSignal = signal(0);
63212
63214
  // Bumped whenever a run takes in rows. The list itself has to hear about it:
@@ -63242,22 +63244,12 @@ const createListVirtual = () => {
63242
63244
  horizontal: false,
63243
63245
  virtualItemSizeSignal: null,
63244
63246
  renderSkeleton: undefined,
63245
- openPass: (renderBudget, scrolled, childrenWalked) => {
63246
- virtual.renderBudget = renderBudget;
63247
- virtual.scrolled = scrolled;
63248
- // Places are handed out again only when the children are actually walked
63249
- // again. A list re-rendering on its own the render window moved, its
63250
- // scroller resolved — hands preact the very children vnodes it already
63251
- // holds, and preact skips them: nobody says where they sit, so nobody
63252
- // may lose where they sat. Reopening the pass there would empty the
63253
- // places without anyone refilling them, and the next row to render on
63254
- // its own (an item being selected, a run following the window) would be
63255
- // handed the first place — drawing itself as the top of the list, its
63256
- // separator gone, and the one after it wearing a separator it should not
63257
- // have.
63258
- if (!childrenWalked) {
63259
- return;
63260
- }
63247
+ // Reopening the pass when the rows are not about to render again would
63248
+ // empty the places without anyone refilling them: the next row to render
63249
+ // on its own (an item being selected, a run following the window) would be
63250
+ // handed the first place drawing itself as the top of the list, its
63251
+ // separator gone, and the one after it wearing a separator it should not.
63252
+ openPass: () => {
63261
63253
  passId++;
63262
63254
  nextIndex = 0;
63263
63255
  },