@stainless-api/docs-ui 0.1.0-beta.76 → 0.1.0-beta.77

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.
@@ -54,7 +54,7 @@ function GroupEntry({ entry, entryToIndex }) {
54
54
  children: labelWithIcon
55
55
  }), /* @__PURE__ */ jsxs(GroupElement, {
56
56
  className: style_default.SidebarExpander,
57
- ...collapsible ? { open: flattenStlSidebar(entry.entries).some((i) => i.isCurrent) || !entry.collapsed } : {},
57
+ ...collapsible ? { open: !entry.collapsed || isAnyItemCurrent(entry.entries) } : {},
58
58
  children: [
59
59
  /* @__PURE__ */ jsxs(GroupLabelElement, {
60
60
  className: style_default.ExpanderSummary,
@@ -99,8 +99,15 @@ function computeEntryToIndex(allEntries) {
99
99
  addEntries(allEntries);
100
100
  return entryToIndex;
101
101
  }
102
- function flattenStlSidebar(sidebar) {
103
- return sidebar.flatMap((entry) => entry.type === "group" ? flattenStlSidebar(entry.entries) : entry);
102
+ function* walkSidebar(entries) {
103
+ for (const entry of entries) {
104
+ yield entry;
105
+ if (entry.type === "group") yield* walkSidebar(entry.entries);
106
+ }
107
+ }
108
+ function isAnyItemCurrent(entries) {
109
+ for (const e of walkSidebar(entries)) if (e.isCurrent) return true;
110
+ return false;
104
111
  }
105
112
 
106
113
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stainless-api/docs-ui",
3
3
  "private": false,
4
- "version": "0.1.0-beta.76",
4
+ "version": "0.1.0-beta.77",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },