@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.
Files changed (129) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/agent-docs/search.js +6 -3
  3. package/dist/asset-index-page/index.js +1 -1
  4. package/dist/asset-page/index.js +1 -1
  5. package/dist/asset-path/index.d.ts +2 -0
  6. package/dist/asset-path/index.js +1 -0
  7. package/dist/catalog.js +1 -1
  8. package/dist/chrome/derive.js +14 -2
  9. package/dist/compiled.css +178 -30
  10. package/dist/config-assertions/index.d.ts +54 -0
  11. package/dist/config-assertions/index.js +205 -0
  12. package/dist/config.d.ts +12 -9
  13. package/dist/config.js +13 -0
  14. package/dist/content/index.d.ts +1 -0
  15. package/dist/content/index.js +2 -0
  16. package/dist/content/wide-section-heading.d.ts +12 -0
  17. package/dist/content/wide-section-heading.js +8 -0
  18. package/dist/content-admonition/index.d.ts +2 -1
  19. package/dist/content-admonition/index.js +2 -1
  20. package/dist/doc-body-end-islands/index.d.ts +0 -7
  21. package/dist/doc-body-end-islands/index.js +0 -6
  22. package/dist/doc-card-nav/index.d.ts +78 -0
  23. package/dist/doc-card-nav/index.js +82 -0
  24. package/dist/doc-card-nav/slug.d.ts +6 -0
  25. package/dist/doc-card-nav/slug.js +6 -0
  26. package/dist/doc-page-renderer/index.d.ts +5 -0
  27. package/dist/doc-page-renderer/index.js +7 -0
  28. package/dist/doc-page-shell/index.d.ts +12 -0
  29. package/dist/doc-page-shell/index.js +6 -1
  30. package/dist/docs-schema/index.d.ts +2 -0
  31. package/dist/docs-schema/index.js +9 -0
  32. package/dist/features.css +201 -0
  33. package/dist/frontmatter-preview-defaults/index.js +3 -1
  34. package/dist/head-with-defaults/index.d.ts +20 -0
  35. package/dist/head-with-defaults/index.js +25 -3
  36. package/dist/home-hero/index.d.ts +36 -0
  37. package/dist/home-hero/index.js +128 -0
  38. package/dist/home-page/index.js +157 -58
  39. package/dist/i18n-defaults/index.js +8 -0
  40. package/dist/mcp/constants.d.ts +11 -0
  41. package/dist/mcp/constants.js +20 -0
  42. package/dist/mcp/discovery.d.ts +45 -0
  43. package/dist/mcp/discovery.js +138 -0
  44. package/dist/mcp/handler.js +5 -9
  45. package/dist/mcp/index.d.ts +3 -0
  46. package/dist/mcp/index.js +37 -1
  47. package/dist/md-utils/index.d.ts +6 -1
  48. package/dist/md-utils/index.js +3 -2
  49. package/dist/mdx-components/index.js +4 -7
  50. package/dist/mdx-components/vocabulary.d.ts +19 -0
  51. package/dist/mdx-components/vocabulary.js +32 -0
  52. package/dist/nav-indexing/doc-card-grid.d.ts +6 -0
  53. package/dist/nav-indexing/doc-card-grid.js +26 -16
  54. package/dist/plugins/internal/agent-export/components.d.ts +27 -0
  55. package/dist/plugins/internal/agent-export/components.js +125 -0
  56. package/dist/plugins/internal/agent-export/index.d.ts +4 -0
  57. package/dist/plugins/internal/agent-export/index.js +29 -8
  58. package/dist/plugins/internal/agent-export/normalize.d.ts +18 -1
  59. package/dist/plugins/internal/agent-export/normalize.js +91 -5
  60. package/dist/plugins/internal/llms-txt/dev-middleware.d.ts +2 -0
  61. package/dist/plugins/internal/llms-txt/dev-middleware.js +6 -1
  62. package/dist/plugins/internal/llms-txt/emit.js +8 -1
  63. package/dist/plugins/internal/llms-txt/generate.d.ts +2 -0
  64. package/dist/plugins/internal/llms-txt/generate.js +3 -0
  65. package/dist/plugins/internal/llms-txt/load.js +2 -2
  66. package/dist/plugins/internal/llms-txt/types.d.ts +4 -0
  67. package/dist/plugins/internal/search-index/collect.js +5 -4
  68. package/dist/plugins/internal/search-index/types.d.ts +2 -0
  69. package/dist/plugins/routes.js +6 -1
  70. package/dist/preset.d.ts +6 -1
  71. package/dist/preset.js +13 -1
  72. package/dist/robots.d.ts +14 -0
  73. package/dist/robots.js +22 -4
  74. package/dist/route-enumerators/index.d.ts +63 -2
  75. package/dist/route-enumerators/index.js +124 -21
  76. package/dist/routes/404.js +1 -1
  77. package/dist/routes/_context.d.ts +1 -1
  78. package/dist/routes/_context.js +6 -0
  79. package/dist/routes/ai-catalog.d.ts +5 -0
  80. package/dist/routes/ai-catalog.js +28 -0
  81. package/dist/routes/mcp-server-card.d.ts +5 -0
  82. package/dist/routes/mcp-server-card.js +24 -0
  83. package/dist/routes/sitemap.xml.js +19 -9
  84. package/dist/settings-defaults.js +1 -1
  85. package/dist/settings.d.ts +102 -6
  86. package/dist/sidebar/client-data.d.ts +1 -1
  87. package/dist/sidebar/client-data.js +2 -0
  88. package/dist/sidebar/types.d.ts +4 -0
  89. package/dist/sidebar-tree/build-tree.js +1 -0
  90. package/dist/sidebar-tree/types.d.ts +4 -0
  91. package/dist/site-schema/nav-tree.js +2 -0
  92. package/dist/site-schema/types.d.ts +3 -0
  93. package/dist/site-tree-nav/index.d.ts +18 -0
  94. package/dist/site-tree-nav/index.js +18 -3
  95. package/dist/site-tree-nav/normalize-island-props.d.ts +6 -0
  96. package/dist/site-tree-nav/normalize-island-props.js +15 -0
  97. package/dist/site-tree-nav-island/count.d.ts +3 -0
  98. package/dist/site-tree-nav-island/count.js +11 -0
  99. package/dist/site-tree-nav-island/index.d.ts +22 -2
  100. package/dist/site-tree-nav-island/index.js +272 -221
  101. package/dist/tag-pages/index.d.ts +1 -0
  102. package/dist/tag-pages/index.js +2 -2
  103. package/dist/theme-packs/bauhaus/meta.json +1 -1
  104. package/dist/theme-packs/bauhaus/pack.css +2 -2
  105. package/dist/theme-packs/beacon/meta.json +1 -1
  106. package/dist/theme-packs/beacon/pack.css +0 -15
  107. package/dist/theme-packs/eink/meta.json +1 -1
  108. package/dist/theme-packs/eink/pack.css +1 -14
  109. package/dist/theme.css +0 -16
  110. package/dist/versions-page/index.d.ts +1 -0
  111. package/dist/versions-page/index.js +1 -1
  112. package/dist/wind.json +4 -6
  113. package/eject/content-admonition/index.tsx +4 -9
  114. package/eject/sidebar/client-data.ts +3 -1
  115. package/eject/sidebar/types.ts +4 -0
  116. package/eject/site-tree-nav-island/count.ts +11 -0
  117. package/eject/site-tree-nav-island/index.tsx +359 -256
  118. package/package.json +19 -7
  119. package/routes-src/404.tsx +1 -1
  120. package/routes-src/_context.ts +3 -0
  121. package/routes-src/ai-catalog.tsx +26 -0
  122. package/routes-src/mcp-server-card.tsx +21 -0
  123. package/routes-src/sitemap.xml.tsx +36 -12
  124. package/dist/find-in-page/find-bar.d.ts +0 -11
  125. package/dist/find-in-page/find-bar.js +0 -103
  126. package/dist/find-in-page/find-in-page.d.ts +0 -17
  127. package/dist/find-in-page/find-in-page.js +0 -131
  128. package/dist/find-in-page/index.d.ts +0 -5
  129. package/dist/find-in-page/index.js +0 -52
