@takazudo/zudo-doc 10.0.3 → 11.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 (102) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/asset-index-page/index.js +1 -1
  3. package/dist/asset-page/index.js +1 -1
  4. package/dist/asset-path/index.d.ts +2 -0
  5. package/dist/asset-path/index.js +1 -0
  6. package/dist/catalog.js +1 -1
  7. package/dist/chrome/derive.js +14 -2
  8. package/dist/compiled.css +178 -30
  9. package/dist/config-assertions/index.d.ts +54 -0
  10. package/dist/config-assertions/index.js +205 -0
  11. package/dist/config.d.ts +12 -9
  12. package/dist/config.js +8 -0
  13. package/dist/content/index.d.ts +1 -0
  14. package/dist/content/index.js +2 -0
  15. package/dist/content/wide-section-heading.d.ts +12 -0
  16. package/dist/content/wide-section-heading.js +8 -0
  17. package/dist/doc-body-end-islands/index.d.ts +0 -7
  18. package/dist/doc-body-end-islands/index.js +0 -6
  19. package/dist/doc-card-nav/index.d.ts +78 -0
  20. package/dist/doc-card-nav/index.js +82 -0
  21. package/dist/doc-card-nav/slug.d.ts +6 -0
  22. package/dist/doc-card-nav/slug.js +6 -0
  23. package/dist/doc-page-renderer/index.d.ts +1 -0
  24. package/dist/doc-page-renderer/index.js +2 -0
  25. package/dist/doc-page-shell/index.d.ts +3 -0
  26. package/dist/doc-page-shell/index.js +4 -1
  27. package/dist/docs-schema/index.d.ts +2 -0
  28. package/dist/docs-schema/index.js +9 -0
  29. package/dist/features.css +201 -0
  30. package/dist/frontmatter-preview-defaults/index.js +3 -1
  31. package/dist/head-with-defaults/index.d.ts +11 -0
  32. package/dist/head-with-defaults/index.js +15 -3
  33. package/dist/home-hero/index.d.ts +36 -0
  34. package/dist/home-hero/index.js +128 -0
  35. package/dist/home-page/index.js +149 -58
  36. package/dist/i18n-defaults/index.js +8 -0
  37. package/dist/mcp/constants.d.ts +11 -0
  38. package/dist/mcp/constants.js +20 -0
  39. package/dist/mcp/discovery.d.ts +45 -0
  40. package/dist/mcp/discovery.js +138 -0
  41. package/dist/mcp/handler.js +4 -2
  42. package/dist/mcp/index.d.ts +3 -0
  43. package/dist/mcp/index.js +37 -1
  44. package/dist/nav-indexing/doc-card-grid.d.ts +6 -0
  45. package/dist/nav-indexing/doc-card-grid.js +26 -16
  46. package/dist/plugins/internal/llms-txt/dev-middleware.js +5 -1
  47. package/dist/plugins/internal/llms-txt/emit.js +5 -1
  48. package/dist/plugins/internal/llms-txt/generate.d.ts +2 -0
  49. package/dist/plugins/internal/llms-txt/generate.js +3 -0
  50. package/dist/plugins/routes.js +6 -1
  51. package/dist/preset.d.ts +4 -1
  52. package/dist/preset.js +8 -0
  53. package/dist/robots.d.ts +14 -0
  54. package/dist/robots.js +22 -4
  55. package/dist/routes/404.js +1 -1
  56. package/dist/routes/ai-catalog.d.ts +5 -0
  57. package/dist/routes/ai-catalog.js +28 -0
  58. package/dist/routes/mcp-server-card.d.ts +5 -0
  59. package/dist/routes/mcp-server-card.js +24 -0
  60. package/dist/settings-defaults.js +1 -1
  61. package/dist/settings.d.ts +102 -6
  62. package/dist/sidebar/client-data.d.ts +1 -1
  63. package/dist/sidebar/client-data.js +2 -0
  64. package/dist/sidebar/types.d.ts +4 -0
  65. package/dist/sidebar-tree/build-tree.js +1 -0
  66. package/dist/sidebar-tree/types.d.ts +4 -0
  67. package/dist/site-schema/nav-tree.js +2 -0
  68. package/dist/site-schema/types.d.ts +3 -0
  69. package/dist/site-tree-nav/index.d.ts +18 -0
  70. package/dist/site-tree-nav/index.js +18 -3
  71. package/dist/site-tree-nav/normalize-island-props.d.ts +6 -0
  72. package/dist/site-tree-nav/normalize-island-props.js +15 -0
  73. package/dist/site-tree-nav-island/count.d.ts +3 -0
  74. package/dist/site-tree-nav-island/count.js +11 -0
  75. package/dist/site-tree-nav-island/index.d.ts +22 -2
  76. package/dist/site-tree-nav-island/index.js +272 -221
  77. package/dist/tag-pages/index.d.ts +1 -0
  78. package/dist/tag-pages/index.js +2 -2
  79. package/dist/theme-packs/bauhaus/meta.json +1 -1
  80. package/dist/theme-packs/bauhaus/pack.css +2 -2
  81. package/dist/theme-packs/beacon/meta.json +1 -1
  82. package/dist/theme-packs/beacon/pack.css +0 -15
  83. package/dist/theme-packs/eink/meta.json +1 -1
  84. package/dist/theme-packs/eink/pack.css +1 -14
  85. package/dist/theme.css +0 -16
  86. package/dist/versions-page/index.d.ts +1 -0
  87. package/dist/versions-page/index.js +1 -1
  88. package/dist/wind.json +4 -6
  89. package/eject/sidebar/client-data.ts +3 -1
  90. package/eject/sidebar/types.ts +4 -0
  91. package/eject/site-tree-nav-island/count.ts +11 -0
  92. package/eject/site-tree-nav-island/index.tsx +359 -256
  93. package/package.json +19 -7
  94. package/routes-src/404.tsx +1 -1
  95. package/routes-src/ai-catalog.tsx +26 -0
  96. package/routes-src/mcp-server-card.tsx +21 -0
  97. package/dist/find-in-page/find-bar.d.ts +0 -11
  98. package/dist/find-in-page/find-bar.js +0 -103
  99. package/dist/find-in-page/find-in-page.d.ts +0 -17
  100. package/dist/find-in-page/find-in-page.js +0 -131
  101. package/dist/find-in-page/index.d.ts +0 -5
  102. package/dist/find-in-page/index.js +0 -52
