clean-jsdoc-theme 5.0.8 → 5.1.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.
@@ -83,6 +83,13 @@ interface JSDocOpts {
83
83
  * parent); a prefix with a single entry is left flat. Off by default.
84
84
  */
85
85
  clubSidebarItems?: unknown;
86
+ /**
87
+ * Which top-level sidebar sections collapse (`jsdoc.json`
88
+ * `"opts": { "collapsibleSidebarSections": true | ["Classes","Namespaces"] }`).
89
+ * `true`/absent → all; `false` → none; array → only those exact labels
90
+ * (case-sensitive). Unmatched labels warn. See utils `resolveCollapsibleSections`.
91
+ */
92
+ collapsibleSidebarSections?: unknown;
86
93
  /**
87
94
  * Custom prompt for the copy-page button's "Open in ChatGPT/Claude/Perplexity"
88
95
  * actions (`jsdoc.json` `"opts": { "aiPrompt": "…" }`). `{siteName}`, `{url}`,
package/dist/publish.d.ts CHANGED
@@ -83,6 +83,13 @@ interface JSDocOpts {
83
83
  * parent); a prefix with a single entry is left flat. Off by default.
84
84
  */
85
85
  clubSidebarItems?: unknown;
86
+ /**
87
+ * Which top-level sidebar sections collapse (`jsdoc.json`
88
+ * `"opts": { "collapsibleSidebarSections": true | ["Classes","Namespaces"] }`).
89
+ * `true`/absent → all; `false` → none; array → only those exact labels
90
+ * (case-sensitive). Unmatched labels warn. See utils `resolveCollapsibleSections`.
91
+ */
92
+ collapsibleSidebarSections?: unknown;
86
93
  /**
87
94
  * Custom prompt for the copy-page button's "Open in ChatGPT/Claude/Perplexity"
88
95
  * actions (`jsdoc.json` `"opts": { "aiPrompt": "…" }`). `{siteName}`, `{url}`,
package/dist/publish.js CHANGED
@@ -151,7 +151,10 @@ var loadUtils = () => loadDep("@clean-jsdoc-theme/utils", [
151
151
  "formatRenderError",
152
152
  "normalizeBasePath",
153
153
  "withBase",
154
- "toExtractManifest"
154
+ "toExtractManifest",
155
+ "normalizeCollapsibleSidebarSections",
156
+ "unmatchedCollapsibleSections",
157
+ "topLevelSectionLabels"
155
158
  ]);
156
159
  var loadOra = async () => {
157
160
  try {
@@ -1097,7 +1100,10 @@ async function publish(data, opts, tutorials) {
1097
1100
  formatRenderError,
1098
1101
  normalizeBasePath,
1099
1102
  withBase,
1100
- toExtractManifest
1103
+ toExtractManifest,
1104
+ normalizeCollapsibleSidebarSections,
1105
+ unmatchedCollapsibleSections,
1106
+ topLevelSectionLabels
1101
1107
  }
1102
1108
  // Loaded sequentially (not Promise.all) so the spinner can step its label
1103
1109
  // through each module — the evaluation of these large ESM bundles is the
@@ -1172,6 +1178,8 @@ async function publish(data, opts, tutorials) {
1172
1178
  const sectionOrder = normalizeSectionOrder(opts.sectionOrder);
1173
1179
  const menu = normalizeMenu(opts.menu);
1174
1180
  const clubSidebarItems = opts.clubSidebarItems === true;
1181
+ const { value: collapsibleSidebarSections, warnings: collapsibleWarnings } = normalizeCollapsibleSidebarSections(opts.collapsibleSidebarSections);
1182
+ collapsibleWarnings.forEach((w) => console.warn(`clean-jsdoc-theme: ${w}`));
1175
1183
  const playground = normalizePlayground(opts.playground);
1176
1184
  const siteOptions = {
1177
1185
  ...pkg ? { pkg } : {},
@@ -1185,12 +1193,22 @@ async function publish(data, opts, tutorials) {
1185
1193
  ...sectionOrder ? { sectionOrder } : {},
1186
1194
  ...menu ? { menu } : {},
1187
1195
  ...clubSidebarItems ? { clubSidebarItems } : {},
1196
+ ...collapsibleSidebarSections !== void 0 ? { collapsibleSidebarSections } : {},
1188
1197
  ...playground ? { playground: playground.site } : {}
1189
1198
  };
1190
1199
  const manifest = await progress.stage(
1191
1200
  "Generating pages",
1192
1201
  () => buildSpec ? stampSite(data, buildSpec.apiMessages, siteOptions) : generateSite(data, siteOptions)
1193
1202
  );
1203
+ if (Array.isArray(collapsibleSidebarSections)) {
1204
+ const present = topLevelSectionLabels(manifest.nav);
1205
+ const unmatched = unmatchedCollapsibleSections(collapsibleSidebarSections, present);
1206
+ if (unmatched.length > 0) {
1207
+ console.warn(
1208
+ `clean-jsdoc-theme: collapsibleSidebarSections \u2014 no sidebar section matches ${unmatched.map((l) => `'${l}'`).join(", ")}. Available sections: ${present.join(", ")}.`
1209
+ );
1210
+ }
1211
+ }
1194
1212
  const extractPath = process.env.CLEAN_JSDOC_THEME_EXTRACT?.trim();
1195
1213
  if (extractPath) {
1196
1214
  const target = (0, import_node_path2.resolve)(extractPath);