@@ -10,6 +10,7 @@ import { resolveConfiguredThemePack } from "../theme-packs-registry/configured-t
10
10
  import { renderAutoLogoIconSvg } from "../auto-logo/icon.js";
11
11
  import { deriveComposeMetaTitle, deriveColorSchemeGenerators } from "../chrome/derive.js";
12
12
  import { assertChromeContext } from "../chrome/assert-chrome-context.js";
13
+ import { AI_CATALOG_MEDIA_TYPE, AI_CATALOG_WELL_KNOWN_PATH } from "../mcp/constants.js";
13
14
  function mediaSwapHandler(media) {
14
15
  const handler = `this.media='${media ?? "all"}'`;
15
16
  if (!/^this\.media='[a-z\d\s(),:.%+\-/*<>=]*'$/i.test(handler)) {
@@ -102,14 +103,25 @@ function createHeadWithDefaults(ctx) {
102
103
  const themePackConfigured = resolveConfiguredThemePack(settings);
103
104
  const themePackBase = withBase("/");
104
105
  const faviconLinks = resolveFaviconLinks(settings.favicon, settings.siteName, withBase);
106
+ const defaultLocale = ctx.defaultLocale;
107
+ const configuredLocales = settings.locales ?? {};
108
+ const llmsTxtHref = (locale) => withBase(
109
+ locale !== void 0 && locale !== defaultLocale && Object.prototype.hasOwnProperty.call(configuredLocales, locale) ? `/${locale}/llms.txt` : "/llms.txt"
110
+ );
111
+ const publishesAiCatalog = settings.mcp === true && withBase("/") === "/";
105
112
  function HeadWithDefaults({
106
113
  title,
107
114
  description,
108
115
  canonical,
109
- alternateLinks
116
+ alternateLinks,
117
+ localeAlternates,
118
+ locale,
119
+ ogImage
110
120
  }) {
111
121
  const { metaTags } = settings;
112
- const ogImageUrl = metaTags.ogImage != null && metaTags.ogImage !== false ? absoluteUrl(withBase(metaTags.ogImage)) : void 0;
122
+ const localeOgImage = locale !== void 0 ? settings.locales?.[locale]?.ogImage : void 0;
123
+ const configuredOgImage = ogImage ?? (localeOgImage !== void 0 ? localeOgImage : metaTags.ogImage);
124
+ const ogImageUrl = configuredOgImage != null && configuredOgImage !== false ? absoluteUrl(withBase(configuredOgImage)) : void 0;
113
125
  const colorMode = settings.colorMode ? settings.colorMode : null;
114
126
  const cssText = colorMode ? generateLightDarkCssProperties() : generateCssCustomProperties();
115
127
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -151,6 +163,15 @@ function createHeadWithDefaults(ctx) {
151
163
  settings.sidebarResizer && /* @__PURE__ */ jsx("script", { rawHtml: SIDEBAR_RESIZER_RESTORE_SCRIPT }),
152
164
  faviconLinks.map((attrs, i) => /* @__PURE__ */ jsx("link", { ...attrs }, i)),
153
165
  canonical !== void 0 && /* @__PURE__ */ jsx("link", { rel: "canonical", href: canonical }),
166
+ localeAlternates?.map((alternate) => /* @__PURE__ */ jsx(
167
+ "link",
168
+ {
169
+ rel: "alternate",
170
+ hreflang: alternate.hreflang,
171
+ href: alternate.href
172
+ },
173
+ `hreflang:${alternate.hreflang}`
174
+ )),
154
175
  alternateLinks?.map((alternate, i) => /* @__PURE__ */ jsx(
155
176
  "link",
156
177
  {
@@ -161,7 +182,8 @@ function createHeadWithDefaults(ctx) {
161
182
  },
162
183
  `page-alternate:${i}`
163
184
  )),
164
- settings.agentExport && settings.llmsTxt && /* @__PURE__ */ jsx("link", { rel: "alternate", href: withBase("/llms.txt"), type: "text/plain" }),
185
+ settings.agentExport && settings.llmsTxt && /* @__PURE__ */ jsx("link", { rel: "alternate", href: llmsTxtHref(locale), type: "text/plain" }),
186
+ publishesAiCatalog && /* @__PURE__ */ jsx("link", { rel: "ai-catalog", href: AI_CATALOG_WELL_KNOWN_PATH, type: AI_CATALOG_MEDIA_TYPE }),
165
187
  ctx.settings.head && /* @__PURE__ */ jsxs(Fragment, { children: [
166
188
  ctx.settings.head.preconnect?.map((p, i) => /* @__PURE__ */ jsx(
167
189
  "link",
@@ -0,0 +1,36 @@
1
+ /** @jsxRuntime automatic */
2
+ import type { Child } from "@takazudo/zfb/zudo-react";
3
+ import type { HomeImageConfig, HomeImageLayout } from "../settings.js";
4
+ export type { HomeImageConfig, HomeImageLayout } from "../settings.js";
5
+ export { assertValidHomeImage, isRootAbsoluteSitePath } from "../config-assertions/index.js";
6
+ /** Props for {@link HomeHero}. Field meanings match the same-named settings. */
7
+ export interface HomeHeroProps {
8
+ /** Printed as the hero `<h1>`. */
9
+ siteName: string;
10
+ /** Short tagline under the title. Printed as-is; `""` leaves it blank. */
11
+ description?: string;
12
+ /** Same values as `settings.logo`. @default "auto" */
13
+ logo?: string | false;
14
+ /** Same shape as `settings.home.image`; replaces the logo when set. */
15
+ image?: HomeImageConfig;
16
+ /** Same values as `settings.home.imageLayout`. Ignored without `image`. @default "logo" */
17
+ imageLayout?: HomeImageLayout;
18
+ /** Site base, prefixed to `logo` and `image` paths. @default "/" */
19
+ base?: string;
20
+ /** Links-row items, rendered `/`-separated in order. */
21
+ links?: Child[];
22
+ /**
23
+ * Resolves a `logo` path to its URL. Defaults to prefixing `base`. The
24
+ * package route passes its page-URL helper here so existing logo output
25
+ * stays byte-identical.
26
+ */
27
+ logoHref?: (path: string) => string;
28
+ }
29
+ /** Base-prefix an asset path without the page-URL trailing-slash rule. */
30
+ export declare function homeAssetHref(base: string | undefined, path: string): string;
31
+ /**
32
+ * The home page hero: logo (or `image`), site name, description and links row.
33
+ * With the default `imageLayout` ("logo") and no `image`, the markup is exactly
34
+ * what the package home route has always emitted.
35
+ */
36
+ export declare function HomeHero({ siteName, description, logo, image, imageLayout, base, links, logoHref, }: HomeHeroProps): import("@takazudo/zfb").Description;
@@ -0,0 +1,128 @@
1
+ import { jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
2
+ import { AutoLogo } from "../auto-logo/index.js";
3
+ import { assertValidHomeImage, isRootAbsoluteSitePath } from "../config-assertions/index.js";
4
+ function cssUrl(url) {
5
+ return `url("${url.replace(/[\\"]/g, "\\$&")}")`;
6
+ }
7
+ function logoMaskStyle(url) {
8
+ const mask = `${cssUrl(url)} center/contain no-repeat`;
9
+ return { "-webkit-mask": mask, mask };
10
+ }
11
+ function homeAssetHref(base, path) {
12
+ return `${(base ?? "/").replace(/\/+$/, "")}${path}`;
13
+ }
14
+ function HomeHeroImage({
15
+ image,
16
+ layout,
17
+ base
18
+ }) {
19
+ const alt = layout === "backdrop" ? "" : image.alt ?? "";
20
+ const size = image.width !== void 0 && image.height !== void 0 ? { width: image.width, height: image.height } : {};
21
+ const variants = image.darkSrc === void 0 ? [{ src: image.src }] : [
22
+ { src: image.src, mode: "light" },
23
+ { src: image.darkSrc, mode: "dark" }
24
+ ];
25
+ const fit = layout === "backdrop" ? "object-cover" : "object-contain";
26
+ return /* @__PURE__ */ jsx(
27
+ "div",
28
+ {
29
+ class: layout === "large" ? "w-[560px] max-w-full aspect-[1200/630] shrink-0" : layout === "banner" ? "w-full aspect-[1200/630]" : layout === "backdrop" ? "zd-home-backdrop-image" : "w-[320px] max-w-full aspect-[1200/630] shrink-0",
30
+ "data-zd-home-image-box": true,
31
+ children: variants.map(({ src, mode }) => /* @__PURE__ */ jsx(
32
+ "img",
33
+ {
34
+ src: homeAssetHref(base, src),
35
+ alt,
36
+ ...size,
37
+ ...mode ? { loading: "lazy" } : {},
38
+ decoding: "async",
39
+ class: `block w-full h-full ${fit}`,
40
+ ...mode ? { "data-zd-home-image": mode } : {}
41
+ }
42
+ ))
43
+ }
44
+ );
45
+ }
46
+ function HomeHeroCopy({
47
+ siteName,
48
+ description,
49
+ rowContent,
50
+ centered
51
+ }) {
52
+ return /* @__PURE__ */ jsxs("div", { class: centered ? "zd-home-copy min-w-0" : "zd-home-copy min-w-0 lg:flex-1", children: [
53
+ /* @__PURE__ */ jsx("h1", { class: "text-heading font-bold mb-vsp-2xs zd-wrap-anywhere", "data-zd-site-name": true, children: siteName }),
54
+ /* @__PURE__ */ jsx("p", { class: "text-muted text-small mb-vsp-sm", children: description }),
55
+ /* @__PURE__ */ jsx(
56
+ "div",
57
+ {
58
+ class: centered ? "zd-home-links flex flex-wrap items-center justify-center gap-hsp-md text-small" : "zd-home-links flex flex-wrap items-center justify-center lg:justify-start gap-hsp-md text-small",
59
+ children: rowContent
60
+ }
61
+ )
62
+ ] });
63
+ }
64
+ function HomeHero({
65
+ siteName,
66
+ description,
67
+ logo = "auto",
68
+ image,
69
+ imageLayout,
70
+ base,
71
+ links = [],
72
+ logoHref
73
+ }) {
74
+ const rowContent = [];
75
+ links.forEach((item, index) => {
76
+ if (index > 0) rowContent.push(/* @__PURE__ */ jsx("span", { class: "text-muted", children: "/" }));
77
+ rowContent.push(item);
78
+ });
79
+ const layout = image ? imageLayout ?? "logo" : "logo";
80
+ const copy = /* @__PURE__ */ jsx(
81
+ HomeHeroCopy,
82
+ {
83
+ siteName,
84
+ description,
85
+ rowContent,
86
+ centered: layout === "banner" || layout === "backdrop"
87
+ }
88
+ );
89
+ if (image && layout === "banner") {
90
+ return /* @__PURE__ */ jsx("div", { "data-zd-home-hero": true, "data-zd-home-hero-layout": "banner", class: "mb-vsp-xl", children: /* @__PURE__ */ jsxs("div", { class: "zd-home-inner flex flex-col items-center text-center gap-hsp-md", children: [
91
+ /* @__PURE__ */ jsx(HomeHeroImage, { image, layout: "banner", base }),
92
+ copy
93
+ ] }) });
94
+ }
95
+ if (image && layout === "backdrop") {
96
+ return /* @__PURE__ */ jsx("div", { "data-zd-home-hero": true, "data-zd-home-hero-layout": "backdrop", class: "mb-vsp-xl", children: /* @__PURE__ */ jsxs("div", { class: "zd-home-inner zd-home-backdrop", children: [
97
+ /* @__PURE__ */ jsx(HomeHeroImage, { image, layout: "backdrop", base }),
98
+ /* @__PURE__ */ jsx("div", { class: "zd-home-backdrop-panel text-center", children: copy })
99
+ ] }) });
100
+ }
101
+ const resolveLogo = logoHref ?? ((path) => /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(path) ? path : homeAssetHref(base, path.startsWith("/") ? path : `/${path}`));
102
+ const visual = image ? /* @__PURE__ */ jsx(HomeHeroImage, { image, layout, base }) : logo === "auto" ? /* @__PURE__ */ jsx(AutoLogo, { seed: siteName, class: "w-[320px] max-w-full aspect-[1200/630] text-fg shrink-0" }) : logo !== false ? /* @__PURE__ */ jsx(
103
+ "div",
104
+ {
105
+ class: "w-[320px] max-w-full aspect-[1200/630] bg-fg shrink-0",
106
+ style: logoMaskStyle(resolveLogo(logo)),
107
+ "aria-hidden": "true"
108
+ }
109
+ ) : null;
110
+ return /* @__PURE__ */ jsx(
111
+ "div",
112
+ {
113
+ "data-zd-home-hero": true,
114
+ ...image && layout === "large" ? { "data-zd-home-hero-layout": "large" } : {},
115
+ class: "mb-vsp-xl",
116
+ children: /* @__PURE__ */ jsxs("div", { class: "zd-home-inner flex flex-col items-center justify-center text-center gap-hsp-md lg:flex-row lg:text-left lg:gap-hsp-xl", children: [
117
+ visual,
118
+ copy
119
+ ] })
120
+ }
121
+ );
122
+ }
123
+ export {
124
+ HomeHero,
125
+ assertValidHomeImage,
126
+ homeAssetHref,
127
+ isRootAbsoluteSitePath
128
+ };
@@ -1,11 +1,19 @@
1
1
  import { Fragment, jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
2
2
  import { Island } from "@takazudo/zfb";
3
- import { AutoLogo } from "../auto-logo/index.js";
3
+ import { HomeHero, homeAssetHref } from "../home-hero/index.js";
4
4
  import { DocLayoutWithDefaults } from "../doclayout/index.js";
5
5
  import { CompactProse, HOME_SECTION_HEADING_CLASS, resolveHomeIntro } from "../home-intro/index.js";
6
6
  import { SiteTreeNav } from "../site-tree-nav-island/index.js";
7
7
  import { TagNav } from "../nav-indexing/tag-nav.js";
8
8
  import { CategoryLinkIcon } from "../tree-nav-shared/index.js";
9
+ import { WideSectionHeading } from "../content/wide-section-heading.js";
10
+ import { DocCardGrid } from "../nav-indexing/doc-card-grid.js";
11
+ import {
12
+ reportDocCardDiagnostics,
13
+ resolveDocCards
14
+ } from "../doc-card-nav/index.js";
15
+ import { resolveSiteTreeNavCountLabels } from "../site-tree-nav/index.js";
16
+ import { getNoteTrayItems } from "../note-tray-model/index.js";
9
17
  import { createHeadWithDefaults } from "../head-with-defaults/index.js";
10
18
  import { resolveThemePackSsrSlug } from "../theme/theme-pack-provider.js";
11
19
  import { deriveComposeMetaTitle, deriveBodyEndIslands, deriveDateFormats } from "../chrome/derive.js";
@@ -48,12 +56,25 @@ function selectSecondaryNodes(tree, secondary, categoryIgnore) {
48
56
  }
49
57
  return moved;
50
58
  }
51
- function cssUrl(url) {
52
- return `url("${url.replace(/[\\"]/g, "\\$&")}")`;
59
+ function sectionText(section, locale, field) {
60
+ for (const value of [section.locales?.[locale]?.[field], section[field]]) {
61
+ if (value?.trim()) return value;
62
+ }
63
+ return void 0;
64
+ }
65
+ function hasCover(nodes) {
66
+ return nodes.some((node) => node.cover !== void 0 || hasCover(node.children));
67
+ }
68
+ function withoutCovers(node) {
69
+ const { cover: _cover, ...rest } = node;
70
+ return { ...rest, children: node.children.map(withoutCovers) };
53
71
  }
54
- function logoMaskStyle(url) {
55
- const mask = `${cssUrl(url)} center/contain no-repeat`;
56
- return { "-webkit-mask": mask, mask };
72
+ function withCoverHrefs(tree, base) {
73
+ if (!hasCover(tree)) return tree;
74
+ return tree.map((node) => {
75
+ const stripped = withoutCovers(node);
76
+ return node.cover === void 0 ? stripped : { ...stripped, coverHref: homeAssetHref(base, node.cover) };
77
+ });
57
78
  }
58
79
  function createHomePageView(ctx) {
59
80
  assertChromeContext(ctx, "createHomePageView");
@@ -74,6 +95,13 @@ function createHomePageView(ctx) {
74
95
  ctx.themePackRegistry,
75
96
  ctx.settings
76
97
  );
98
+ function homeLocaleAlternates() {
99
+ const alternates = ctx.getHomeLocaleAlternates().flatMap(({ hreflang, url }) => {
100
+ const href = ctx.absoluteUrl(url);
101
+ return href === void 0 ? [] : [{ hreflang, href }];
102
+ });
103
+ return alternates.length > 0 ? alternates : void 0;
104
+ }
77
105
  function HomePageView({
78
106
  locale,
79
107
  extras,
@@ -87,12 +115,14 @@ function createHomePageView(ctx) {
87
115
  wide
88
116
  }) {
89
117
  const prefix = locale === defaultLocale ? "" : `/${locale}`;
118
+ const homePath = withBase(prefix === "" ? "/" : prefix);
90
119
  const effectiveInitiallyCollapsedCategorySlugs = initiallyCollapsedCategorySlugs ?? settings.siteTreeNavInitiallyCollapsed;
91
120
  const rawDescription = settings.locales[locale]?.description ?? settings.siteDescription;
92
121
  const description = rawDescription?.trim() ? rawDescription : void 0;
93
122
  const ctaNav = settings.headerNav[0] ?? null;
94
123
  const primary = heroLink ? { href: withBase(`${prefix}${heroLink.path}`), label: t(heroLink.labelKey, locale) } : ctaNav ? { href: withBase(`${prefix}${ctaNav.path}`), label: t("nav.overview", locale) } : null;
95
124
  const logoSetting = settings.logo ?? "auto";
125
+ const homeImage = settings.home?.image;
96
126
  const resolvedExtras = extras ?? homeExtras?.({ locale });
97
127
  const intro = homeIntros?.[locale] ?? null;
98
128
  const hasIntro = Boolean(intro?.nodes.length);
@@ -135,17 +165,104 @@ function createHomePageView(ctx) {
135
165
  if (hasExtras) {
136
166
  rowItems.push(resolvedExtras);
137
167
  }
138
- const rowContent = [];
139
- rowItems.forEach((item, index) => {
140
- if (index > 0) rowContent.push(/* @__PURE__ */ jsx("span", { class: "text-muted", children: "/" }));
141
- rowContent.push(item);
142
- });
168
+ const homeSections = settings.home?.sections;
169
+ const ignoredRoots = /* @__PURE__ */ new Set([...categoryIgnore, ...movedNodes.map((n) => n.slug)]);
170
+ const treeRootCount = tree.filter(
171
+ (n) => !ignoredRoots.has(n.slug) && (n.shape !== "note-tray" || getNoteTrayItems(n).length > 0)
172
+ ).length;
173
+ const siteTreeIsland = (variant) => {
174
+ const countLabels = variant === "described" ? resolveSiteTreeNavCountLabels(t, locale) : void 0;
175
+ return Island({
176
+ when: "idle",
177
+ children: /* @__PURE__ */ jsx(
178
+ SiteTreeNav,
179
+ {
180
+ tree: withCoverHrefs(tree, settings.base),
181
+ categoryOrder,
182
+ categoryIgnore: [...ignoredRoots],
183
+ ...effectiveInitiallyCollapsedCategorySlugs !== void 0 ? { initiallyCollapsedCategorySlugs: effectiveInitiallyCollapsedCategorySlugs } : {},
184
+ ...variant === "described" ? { variant } : {},
185
+ ...countLabels ? { countLabels } : {},
186
+ locale,
187
+ updatedLabel: t("doc.updated", locale),
188
+ dateFormats: dateFormatsFor(locale)
189
+ }
190
+ )
191
+ });
192
+ };
193
+ const secondaryRow = movedNodes.length > 0 && /* @__PURE__ */ jsx(
194
+ "nav",
195
+ {
196
+ "aria-label": t("home.secondaryNav", locale),
197
+ "data-home-secondary-nav": true,
198
+ class: "flex flex-wrap items-center gap-x-hsp-xl gap-y-vsp-xs",
199
+ children: movedNodes.map((n) => /* @__PURE__ */ jsx(HomeMetaLink, { href: n.href, children: n.label }, n.slug))
200
+ }
201
+ );
202
+ function renderSiteTreeSection(section) {
203
+ const variant = section.variant ?? "default";
204
+ const headingId = "zd-home-site-tree-heading";
205
+ const sectionDescription = sectionText(section, locale, "description");
206
+ const capped = treeRootCount === 1;
207
+ return /* @__PURE__ */ jsxs(
208
+ "section",
209
+ {
210
+ "data-zd-home-sitemap": true,
211
+ "data-zd-home-section": "site-tree",
212
+ "aria-labelledby": headingId,
213
+ class: `flex w-full min-w-0 flex-col gap-vsp-md${capped ? " mx-auto max-w-[80rem]" : ""}`,
214
+ children: [
215
+ /* @__PURE__ */ jsx(WideSectionHeading, { id: headingId, children: sectionText(section, locale, "heading") ?? sitemapHeading }),
216
+ sectionDescription && /* @__PURE__ */ jsx("p", { class: "text-muted", children: sectionDescription }),
217
+ siteTreeIsland(variant),
218
+ secondaryRow
219
+ ]
220
+ }
221
+ );
222
+ }
223
+ function renderDocCardsSection(section) {
224
+ const { items, diagnostics } = resolveDocCards(section.docs, {
225
+ docs: ctx.resolveNavSource(locale, void 0, {
226
+ applyDefaultLocaleOnlyFilter: true,
227
+ keepUnlisted: true
228
+ }).navDocs,
229
+ locale,
230
+ toRouteSlug: ctx.toRouteSlug,
231
+ docsUrl: (slug, loc) => ctx.docsUrl(slug, loc)
232
+ });
233
+ reportDocCardDiagnostics(diagnostics, "home.sections doc-cards");
234
+ if (items.length === 0) return null;
235
+ const headingId = "zd-home-doc-cards-heading";
236
+ const sectionDescription = sectionText(section, locale, "description");
237
+ return /* @__PURE__ */ jsxs(
238
+ "section",
239
+ {
240
+ "data-zd-home-section": "doc-cards",
241
+ "aria-labelledby": headingId,
242
+ class: "mx-auto flex w-full min-w-0 max-w-[80rem] flex-col gap-vsp-md",
243
+ children: [
244
+ /* @__PURE__ */ jsx(WideSectionHeading, { id: headingId, children: sectionText(section, locale, "heading") ?? t("home.selectedDocsHeading", locale) }),
245
+ sectionDescription && /* @__PURE__ */ jsx("p", { class: "text-muted", children: sectionDescription }),
246
+ /* @__PURE__ */ jsx(DocCardGrid, { items, ariaLabel: t("home.selectedDocsNav", locale), layout: "auto" })
247
+ ]
248
+ }
249
+ );
250
+ }
143
251
  return /* @__PURE__ */ jsxs(
144
252
  DocLayoutWithDefaults,
145
253
  {
146
254
  title: composeMetaTitle(settings.siteName),
147
255
  description: settings.metaTags.description ? description : void 0,
148
- head: /* @__PURE__ */ jsx(HeadWithDefaults, { title: settings.siteName, description }),
256
+ head: /* @__PURE__ */ jsx(
257
+ HeadWithDefaults,
258
+ {
259
+ title: settings.siteName,
260
+ description,
261
+ canonical: ctx.absoluteUrl(homePath),
262
+ localeAlternates: homeLocaleAlternates(),
263
+ locale
264
+ }
265
+ ),
149
266
  lang: locale,
150
267
  dataThemePack,
151
268
  noindex: settings.noindex,
@@ -158,59 +275,41 @@ function createHomePageView(ctx) {
158
275
  bodyEndComponents: /* @__PURE__ */ jsx(BodyEndIslands, { basePath: settings.base ?? "/" }),
159
276
  enableClientRouter: settings.dynamicPageTransition,
160
277
  children: [
161
- /* @__PURE__ */ jsx("div", { "data-zd-home-hero": true, class: "mb-vsp-xl", children: /* @__PURE__ */ jsxs("div", { class: "zd-home-inner flex flex-col items-center justify-center text-center gap-hsp-md lg:flex-row lg:text-left lg:gap-hsp-xl", children: [
162
- logoSetting === "auto" ? /* @__PURE__ */ jsx(
163
- AutoLogo,
164
- {
165
- seed: settings.siteName,
166
- class: "w-[320px] max-w-full aspect-[1200/630] text-fg shrink-0"
167
- }
168
- ) : logoSetting !== false ? /* @__PURE__ */ jsx(
169
- "div",
170
- {
171
- class: "w-[320px] max-w-full aspect-[1200/630] bg-fg shrink-0",
172
- style: logoMaskStyle(withBase(logoSetting)),
173
- "aria-hidden": "true"
174
- }
175
- ) : null,
176
- /* @__PURE__ */ jsxs("div", { class: "zd-home-copy min-w-0 lg:flex-1", children: [
177
- /* @__PURE__ */ jsx("h1", { class: "text-heading font-bold mb-vsp-2xs zd-wrap-anywhere", "data-zd-site-name": true, children: settings.siteName }),
178
- /* @__PURE__ */ jsx("p", { class: "text-muted text-small mb-vsp-sm", children: rawDescription }),
179
- /* @__PURE__ */ jsx("div", { class: "zd-home-links flex flex-wrap items-center justify-center lg:justify-start gap-hsp-md text-small", children: rowContent })
180
- ] })
181
- ] }) }),
278
+ /* @__PURE__ */ jsx(
279
+ HomeHero,
280
+ {
281
+ siteName: settings.siteName,
282
+ description: rawDescription,
283
+ logo: logoSetting,
284
+ image: homeImage,
285
+ imageLayout: settings.home?.imageLayout,
286
+ base: settings.base,
287
+ links: rowItems,
288
+ logoHref: withBase
289
+ }
290
+ ),
182
291
  hasIntro && /* @__PURE__ */ jsxs(Fragment, { children: [
183
292
  /* @__PURE__ */ jsx("hr", { class: "zd-home-rule", "data-home-rule": "upper" }),
184
293
  /* @__PURE__ */ jsx("div", { "data-zd-home-intro": true, children: /* @__PURE__ */ jsx("div", { class: "zd-home-inner", children: /* @__PURE__ */ jsx(CompactProse, { intro }) }) })
185
294
  ] }),
186
- /* @__PURE__ */ jsx("hr", { class: "zd-home-rule", "data-home-rule": "lower" }),
187
- /* @__PURE__ */ jsxs("section", { "data-zd-home-sitemap": true, children: [
188
- /* @__PURE__ */ jsx(HomeSectionHeading, { children: sitemapHeading }),
189
- Island({
190
- when: "idle",
191
- children: /* @__PURE__ */ jsx(
192
- SiteTreeNav,
295
+ homeSections === void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
296
+ /* @__PURE__ */ jsx("hr", { class: "zd-home-rule", "data-home-rule": "lower" }),
297
+ /* @__PURE__ */ jsxs("section", { "data-zd-home-sitemap": true, children: [
298
+ /* @__PURE__ */ jsx(HomeSectionHeading, { children: sitemapHeading }),
299
+ siteTreeIsland("default"),
300
+ movedNodes.length > 0 && /* @__PURE__ */ jsx(
301
+ "nav",
193
302
  {
194
- tree,
195
- categoryOrder,
196
- categoryIgnore: [...categoryIgnore, ...movedNodes.map((n) => n.slug)],
197
- ...effectiveInitiallyCollapsedCategorySlugs !== void 0 ? { initiallyCollapsedCategorySlugs: effectiveInitiallyCollapsedCategorySlugs } : {},
198
- locale,
199
- updatedLabel: t("doc.updated", locale),
200
- dateFormats: dateFormatsFor(locale)
303
+ "aria-label": t("home.secondaryNav", locale),
304
+ "data-home-secondary-nav": true,
305
+ class: "mt-vsp-md flex flex-wrap items-center gap-x-hsp-xl gap-y-vsp-xs",
306
+ children: movedNodes.map((n) => /* @__PURE__ */ jsx(HomeMetaLink, { href: n.href, children: n.label }, n.slug))
201
307
  }
202
308
  )
203
- }),
204
- movedNodes.length > 0 && /* @__PURE__ */ jsx(
205
- "nav",
206
- {
207
- "aria-label": t("home.secondaryNav", locale),
208
- "data-home-secondary-nav": true,
209
- class: "mt-vsp-md flex flex-wrap items-center gap-x-hsp-xl gap-y-vsp-xs",
210
- children: movedNodes.map((n) => /* @__PURE__ */ jsx(HomeMetaLink, { href: n.href, children: n.label }, n.slug))
211
- }
212
- )
213
- ] }),
309
+ ] })
310
+ ] }) : /* @__PURE__ */ jsx("div", { "data-zd-home-sections": true, class: "mt-vsp-2xl flex flex-col gap-vsp-2xl", children: homeSections.map(
311
+ (section) => section.type === "doc-cards" ? renderDocCardsSection(section) : renderSiteTreeSection(section)
312
+ ) }),
214
313
  settings.docTags && tagCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
215
314
  /* @__PURE__ */ jsx("hr", { class: "zd-home-rule", "data-home-rule": "tags" }),
216
315
  /* @__PURE__ */ jsx("section", { "data-zd-home-tags": true, children: tags && tags.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -2,6 +2,10 @@ const defaultTranslations = {
2
2
  en: {
3
3
  "home.sitemapHeading": "Explore the documentation",
4
4
  "home.secondaryNav": "More categories",
5
+ "home.selectedDocsHeading": "Start here",
6
+ "home.selectedDocsNav": "Selected documents",
7
+ "siteTreeNav.documentCount.one": "{count} document",
8
+ "siteTreeNav.documentCount.other": "{count} documents",
5
9
  "nav.gettingStarted": "Getting Started",
6
10
  "nav.learn": "Learn",
7
11
  "nav.guides": "Guides",
@@ -137,6 +141,10 @@ const defaultTranslations = {
137
141
  ja: {
138
142
  "home.sitemapHeading": "\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8\u3092\u63A2\u3059",
139
143
  "home.secondaryNav": "\u305D\u306E\u4ED6\u306E\u30AB\u30C6\u30B4\u30EA",
144
+ "home.selectedDocsHeading": "\u307E\u305A\u306F\u3053\u3053\u304B\u3089",
145
+ "home.selectedDocsNav": "\u9078\u3093\u3060\u6587\u66F8",
146
+ "siteTreeNav.documentCount.one": "{count} \u4EF6\u306E\u6587\u66F8",
147
+ "siteTreeNav.documentCount.other": "{count} \u4EF6\u306E\u6587\u66F8",
140
148
  "nav.gettingStarted": "\u306F\u3058\u3081\u306B",
141
149
  "nav.learn": "\u5B66\u3076",
142
150
  "nav.guides": "\u30AC\u30A4\u30C9",
@@ -0,0 +1,11 @@
1
+ /** `serverInfo` reported by `initialize`; the Server Card restates the version. */
2
+ export declare const MCP_SERVER_NAME = "zudo-doc";
3
+ export declare const MCP_SERVER_VERSION = "1.0.0";
4
+ /** Streamable HTTP endpoint under the site base; SEP-2127 reserves `<endpoint>/server-card` for a hosted card. */
5
+ export declare const MCP_ENDPOINT_PATH = "/mcp";
6
+ export declare const MCP_SERVER_CARD_PATH = "/mcp/server-card";
7
+ export declare const MCP_SERVER_CARD_SCHEMA = "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";
8
+ export declare const MCP_SERVER_CARD_MEDIA_TYPE = "application/mcp-server-card+json";
9
+ export declare const AI_CATALOG_MEDIA_TYPE = "application/ai-catalog+json";
10
+ export declare const AI_CATALOG_SPEC_VERSION = "1.0";
11
+ export declare const AI_CATALOG_WELL_KNOWN_PATH = "/.well-known/ai-catalog.json";
@@ -0,0 +1,20 @@
1
+ const MCP_SERVER_NAME = "zudo-doc";
2
+ const MCP_SERVER_VERSION = "1.0.0";
3
+ const MCP_ENDPOINT_PATH = "/mcp";
4
+ const MCP_SERVER_CARD_PATH = `${MCP_ENDPOINT_PATH}/server-card`;
5
+ const MCP_SERVER_CARD_SCHEMA = "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";
6
+ const MCP_SERVER_CARD_MEDIA_TYPE = "application/mcp-server-card+json";
7
+ const AI_CATALOG_MEDIA_TYPE = "application/ai-catalog+json";
8
+ const AI_CATALOG_SPEC_VERSION = "1.0";
9
+ const AI_CATALOG_WELL_KNOWN_PATH = "/.well-known/ai-catalog.json";
10
+ export {
11
+ AI_CATALOG_MEDIA_TYPE,
12
+ AI_CATALOG_SPEC_VERSION,
13
+ AI_CATALOG_WELL_KNOWN_PATH,
14
+ MCP_ENDPOINT_PATH,
15
+ MCP_SERVER_CARD_MEDIA_TYPE,
16
+ MCP_SERVER_CARD_PATH,
17
+ MCP_SERVER_CARD_SCHEMA,
18
+ MCP_SERVER_NAME,
19
+ MCP_SERVER_VERSION
20
+ };
@@ -0,0 +1,45 @@
1
+ export interface McpServerCard {
2
+ $schema: string;
3
+ name: string;
4
+ version: string;
5
+ description: string;
6
+ title?: string;
7
+ websiteUrl: string;
8
+ remotes: Array<{
9
+ type: "streamable-http";
10
+ url: string;
11
+ supportedProtocolVersions: string[];
12
+ }>;
13
+ }
14
+ export interface AiCatalog {
15
+ specVersion: string;
16
+ host: {
17
+ displayName: string;
18
+ identifier: string;
19
+ documentationUrl: string;
20
+ };
21
+ entries: Array<{
22
+ identifier: string;
23
+ displayName: string;
24
+ type: string;
25
+ url: string;
26
+ }>;
27
+ }
28
+ export interface McpDiscoveryOptions {
29
+ /** Configured site base, e.g. `/` or `/manual/`. */
30
+ base: string;
31
+ siteName: string;
32
+ /** Public origin, from {@link mcpPublicOrigin}. */
33
+ origin: string;
34
+ }
35
+ /** `""` for a root deployment, otherwise `/segment[/segment…]` without a trailing slash. */
36
+ export declare function mcpBasePath(base: string): string;
37
+ /** The origin the MCP handler cites and the discovery documents advertise: an http(s) `siteUrl` origin, else the request origin. */
38
+ export declare function mcpPublicOrigin(siteUrl: string | undefined, requestUrl: string): string;
39
+ export declare function mcpEndpointUrl(options: Pick<McpDiscoveryOptions, "base" | "origin">): string;
40
+ export declare function mcpServerCardUrl(options: Pick<McpDiscoveryOptions, "base" | "origin">): string;
41
+ export declare function buildMcpServerCard(options: McpDiscoveryOptions): McpServerCard;
42
+ /** Root-deployment catalog. ARD §4.2 requires an entry `displayName`; the AI Catalog spec leaves `description` and `version` to the card. */
43
+ export declare function buildAiCatalog(options: McpDiscoveryOptions): AiCatalog;
44
+ /** Read-only JSON discovery response: GET/HEAD with a validator, CORS preflight, 405 otherwise. */
45
+ export declare function respondWithDiscoveryDocument(request: Request, document: unknown, mediaType: string): Promise<Response>;