@@ -68,6 +68,60 @@ export interface HeaderBrandSubject {
68
68
  * every page header. Fail loudly at config resolution, naming the field.
69
69
  */
70
70
  export declare function assertValidHeaderBrand(settings: HeaderBrandSubject): void;
71
+ /** Structural subset of `Settings` {@link assertValidHomeImage} reads. */
72
+ export interface HomeImageSubject {
73
+ home?: unknown;
74
+ }
75
+ /**
76
+ * True for a root-absolute site path: one leading `/` (never `//`, which is
77
+ * protocol-relative), no backslash and no C0/C1 control character. Such a
78
+ * path can only resolve to the site's own origin, which keeps `home.image`
79
+ * compatible with a strict `img-src 'self'` policy.
80
+ */
81
+ export declare function isRootAbsoluteSitePath(value: string): boolean;
82
+ /**
83
+ * Validate `home.imageLayout` (one of the four layouts, when present) and
84
+ * `home.image`: absent, or `{ src, alt?, width?, height?, darkSrc? }`
85
+ * with root-absolute `src`/`darkSrc`, a string `alt`, and positive-integer
86
+ * `width`/`height` given together. Unknown keys are rejected so a typo such
87
+ * as `dark` fails loudly instead of being ignored. Throws a `TypeError`
88
+ * naming the field.
89
+ */
90
+ export declare function assertValidHomeImage(settings: HomeImageSubject): void;
91
+ /** Structural subset of `Settings` that `assertValidContentSignals` reads. */
92
+ export interface ContentSignalsSubject {
93
+ contentSignals?: unknown;
94
+ }
95
+ /**
96
+ * Reject a malformed `contentSignals` at config resolution: it must be
97
+ * `false`, absent, or an object whose only keys are `search`, `aiInput` and
98
+ * `aiTrain`, each `true`, `false` or omitted. A typo would otherwise drop the
99
+ * signal from robots.txt without any diagnostic.
100
+ */
101
+ export declare function assertValidContentSignals(settings: ContentSignalsSubject): void;
102
+ /** Structural subset of `Settings` {@link assertValidLocaleOgImages} reads. */
103
+ export interface LocaleOgImageSubject {
104
+ locales?: unknown;
105
+ }
106
+ /**
107
+ * Validate every `locales.<code>.ogImage`: absent, `false`, or a root-absolute
108
+ * site path (it is base-prefixed and joined to `siteUrl`, so an external URL
109
+ * would produce a broken og:image). Throws a `TypeError` naming the locale.
110
+ */
111
+ export declare function assertValidLocaleOgImages(settings: LocaleOgImageSubject): void;
112
+ /**
113
+ * Validate `home.sections`: absent, or an array holding exactly one
114
+ * `{ type: "site-tree" }` and at most one `{ type: "doc-cards", docs }`, in
115
+ * either order. Every field is serializable presentation data — unknown
116
+ * kinds, unknown keys, non-string text, invalid variants and non-canonical
117
+ * slugs (leading/trailing `/`, whitespace, URLs) throw a `TypeError` naming
118
+ * the entry. Whether a slug matches a published document is checked at
119
+ * render time against the content (see `DocCardNav`).
120
+ */
121
+ export declare function assertValidHomeSections(settings: HomeImageSubject & {
122
+ defaultLocale?: unknown;
123
+ locales?: unknown;
124
+ }): void;
71
125
  /** Structural subset of `Settings` the zdtp-bundling helpers read. */
72
126
  export interface ZdtpBundlingSubject {
73
127
  designTokenPanel?: boolean;
@@ -1,3 +1,6 @@
1
+ import { CONTROL_CHARS } from "../asset-path/index.js";
2
+ import { CONTENT_SIGNAL_KEYS } from "../robots.js";
3
+ import { isCanonicalDocSlug } from "../doc-card-nav/slug.js";
1
4
  function assertAgentDocsConsistent(settings) {
2
5
  if (settings.agentExport !== void 0 && typeof settings.agentExport !== "boolean") {
3
6
  throw new TypeError("agentExport must be a boolean.");
@@ -47,6 +50,203 @@ function assertValidHeaderBrand(settings) {
47
50
  );
48
51
  }
49
52
  }
53
+ const HOME_IMAGE_KEYS = /* @__PURE__ */ new Set(["src", "alt", "width", "height", "darkSrc"]);
54
+ const HOME_IMAGE_LAYOUTS = /* @__PURE__ */ new Set(["logo", "large", "banner", "backdrop"]);
55
+ function isRootAbsoluteSitePath(value) {
56
+ if (!value.startsWith("/") || value.startsWith("//")) return false;
57
+ return !value.includes("\\") && !CONTROL_CHARS.test(value);
58
+ }
59
+ function assertValidHomeImage(settings) {
60
+ const home = settings.home;
61
+ if (home === void 0 || home === null || typeof home !== "object") return;
62
+ const layout = home.imageLayout;
63
+ if (layout !== void 0 && !HOME_IMAGE_LAYOUTS.has(layout)) {
64
+ throw new TypeError(
65
+ `Invalid home.imageLayout ${describeValue(layout)}: must be one of "logo", "large", "banner", "backdrop".`
66
+ );
67
+ }
68
+ const value = home.image;
69
+ if (value === void 0) return;
70
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
71
+ throw new TypeError(
72
+ `Invalid home.image ${describeValue(value)}: omit it, or pass an object { src: "/img/hero.png" }.`
73
+ );
74
+ }
75
+ for (const key of Object.keys(value)) {
76
+ if (!HOME_IMAGE_KEYS.has(key)) {
77
+ throw new TypeError(
78
+ `Invalid home.image: unknown key "${key}". Allowed keys: src, alt, width, height, darkSrc.`
79
+ );
80
+ }
81
+ }
82
+ const image = value;
83
+ const checkPath = (field) => {
84
+ const path = image[field];
85
+ if (typeof path !== "string" || !isRootAbsoluteSitePath(path)) {
86
+ throw new TypeError(
87
+ `Invalid home.image.${field} ${describeValue(path)}: must be a root-absolute site path such as "/img/hero.png" (no external URL, no "//", no backslash or control character).`
88
+ );
89
+ }
90
+ };
91
+ checkPath("src");
92
+ if (image.darkSrc !== void 0) checkPath("darkSrc");
93
+ if (image.alt !== void 0 && typeof image.alt !== "string") {
94
+ throw new TypeError(`Invalid home.image.alt ${describeValue(image.alt)}: must be a string.`);
95
+ }
96
+ const hasWidth = image.width !== void 0;
97
+ const hasHeight = image.height !== void 0;
98
+ if (hasWidth !== hasHeight) {
99
+ throw new TypeError(
100
+ "Invalid home.image: width and height must be given together, or both omitted."
101
+ );
102
+ }
103
+ for (const field of ["width", "height"]) {
104
+ const n = image[field];
105
+ if (n !== void 0 && (typeof n !== "number" || !Number.isInteger(n) || n <= 0)) {
106
+ throw new TypeError(
107
+ `Invalid home.image.${field} ${describeValue(n)}: must be a positive integer (pixels).`
108
+ );
109
+ }
110
+ }
111
+ }
112
+ function assertValidContentSignals(settings) {
113
+ const value = settings.contentSignals;
114
+ if (value === void 0 || value === false) return;
115
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
116
+ throw new TypeError(
117
+ `Invalid contentSignals ${describeValue(value)}: pass false, or an object such as { search: true, aiInput: true, aiTrain: false }.`
118
+ );
119
+ }
120
+ for (const [key, signal] of Object.entries(value)) {
121
+ if (!CONTENT_SIGNAL_KEYS.includes(key)) {
122
+ throw new TypeError(
123
+ `Invalid contentSignals: unknown key "${key}". Allowed keys: ${CONTENT_SIGNAL_KEYS.join(", ")}.`
124
+ );
125
+ }
126
+ if (signal !== void 0 && typeof signal !== "boolean") {
127
+ throw new TypeError(
128
+ `Invalid contentSignals.${key} ${describeValue(signal)}: must be true, false or omitted.`
129
+ );
130
+ }
131
+ }
132
+ }
133
+ function assertValidLocaleOgImages(settings) {
134
+ const locales = settings.locales;
135
+ if (locales === void 0 || locales === null || typeof locales !== "object") return;
136
+ for (const [code, config] of Object.entries(locales)) {
137
+ if (config === null || typeof config !== "object") continue;
138
+ const value = config.ogImage;
139
+ if (value === void 0 || value === false) continue;
140
+ if (typeof value !== "string" || !isRootAbsoluteSitePath(value)) {
141
+ throw new TypeError(
142
+ `Invalid locales.${code}.ogImage ${describeValue(value)}: pass false, or a root-absolute site path such as "/img/ogp-${code}.png".`
143
+ );
144
+ }
145
+ }
146
+ }
147
+ const HOME_SECTION_KEYS = {
148
+ "doc-cards": /* @__PURE__ */ new Set(["type", "heading", "description", "docs", "locales"]),
149
+ "site-tree": /* @__PURE__ */ new Set(["type", "heading", "description", "variant", "locales"])
150
+ };
151
+ const HOME_SECTION_LOCALE_KEYS = /* @__PURE__ */ new Set(["heading", "description"]);
152
+ function isPlainRecord(value) {
153
+ return typeof value === "object" && value !== null && !Array.isArray(value);
154
+ }
155
+ function assertValidHomeSections(settings) {
156
+ const home = settings.home;
157
+ if (home === void 0 || home === null || typeof home !== "object") return;
158
+ const value = home.sections;
159
+ if (value === void 0) return;
160
+ if (!Array.isArray(value)) {
161
+ throw new TypeError(
162
+ `Invalid home.sections ${describeValue(value)}: omit it, or pass an array such as [{ type: "site-tree" }].`
163
+ );
164
+ }
165
+ const knownLocales = typeof settings.defaultLocale === "string" ? /* @__PURE__ */ new Set([settings.defaultLocale, ...isPlainRecord(settings.locales) ? Object.keys(settings.locales) : []]) : void 0;
166
+ const counts = { "doc-cards": 0, "site-tree": 0 };
167
+ value.forEach((entry, index) => {
168
+ const at = `home.sections[${index}]`;
169
+ if (!isPlainRecord(entry)) {
170
+ throw new TypeError(`Invalid ${at} ${describeValue(entry)}: each section must be an object.`);
171
+ }
172
+ const type = entry.type;
173
+ if (type !== "doc-cards" && type !== "site-tree") {
174
+ throw new TypeError(
175
+ `Invalid ${at}.type ${describeValue(type)}: allowed section types are "doc-cards" and "site-tree".`
176
+ );
177
+ }
178
+ const allowed = HOME_SECTION_KEYS[type];
179
+ for (const key of Object.keys(entry)) {
180
+ if (!allowed.has(key)) {
181
+ throw new TypeError(
182
+ `Invalid ${at}: unknown key "${key}" for a "${type}" section. Allowed keys: ${[...allowed].join(", ")}.`
183
+ );
184
+ }
185
+ }
186
+ for (const field of ["heading", "description"]) {
187
+ if (entry[field] !== void 0 && typeof entry[field] !== "string") {
188
+ throw new TypeError(`Invalid ${at}.${field} ${describeValue(entry[field])}: must be a string.`);
189
+ }
190
+ }
191
+ if (entry.locales !== void 0) {
192
+ if (!isPlainRecord(entry.locales)) {
193
+ throw new TypeError(
194
+ `Invalid ${at}.locales ${describeValue(entry.locales)}: must be an object keyed by locale code.`
195
+ );
196
+ }
197
+ for (const [code, text] of Object.entries(entry.locales)) {
198
+ if (knownLocales && !knownLocales.has(code)) {
199
+ throw new TypeError(
200
+ `Invalid ${at}.locales.${code}: unknown locale code. Configured locales: ${[...knownLocales].join(", ")}.`
201
+ );
202
+ }
203
+ if (!isPlainRecord(text)) {
204
+ throw new TypeError(`Invalid ${at}.locales.${code} ${describeValue(text)}: must be an object.`);
205
+ }
206
+ for (const [key, v] of Object.entries(text)) {
207
+ if (!HOME_SECTION_LOCALE_KEYS.has(key)) {
208
+ throw new TypeError(
209
+ `Invalid ${at}.locales.${code}: unknown key "${key}". Allowed keys: heading, description.`
210
+ );
211
+ }
212
+ if (v !== void 0 && typeof v !== "string") {
213
+ throw new TypeError(`Invalid ${at}.locales.${code}.${key} ${describeValue(v)}: must be a string.`);
214
+ }
215
+ }
216
+ }
217
+ }
218
+ if (type === "doc-cards") {
219
+ const docs = entry.docs;
220
+ if (!Array.isArray(docs)) {
221
+ throw new TypeError(
222
+ `Invalid ${at}.docs ${describeValue(docs)}: must be an array of canonical document slugs such as ["getting-started/introduction"].`
223
+ );
224
+ }
225
+ docs.forEach((slug, i) => {
226
+ if (!isCanonicalDocSlug(slug)) {
227
+ throw new TypeError(
228
+ `Invalid ${at}.docs[${i}] ${describeValue(slug)}: must be a canonical document slug such as "getting-started/introduction" (no leading or trailing "/", no URL).`
229
+ );
230
+ }
231
+ });
232
+ } else if (entry.variant !== void 0 && entry.variant !== "default" && entry.variant !== "described") {
233
+ throw new TypeError(
234
+ `Invalid ${at}.variant ${describeValue(entry.variant)}: must be "default" or "described".`
235
+ );
236
+ }
237
+ counts[type] += 1;
238
+ });
239
+ if (counts["site-tree"] !== 1) {
240
+ throw new TypeError(
241
+ `Invalid home.sections: exactly one { type: "site-tree" } section is required (found ${counts["site-tree"]}).`
242
+ );
243
+ }
244
+ if (counts["doc-cards"] > 1) {
245
+ throw new TypeError(
246
+ `Invalid home.sections: at most one { type: "doc-cards" } section is allowed (found ${counts["doc-cards"]}).`
247
+ );
248
+ }
249
+ }
50
250
  function describeValue(value) {
51
251
  if (value === void 0) return "undefined";
52
252
  if (Array.isArray(value)) return "(array)";
@@ -116,9 +316,14 @@ function warnAmbiguousDropdownCategoryMatch(headerNav, logger = console) {
116
316
  export {
117
317
  assertAgentDocsConsistent,
118
318
  assertNoEmptyStringFaviconOrLogo,
319
+ assertValidContentSignals,
119
320
  assertValidHeaderBrand,
321
+ assertValidHomeImage,
322
+ assertValidHomeSections,
323
+ assertValidLocaleOgImages,
120
324
  assertValidSearchMaxBodyLength,
121
325
  assertZdtpBundlingConsistent,
326
+ isRootAbsoluteSitePath,
122
327
  resolvesBundleZdtp,
123
328
  warnAmbiguousDropdownCategoryMatch
124
329
  };
package/dist/config.d.ts CHANGED
@@ -70,7 +70,7 @@ import type { ZfbConfig, BundleConfig, WindConfig } from "@takazudo/zfb/config";
70
70
  import type { ZodType } from "zod";
71
71
  import type { DirectiveVocabulary, PresetTranslations, PresetTagVocabularyEntry } from "./preset.js";
72
72
  import type { ColorScheme } from "./color-scheme-utils.js";
73
- import type { Settings, ColorModeConfig, LocaleConfig, MetaTagsConfig, SiteHeadConfig, TagPlacement, TagGovernanceMode, VersionConfig, FooterConfig, HeaderNavItem, HeaderRightItem, HomeConfig, AssetViewerIndexingConfig, FrontmatterPreviewConfig, BodyFootUtilAreaConfig, HtmlPreviewConfig, FaviconConfig, HeaderBrandConfig, DateFormatSetting } from "./settings.js";
73
+ import type { Settings, ColorModeConfig, ContentSignalsConfig, LocaleConfig, MetaTagsConfig, SiteHeadConfig, TagPlacement, TagGovernanceMode, VersionConfig, FooterConfig, HeaderNavItem, HeaderRightItem, HomeConfig, AssetViewerIndexingConfig, FrontmatterPreviewConfig, BodyFootUtilAreaConfig, HtmlPreviewConfig, FaviconConfig, HeaderBrandConfig, DateFormatSetting } from "./settings.js";
74
74
  /** The `settings.claudeResources` block (or `false` when disabled). */
75
75
  type ClaudeResourcesConfig = {
76
76
  claudeDir: string;
@@ -156,7 +156,9 @@ export interface ZudoDocConfig {
156
156
  trailingSlash?: boolean;
157
157
  /**
158
158
  * Package-owned home-page layout. Set `wide: true` to let the category grid
159
- * fill most of the viewport on both `/` and locale home routes.
159
+ * fill most of the viewport on both `/` and locale home routes. The optional
160
+ * `sections` recipe (one `site-tree`, at most one `doc-cards`, either order)
161
+ * replaces the legacy sitemap block; it is omitted by default.
160
162
  * @default { wide: false, introMarkdown: "", sitemapHeading: "" }
161
163
  */
162
164
  home?: HomeConfig;
@@ -245,6 +247,14 @@ export interface ZudoDocConfig {
245
247
  * @default false
246
248
  */
247
249
  noindex?: boolean;
250
+ /**
251
+ * Content Signals (https://contentsignals.org) published in `robots.txt` as
252
+ * `Content-Signal: search=…, ai-input=…, ai-train=…`. `true` is `yes`,
253
+ * `false` is `no`, an omitted key expresses no preference, and `false`
254
+ * publishes no line.
255
+ * @default false
256
+ */
257
+ contentSignals?: ContentSignalsConfig | false;
248
258
  /**
249
259
  * "Edit this page" link base, or `false` to omit.
250
260
  * @default false
@@ -435,13 +445,6 @@ export interface ZudoDocConfig {
435
445
  * @default false
436
446
  */
437
447
  imageEnlarge?: boolean;
438
- /**
439
- * Mount the `FindInPageInit` island (Cmd/Ctrl+F find bar). Self-gates on
440
- * `window.__TAURI_INTERNALS__`, so it is a safe no-op outside a Tauri
441
- * shell even when `true`.
442
- * @default false
443
- */
444
- findInPage?: boolean;
445
448
  /**
446
449
  * Enable the dynamic (view-transition) page-loading overlay.
447
450
  * @default false
package/dist/config.js CHANGED
@@ -8,6 +8,10 @@ import { assertNoCommaInVersionSlugs } from "./version-availability/index.js";
8
8
  import {
9
9
  assertNoEmptyStringFaviconOrLogo,
10
10
  assertValidHeaderBrand,
11
+ assertValidHomeImage,
12
+ assertValidContentSignals,
13
+ assertValidLocaleOgImages,
14
+ assertValidHomeSections,
11
15
  assertZdtpBundlingConsistent,
12
16
  assertValidSearchMaxBodyLength,
13
17
  assertAgentDocsConsistent
@@ -87,6 +91,10 @@ function zudoDoc(user = {}) {
87
91
  assertNoCommaInVersionSlugs(settings.versions);
88
92
  assertNoEmptyStringFaviconOrLogo(settings);
89
93
  assertValidHeaderBrand(settings);
94
+ assertValidHomeImage(settings);
95
+ assertValidLocaleOgImages(settings);
96
+ assertValidHomeSections(settings);
97
+ assertValidContentSignals(settings);
90
98
  assertZdtpBundlingConsistent(settings);
91
99
  assertValidSearchMaxBodyLength(settings.searchMaxBodyLength);
92
100
  assertAgentDocsConsistent(settings);
@@ -16,6 +16,7 @@
16
16
  * <Content components={components} />
17
17
  */
18
18
  export { HeadingH2 } from "./heading-h2.js";
19
+ export { WideSectionHeading } from "./wide-section-heading.js";
19
20
  export { HeadingH3 } from "./heading-h3.js";
20
21
  export { HeadingH4 } from "./heading-h4.js";
21
22
  export { ContentParagraph } from "./content-paragraph.js";
@@ -1,4 +1,5 @@
1
1
  import { HeadingH2 } from "./heading-h2.js";
2
+ import { WideSectionHeading } from "./wide-section-heading.js";
2
3
  import { HeadingH3 } from "./heading-h3.js";
3
4
  import { HeadingH4 } from "./heading-h4.js";
4
5
  import { ContentParagraph } from "./content-paragraph.js";
@@ -25,6 +26,7 @@ export {
25
26
  HeadingH2,
26
27
  HeadingH3,
27
28
  HeadingH4,
29
+ WideSectionHeading,
28
30
  createContentLink,
29
31
  defaultComponents
30
32
  };
@@ -0,0 +1,12 @@
1
+ /** @jsxRuntime automatic */
2
+ import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
3
+ type Props = JSX.IntrinsicElements["h2"];
4
+ /**
5
+ * Section heading for composed navigation sections (home `sections`, or an
6
+ * authored MDX page). It IS the content `HeadingH2` — same typography, the 3px
7
+ * gradient upper rule with `pt-vsp-sm`, and every theme pack's `.zd-content h2`
8
+ * treatment — exposed under a name that does not depend on MDX `##` mapping.
9
+ * It owns no outside margin: the placing parent owns the surrounding gaps.
10
+ */
11
+ export declare function WideSectionHeading(props: Props): import("@takazudo/zfb").Description;
12
+ export {};
@@ -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
+ };
@@ -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,6 +70,7 @@ 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;
@@ -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;
@@ -73,6 +74,7 @@ function createRenderDocPage(ctx) {
73
74
  title,
74
75
  description,
75
76
  canonical,
77
+ ogImage: typeof entryData?.og_image === "string" && isRootAbsoluteSitePath(entryData.og_image) ? entryData.og_image : void 0,
76
78
  alternateLinks: agentMarkdownAlternates,
77
79
  breadcrumbs,
78
80
  prev,
@@ -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;
@@ -137,6 +139,7 @@ export interface DocPageShellDeps {
137
139
  type?: string;
138
140
  title?: string;
139
141
  }>;
142
+ lang?: string;
140
143
  }) => JSX.Element;
141
144
  SidebarWithDefaults: (props: {
142
145
  currentSlug?: string;