@takazudo/zudo-doc 10.0.3 → 12.0.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/CHANGELOG.md +47 -0
- package/dist/agent-docs/search.js +6 -3
- package/dist/asset-index-page/index.js +1 -1
- package/dist/asset-page/index.js +1 -1
- package/dist/asset-path/index.d.ts +2 -0
- package/dist/asset-path/index.js +1 -0
- package/dist/catalog.js +1 -1
- package/dist/chrome/derive.js +14 -2
- package/dist/compiled.css +178 -30
- package/dist/config-assertions/index.d.ts +54 -0
- package/dist/config-assertions/index.js +205 -0
- package/dist/config.d.ts +12 -9
- package/dist/config.js +13 -0
- package/dist/content/index.d.ts +1 -0
- package/dist/content/index.js +2 -0
- package/dist/content/wide-section-heading.d.ts +12 -0
- package/dist/content/wide-section-heading.js +8 -0
- package/dist/content-admonition/index.d.ts +2 -1
- package/dist/content-admonition/index.js +2 -1
- package/dist/doc-body-end-islands/index.d.ts +0 -7
- package/dist/doc-body-end-islands/index.js +0 -6
- package/dist/doc-card-nav/index.d.ts +78 -0
- package/dist/doc-card-nav/index.js +82 -0
- package/dist/doc-card-nav/slug.d.ts +6 -0
- package/dist/doc-card-nav/slug.js +6 -0
- package/dist/doc-page-renderer/index.d.ts +5 -0
- package/dist/doc-page-renderer/index.js +7 -0
- package/dist/doc-page-shell/index.d.ts +12 -0
- package/dist/doc-page-shell/index.js +6 -1
- package/dist/docs-schema/index.d.ts +2 -0
- package/dist/docs-schema/index.js +9 -0
- package/dist/features.css +201 -0
- package/dist/frontmatter-preview-defaults/index.js +3 -1
- package/dist/head-with-defaults/index.d.ts +20 -0
- package/dist/head-with-defaults/index.js +25 -3
- package/dist/home-hero/index.d.ts +36 -0
- package/dist/home-hero/index.js +128 -0
- package/dist/home-page/index.js +157 -58
- package/dist/i18n-defaults/index.js +8 -0
- package/dist/mcp/constants.d.ts +11 -0
- package/dist/mcp/constants.js +20 -0
- package/dist/mcp/discovery.d.ts +45 -0
- package/dist/mcp/discovery.js +138 -0
- package/dist/mcp/handler.js +5 -9
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.js +37 -1
- package/dist/md-utils/index.d.ts +6 -1
- package/dist/md-utils/index.js +3 -2
- package/dist/mdx-components/index.js +4 -7
- package/dist/mdx-components/vocabulary.d.ts +19 -0
- package/dist/mdx-components/vocabulary.js +32 -0
- package/dist/nav-indexing/doc-card-grid.d.ts +6 -0
- package/dist/nav-indexing/doc-card-grid.js +26 -16
- package/dist/plugins/internal/agent-export/components.d.ts +27 -0
- package/dist/plugins/internal/agent-export/components.js +125 -0
- package/dist/plugins/internal/agent-export/index.d.ts +4 -0
- package/dist/plugins/internal/agent-export/index.js +29 -8
- package/dist/plugins/internal/agent-export/normalize.d.ts +18 -1
- package/dist/plugins/internal/agent-export/normalize.js +91 -5
- package/dist/plugins/internal/llms-txt/dev-middleware.d.ts +2 -0
- package/dist/plugins/internal/llms-txt/dev-middleware.js +6 -1
- package/dist/plugins/internal/llms-txt/emit.js +8 -1
- package/dist/plugins/internal/llms-txt/generate.d.ts +2 -0
- package/dist/plugins/internal/llms-txt/generate.js +3 -0
- package/dist/plugins/internal/llms-txt/load.js +2 -2
- package/dist/plugins/internal/llms-txt/types.d.ts +4 -0
- package/dist/plugins/internal/search-index/collect.js +5 -4
- package/dist/plugins/internal/search-index/types.d.ts +2 -0
- package/dist/plugins/routes.js +6 -1
- package/dist/preset.d.ts +6 -1
- package/dist/preset.js +13 -1
- package/dist/robots.d.ts +14 -0
- package/dist/robots.js +22 -4
- package/dist/route-enumerators/index.d.ts +63 -2
- package/dist/route-enumerators/index.js +124 -21
- package/dist/routes/404.js +1 -1
- package/dist/routes/_context.d.ts +1 -1
- package/dist/routes/_context.js +6 -0
- package/dist/routes/ai-catalog.d.ts +5 -0
- package/dist/routes/ai-catalog.js +28 -0
- package/dist/routes/mcp-server-card.d.ts +5 -0
- package/dist/routes/mcp-server-card.js +24 -0
- package/dist/routes/sitemap.xml.js +19 -9
- package/dist/settings-defaults.js +1 -1
- package/dist/settings.d.ts +102 -6
- package/dist/sidebar/client-data.d.ts +1 -1
- package/dist/sidebar/client-data.js +2 -0
- package/dist/sidebar/types.d.ts +4 -0
- package/dist/sidebar-tree/build-tree.js +1 -0
- package/dist/sidebar-tree/types.d.ts +4 -0
- package/dist/site-schema/nav-tree.js +2 -0
- package/dist/site-schema/types.d.ts +3 -0
- package/dist/site-tree-nav/index.d.ts +18 -0
- package/dist/site-tree-nav/index.js +18 -3
- package/dist/site-tree-nav/normalize-island-props.d.ts +6 -0
- package/dist/site-tree-nav/normalize-island-props.js +15 -0
- package/dist/site-tree-nav-island/count.d.ts +3 -0
- package/dist/site-tree-nav-island/count.js +11 -0
- package/dist/site-tree-nav-island/index.d.ts +22 -2
- package/dist/site-tree-nav-island/index.js +272 -221
- package/dist/tag-pages/index.d.ts +1 -0
- package/dist/tag-pages/index.js +2 -2
- package/dist/theme-packs/bauhaus/meta.json +1 -1
- package/dist/theme-packs/bauhaus/pack.css +2 -2
- package/dist/theme-packs/beacon/meta.json +1 -1
- package/dist/theme-packs/beacon/pack.css +0 -15
- package/dist/theme-packs/eink/meta.json +1 -1
- package/dist/theme-packs/eink/pack.css +1 -14
- package/dist/theme.css +0 -16
- package/dist/versions-page/index.d.ts +1 -0
- package/dist/versions-page/index.js +1 -1
- package/dist/wind.json +4 -6
- package/eject/content-admonition/index.tsx +4 -9
- package/eject/sidebar/client-data.ts +3 -1
- package/eject/sidebar/types.ts +4 -0
- package/eject/site-tree-nav-island/count.ts +11 -0
- package/eject/site-tree-nav-island/index.tsx +359 -256
- package/package.json +19 -7
- package/routes-src/404.tsx +1 -1
- package/routes-src/_context.ts +3 -0
- package/routes-src/ai-catalog.tsx +26 -0
- package/routes-src/mcp-server-card.tsx +21 -0
- package/routes-src/sitemap.xml.tsx +36 -12
- package/dist/find-in-page/find-bar.d.ts +0 -11
- package/dist/find-in-page/find-bar.js +0 -103
- package/dist/find-in-page/find-in-page.d.ts +0 -17
- package/dist/find-in-page/find-in-page.js +0 -131
- package/dist/find-in-page/index.d.ts +0 -5
- package/dist/find-in-page/index.js +0 -52
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
2
|
+
import { HeadingH2 } from "./heading-h2.js";
|
|
3
|
+
function WideSectionHeading(props) {
|
|
4
|
+
return /* @__PURE__ */ jsx(HeadingH2, { "data-zd-section-heading": "", ...props });
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
WideSectionHeading
|
|
8
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
2
|
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
3
|
-
|
|
3
|
+
import { type AdmonitionVariant } from "../mdx-components/vocabulary.js";
|
|
4
|
+
export type { AdmonitionVariant };
|
|
4
5
|
export interface AdmonitionProps {
|
|
5
6
|
/** Custom title; falls back to the capitalized variant name (e.g. "Note"). */
|
|
6
7
|
title?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
2
|
+
import { admonitionComponentName } from "../mdx-components/vocabulary.js";
|
|
2
3
|
function makeAdmonition(variant) {
|
|
3
|
-
const defaultTitle =
|
|
4
|
+
const defaultTitle = admonitionComponentName(variant);
|
|
4
5
|
return function Admonition({ title, children }) {
|
|
5
6
|
const heading = title && title.length > 0 ? title : defaultTitle;
|
|
6
7
|
return /* @__PURE__ */ jsxs("div", { "data-admonition": variant, class: `admonition-${variant}`, children: [
|
|
@@ -15,13 +15,6 @@ export interface BodyEndIslandsSettings {
|
|
|
15
15
|
* `true`, nothing mounts unless `deps.DesignTokenPanelBootstrap` was also
|
|
16
16
|
* supplied — see {@link BodyEndIslandsDeps}. */
|
|
17
17
|
designTokenPanel: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Gates the `FindInPageInit` island mount (zudolab/zudo-doc#2689).
|
|
20
|
-
* Controls the PACKAGE-DEFAULT `BodyEndIslands` slot only — a host that
|
|
21
|
-
* overrides the `BodyEndIslands` chrome binding must mount `FindInPageInit`
|
|
22
|
-
* itself.
|
|
23
|
-
*/
|
|
24
|
-
findInPage: boolean;
|
|
25
18
|
/**
|
|
26
19
|
* Gates the `ThemePackSwitcher` flyout island mount (ADR
|
|
27
20
|
* `docs/adr/theme-packs.md` Decision 7; #2821). Optional — the field is
|
|
@@ -5,7 +5,6 @@ import { ImageEnlarge } from "../image-enlarge/index.js";
|
|
|
5
5
|
import { ImageEnlargeSsrFallback } from "../image-enlarge/ssr-fallback.js";
|
|
6
6
|
import { MermaidEnlarge } from "../mermaid-enlarge/index.js";
|
|
7
7
|
import { MermaidEnlargeSsrFallback } from "../mermaid-enlarge/ssr-fallback.js";
|
|
8
|
-
import { FindInPageInit } from "../find-in-page/index.js";
|
|
9
8
|
import { PageLoadingOverlay } from "../page-loading/index.js";
|
|
10
9
|
import { createDesignTokenPanelIsland } from "./design-token-panel-island.js";
|
|
11
10
|
import { createThemePackSwitcherIsland } from "./theme-pack-switcher-island.js";
|
|
@@ -44,15 +43,10 @@ function createBodyEndIslands(deps) {
|
|
|
44
43
|
ssrFallback: /* @__PURE__ */ jsx(MermaidEnlargeSsrFallback, {}),
|
|
45
44
|
children: /* @__PURE__ */ jsx(MermaidEnlarge, {})
|
|
46
45
|
}) : null;
|
|
47
|
-
const findInPageInit = settings.findInPage ? Island({
|
|
48
|
-
when: "load",
|
|
49
|
-
children: /* @__PURE__ */ jsx(FindInPageInit, {})
|
|
50
|
-
}) : null;
|
|
51
46
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
47
|
settings.dynamicPageTransition ? /* @__PURE__ */ jsx(PageLoadingOverlay, {}) : null,
|
|
53
48
|
/* @__PURE__ */ jsx(DesignTokenPanelIsland, {}),
|
|
54
49
|
/* @__PURE__ */ jsx(ThemePackSwitcherIsland, {}),
|
|
55
|
-
findInPageInit,
|
|
56
50
|
aiAssistant,
|
|
57
51
|
imageEnlarge,
|
|
58
52
|
mermaidEnlarge
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
3
|
+
import { type DocCardItem } from "../nav-indexing/doc-card-grid.js";
|
|
4
|
+
import { isCanonicalDocSlug } from "./slug.js";
|
|
5
|
+
export { isCanonicalDocSlug };
|
|
6
|
+
/** Why a requested reference produced no card. */
|
|
7
|
+
export type DocCardDiagnosticReason = "invalid" | "duplicate" | "not-found" | "no-page";
|
|
8
|
+
export interface DocCardDiagnostic {
|
|
9
|
+
/** The reference exactly as requested. */
|
|
10
|
+
ref: unknown;
|
|
11
|
+
reason: DocCardDiagnosticReason;
|
|
12
|
+
}
|
|
13
|
+
/** Minimal document shape read by {@link resolveDocCards}. */
|
|
14
|
+
export interface DocCardSourceDoc {
|
|
15
|
+
slug: string;
|
|
16
|
+
data: {
|
|
17
|
+
slug?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
category_no_page?: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface ResolveDocCardsOptions {
|
|
24
|
+
/** Published documents for the render locale/version (drafts already removed). */
|
|
25
|
+
docs: readonly DocCardSourceDoc[];
|
|
26
|
+
locale: string;
|
|
27
|
+
/** Canonical route slug for a content entry slug. */
|
|
28
|
+
toRouteSlug: (entrySlug: string) => string;
|
|
29
|
+
/** Locale/base/trailing-slash-aware href for a route slug. */
|
|
30
|
+
docsUrl: (slug: string, locale: string) => string;
|
|
31
|
+
/** Active `/v/{version}` slug; hrefs use `versionedDocsUrl` when both are set. */
|
|
32
|
+
currentVersion?: string;
|
|
33
|
+
versionedDocsUrl?: (slug: string, versionSlug: string, lang: string) => string;
|
|
34
|
+
}
|
|
35
|
+
export interface ResolvedDocCards {
|
|
36
|
+
items: DocCardItem[];
|
|
37
|
+
diagnostics: DocCardDiagnostic[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolve ordered canonical slugs into card items. Order follows the request;
|
|
41
|
+
* a repeated slug keeps its first occurrence. Invalid, unknown and no-page
|
|
42
|
+
* references are omitted and reported — a link is never manufactured.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveDocCards(refs: readonly unknown[], options: ResolveDocCardsOptions): ResolvedDocCards;
|
|
45
|
+
/** Warn once per omitted reference. Duplicates are a documented no-op and stay silent. */
|
|
46
|
+
export declare function reportDocCardDiagnostics(diagnostics: readonly DocCardDiagnostic[], where: string): void;
|
|
47
|
+
export interface DocCardNavSource {
|
|
48
|
+
navDocs: unknown[];
|
|
49
|
+
}
|
|
50
|
+
/** Injected dependencies for {@link createDocCardNavWrapper}. */
|
|
51
|
+
export interface DocCardNavDeps {
|
|
52
|
+
defaultLocale: string;
|
|
53
|
+
resolveNavSource: (lang: string, currentVersion: string | undefined, options?: {
|
|
54
|
+
applyDefaultLocaleOnlyFilter?: boolean;
|
|
55
|
+
keepUnlisted?: boolean;
|
|
56
|
+
}) => DocCardNavSource;
|
|
57
|
+
toRouteSlug: (entrySlug: string) => string;
|
|
58
|
+
docsUrl: (slug: string, locale: string) => string;
|
|
59
|
+
versionedDocsUrl?: (slug: string, versionSlug: string, lang: string) => string;
|
|
60
|
+
}
|
|
61
|
+
export interface DocCardNavProps {
|
|
62
|
+
/** Ordered canonical document slugs, e.g. `["getting-started/introduction"]`. */
|
|
63
|
+
docs: readonly string[];
|
|
64
|
+
/** Accessible name of the card `<nav>`. @default "Selected documents" */
|
|
65
|
+
ariaLabel?: string;
|
|
66
|
+
/** Card column layout. @default "auto" (up to three columns by available width) */
|
|
67
|
+
layout?: "auto" | "default";
|
|
68
|
+
/** Active locale. Injected per page by the MDX component map. */
|
|
69
|
+
lang?: string;
|
|
70
|
+
/** Active version slug. Injected per page by the MDX component map. */
|
|
71
|
+
currentVersion?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create the `DocCardNav` server component bound to a nav source. It resolves
|
|
75
|
+
* `docs` for the render locale/version and renders `DocCardGrid`; an empty
|
|
76
|
+
* result renders nothing.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createDocCardNavWrapper(deps: DocCardNavDeps): (props: DocCardNavProps) => JSX.Element | null;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { DocCardGrid } from "../nav-indexing/doc-card-grid.js";
|
|
2
|
+
import { isCanonicalDocSlug } from "./slug.js";
|
|
3
|
+
function resolveDocCards(refs, options) {
|
|
4
|
+
const bySlug = /* @__PURE__ */ new Map();
|
|
5
|
+
for (const doc of options.docs) {
|
|
6
|
+
const routeSlug = doc.data.slug ?? options.toRouteSlug(doc.slug);
|
|
7
|
+
if (!bySlug.has(routeSlug)) bySlug.set(routeSlug, doc);
|
|
8
|
+
}
|
|
9
|
+
const items = [];
|
|
10
|
+
const diagnostics = [];
|
|
11
|
+
const seen = /* @__PURE__ */ new Set();
|
|
12
|
+
for (const ref of refs) {
|
|
13
|
+
if (!isCanonicalDocSlug(ref)) {
|
|
14
|
+
diagnostics.push({ ref, reason: "invalid" });
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (seen.has(ref)) {
|
|
18
|
+
diagnostics.push({ ref, reason: "duplicate" });
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
seen.add(ref);
|
|
22
|
+
const doc = bySlug.get(ref);
|
|
23
|
+
if (!doc) {
|
|
24
|
+
diagnostics.push({ ref, reason: "not-found" });
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (doc.data.category_no_page === true) {
|
|
28
|
+
diagnostics.push({ ref, reason: "no-page" });
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const href = options.currentVersion && options.versionedDocsUrl ? options.versionedDocsUrl(ref, options.currentVersion, options.locale) : options.docsUrl(ref, options.locale);
|
|
32
|
+
const description = doc.data.description?.trim();
|
|
33
|
+
items.push({
|
|
34
|
+
href,
|
|
35
|
+
title: doc.data.title ?? ref,
|
|
36
|
+
...description ? { description } : {}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return { items, diagnostics };
|
|
40
|
+
}
|
|
41
|
+
function reportDocCardDiagnostics(diagnostics, where) {
|
|
42
|
+
for (const { ref, reason } of diagnostics) {
|
|
43
|
+
if (reason === "duplicate") continue;
|
|
44
|
+
const detail = reason === "invalid" ? 'is not a canonical document slug (e.g. "getting-started/introduction")' : reason === "not-found" ? "does not match a published document for this locale/version" : "is a category without a page";
|
|
45
|
+
console.warn(`[zudo-doc] ${where}: ${JSON.stringify(ref)} ${detail} \u2014 omitted.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function createDocCardNavWrapper(deps) {
|
|
49
|
+
function DocCardNav({
|
|
50
|
+
docs,
|
|
51
|
+
ariaLabel = "Selected documents",
|
|
52
|
+
layout = "auto",
|
|
53
|
+
lang = deps.defaultLocale,
|
|
54
|
+
currentVersion
|
|
55
|
+
}) {
|
|
56
|
+
const { navDocs } = deps.resolveNavSource(lang, currentVersion, {
|
|
57
|
+
applyDefaultLocaleOnlyFilter: true,
|
|
58
|
+
keepUnlisted: true
|
|
59
|
+
});
|
|
60
|
+
const { items, diagnostics } = resolveDocCards(Array.isArray(docs) ? docs : [], {
|
|
61
|
+
docs: navDocs,
|
|
62
|
+
locale: lang,
|
|
63
|
+
toRouteSlug: deps.toRouteSlug,
|
|
64
|
+
docsUrl: deps.docsUrl,
|
|
65
|
+
...currentVersion !== void 0 ? { currentVersion } : {},
|
|
66
|
+
...deps.versionedDocsUrl ? { versionedDocsUrl: deps.versionedDocsUrl } : {}
|
|
67
|
+
});
|
|
68
|
+
reportDocCardDiagnostics(diagnostics, "DocCardNav");
|
|
69
|
+
return DocCardGrid({
|
|
70
|
+
items,
|
|
71
|
+
ariaLabel,
|
|
72
|
+
...layout === "auto" ? { layout: "auto" } : {}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return DocCardNav;
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
createDocCardNavWrapper,
|
|
79
|
+
isCanonicalDocSlug,
|
|
80
|
+
reportDocCardDiagnostics,
|
|
81
|
+
resolveDocCards
|
|
82
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True for a canonical document slug as written in `home.sections` or MDX:
|
|
3
|
+
* non-empty, no surrounding slash, no whitespace, no URL scheme, query or
|
|
4
|
+
* hash, no backslash, and no empty, "." or ".." path segment.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isCanonicalDocSlug(value: unknown): value is string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function isCanonicalDocSlug(value) {
|
|
2
|
+
return typeof value === "string" && value.length > 0 && !value.startsWith("/") && !value.endsWith("/") && !/\s/.test(value) && !value.includes("://") && !value.includes("?") && !value.includes("#") && !value.includes("\\") && value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
|
|
3
|
+
}
|
|
4
|
+
export {
|
|
5
|
+
isCanonicalDocSlug
|
|
6
|
+
};
|
|
@@ -70,12 +70,17 @@ export interface DocPageRendererDeps {
|
|
|
70
70
|
title: string;
|
|
71
71
|
description?: string;
|
|
72
72
|
canonical?: string;
|
|
73
|
+
ogImage?: string;
|
|
73
74
|
alternateLinks?: ReadonlyArray<{
|
|
74
75
|
rel: string;
|
|
75
76
|
href: string;
|
|
76
77
|
type?: string;
|
|
77
78
|
title?: string;
|
|
78
79
|
}>;
|
|
80
|
+
localeAlternates?: ReadonlyArray<{
|
|
81
|
+
hreflang: string;
|
|
82
|
+
href: string;
|
|
83
|
+
}>;
|
|
79
84
|
breadcrumbs: Array<{
|
|
80
85
|
label: string;
|
|
81
86
|
href?: string;
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
deriveGetUnavailableVersions
|
|
11
11
|
} from "../chrome/derive.js";
|
|
12
12
|
import { assertChromeContext } from "../chrome/assert-chrome-context.js";
|
|
13
|
+
import { isRootAbsoluteSitePath } from "../config-assertions/index.js";
|
|
13
14
|
function createRenderDocPage(ctx) {
|
|
14
15
|
assertChromeContext(ctx, "createRenderDocPage");
|
|
15
16
|
const docsUrl = ctx.docsUrl;
|
|
@@ -63,6 +64,10 @@ function createRenderDocPage(ctx) {
|
|
|
63
64
|
type: "text/markdown",
|
|
64
65
|
href: ctx.withBase(`/agent/v1/pages/${agentPageKey(locale, slug)}.md`)
|
|
65
66
|
}] : void 0;
|
|
67
|
+
const localeAlternates = !version && props.kind === "entry" && !isFallback && canonical !== void 0 ? ctx.getDocLocaleAlternates(slug, locale).flatMap(({ hreflang, url }) => {
|
|
68
|
+
const href = absoluteUrl(url);
|
|
69
|
+
return href === void 0 ? [] : [{ hreflang, href }];
|
|
70
|
+
}) : [];
|
|
66
71
|
const ContentComponent = props.kind === "entry" ? props.entry.Content : null;
|
|
67
72
|
return /* @__PURE__ */ jsx(
|
|
68
73
|
DocPageShell,
|
|
@@ -73,7 +78,9 @@ function createRenderDocPage(ctx) {
|
|
|
73
78
|
title,
|
|
74
79
|
description,
|
|
75
80
|
canonical,
|
|
81
|
+
ogImage: typeof entryData?.og_image === "string" && isRootAbsoluteSitePath(entryData.og_image) ? entryData.og_image : void 0,
|
|
76
82
|
alternateLinks: agentMarkdownAlternates,
|
|
83
|
+
localeAlternates: localeAlternates.length > 0 ? localeAlternates : void 0,
|
|
77
84
|
breadcrumbs,
|
|
78
85
|
prev,
|
|
79
86
|
next,
|
|
@@ -43,6 +43,8 @@ export interface DocPageShellProps {
|
|
|
43
43
|
description?: string;
|
|
44
44
|
/** Absolute canonical URL, or undefined when siteUrl is unset. */
|
|
45
45
|
canonical?: string;
|
|
46
|
+
/** Page link-preview image path (frontmatter `og_image`). */
|
|
47
|
+
ogImage?: string;
|
|
46
48
|
/** Additional per-page alternate links passed through to the head defaults. */
|
|
47
49
|
alternateLinks?: ReadonlyArray<{
|
|
48
50
|
rel: string;
|
|
@@ -50,6 +52,11 @@ export interface DocPageShellProps {
|
|
|
50
52
|
type?: string;
|
|
51
53
|
title?: string;
|
|
52
54
|
}>;
|
|
55
|
+
/** Absolute `hreflang` alternates passed through to the head defaults. */
|
|
56
|
+
localeAlternates?: ReadonlyArray<{
|
|
57
|
+
hreflang: string;
|
|
58
|
+
href: string;
|
|
59
|
+
}>;
|
|
53
60
|
/** Pre-resolved breadcrumb trail (hrefs already remapped per route). */
|
|
54
61
|
breadcrumbs: DocPageBreadcrumbItem[];
|
|
55
62
|
/** Pre-resolved prev/next nav nodes (hrefs already remapped per route). */
|
|
@@ -137,6 +144,11 @@ export interface DocPageShellDeps {
|
|
|
137
144
|
type?: string;
|
|
138
145
|
title?: string;
|
|
139
146
|
}>;
|
|
147
|
+
localeAlternates?: ReadonlyArray<{
|
|
148
|
+
hreflang: string;
|
|
149
|
+
href: string;
|
|
150
|
+
}>;
|
|
151
|
+
lang?: string;
|
|
140
152
|
}) => JSX.Element;
|
|
141
153
|
SidebarWithDefaults: (props: {
|
|
142
154
|
currentSlug?: string;
|
|
@@ -61,7 +61,9 @@ function createDocPageShell(ctx) {
|
|
|
61
61
|
title,
|
|
62
62
|
description,
|
|
63
63
|
canonical,
|
|
64
|
+
ogImage,
|
|
64
65
|
alternateLinks,
|
|
66
|
+
localeAlternates,
|
|
65
67
|
breadcrumbs,
|
|
66
68
|
prev,
|
|
67
69
|
next,
|
|
@@ -133,7 +135,10 @@ function createDocPageShell(ctx) {
|
|
|
133
135
|
title,
|
|
134
136
|
description,
|
|
135
137
|
canonical,
|
|
136
|
-
alternateLinks
|
|
138
|
+
alternateLinks,
|
|
139
|
+
localeAlternates,
|
|
140
|
+
locale,
|
|
141
|
+
ogImage
|
|
137
142
|
}
|
|
138
143
|
),
|
|
139
144
|
/* @__PURE__ */ jsx(SidebarVisibilityPrepaint, { hideSidebar }),
|
|
@@ -57,6 +57,8 @@ export declare function buildDocsSchema(opts?: BuildDocsSchemaOptions): z.ZodObj
|
|
|
57
57
|
standalone: z.ZodOptional<z.ZodBoolean>;
|
|
58
58
|
slug: z.ZodOptional<z.ZodString>;
|
|
59
59
|
generated: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
cover: z.ZodOptional<z.ZodString>;
|
|
61
|
+
og_image: z.ZodOptional<z.ZodString>;
|
|
60
62
|
category_no_page: z.ZodOptional<z.ZodBoolean>;
|
|
61
63
|
category_sort_order: z.ZodOptional<z.ZodEnum<{
|
|
62
64
|
asc: "asc";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { isRootAbsoluteSitePath } from "../config-assertions/index.js";
|
|
2
3
|
function buildTagsSchema(opts) {
|
|
3
4
|
const vocabulary = opts?.tagVocabulary ?? [];
|
|
4
5
|
const vocabularyActive = vocabulary.length > 0 && opts?.tagGovernance === "strict";
|
|
@@ -30,6 +31,14 @@ function buildDocsSchema(opts) {
|
|
|
30
31
|
standalone: z.boolean().optional(),
|
|
31
32
|
slug: z.string().optional(),
|
|
32
33
|
generated: z.boolean().optional(),
|
|
34
|
+
// Home-grid card picture for a top-level category's index page, a root-absolute site path.
|
|
35
|
+
cover: z.string().refine(isRootAbsoluteSitePath, {
|
|
36
|
+
message: 'cover must be a root-absolute site path such as "/img/guides.png"'
|
|
37
|
+
}).optional(),
|
|
38
|
+
// Page link-preview image (og:image / twitter:image), a root-absolute site path.
|
|
39
|
+
og_image: z.string().refine(isRootAbsoluteSitePath, {
|
|
40
|
+
message: 'og_image must be a root-absolute site path such as "/img/page.png"'
|
|
41
|
+
}).optional(),
|
|
33
42
|
// Category metadata expressed as a directory index.mdx's frontmatter — the
|
|
34
43
|
// frontmatter form of `_category_.json`. `category_no_page` makes the index
|
|
35
44
|
// a non-linked sidebar header excluded from routes/sitemap/search;
|
package/dist/features.css
CHANGED
|
@@ -1460,3 +1460,204 @@ site-search [data-search-results] > :is([data-search-placeholder], p) {
|
|
|
1460
1460
|
border: 1px solid CanvasText;
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
|
+
|
|
1464
|
+
/* ======== Home hero image (home.image) ======== */
|
|
1465
|
+
/* With `darkSrc`, the hero emits a light and a dark picture; show the one that
|
|
1466
|
+
* matches the colour mode. `data-theme` is set on <html> by the colour-mode
|
|
1467
|
+
* bootstrap before first paint, so no script runs for this choice. Without a
|
|
1468
|
+
* `data-theme` (colorMode: false, or scripting off) the light picture shows. */
|
|
1469
|
+
html[data-theme="dark"] [data-zd-home-image="light"],
|
|
1470
|
+
html:not([data-theme="dark"]) [data-zd-home-image="dark"] {
|
|
1471
|
+
display: none;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
/* home.imageLayout: "backdrop" — the picture fills the hero behind a readable
|
|
1475
|
+
* copy panel. aspect-ratio grows with the panel when the copy is taller than
|
|
1476
|
+
* 1200:630 (narrow screens), so text is never clipped; no overflow clipping is
|
|
1477
|
+
* set because that would disable the aspect-ratio growth. */
|
|
1478
|
+
.zd-home-backdrop {
|
|
1479
|
+
position: relative;
|
|
1480
|
+
display: grid;
|
|
1481
|
+
place-items: center;
|
|
1482
|
+
aspect-ratio: 1200 / 630;
|
|
1483
|
+
padding: var(--spacing-vsp-md) var(--spacing-hsp-lg);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
.zd-home-backdrop-image {
|
|
1487
|
+
position: absolute;
|
|
1488
|
+
inset: 0;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
.zd-home-backdrop-panel {
|
|
1492
|
+
position: relative;
|
|
1493
|
+
max-width: 40rem;
|
|
1494
|
+
padding: var(--spacing-vsp-sm) var(--spacing-hsp-xl);
|
|
1495
|
+
background: color-mix(in oklch, var(--zd-bg) 92%, transparent);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
/* ======== SiteTreeNav tree geometry ======== */
|
|
1499
|
+
/* One set of shared lengths drives every connector of `SiteTreeNav`
|
|
1500
|
+
* (site-tree-nav-island). The disclosure box and the category-marker slot are
|
|
1501
|
+
* the same `--zd-stn-slot` square, and every rail sits on that slot's centre
|
|
1502
|
+
* (`--zd-stn-rail-x`), so:
|
|
1503
|
+
* - a category's double-chevron (centred in its slot) shares the x axis of
|
|
1504
|
+
* the dashed rail of the tree directly below it;
|
|
1505
|
+
* - a nested rail starts at the bottom centre of its parent's boxed toggle;
|
|
1506
|
+
* - each branch sits on the first text line (`--zd-stn-mid`), never on the
|
|
1507
|
+
* middle of a multi-line row; the last rail stops at its branch.
|
|
1508
|
+
* Stacked categories keep a short lead-in above the first branch (the root
|
|
1509
|
+
* rail starts at the first row's top). A lone described category whose own
|
|
1510
|
+
* tree box (the `<nav>`, which it fills alone) is at least 48.75rem wide splits into summary + tree columns; the SAME
|
|
1511
|
+
* container condition sets `--zd-stn-split: 1`, which crops the root rail so
|
|
1512
|
+
* it begins at the first branch (no vertical segment for an only child).
|
|
1513
|
+
* Container queries are authored here because Wind has no container-query
|
|
1514
|
+
* variant. Sidebar connectors (tree-nav-shared) are unaffected. */
|
|
1515
|
+
.zd-site-tree {
|
|
1516
|
+
--zd-stn-slot: 1.75rem;
|
|
1517
|
+
--zd-stn-rail-x: calc(var(--zd-stn-slot) / 2);
|
|
1518
|
+
--zd-stn-indent: calc(var(--zd-stn-slot) + var(--spacing-hsp-sm));
|
|
1519
|
+
--zd-stn-row-pad: var(--spacing-vsp-2xs);
|
|
1520
|
+
container: zd-site-tree / inline-size;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
.zd-site-tree-card {
|
|
1524
|
+
--zd-stn-card-pad: var(--spacing-hsp-sm);
|
|
1525
|
+
padding: var(--zd-stn-card-pad);
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
.zd-site-tree-card[data-described] {
|
|
1529
|
+
--zd-stn-card-pad: var(--spacing-hsp-xl);
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
@container zd-site-tree (max-width: 38.75rem) {
|
|
1533
|
+
.zd-site-tree-card[data-described] {
|
|
1534
|
+
--zd-stn-card-pad: var(--spacing-hsp-lg);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/* Category card cover (`cover` frontmatter on a top-level category index).
|
|
1539
|
+
* Bleeds over the card padding so it sits flush with the border; the 1200:630
|
|
1540
|
+
* box is reserved before the picture loads. */
|
|
1541
|
+
.zd-site-nav-cover {
|
|
1542
|
+
display: block;
|
|
1543
|
+
width: calc(100% + 2 * var(--zd-stn-card-pad));
|
|
1544
|
+
max-width: none;
|
|
1545
|
+
height: auto;
|
|
1546
|
+
aspect-ratio: 1200 / 630;
|
|
1547
|
+
object-fit: cover;
|
|
1548
|
+
margin: calc(-1 * var(--zd-stn-card-pad)) calc(-1 * var(--zd-stn-card-pad)) var(--zd-stn-card-pad);
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
.zd-site-tree-body {
|
|
1552
|
+
display: flex;
|
|
1553
|
+
flex-direction: column;
|
|
1554
|
+
gap: var(--spacing-vsp-2xs);
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
.zd-site-tree-card[data-described] .zd-site-tree-body {
|
|
1558
|
+
gap: var(--spacing-vsp-sm);
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
@container zd-site-tree (min-width: 48.75rem) {
|
|
1562
|
+
.zd-site-tree-body[data-split="true"] {
|
|
1563
|
+
display: grid;
|
|
1564
|
+
grid-template-columns: minmax(12rem, 20rem) minmax(0, 1fr);
|
|
1565
|
+
column-gap: var(--spacing-hsp-2xl);
|
|
1566
|
+
align-items: start;
|
|
1567
|
+
--zd-stn-split: 1;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
.zd-site-tree-head,
|
|
1572
|
+
.zd-site-tree-row {
|
|
1573
|
+
font-size: var(--text-small);
|
|
1574
|
+
line-height: var(--leading-relaxed);
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/* First text line centred on the slot; `max()` keeps tall line-heights intact. */
|
|
1578
|
+
.zd-site-tree-label {
|
|
1579
|
+
padding-block-start: calc((max(var(--zd-stn-slot), 1lh) - 1lh) / 2);
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
.zd-site-tree-marker {
|
|
1583
|
+
inline-size: var(--zd-stn-slot);
|
|
1584
|
+
block-size: 1lh;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
.zd-site-tree-toggle {
|
|
1588
|
+
inline-size: var(--zd-stn-slot);
|
|
1589
|
+
block-size: var(--zd-stn-slot);
|
|
1590
|
+
padding: 0;
|
|
1591
|
+
background: transparent;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
.zd-site-tree-list {
|
|
1595
|
+
list-style: none;
|
|
1596
|
+
margin: 0;
|
|
1597
|
+
padding: 0;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
.zd-site-tree-row {
|
|
1601
|
+
--zd-stn-mid: calc(var(--zd-stn-row-pad) + max(var(--zd-stn-slot), 1lh) / 2);
|
|
1602
|
+
position: relative;
|
|
1603
|
+
min-inline-size: 0;
|
|
1604
|
+
margin: 0;
|
|
1605
|
+
padding-inline-start: var(--zd-stn-indent);
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
.zd-site-tree-line {
|
|
1609
|
+
padding-block: var(--zd-stn-row-pad);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
.zd-site-tree-rail,
|
|
1613
|
+
.zd-site-tree-branch,
|
|
1614
|
+
.zd-site-tree-stem {
|
|
1615
|
+
position: absolute;
|
|
1616
|
+
inline-size: 0;
|
|
1617
|
+
border: 0 dashed var(--color-muted);
|
|
1618
|
+
pointer-events: none;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
.zd-site-tree-rail {
|
|
1622
|
+
inset-inline-start: var(--zd-stn-rail-x);
|
|
1623
|
+
inset-block: 0;
|
|
1624
|
+
border-inline-start-width: 1px;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
.zd-site-tree-rail[data-last="true"] {
|
|
1628
|
+
inset-block-end: auto;
|
|
1629
|
+
block-size: var(--zd-stn-mid);
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
.zd-site-tree-rail[data-root][data-first="true"] {
|
|
1633
|
+
inset-block-start: calc(var(--zd-stn-mid) * var(--zd-stn-split, 0));
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.zd-site-tree-rail[data-root][data-first="true"][data-last="true"] {
|
|
1637
|
+
block-size: calc(var(--zd-stn-mid) * (1 - var(--zd-stn-split, 0)));
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
.zd-site-tree-branch {
|
|
1641
|
+
inset-inline-start: var(--zd-stn-rail-x);
|
|
1642
|
+
inset-block-start: var(--zd-stn-mid);
|
|
1643
|
+
inline-size: calc(var(--zd-stn-indent) - var(--zd-stn-rail-x) - var(--spacing-hsp-xs));
|
|
1644
|
+
border-block-start-width: 1px;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
.zd-site-tree-row[data-group] > .zd-site-tree-branch {
|
|
1648
|
+
inline-size: calc(var(--zd-stn-indent) - var(--zd-stn-rail-x));
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
.zd-site-tree-stem {
|
|
1652
|
+
inset-inline-start: var(--zd-stn-rail-x);
|
|
1653
|
+
inset-block: calc(var(--zd-stn-row-pad) + var(--zd-stn-slot)) 0;
|
|
1654
|
+
border-inline-start-width: 1px;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
@media (forced-colors: active) {
|
|
1658
|
+
.zd-site-tree-rail,
|
|
1659
|
+
.zd-site-tree-branch,
|
|
1660
|
+
.zd-site-tree-stem {
|
|
1661
|
+
border-color: CanvasText;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
@@ -16,6 +16,20 @@ export interface HeadWithDefaultsProps {
|
|
|
16
16
|
canonical?: string;
|
|
17
17
|
/** Page-specific alternate links, such as an exported Markdown version. */
|
|
18
18
|
alternateLinks?: HeadProps["alternateLinks"];
|
|
19
|
+
/**
|
|
20
|
+
* Absolute `hreflang` alternates for this page's locale variants (including
|
|
21
|
+
* itself and `x-default`), emitted right after the canonical link. Omitted
|
|
22
|
+
* or empty emits nothing.
|
|
23
|
+
*/
|
|
24
|
+
localeAlternates?: ReadonlyArray<{
|
|
25
|
+
hreflang: string;
|
|
26
|
+
href: string;
|
|
27
|
+
}>;
|
|
28
|
+
/** Active locale: selects `locales[locale].ogImage` when set, and a configured non-default
|
|
29
|
+
* locale links its own `llms.txt`. */
|
|
30
|
+
locale?: string;
|
|
31
|
+
/** Page link-preview image path (frontmatter `og_image`); wins over every setting. */
|
|
32
|
+
ogImage?: string;
|
|
19
33
|
}
|
|
20
34
|
/** Settings subset read by {@link createHeadWithDefaults}. Retained for the
|
|
21
35
|
* `HeadProps`/`ColorSchemeProviderColorMode` type references it documents. */
|
|
@@ -30,10 +44,16 @@ export interface HeadWithDefaultsSettings {
|
|
|
30
44
|
twitterCreator?: string;
|
|
31
45
|
};
|
|
32
46
|
siteName: string;
|
|
47
|
+
/** Per-locale settings: `ogImage` is read here, and each configured code has its own `llms.txt`. */
|
|
48
|
+
locales?: Record<string, {
|
|
49
|
+
ogImage?: string | false;
|
|
50
|
+
}>;
|
|
33
51
|
/** Emit agent-discovery links only when the opt-in static export is enabled. */
|
|
34
52
|
agentExport?: boolean;
|
|
35
53
|
/** Existing llms.txt output setting; retained independently from agent export. */
|
|
36
54
|
llmsTxt?: boolean;
|
|
55
|
+
/** The read-only MCP endpoint; on a root base it also publishes the AI Catalog. */
|
|
56
|
+
mcp?: boolean;
|
|
37
57
|
colorMode?: ColorSchemeProviderColorMode | null | false;
|
|
38
58
|
sidebarResizer?: boolean;
|
|
39
59
|
/** Configured theme-pack slug (ADR `docs/adr/theme-packs.md`, #2822). */
|