@fern-api/fdr-sdk 1.2.56-a6947428a1 → 1.2.57-4cf0b0d54d

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.
@@ -1908,17 +1908,31 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1908
1908
  const sectionChildren = isUnboundedSkipSlugSibling && !hasDepthMarkedChildren ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
1909
1909
  node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1910
1910
  }
1911
- const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
1912
1911
  annotated.push({
1913
1912
  node,
1914
- pos: isSharedSection ? void 0 : metaNum(s.seg.metadata, "childIndex"),
1913
+ pos: metaNum(s.seg.metadata, "childIndex"),
1915
1914
  isLeaf: false
1916
1915
  });
1917
1916
  }
1918
1917
  }
1919
1918
  const hasLeafPos = annotated.some((a) => a.isLeaf && a.pos != null);
1920
1919
  const hasSegmentPos = annotated.some((a) => !a.isLeaf && a.pos != null);
1921
- const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, seq })).sort(
1920
+ const inferredPos = annotated.map((a) => a.pos);
1921
+ if (hasLeafPos && hasSegmentPos) {
1922
+ let nextSegPos;
1923
+ for (let i = annotated.length - 1; i >= 0; i--) {
1924
+ const a = annotated[i];
1925
+ if (a == null || a.isLeaf) {
1926
+ continue;
1927
+ }
1928
+ if (a.pos != null) {
1929
+ nextSegPos = a.pos;
1930
+ } else if (nextSegPos != null) {
1931
+ inferredPos[i] = nextSegPos - 0.5;
1932
+ }
1933
+ }
1934
+ }
1935
+ const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, pos: inferredPos[seq], seq })).sort(
1922
1936
  (x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || // When positions tie, prefer structural nodes (sections) over
1923
1937
  // leaves (pages). This handles stale tabRoot nav entries whose
1924
1938
  // displaySortOrder wasn't updated due to content-addressing
@@ -1945,7 +1959,7 @@ function groupSidebarRootChildren(ctx, children) {
1945
1959
  if (child.type === "apiReference" || child.type === "varianted") {
1946
1960
  flushRun();
1947
1961
  out.push(child);
1948
- } else if (child.type === "section" && !child.collapsible) {
1962
+ } else if (child.type === "section" && child.collapsed == null && !child.collapsible) {
1949
1963
  flushRun();
1950
1964
  out.push(child);
1951
1965
  } else {