ardo 3.3.0 → 3.4.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.
- package/dist/{DocPage-B0Fr09xS.js → DocPage-Dy7OrCP2.js} +21 -19
- package/dist/DocPage-Dy7OrCP2.js.map +1 -0
- package/dist/assets/src/ui/{DocPage.css.ts.vanilla-BzG5Z7uL.css → DocPage.css.ts.vanilla-CWL92vUE.css} +8 -19
- package/dist/assets/src/ui/ErrorBoundary.css.ts.vanilla-C4usIU4z.css +112 -0
- package/dist/assets/src/ui/{Footer.css.ts.vanilla-YkYGSrJ5.css → Footer.css.ts.vanilla-DGTyff5Y.css} +39 -17
- package/dist/assets/src/ui/{Header.css.ts.vanilla-DoHPoq3b.css → Header.css.ts.vanilla-DEcLj8r0.css} +27 -45
- package/dist/assets/src/ui/{Layout.css.ts.vanilla-C7TVummJ.css → Layout.css.ts.vanilla-ClOa1YZm.css} +0 -3
- package/dist/assets/src/ui/{Sidebar.css.ts.vanilla-PyKaHp0J.css → Sidebar.css.ts.vanilla-IxNEQEBv.css} +57 -31
- package/dist/assets/src/ui/{Toc.css.ts.vanilla-Py3sLE1P.css → Toc.css.ts.vanilla-CQbpEdTg.css} +5 -5
- package/dist/assets/src/ui/components/{CodeBlock.css.ts.vanilla-DL4KE8dp.css → CodeBlock.css.ts.vanilla-BxDJ2gKc.css} +14 -12
- package/dist/assets/src/ui/components/{CopyButton.css.ts.vanilla-DSjVT6G0.css → CopyButton.css.ts.vanilla-CO2awD6S.css} +4 -5
- package/dist/assets/src/ui/components/HeaderSearch.css.ts.vanilla-KAo_Mlc-.css +68 -0
- package/dist/assets/src/ui/components/{Search.css.ts.vanilla-CX2EM6hW.css → Search.css.ts.vanilla-NQZH1eLo.css} +17 -6
- package/dist/assets/src/ui/theme/{dark.css.ts.vanilla-C40AfyaZ.css → dark.css.ts.vanilla-CQef5pk2.css} +11 -7
- package/dist/assets/src/ui/theme/{light.css.ts.vanilla-D0oxKOX2.css → light.css.ts.vanilla-D8gxaS1c.css} +11 -7
- package/dist/{brand-icons-DLJKqTun.js → brand-icons-Di8w0Nu9.js} +1 -1
- package/dist/{brand-icons-DLJKqTun.js.map → brand-icons-Di8w0Nu9.js.map} +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/{contract.css-ZxmDpwAM.d.ts → contract.css-qPyk_asd.d.ts} +5 -1
- package/dist/contract.css-qPyk_asd.d.ts.map +1 -0
- package/dist/{generator-DX0PP1xf.js → generator-CYSyo4Vz.js} +7 -6
- package/dist/generator-CYSyo4Vz.js.map +1 -0
- package/dist/icons/index.js +1 -1
- package/dist/{index-CWfXolzQ.d.ts → index-BcekgOfA.d.ts} +68 -7
- package/dist/index-BcekgOfA.d.ts.map +1 -0
- package/dist/{index-BNKprp9_.d.ts → index-CuMTHUxX.d.ts} +8 -2
- package/dist/index-CuMTHUxX.d.ts.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/mdx/provider.js +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/{sidebar-utils-1Skqle1Q.js → sidebar-utils-C06DJsx4.js} +15 -4
- package/dist/sidebar-utils-C06DJsx4.js.map +1 -0
- package/dist/theme/index.d.ts +16 -4
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +46 -23
- package/dist/theme/index.js.map +1 -1
- package/dist/typedoc/components/index.d.ts +1 -1
- package/dist/typedoc/index.d.ts +1 -1
- package/dist/typedoc/index.d.ts.map +1 -1
- package/dist/typedoc/index.js +1 -1
- package/dist/{types-Do3OQY8G.d.ts → types-B75OhnGa.d.ts} +13 -2
- package/dist/types-B75OhnGa.d.ts.map +1 -0
- package/dist/{types-DvGYhH63.d.ts → types-Ck2Vm7NB.d.ts} +2 -2
- package/dist/{types-DvGYhH63.d.ts.map → types-Ck2Vm7NB.d.ts.map} +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +3 -3
- package/dist/ui/styles.css +342 -306
- package/dist/ui/styles.js +11 -11
- package/dist/{ui-BzUIfYJm.js → ui-AGPGBunC.js} +584 -276
- package/dist/ui-AGPGBunC.js.map +1 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +165 -24
- package/dist/vite/index.js.map +1 -1
- package/package.json +13 -13
- package/dist/DocPage-B0Fr09xS.js.map +0 -1
- package/dist/contract.css-ZxmDpwAM.d.ts.map +0 -1
- package/dist/generator-DX0PP1xf.js.map +0 -1
- package/dist/index-BNKprp9_.d.ts.map +0 -1
- package/dist/index-CWfXolzQ.d.ts.map +0 -1
- package/dist/sidebar-utils-1Skqle1Q.js.map +0 -1
- package/dist/types-Do3OQY8G.d.ts.map +0 -1
- package/dist/ui-BzUIfYJm.js.map +0 -1
package/dist/vite/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultMarkdownConfig, resolveConfig } from "../config/index.js";
|
|
2
2
|
import { n as ARDO_FAVICON_SVG } from "../favicon-Cx-inut3.js";
|
|
3
|
-
import { n as generateApiDocs } from "../generator-
|
|
3
|
+
import { n as generateApiDocs } from "../generator-CYSyo4Vz.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import matter from "gray-matter";
|
|
6
6
|
import rehypeStringify from "rehype-stringify";
|
|
@@ -221,7 +221,7 @@ function getCodeNode(node) {
|
|
|
221
221
|
return firstChild;
|
|
222
222
|
}
|
|
223
223
|
function isElementNode(node) {
|
|
224
|
-
return isRecord$
|
|
224
|
+
return isRecord$6(node) && node.type === "element";
|
|
225
225
|
}
|
|
226
226
|
function getMetaString(codeNode) {
|
|
227
227
|
const properties = toRecord(codeNode.properties);
|
|
@@ -255,12 +255,12 @@ function replaceNodeWithShikiContainer(parent, index, innerHtml) {
|
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
function hasChildrenArray(value) {
|
|
258
|
-
return isRecord$
|
|
258
|
+
return isRecord$6(value) && Array.isArray(value.children);
|
|
259
259
|
}
|
|
260
260
|
function toRecord(value) {
|
|
261
|
-
return isRecord$
|
|
261
|
+
return isRecord$6(value) ? value : {};
|
|
262
262
|
}
|
|
263
|
-
function isRecord$
|
|
263
|
+
function isRecord$6(value) {
|
|
264
264
|
return value != null && typeof value === "object";
|
|
265
265
|
}
|
|
266
266
|
//#endregion
|
|
@@ -287,9 +287,9 @@ function ensureNodeData(node) {
|
|
|
287
287
|
return node.data;
|
|
288
288
|
}
|
|
289
289
|
function ensureRecord(value) {
|
|
290
|
-
return isRecord$
|
|
290
|
+
return isRecord$5(value) ? value : {};
|
|
291
291
|
}
|
|
292
|
-
function isRecord$
|
|
292
|
+
function isRecord$5(value) {
|
|
293
293
|
return value != null && typeof value === "object";
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
@@ -323,7 +323,7 @@ function ardoLineTransformer(options = {}) {
|
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
325
|
function getMetaRaw(meta) {
|
|
326
|
-
if (!isRecord$
|
|
326
|
+
if (!isRecord$5(meta)) return "";
|
|
327
327
|
const raw = meta.__raw;
|
|
328
328
|
return typeof raw === "string" ? raw : "";
|
|
329
329
|
}
|
|
@@ -409,7 +409,7 @@ function remarkExtractToc(options) {
|
|
|
409
409
|
let headingIndex = 0;
|
|
410
410
|
visit(tree, "heading", (node) => {
|
|
411
411
|
if (node.depth < minLevel || node.depth > maxLevel) return;
|
|
412
|
-
const text = getHeadingText$
|
|
412
|
+
const text = getHeadingText$2(node);
|
|
413
413
|
const slug = slugify$1(text);
|
|
414
414
|
const id = slug === "" ? `heading-${headingIndex}` : slug;
|
|
415
415
|
headingIndex++;
|
|
@@ -424,10 +424,10 @@ function remarkExtractToc(options) {
|
|
|
424
424
|
tocExtraction.toc = buildTocTree(headings);
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
|
-
function getHeadingText$
|
|
427
|
+
function getHeadingText$2(node) {
|
|
428
428
|
const textParts = [];
|
|
429
429
|
function extractText(child) {
|
|
430
|
-
if (!isRecord$
|
|
430
|
+
if (!isRecord$4(child)) return;
|
|
431
431
|
if (child.type === "text") textParts.push(typeof child.value === "string" ? child.value : "");
|
|
432
432
|
else if (child.type === "inlineCode") textParts.push(typeof child.value === "string" ? child.value : "");
|
|
433
433
|
else if (Array.isArray(child.children)) child.children.forEach((nestedChild) => {
|
|
@@ -482,10 +482,10 @@ function buildTocTree(headings) {
|
|
|
482
482
|
function ensureHProperties$1(node) {
|
|
483
483
|
const data = node.data ?? {};
|
|
484
484
|
node.data = data;
|
|
485
|
-
if (!isRecord$
|
|
485
|
+
if (!isRecord$4(data.hProperties)) data.hProperties = {};
|
|
486
486
|
return data.hProperties;
|
|
487
487
|
}
|
|
488
|
-
function isRecord$
|
|
488
|
+
function isRecord$4(value) {
|
|
489
489
|
return value != null && typeof value === "object";
|
|
490
490
|
}
|
|
491
491
|
//#endregion
|
|
@@ -516,9 +516,9 @@ async function transformMarkdownToReact(content, config) {
|
|
|
516
516
|
return transformMarkdown(content, config);
|
|
517
517
|
}
|
|
518
518
|
function readPageFrontmatter(data) {
|
|
519
|
-
return isRecord$
|
|
519
|
+
return isRecord$3(data) ? data : {};
|
|
520
520
|
}
|
|
521
|
-
function isRecord$
|
|
521
|
+
function isRecord$3(value) {
|
|
522
522
|
return value != null && typeof value === "object";
|
|
523
523
|
}
|
|
524
524
|
//#endregion
|
|
@@ -680,14 +680,14 @@ async function readFrontmatter$1(filePath) {
|
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
function toSidebarFrontmatter(data) {
|
|
683
|
-
if (!isRecord$
|
|
683
|
+
if (!isRecord$2(data)) return {};
|
|
684
684
|
return {
|
|
685
685
|
order: typeof data.order === "number" ? data.order : void 0,
|
|
686
686
|
sidebar: typeof data.sidebar === "boolean" ? data.sidebar : void 0,
|
|
687
687
|
title: typeof data.title === "string" ? data.title : void 0
|
|
688
688
|
};
|
|
689
689
|
}
|
|
690
|
-
function isRecord$
|
|
690
|
+
function isRecord$2(value) {
|
|
691
691
|
return value != null && typeof value === "object";
|
|
692
692
|
}
|
|
693
693
|
function sortSidebarItems(items) {
|
|
@@ -1273,6 +1273,51 @@ function extractFrontmatterValue(code, key) {
|
|
|
1273
1273
|
return code.slice(startIndex, endIndex);
|
|
1274
1274
|
}
|
|
1275
1275
|
//#endregion
|
|
1276
|
+
//#region src/markdown/remark-callouts.ts
|
|
1277
|
+
const TYPE_MAP = {
|
|
1278
|
+
NOTE: "Note",
|
|
1279
|
+
TIP: "Tip",
|
|
1280
|
+
IMPORTANT: "Info",
|
|
1281
|
+
WARNING: "Warning",
|
|
1282
|
+
CAUTION: "Danger"
|
|
1283
|
+
};
|
|
1284
|
+
const ALERT_REGEX = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\][ \t]*\r?\n?/i;
|
|
1285
|
+
function remarkCallouts() {
|
|
1286
|
+
return function(tree) {
|
|
1287
|
+
visit(tree, "blockquote", (node, index, parent) => {
|
|
1288
|
+
if (parent == null || index == null) return;
|
|
1289
|
+
const componentName = extractCalloutType(node);
|
|
1290
|
+
if (componentName == null) return;
|
|
1291
|
+
const replacement = {
|
|
1292
|
+
type: "mdxJsxFlowElement",
|
|
1293
|
+
name: componentName,
|
|
1294
|
+
attributes: [],
|
|
1295
|
+
children: node.children
|
|
1296
|
+
};
|
|
1297
|
+
parent.children[index] = replacement;
|
|
1298
|
+
});
|
|
1299
|
+
};
|
|
1300
|
+
}
|
|
1301
|
+
function extractCalloutType(node) {
|
|
1302
|
+
const firstChild = node.children[0];
|
|
1303
|
+
if (firstChild?.type !== "paragraph") return void 0;
|
|
1304
|
+
const firstParaChild = firstChild.children[0];
|
|
1305
|
+
if (firstParaChild?.type !== "text") return void 0;
|
|
1306
|
+
const match = ALERT_REGEX.exec(firstParaChild.value);
|
|
1307
|
+
if (match === null) return void 0;
|
|
1308
|
+
const calloutName = TYPE_MAP[match[1].toUpperCase()];
|
|
1309
|
+
firstParaChild.value = firstParaChild.value.slice(match[0].length);
|
|
1310
|
+
if (firstParaChild.value === "") {
|
|
1311
|
+
firstChild.children.shift();
|
|
1312
|
+
stripLeadingBreak(firstChild.children);
|
|
1313
|
+
}
|
|
1314
|
+
if (firstChild.children.length === 0) node.children.shift();
|
|
1315
|
+
return calloutName;
|
|
1316
|
+
}
|
|
1317
|
+
function stripLeadingBreak(children) {
|
|
1318
|
+
if (children[0]?.type === "break") children.shift();
|
|
1319
|
+
}
|
|
1320
|
+
//#endregion
|
|
1276
1321
|
//#region ../../node_modules/.pnpm/estree-util-value-to-estree@3.5.0/node_modules/estree-util-value-to-estree/dist/estree-util-value-to-estree.js
|
|
1277
1322
|
/**
|
|
1278
1323
|
* Create an ESTree identifier node for a given name.
|
|
@@ -2307,6 +2352,23 @@ function define(ast, file, variables, options) {
|
|
|
2307
2352
|
}
|
|
2308
2353
|
}
|
|
2309
2354
|
//#endregion
|
|
2355
|
+
//#region src/markdown/remark-mdx-handle.ts
|
|
2356
|
+
function remarkMdxHandle() {
|
|
2357
|
+
return function(tree, file) {
|
|
2358
|
+
const yamlNode = tree.children.find((node) => node.type === "yaml");
|
|
2359
|
+
if (yamlNode === void 0) return;
|
|
2360
|
+
const layout = extractLayoutValue(yamlNode.value);
|
|
2361
|
+
if (layout === void 0) return;
|
|
2362
|
+
define(tree, file, { handle: valueToEstree({ layout }) });
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2365
|
+
function extractLayoutValue(yaml) {
|
|
2366
|
+
const match = /^layout:[ \t]+(\S.*)$/m.exec(yaml);
|
|
2367
|
+
if (match === null) return void 0;
|
|
2368
|
+
const raw = match[1].trim().replaceAll(/^["']|["']$/g, "");
|
|
2369
|
+
if (raw === "bare" || raw === "default") return raw;
|
|
2370
|
+
}
|
|
2371
|
+
//#endregion
|
|
2310
2372
|
//#region src/markdown/remark-mdx-toc.ts
|
|
2311
2373
|
function remarkMdxToc(options = {}) {
|
|
2312
2374
|
const { name = "toc", levels = [2, 3] } = options;
|
|
@@ -2316,7 +2378,7 @@ function remarkMdxToc(options = {}) {
|
|
|
2316
2378
|
let headingIndex = 0;
|
|
2317
2379
|
visit(tree, "heading", (node) => {
|
|
2318
2380
|
if (node.depth < minLevel || node.depth > maxLevel) return;
|
|
2319
|
-
const text = getHeadingText(node);
|
|
2381
|
+
const text = getHeadingText$1(node);
|
|
2320
2382
|
const slug = slugify(text);
|
|
2321
2383
|
const id = slug === "" ? `heading-${String(headingIndex)}` : slug;
|
|
2322
2384
|
headingIndex++;
|
|
@@ -2331,10 +2393,10 @@ function remarkMdxToc(options = {}) {
|
|
|
2331
2393
|
define(tree, file, { [name]: valueToEstree(items) });
|
|
2332
2394
|
};
|
|
2333
2395
|
}
|
|
2334
|
-
function getHeadingText(node) {
|
|
2396
|
+
function getHeadingText$1(node) {
|
|
2335
2397
|
const parts = [];
|
|
2336
2398
|
function extract(child) {
|
|
2337
|
-
if (!isRecord(child)) return;
|
|
2399
|
+
if (!isRecord$1(child)) return;
|
|
2338
2400
|
if (child.type === "text" || child.type === "inlineCode") parts.push(typeof child.value === "string" ? child.value : "");
|
|
2339
2401
|
else if (Array.isArray(child.children)) for (const nested of child.children) extract(nested);
|
|
2340
2402
|
}
|
|
@@ -2349,9 +2411,42 @@ function slugify(text) {
|
|
|
2349
2411
|
function ensureHProperties(node) {
|
|
2350
2412
|
const data = node.data ?? {};
|
|
2351
2413
|
node.data = data;
|
|
2352
|
-
if (!isRecord(data.hProperties)) data.hProperties = {};
|
|
2414
|
+
if (!isRecord$1(data.hProperties)) data.hProperties = {};
|
|
2353
2415
|
return data.hProperties;
|
|
2354
2416
|
}
|
|
2417
|
+
function isRecord$1(value) {
|
|
2418
|
+
return value != null && typeof value === "object";
|
|
2419
|
+
}
|
|
2420
|
+
//#endregion
|
|
2421
|
+
//#region src/markdown/remark-strip-frontmatter-h1.ts
|
|
2422
|
+
function remarkStripFrontmatterH1() {
|
|
2423
|
+
return function(tree) {
|
|
2424
|
+
const yamlNode = tree.children.find((node) => node.type === "yaml");
|
|
2425
|
+
if (yamlNode === void 0) return;
|
|
2426
|
+
const title = extractYamlTitle(yamlNode.value);
|
|
2427
|
+
if (title === "") return;
|
|
2428
|
+
const firstH1Index = tree.children.findIndex((node) => node.type === "heading" && node.depth === 1);
|
|
2429
|
+
if (firstH1Index === -1) return;
|
|
2430
|
+
const h1Node = tree.children[firstH1Index];
|
|
2431
|
+
if (h1Node.type !== "heading") return;
|
|
2432
|
+
if (getHeadingText(h1Node).trim() === title) tree.children.splice(firstH1Index, 1);
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
function extractYamlTitle(yaml) {
|
|
2436
|
+
const match = /^title:[ \t]+(\S.*)$/m.exec(yaml);
|
|
2437
|
+
if (match === null) return "";
|
|
2438
|
+
return match[1].trim().replaceAll(/^["']|["']$/g, "");
|
|
2439
|
+
}
|
|
2440
|
+
function getHeadingText(node) {
|
|
2441
|
+
const parts = [];
|
|
2442
|
+
function extract(child) {
|
|
2443
|
+
if (!isRecord(child)) return;
|
|
2444
|
+
if (child.type === "text" || child.type === "inlineCode") parts.push(typeof child.value === "string" ? child.value : "");
|
|
2445
|
+
else if (Array.isArray(child.children)) for (const nested of child.children) extract(nested);
|
|
2446
|
+
}
|
|
2447
|
+
for (const child of node.children) extract(child);
|
|
2448
|
+
return parts.join("");
|
|
2449
|
+
}
|
|
2355
2450
|
function isRecord(value) {
|
|
2356
2451
|
return value != null && typeof value === "object";
|
|
2357
2452
|
}
|
|
@@ -2506,8 +2601,11 @@ function createMdxPlugin(markdownConfig) {
|
|
|
2506
2601
|
include: /\.(md|mdx)$/,
|
|
2507
2602
|
remarkPlugins: [
|
|
2508
2603
|
remarkFrontmatter,
|
|
2604
|
+
remarkStripFrontmatterH1,
|
|
2509
2605
|
[remarkMdxFrontmatter, { name: "frontmatter" }],
|
|
2606
|
+
remarkMdxHandle,
|
|
2510
2607
|
remarkGfm,
|
|
2608
|
+
remarkCallouts,
|
|
2511
2609
|
remarkCodeMeta,
|
|
2512
2610
|
[remarkMdxToc, { levels: markdownConfig?.toc?.level ?? [2, 3] }]
|
|
2513
2611
|
],
|
|
@@ -2880,6 +2978,29 @@ async function generateSidebar$1(routesDir, options = {}) {
|
|
|
2880
2978
|
return [];
|
|
2881
2979
|
}
|
|
2882
2980
|
}
|
|
2981
|
+
/**
|
|
2982
|
+
* Build one sidebar tree per top-level routes folder.
|
|
2983
|
+
*
|
|
2984
|
+
* The flat `generateSidebar` returns a single nested array — fine for sites
|
|
2985
|
+
* where everything lives in one column. For context-driven sites (Guide vs.
|
|
2986
|
+
* API vs. …) each top-level folder gets its own subtree, keyed by folder
|
|
2987
|
+
* name (`guide`, `api-reference`, …). Top-level files like `home.tsx` are
|
|
2988
|
+
* skipped — they belong to a bare layout, not a sidebar context.
|
|
2989
|
+
*/
|
|
2990
|
+
async function generateContextSidebars(routesDir) {
|
|
2991
|
+
try {
|
|
2992
|
+
const entries = await fs.readdir(routesDir, { withFileTypes: true });
|
|
2993
|
+
const sidebars = {};
|
|
2994
|
+
for (const entry of entries) {
|
|
2995
|
+
if (!entry.isDirectory()) continue;
|
|
2996
|
+
const nodes = await scanSidebarDirectory(path.join(routesDir, entry.name), routesDir);
|
|
2997
|
+
if (nodes.length > 0) sidebars[entry.name] = nodes.map((node) => stripOrderFromNode(node));
|
|
2998
|
+
}
|
|
2999
|
+
return sidebars;
|
|
3000
|
+
} catch {
|
|
3001
|
+
return {};
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
2883
3004
|
async function scanSidebarDirectory(dir, rootDir) {
|
|
2884
3005
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
2885
3006
|
const nodes = [];
|
|
@@ -2899,10 +3020,20 @@ async function scanSidebarDirectory(dir, rootDir) {
|
|
|
2899
3020
|
}
|
|
2900
3021
|
async function createDirectoryNode(entry, fullPath, rootDir) {
|
|
2901
3022
|
const relativePath = path.relative(rootDir, fullPath);
|
|
2902
|
-
const children = await scanSidebarDirectory(fullPath, rootDir);
|
|
2903
|
-
if (children.length === 0) return null;
|
|
2904
3023
|
const metadata = await readDirectoryIndexMetadata(fullPath);
|
|
3024
|
+
if (metadata?.sidebar === false) return null;
|
|
2905
3025
|
const link = metadata == null ? void 0 : `/${relativePath.replaceAll("\\", "/")}`;
|
|
3026
|
+
if (metadata?.sidebar === "leaf") {
|
|
3027
|
+
if (link === void 0) return null;
|
|
3028
|
+
return {
|
|
3029
|
+
text: metadata.title ?? formatTitle(entry.name),
|
|
3030
|
+
link,
|
|
3031
|
+
order: metadata.order,
|
|
3032
|
+
sectionId: entry.name
|
|
3033
|
+
};
|
|
3034
|
+
}
|
|
3035
|
+
const children = await scanSidebarDirectory(fullPath, rootDir);
|
|
3036
|
+
if (children.length === 0) return null;
|
|
2906
3037
|
return {
|
|
2907
3038
|
text: metadata?.title ?? formatTitle(entry.name),
|
|
2908
3039
|
link,
|
|
@@ -2944,9 +3075,13 @@ function readFrontmatter(fileContent) {
|
|
|
2944
3075
|
title: typeof parsed.data.title === "string" ? parsed.data.title : void 0,
|
|
2945
3076
|
order: typeof parsed.data.order === "number" ? parsed.data.order : void 0,
|
|
2946
3077
|
collapsed: typeof parsed.data.collapsed === "boolean" ? parsed.data.collapsed : void 0,
|
|
2947
|
-
sidebar:
|
|
3078
|
+
sidebar: parseSidebarValue(parsed.data.sidebar)
|
|
2948
3079
|
};
|
|
2949
3080
|
}
|
|
3081
|
+
function parseSidebarValue(raw) {
|
|
3082
|
+
if (typeof raw === "boolean") return raw;
|
|
3083
|
+
if (raw === "leaf") return "leaf";
|
|
3084
|
+
}
|
|
2950
3085
|
function sortNodes(nodes) {
|
|
2951
3086
|
nodes.sort((leftNode, rightNode) => {
|
|
2952
3087
|
if (leftNode.order != null && rightNode.order != null) return leftNode.order - rightNode.order;
|
|
@@ -3039,10 +3174,12 @@ function createTypeDocPlugin(typedocConfig, routesDir) {
|
|
|
3039
3174
|
//#region src/vite/plugin.ts
|
|
3040
3175
|
const VIRTUAL_MODULE_ID = "virtual:ardo/config";
|
|
3041
3176
|
const VIRTUAL_SIDEBAR_ID = "virtual:ardo/sidebar";
|
|
3177
|
+
const VIRTUAL_SIDEBARS_ID = "virtual:ardo/sidebars";
|
|
3042
3178
|
const VIRTUAL_SEARCH_ID = "virtual:ardo/search-index";
|
|
3043
3179
|
const RESOLVED_IDS = {
|
|
3044
3180
|
[VIRTUAL_MODULE_ID]: `\0${VIRTUAL_MODULE_ID}`,
|
|
3045
3181
|
[VIRTUAL_SIDEBAR_ID]: `\0${VIRTUAL_SIDEBAR_ID}`,
|
|
3182
|
+
[VIRTUAL_SIDEBARS_ID]: `\0${VIRTUAL_SIDEBARS_ID}`,
|
|
3046
3183
|
[VIRTUAL_SEARCH_ID]: `\0${VIRTUAL_SEARCH_ID}`
|
|
3047
3184
|
};
|
|
3048
3185
|
function ardoPlugin(options = {}) {
|
|
@@ -3154,6 +3291,10 @@ async function loadVirtualModule(id, state) {
|
|
|
3154
3291
|
const sidebar = await generateSidebar$1(state.routesDir, state.resolvedConfig.sidebar);
|
|
3155
3292
|
return `export default ${JSON.stringify(sidebar)}`;
|
|
3156
3293
|
}
|
|
3294
|
+
if (id === RESOLVED_IDS[VIRTUAL_SIDEBARS_ID]) {
|
|
3295
|
+
const sidebars = await generateContextSidebars(state.routesDir);
|
|
3296
|
+
return `export default ${JSON.stringify(sidebars)}`;
|
|
3297
|
+
}
|
|
3157
3298
|
if (id === RESOLVED_IDS[VIRTUAL_SEARCH_ID]) {
|
|
3158
3299
|
const searchIndex = await generateSearchIndex(state.routesDir);
|
|
3159
3300
|
return `export default ${JSON.stringify(searchIndex)}`;
|