@takazudo/zudo-doc 0.2.21 → 0.2.22

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 (275) hide show
  1. package/bin/gen-z-index.mjs +164 -0
  2. package/bin/tags-audit-runner.ts +126 -0
  3. package/bin/tags-audit.mjs +64 -0
  4. package/dist/ai-chat-modal/index.d.ts +8 -0
  5. package/dist/ai-chat-modal/index.js +243 -0
  6. package/dist/body-foot-util/body-foot-util-area.d.ts +4 -8
  7. package/dist/body-foot-util/edit-link.d.ts +4 -8
  8. package/dist/body-foot-util/index.d.ts +4 -3
  9. package/dist/breadcrumb/breadcrumb.d.ts +5 -9
  10. package/dist/breadcrumb/find-path.d.ts +2 -5
  11. package/dist/breadcrumb/index.d.ts +4 -4
  12. package/dist/breadcrumb/types.d.ts +3 -5
  13. package/dist/category-nav/index.d.ts +86 -0
  14. package/dist/category-nav/index.js +44 -0
  15. package/dist/category-tree-nav/index.d.ts +65 -0
  16. package/dist/category-tree-nav/index.js +24 -0
  17. package/dist/code-group/index.d.ts +10 -0
  18. package/dist/code-group/index.js +37 -0
  19. package/dist/code-syntax/code-block-enhancer-script.d.ts +1 -3
  20. package/dist/code-syntax/code-block-enhancer.d.ts +3 -6
  21. package/dist/code-syntax/index.d.ts +9 -8
  22. package/dist/code-syntax/mermaid-init-script.d.ts +3 -5
  23. package/dist/code-syntax/mermaid-init.d.ts +4 -7
  24. package/dist/code-syntax/tabs-init-script.d.ts +1 -3
  25. package/dist/code-syntax/tabs-init.d.ts +3 -6
  26. package/dist/code-syntax/tabs.d.ts +4 -7
  27. package/dist/color-scheme-utils.d.ts +125 -0
  28. package/dist/color-scheme-utils.js +151 -0
  29. package/dist/compose-meta-title/index.d.ts +7 -0
  30. package/dist/compose-meta-title/index.js +10 -0
  31. package/dist/content/component-map.d.ts +13 -17
  32. package/dist/content/content-blockquote.d.ts +3 -6
  33. package/dist/content/content-code.d.ts +3 -6
  34. package/dist/content/content-code.js +1 -1
  35. package/dist/content/content-link.d.ts +3 -6
  36. package/dist/content/content-link.js +1 -1
  37. package/dist/content/content-ol.d.ts +3 -6
  38. package/dist/content/content-paragraph.d.ts +3 -6
  39. package/dist/content/content-strong.d.ts +3 -6
  40. package/dist/content/content-table.d.ts +3 -6
  41. package/dist/content/content-ul.d.ts +3 -6
  42. package/dist/content/heading-h2.d.ts +3 -6
  43. package/dist/content/heading-h3.d.ts +3 -6
  44. package/dist/content/heading-h4.d.ts +3 -6
  45. package/dist/content/index.d.ts +29 -13
  46. package/dist/content-admonition/index.d.ts +15 -0
  47. package/dist/content-admonition/index.js +14 -0
  48. package/dist/design-token-panel-bootstrap.d.ts +38 -0
  49. package/dist/design-token-panel-bootstrap.js +29 -0
  50. package/dist/desktop-sidebar-toggle-island/index.d.ts +5 -0
  51. package/dist/desktop-sidebar-toggle-island/index.js +62 -0
  52. package/dist/details/details.d.ts +3 -7
  53. package/dist/details/index.d.ts +2 -2
  54. package/dist/doc-body-end/index.d.ts +21 -0
  55. package/dist/doc-body-end/index.js +15 -0
  56. package/dist/doc-content-header/index.d.ts +69 -0
  57. package/dist/doc-content-header/index.js +49 -0
  58. package/dist/doc-history/index.d.ts +10 -0
  59. package/dist/doc-history/index.js +407 -0
  60. package/dist/doc-history-area/index.d.ts +84 -0
  61. package/dist/doc-history-area/index.js +76 -0
  62. package/dist/doc-metainfo-area/index.d.ts +46 -0
  63. package/dist/doc-metainfo-area/index.js +41 -0
  64. package/dist/doc-page-props/index.d.ts +93 -0
  65. package/dist/doc-page-props/index.js +0 -0
  66. package/dist/doc-page-renderer/index.d.ts +128 -0
  67. package/dist/doc-page-renderer/index.js +103 -0
  68. package/dist/doc-page-shell/index.d.ts +136 -0
  69. package/dist/doc-page-shell/index.js +127 -0
  70. package/dist/doc-pager/index.d.ts +25 -0
  71. package/dist/doc-pager/index.js +41 -0
  72. package/dist/doc-route-entries/index.d.ts +125 -0
  73. package/dist/doc-route-entries/index.js +76 -0
  74. package/dist/doc-route-paths/index.d.ts +54 -0
  75. package/dist/doc-route-paths/index.js +61 -0
  76. package/dist/doc-tags-area/index.d.ts +38 -0
  77. package/dist/doc-tags-area/index.js +30 -0
  78. package/dist/doclayout/anchors.d.ts +7 -9
  79. package/dist/doclayout/doc-layout-with-defaults.d.ts +16 -12
  80. package/dist/doclayout/doc-layout.d.ts +5 -9
  81. package/dist/doclayout/index.d.ts +6 -6
  82. package/dist/extract-headings/index.d.ts +43 -0
  83. package/dist/extract-headings/index.js +111 -0
  84. package/dist/factory-context/index.d.ts +80 -0
  85. package/dist/factory-context/index.js +0 -0
  86. package/dist/features.css +882 -0
  87. package/dist/footer/footer.d.ts +4 -8
  88. package/dist/footer/index.d.ts +13 -3
  89. package/dist/footer/types.d.ts +4 -6
  90. package/dist/footer-with-defaults/index.d.ts +63 -0
  91. package/dist/footer-with-defaults/index.js +128 -0
  92. package/dist/frontmatter-preview-data/index.d.ts +26 -0
  93. package/dist/frontmatter-preview-data/index.js +23 -0
  94. package/dist/github-helpers/index.d.ts +17 -0
  95. package/dist/github-helpers/index.js +16 -0
  96. package/dist/head/doc-head.d.ts +3 -6
  97. package/dist/head/index.d.ts +9 -5
  98. package/dist/head/og-tags.d.ts +4 -7
  99. package/dist/head/twitter-card.d.ts +3 -6
  100. package/dist/head/types.d.ts +1 -3
  101. package/dist/head-with-defaults/index.d.ts +49 -0
  102. package/dist/head-with-defaults/index.js +62 -0
  103. package/dist/header/header.d.ts +6 -10
  104. package/dist/header/index.d.ts +16 -6
  105. package/dist/header/nav-active.d.ts +5 -7
  106. package/dist/header/nav-overflow-script.d.ts +1 -3
  107. package/dist/header/right-items.d.ts +3 -6
  108. package/dist/header/types.d.ts +10 -12
  109. package/dist/header-with-defaults/index.d.ts +77 -0
  110. package/dist/header-with-defaults/index.js +163 -0
  111. package/dist/html-preview-wrapper/dedent.d.ts +1 -3
  112. package/dist/html-preview-wrapper/highlighted-code.d.ts +3 -7
  113. package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +6 -10
  114. package/dist/html-preview-wrapper/html-preview.d.ts +5 -9
  115. package/dist/html-preview-wrapper/index.d.ts +8 -5
  116. package/dist/html-preview-wrapper/preflight.d.ts +1 -3
  117. package/dist/html-preview-wrapper/preview-base.d.ts +4 -8
  118. package/dist/i18n-version/index.d.ts +7 -5
  119. package/dist/i18n-version/language-switcher.d.ts +5 -8
  120. package/dist/i18n-version/types.d.ts +3 -5
  121. package/dist/i18n-version/version-banner.d.ts +4 -8
  122. package/dist/i18n-version/version-switcher.d.ts +7 -10
  123. package/dist/icons/index.d.ts +9 -13
  124. package/dist/image-enlarge/index.d.ts +13 -0
  125. package/dist/image-enlarge/index.js +176 -0
  126. package/dist/index.d.ts +26 -2
  127. package/dist/inline-version-switcher/index.d.ts +31 -0
  128. package/dist/inline-version-switcher/index.js +44 -0
  129. package/dist/integrations/claude-resources/escape-for-mdx.d.ts +1 -3
  130. package/dist/integrations/claude-resources/generate.d.ts +2 -4
  131. package/dist/integrations/claude-resources/index.d.ts +7 -10
  132. package/dist/integrations/doc-history/index.d.ts +21 -24
  133. package/dist/integrations/doc-history/pre-build.d.ts +7 -9
  134. package/dist/integrations/llms-txt/dev-middleware.d.ts +7 -11
  135. package/dist/integrations/llms-txt/emit.d.ts +2 -7
  136. package/dist/integrations/llms-txt/generate.d.ts +3 -8
  137. package/dist/integrations/llms-txt/index.d.ts +33 -8
  138. package/dist/integrations/llms-txt/load.d.ts +3 -7
  139. package/dist/integrations/llms-txt/strip.d.ts +2 -6
  140. package/dist/integrations/llms-txt/types.d.ts +9 -13
  141. package/dist/integrations/search-index/build-emitter.d.ts +4 -7
  142. package/dist/integrations/search-index/collect.d.ts +2 -5
  143. package/dist/integrations/search-index/dev-middleware.d.ts +5 -8
  144. package/dist/integrations/search-index/index.d.ts +7 -5
  145. package/dist/integrations/search-index/types.d.ts +5 -7
  146. package/dist/island-types/index.d.ts +44 -0
  147. package/dist/island-types/index.js +12 -0
  148. package/dist/locale-merge/index.d.ts +114 -0
  149. package/dist/locale-merge/index.js +27 -0
  150. package/dist/math-block/index.d.ts +18 -0
  151. package/dist/math-block/index.js +29 -0
  152. package/dist/md-utils/index.d.ts +6 -8
  153. package/dist/md-utils/index.js +2 -1
  154. package/dist/mdx-components/index.d.ts +46 -0
  155. package/dist/mdx-components/index.js +161 -0
  156. package/dist/mermaid-enlarge/index.d.ts +11 -0
  157. package/dist/mermaid-enlarge/index.js +290 -0
  158. package/dist/metainfo/doc-metainfo.d.ts +5 -9
  159. package/dist/metainfo/doc-tags.d.ts +7 -11
  160. package/dist/metainfo/frontmatter-preview.d.ts +8 -12
  161. package/dist/metainfo/index.d.ts +6 -4
  162. package/dist/nav-data-prep/index.d.ts +72 -0
  163. package/dist/nav-data-prep/index.js +34 -0
  164. package/dist/nav-indexing/category-nav.d.ts +4 -8
  165. package/dist/nav-indexing/category-tree-nav.d.ts +4 -8
  166. package/dist/nav-indexing/doc-card-grid.d.ts +4 -8
  167. package/dist/nav-indexing/docs-sitemap.d.ts +4 -8
  168. package/dist/nav-indexing/index.d.ts +37 -10
  169. package/dist/nav-indexing/nav-card-grid.d.ts +4 -8
  170. package/dist/nav-indexing/site-tree-nav-demo.d.ts +4 -8
  171. package/dist/nav-indexing/tag-nav.d.ts +6 -10
  172. package/dist/nav-indexing/types.d.ts +6 -8
  173. package/dist/nav-indexing/versions-page-content.d.ts +4 -8
  174. package/dist/nav-scope/index.d.ts +41 -0
  175. package/dist/nav-scope/index.js +41 -0
  176. package/dist/nav-source-cache/index.d.ts +13 -0
  177. package/dist/nav-source-cache/index.js +28 -0
  178. package/dist/nav-source-docs/index.d.ts +169 -0
  179. package/dist/nav-source-docs/index.js +123 -0
  180. package/dist/page-loading/index.d.ts +1 -2
  181. package/dist/page-loading/page-loading-overlay.d.ts +4 -8
  182. package/dist/plugins/claude-resources.d.ts +3 -0
  183. package/dist/plugins/claude-resources.js +27 -0
  184. package/dist/plugins/connect-adapter.d.ts +31 -0
  185. package/dist/plugins/connect-adapter.js +78 -0
  186. package/dist/plugins/doc-history.d.ts +3 -0
  187. package/dist/plugins/doc-history.js +54 -0
  188. package/dist/plugins/llms-txt.d.ts +3 -0
  189. package/dist/plugins/llms-txt.js +48 -0
  190. package/dist/plugins/plugin-utils.d.ts +17 -0
  191. package/dist/plugins/plugin-utils.js +11 -0
  192. package/dist/plugins/search-index.d.ts +3 -0
  193. package/dist/plugins/search-index.js +24 -0
  194. package/dist/preset.d.ts +152 -0
  195. package/dist/preset.js +169 -0
  196. package/dist/render-markdown/index.d.ts +5 -0
  197. package/dist/render-markdown/index.js +115 -0
  198. package/dist/robots.d.ts +36 -0
  199. package/dist/robots.js +17 -0
  200. package/dist/route-enumerators/index.d.ts +204 -0
  201. package/dist/route-enumerators/index.js +156 -0
  202. package/dist/safelist.css +1 -1
  203. package/dist/search-widget/index.d.ts +38 -0
  204. package/dist/search-widget/index.js +169 -0
  205. package/dist/search-widget-script/index.d.ts +18 -0
  206. package/dist/search-widget-script/index.js +465 -0
  207. package/dist/settings.d.ts +255 -0
  208. package/dist/settings.js +0 -0
  209. package/dist/sidebar/index.d.ts +21 -3
  210. package/dist/sidebar/sidebar.d.ts +5 -9
  211. package/dist/sidebar/types.d.ts +4 -6
  212. package/dist/sidebar-prepaint/index.d.ts +21 -0
  213. package/dist/sidebar-prepaint/index.js +23 -0
  214. package/dist/sidebar-resizer/index.d.ts +2 -6
  215. package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +6 -10
  216. package/dist/sidebar-toggle-island/index.d.ts +13 -0
  217. package/dist/sidebar-toggle-island/index.js +122 -0
  218. package/dist/sidebar-tree/build-tree.d.ts +4 -8
  219. package/dist/sidebar-tree/category-meta.d.ts +3 -6
  220. package/dist/sidebar-tree/index.d.ts +18 -3
  221. package/dist/sidebar-tree/types.d.ts +6 -8
  222. package/dist/sidebar-tree-island/index.d.ts +13 -0
  223. package/dist/sidebar-tree-island/index.js +454 -0
  224. package/dist/sidebar-utils/index.d.ts +64 -0
  225. package/dist/sidebar-utils/index.js +88 -0
  226. package/dist/sidebar-with-defaults/index.d.ts +38 -0
  227. package/dist/sidebar-with-defaults/index.js +45 -0
  228. package/dist/site-tree-nav/index.d.ts +71 -0
  229. package/dist/site-tree-nav/index.js +36 -0
  230. package/dist/site-tree-nav-island/index.d.ts +11 -0
  231. package/dist/site-tree-nav-island/index.js +176 -0
  232. package/dist/slug/index.d.ts +4 -0
  233. package/dist/slug/index.js +19 -0
  234. package/dist/smart-break/index.d.ts +55 -0
  235. package/dist/{toc/smart-break.js → smart-break/index.js} +30 -3
  236. package/dist/tab-item/index.d.ts +2 -2
  237. package/dist/tab-item/tab-item.d.ts +6 -7
  238. package/dist/tag-helpers/index.d.ts +40 -0
  239. package/dist/tag-helpers/index.js +54 -0
  240. package/dist/tag-pages/index.d.ts +114 -0
  241. package/dist/tag-pages/index.js +146 -0
  242. package/dist/tags-audit.d.ts +107 -0
  243. package/dist/tags-audit.js +321 -0
  244. package/dist/theme/color-scheme-provider.d.ts +4 -8
  245. package/dist/theme/color-tweak-export-modal.d.ts +4 -7
  246. package/dist/theme/design-token-serde.d.ts +14 -17
  247. package/dist/theme/design-token-types.d.ts +4 -6
  248. package/dist/theme/iframe-bridge.d.ts +12 -14
  249. package/dist/theme/index.d.ts +7 -9
  250. package/dist/theme/theme-toggle.d.ts +3 -8
  251. package/dist/theme-toggle/color-scheme-sync.d.ts +5 -7
  252. package/dist/theme-toggle/index.d.ts +4 -8
  253. package/dist/toc/cx.d.ts +2 -3
  254. package/dist/toc/index.d.ts +8 -6
  255. package/dist/toc/mobile-toc.d.ts +5 -9
  256. package/dist/toc/mobile-toc.js +1 -1
  257. package/dist/toc/toc-title.d.ts +1 -3
  258. package/dist/toc/toc.d.ts +5 -9
  259. package/dist/toc/toc.js +1 -1
  260. package/dist/toc/types.d.ts +1 -3
  261. package/dist/toc/use-active-heading.d.ts +4 -7
  262. package/dist/transitions/index.d.ts +1 -1
  263. package/dist/transitions/page-events.d.ts +4 -6
  264. package/dist/tree-nav-shared/index.d.ts +22 -0
  265. package/dist/tree-nav-shared/index.js +66 -0
  266. package/dist/url-helpers/index.d.ts +37 -0
  267. package/dist/url-helpers/index.js +106 -0
  268. package/dist/url-normalizer/index.d.ts +39 -1
  269. package/dist/url-normalizer/normalize.d.ts +3 -5
  270. package/dist/use-modal-dialog/index.d.ts +70 -0
  271. package/dist/use-modal-dialog/index.js +73 -0
  272. package/dist/versions-page/index.d.ts +55 -0
  273. package/dist/versions-page/index.js +73 -0
  274. package/package.json +290 -10
  275. package/dist/toc/smart-break.d.ts +0 -27
@@ -1,8 +1,33 @@
1
- export { LlmsTxtDevMiddlewareOptions, LlmsTxtMiddleware, LlmsTxtMiddlewareLogger, LlmsTxtNextFn, createLlmsTxtDevMiddleware } from './dev-middleware.js';
2
- export { emitLlmsTxt } from './emit.js';
3
- export { generateLlmsFullTxt, generateLlmsTxt } from './generate.js';
4
- export { loadDocEntries } from './load.js';
5
- export { stripImportsAndJsx } from './strip.js';
6
- export { LlmsDocEntry, LlmsTxtEmitOptions, LlmsTxtEmitResult, LlmsTxtFrontmatter, LlmsTxtLoadOptions, LlmsTxtLocaleConfig, LlmsTxtLogger, LlmsTxtSiteMeta } from './types.js';
7
- export { collectMdFiles, isExcluded, parseMarkdownFile, slugToUrl, stripMarkdown } from '../../md-utils/index.js';
8
- import 'node:http';
1
+ /**
2
+ * Public entry for `@takazudo/zudo-doc/integrations/llms-txt`.
3
+ *
4
+ * Framework-agnostic build emitter that produces `dist/llms.txt` and
5
+ * `dist/llms-full.txt` (plus per-locale variants) with byte-identical
6
+ * format vs the legacy Astro integration in
7
+ * `src/integrations/llms-txt.ts`.
8
+ *
9
+ * Typical zfb registration (see ./README.md for the full snippet):
10
+ *
11
+ * import { emitLlmsTxt } from "@takazudo/zudo-doc/integrations/llms-txt";
12
+ *
13
+ * // inside a zfb plugin's onBuildDone hook
14
+ * emitLlmsTxt({
15
+ * outDir,
16
+ * siteName: "...",
17
+ * siteDescription: "...",
18
+ * base: "/",
19
+ * defaultLocaleDir: "src/content/docs",
20
+ * locales: [{ code: "ja", dir: "src/content/docs-ja" }],
21
+ * });
22
+ *
23
+ * The pure `generate*` and `loadDocEntries` helpers are exported as well
24
+ * so a zfb non-HTML page (`pages/llms.txt.tsx`) or a unit test can build
25
+ * the strings directly without touching the filesystem twice.
26
+ */
27
+ export { createLlmsTxtDevMiddleware } from "./dev-middleware.js";
28
+ export type { LlmsTxtDevMiddlewareOptions, LlmsTxtMiddleware, LlmsTxtMiddlewareLogger, LlmsTxtNextFn, } from "./dev-middleware.js";
29
+ export { emitLlmsTxt } from "./emit.js";
30
+ export { generateLlmsFullTxt, generateLlmsTxt, } from "./generate.js";
31
+ export { collectMdFiles, isExcluded, loadDocEntries, parseMarkdownFile, slugToUrl, } from "./load.js";
32
+ export { stripImportsAndJsx, stripMarkdown } from "./strip.js";
33
+ export type { LlmsDocEntry, LlmsTxtEmitOptions, LlmsTxtEmitResult, LlmsTxtFrontmatter, LlmsTxtLoadOptions, LlmsTxtLocaleConfig, LlmsTxtLogger, LlmsTxtSiteMeta, } from "./types.js";
@@ -1,6 +1,3 @@
1
- import { LlmsTxtLoadOptions, LlmsDocEntry } from './types.js';
2
- export { collectMdFiles, isExcluded, parseMarkdownFile, slugToUrl } from '../../md-utils/index.js';
3
-
4
1
  /**
5
2
  * Filesystem loader for llms-txt content. Walks a markdown content root,
6
3
  * parses frontmatter via `gray-matter`, and emits sorted
@@ -11,7 +8,8 @@ export { collectMdFiles, isExcluded, parseMarkdownFile, slugToUrl } from '../../
11
8
  * zudo-doc#2024); they are re-exported here so the integration's public
12
9
  * surface is unchanged.
13
10
  */
14
-
11
+ import type { LlmsDocEntry, LlmsTxtLoadOptions } from "./types.js";
12
+ export { collectMdFiles, isExcluded, parseMarkdownFile, slugToUrl, } from "../../md-utils/index.js";
15
13
  /**
16
14
  * Build the sorted {@link LlmsDocEntry} list for a single content root.
17
15
  * Excluded pages (draft / unlisted / search_exclude) are dropped.
@@ -20,6 +18,4 @@ export { collectMdFiles, isExcluded, parseMarkdownFile, slugToUrl } from '../../
20
18
  * `Array.prototype.sort` is stable in V8 so ties keep filesystem
21
19
  * traversal order — same as the legacy emitter).
22
20
  */
23
- declare function loadDocEntries(options: LlmsTxtLoadOptions): LlmsDocEntry[];
24
-
25
- export { loadDocEntries };
21
+ export declare function loadDocEntries(options: LlmsTxtLoadOptions): LlmsDocEntry[];
@@ -1,5 +1,3 @@
1
- export { stripMarkdown } from '../../md-utils/index.js';
2
-
3
1
  /**
4
2
  * Markdown / JSX text-stripping helpers.
5
3
  *
@@ -15,12 +13,10 @@ export { stripMarkdown } from '../../md-utils/index.js';
15
13
  * (zudo-doc#2024) — and is re-exported here to keep the public surface
16
14
  * unchanged.
17
15
  */
18
-
16
+ export { stripMarkdown } from "../../md-utils/index.js";
19
17
  /**
20
18
  * Strip imports, exports, and HTML/JSX tags from MDX/MD content while
21
19
  * keeping the prose layout (headings, lists, blockquotes) intact for
22
20
  * LLM consumption. Used by `llms-full.txt`.
23
21
  */
24
- declare function stripImportsAndJsx(content: string): string;
25
-
26
- export { stripImportsAndJsx };
22
+ export declare function stripImportsAndJsx(content: string): string;
@@ -1,5 +1,3 @@
1
- import { MdDocFrontmatter } from '../../md-utils/index.js';
2
-
3
1
  /**
4
2
  * Public types for the framework-agnostic llms-txt build emitter.
5
3
  *
@@ -9,20 +7,20 @@ import { MdDocFrontmatter } from '../../md-utils/index.js';
9
7
  * markdown content roots — Astro today, zfb tomorrow, plain Node tooling
10
8
  * in a unit test, etc.
11
9
  */
12
-
10
+ import type { MdDocFrontmatter } from "../../md-utils/index.js";
13
11
  /**
14
12
  * Frontmatter fields the loader reads off of each MDX/MD file. Callers
15
13
  * are free to extend this; unrecognised fields are ignored. Alias of the
16
14
  * shared {@link MdDocFrontmatter} shape (`md-utils`, zudo-doc#2024) —
17
15
  * search-index and llms-txt read the same fields.
18
16
  */
19
- type LlmsTxtFrontmatter = MdDocFrontmatter;
17
+ export type LlmsTxtFrontmatter = MdDocFrontmatter;
20
18
  /**
21
19
  * One entry in the generated llms.txt / llms-full.txt files. Pure data,
22
20
  * already sorted, already stripped — generators (`generateLlmsTxt`,
23
21
  * `generateLlmsFullTxt`) consume this without further processing.
24
22
  */
25
- interface LlmsDocEntry {
23
+ export interface LlmsDocEntry {
26
24
  /** Page title (frontmatter `title`, with the slug as a fallback). */
27
25
  title: string;
28
26
  /**
@@ -49,7 +47,7 @@ interface LlmsDocEntry {
49
47
  * `siteName` / `siteDescription` fields on the legacy settings object
50
48
  * one-for-one so callers can pass `settings` straight through.
51
49
  */
52
- interface LlmsTxtSiteMeta {
50
+ export interface LlmsTxtSiteMeta {
53
51
  siteName: string;
54
52
  siteDescription: string;
55
53
  }
@@ -58,7 +56,7 @@ interface LlmsTxtSiteMeta {
58
56
  * represented separately on {@link LlmsTxtEmitOptions}; this type
59
57
  * describes the *additional* locales (e.g. `ja`).
60
58
  */
61
- interface LlmsTxtLocaleConfig {
59
+ export interface LlmsTxtLocaleConfig {
62
60
  /** Locale code used as both the URL segment and the output subfolder. */
63
61
  code: string;
64
62
  /** Absolute or cwd-relative path to the locale's content root. */
@@ -67,7 +65,7 @@ interface LlmsTxtLocaleConfig {
67
65
  /**
68
66
  * Options for {@link loadDocEntries} — one content directory at a time.
69
67
  */
70
- interface LlmsTxtLoadOptions {
68
+ export interface LlmsTxtLoadOptions {
71
69
  /** Absolute or cwd-relative path to the markdown content root. */
72
70
  contentDir: string;
73
71
  /**
@@ -94,7 +92,7 @@ interface LlmsTxtLoadOptions {
94
92
  * module so that a one-line registration in `zfb.config.ts` (or a
95
93
  * `b4-build` hook in Astro) can wire the same behaviour.
96
94
  */
97
- interface LlmsTxtEmitOptions extends LlmsTxtSiteMeta {
95
+ export interface LlmsTxtEmitOptions extends LlmsTxtSiteMeta {
98
96
  /** Absolute output directory — typically `dist/`. */
99
97
  outDir: string;
100
98
  /** URL base used when materialising per-page links. */
@@ -123,16 +121,14 @@ interface LlmsTxtEmitOptions extends LlmsTxtSiteMeta {
123
121
  * `logger` and `console`. Only `info` is used today; the wider shape is
124
122
  * provided so the option can hold either object without type acrobatics.
125
123
  */
126
- interface LlmsTxtLogger {
124
+ export interface LlmsTxtLogger {
127
125
  info: (msg: string) => void;
128
126
  }
129
127
  /**
130
128
  * Result returned by {@link emitLlmsTxt}. Useful for tests and for
131
129
  * callers that want to log / further process the emitted set.
132
130
  */
133
- interface LlmsTxtEmitResult {
131
+ export interface LlmsTxtEmitResult {
134
132
  /** Absolute paths of every file written, in emit order. */
135
133
  written: string[];
136
134
  }
137
-
138
- export type { LlmsDocEntry, LlmsTxtEmitOptions, LlmsTxtEmitResult, LlmsTxtFrontmatter, LlmsTxtLoadOptions, LlmsTxtLocaleConfig, LlmsTxtLogger, LlmsTxtSiteMeta };
@@ -1,6 +1,5 @@
1
- import { SearchIndexConfig, SearchIndexEntry } from './types.js';
2
-
3
- interface SearchIndexBuildResult {
1
+ import type { SearchIndexConfig, SearchIndexEntry } from "./types.js";
2
+ export interface SearchIndexBuildResult {
4
3
  /** Absolute path of the JSON file that was written. */
5
4
  jsonPath: string;
6
5
  /** Number of entries serialised. */
@@ -8,7 +7,7 @@ interface SearchIndexBuildResult {
8
7
  /** The raw entries — exposed so callers can pipe the same data into a Worker bundle if needed. */
9
8
  entries: SearchIndexEntry[];
10
9
  }
11
- interface SearchIndexBuildOptions extends SearchIndexConfig {
10
+ export interface SearchIndexBuildOptions extends SearchIndexConfig {
12
11
  /** Absolute path of the build output directory (e.g. zfb's `outDir`). */
13
12
  outDir: string;
14
13
  /** Optional logger; defaults to a no-op so builds stay quiet by default. */
@@ -25,6 +24,4 @@ interface SearchIndexBuildOptions extends SearchIndexConfig {
25
24
  * Schema is byte-identical to today's Astro integration — see
26
25
  * `types.ts` for the locked-in shape.
27
26
  */
28
- declare function emitSearchIndex(options: SearchIndexBuildOptions): SearchIndexBuildResult;
29
-
30
- export { type SearchIndexBuildOptions, type SearchIndexBuildResult, emitSearchIndex };
27
+ export declare function emitSearchIndex(options: SearchIndexBuildOptions): SearchIndexBuildResult;
@@ -1,5 +1,4 @@
1
- import { SearchIndexConfig, SearchIndexEntry } from './types.js';
2
-
1
+ import { type SearchIndexConfig, type SearchIndexEntry } from "./types.js";
3
2
  /**
4
3
  * Collect every search-index entry across the default locale plus all
5
4
  * configured non-default locales. The traversal order matches today's
@@ -7,6 +6,4 @@ import { SearchIndexConfig, SearchIndexEntry } from './types.js';
7
6
  * order of the `locales` map. Downstream consumers should not rely on
8
7
  * order beyond that, but keep it stable for diff-friendly builds.
9
8
  */
10
- declare function collectSearchEntries(config: SearchIndexConfig): SearchIndexEntry[];
11
-
12
- export { collectSearchEntries };
9
+ export declare function collectSearchEntries(config: SearchIndexConfig): SearchIndexEntry[];
@@ -1,8 +1,7 @@
1
- import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { SearchIndexConfig } from './types.js';
3
-
4
- type SearchIndexNextFn = (err?: unknown) => void;
5
- type SearchIndexMiddleware = (req: IncomingMessage, res: ServerResponse, next: SearchIndexNextFn) => void;
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ import { type SearchIndexConfig } from "./types.js";
3
+ export type SearchIndexNextFn = (err?: unknown) => void;
4
+ export type SearchIndexMiddleware = (req: IncomingMessage, res: ServerResponse, next: SearchIndexNextFn) => void;
6
5
  /**
7
6
  * Build a dev-server middleware that responds to GET requests for
8
7
  * `/search-index.json` (or any URL ending in that suffix, mirroring the
@@ -11,6 +10,4 @@ type SearchIndexMiddleware = (req: IncomingMessage, res: ServerResponse, next: S
11
10
  * index from disk — that matches the Astro behaviour and keeps content
12
11
  * edits visible without a dev-server restart.
13
12
  */
14
- declare function createSearchIndexDevMiddleware(config: SearchIndexConfig): SearchIndexMiddleware;
15
-
16
- export { type SearchIndexMiddleware, type SearchIndexNextFn, createSearchIndexDevMiddleware };
13
+ export declare function createSearchIndexDevMiddleware(config: SearchIndexConfig): SearchIndexMiddleware;
@@ -1,5 +1,7 @@
1
- export { SearchIndexBuildOptions, SearchIndexBuildResult, emitSearchIndex } from './build-emitter.js';
2
- export { collectSearchEntries } from './collect.js';
3
- export { SearchIndexMiddleware, SearchIndexNextFn, createSearchIndexDevMiddleware } from './dev-middleware.js';
4
- export { MAX_BODY_LENGTH, SEARCH_INDEX_ROUTE, SearchIndexConfig, SearchIndexEntry, SearchIndexLocaleConfig } from './types.js';
5
- import 'node:http';
1
+ export { emitSearchIndex } from "./build-emitter.js";
2
+ export type { SearchIndexBuildOptions, SearchIndexBuildResult, } from "./build-emitter.js";
3
+ export { collectSearchEntries } from "./collect.js";
4
+ export { createSearchIndexDevMiddleware } from "./dev-middleware.js";
5
+ export type { SearchIndexMiddleware, SearchIndexNextFn, } from "./dev-middleware.js";
6
+ export { MAX_BODY_LENGTH, SEARCH_INDEX_ROUTE, } from "./types.js";
7
+ export type { SearchIndexConfig, SearchIndexEntry, SearchIndexLocaleConfig, } from "./types.js";
@@ -4,7 +4,7 @@
4
4
  * consumers (the search client island and packages/search-worker via
5
5
  * MiniSearch) keep working unchanged after the zfb cutover.
6
6
  */
7
- interface SearchIndexEntry {
7
+ export interface SearchIndexEntry {
8
8
  /** Stable identifier — `slug` for the default locale, `${locale}/${slug}` otherwise. */
9
9
  id: string;
10
10
  /** Frontmatter title, falling back to the slug when missing. */
@@ -17,12 +17,12 @@ interface SearchIndexEntry {
17
17
  description: string;
18
18
  }
19
19
  /** A locale entry that mirrors the Astro `settings.locales` shape we already have. */
20
- interface SearchIndexLocaleConfig {
20
+ export interface SearchIndexLocaleConfig {
21
21
  /** Absolute or project-relative directory holding this locale's MDX content. */
22
22
  dir: string;
23
23
  }
24
24
  /** Build-time configuration for collecting search entries. */
25
- interface SearchIndexConfig {
25
+ export interface SearchIndexConfig {
26
26
  /** Default-locale content directory (e.g. `src/content/docs`). */
27
27
  docsDir: string;
28
28
  /** Optional non-default locales, keyed by locale code (e.g. `{ ja: { dir: "src/content/docs-ja" } }`). */
@@ -31,8 +31,6 @@ interface SearchIndexConfig {
31
31
  base?: string;
32
32
  }
33
33
  /** Maximum body text stored per entry (display excerpt cap). */
34
- declare const MAX_BODY_LENGTH = 300;
34
+ export declare const MAX_BODY_LENGTH = 300;
35
35
  /** Public route the dev middleware and build emitter agree on. */
36
- declare const SEARCH_INDEX_ROUTE = "/search-index.json";
37
-
38
- export { MAX_BODY_LENGTH, SEARCH_INDEX_ROUTE, type SearchIndexConfig, type SearchIndexEntry, type SearchIndexLocaleConfig };
36
+ export declare const SEARCH_INDEX_ROUTE = "/search-index.json";
@@ -0,0 +1,44 @@
1
+ /** A single turn in the AI-chat conversation. */
2
+ export interface ChatMessage {
3
+ role: "user" | "assistant";
4
+ content: string;
5
+ }
6
+ /** A single git revision entry for a document. */
7
+ export interface DocHistoryEntry {
8
+ /** Full commit hash (use .slice(0, 7) for display). */
9
+ hash: string;
10
+ /** ISO 8601 date string. */
11
+ date: string;
12
+ /** Commit author name. */
13
+ author: string;
14
+ /** First line of commit message. */
15
+ message: string;
16
+ /** Full file content at this revision. */
17
+ content: string;
18
+ }
19
+ /** Complete history data for a single document. */
20
+ export interface DocHistoryData {
21
+ /** Document slug (route path). */
22
+ slug: string;
23
+ /** Relative file path in the repository. */
24
+ filePath: string;
25
+ /** Git revision entries, newest first. */
26
+ entries: DocHistoryEntry[];
27
+ }
28
+ /** Shared inline style centering an enlarge `<dialog>` transform-free. */
29
+ export declare const ENLARGE_DIALOG_STYLE: {
30
+ readonly position: "fixed";
31
+ readonly inset: "0";
32
+ readonly margin: "auto";
33
+ };
34
+ /** Class string for the image-enlarge `<dialog>` (hydrated + SSR fallback). */
35
+ export declare const IMAGE_ENLARGE_DIALOG_CLASS = "zd-enlarge-dialog z-modal mx-auto max-h-[90vh] max-w-[90vw] overflow-hidden border border-muted bg-surface p-0 backdrop:z-modal-backdrop";
36
+ /** Class string for the mermaid-enlarge `<dialog>` (hydrated + SSR fallback). */
37
+ export declare const MERMAID_ENLARGE_DIALOG_CLASS = "zd-mermaid-dialog z-modal mx-auto h-[90vh] max-h-[90vh] w-[90vw] max-w-[90vw] overflow-hidden border border-muted bg-surface p-0 backdrop:z-modal-backdrop";
38
+ /** Shared shape an enlarge `<dialog>` is rendered with. */
39
+ export interface EnlargeDialogProps {
40
+ /** Tailwind class string for the `<dialog>`. */
41
+ className: string;
42
+ /** Inline style centering the dialog transform-free. */
43
+ style: typeof ENLARGE_DIALOG_STYLE;
44
+ }
@@ -0,0 +1,12 @@
1
+ const ENLARGE_DIALOG_STYLE = {
2
+ position: "fixed",
3
+ inset: "0",
4
+ margin: "auto"
5
+ };
6
+ const IMAGE_ENLARGE_DIALOG_CLASS = "zd-enlarge-dialog z-modal mx-auto max-h-[90vh] max-w-[90vw] overflow-hidden border border-muted bg-surface p-0 backdrop:z-modal-backdrop";
7
+ const MERMAID_ENLARGE_DIALOG_CLASS = "zd-mermaid-dialog z-modal mx-auto h-[90vh] max-h-[90vh] w-[90vw] max-w-[90vw] overflow-hidden border border-muted bg-surface p-0 backdrop:z-modal-backdrop";
8
+ export {
9
+ ENLARGE_DIALOG_STYLE,
10
+ IMAGE_ENLARGE_DIALOG_CLASS,
11
+ MERMAID_ENLARGE_DIALOG_CLASS
12
+ };
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Minimal structural interface for a docs entry.
3
+ *
4
+ * Structurally compatible with the host's `DocsEntry` from
5
+ * `@/types/docs-entry`. Callers pass their concrete entry arrays and
6
+ * TypeScript's structural typing ensures compatibility.
7
+ */
8
+ export interface MergeDocsEntry {
9
+ id: string;
10
+ data: {
11
+ slug?: string;
12
+ unlisted?: boolean;
13
+ [key: string]: unknown;
14
+ };
15
+ }
16
+ /**
17
+ * Options for mergeLocaleDocs.
18
+ *
19
+ * The generic parameter `T` allows callers to pass arrays of a concrete entry
20
+ * subtype and get back results of the same subtype, eliminating `as unknown as`
21
+ * casts at call sites.
22
+ */
23
+ export interface MergeLocaleDocsOptions<T extends MergeDocsEntry = MergeDocsEntry> {
24
+ /** Pre-loaded base (EN/default-locale) docs array, already draft-filtered. */
25
+ baseDocs: T[];
26
+ /** Pre-loaded locale-specific docs array, already draft-filtered. */
27
+ localeDocs: T[];
28
+ /**
29
+ * When true, base docs whose path matches a `defaultLocaleOnlyPrefixes`
30
+ * entry are excluded from the merge result. This matches the behavior of the
31
+ * inline copies in route-enumerators, nav helpers, and page paths() sections.
32
+ *
33
+ * Pass true for any call site that enumerates routes or builds nav trees for
34
+ * non-default locales (where showing a default-locale-only page to a locale
35
+ * user would be incorrect). Pass false (or omit) for call sites where the
36
+ * filtered paths are harmless — e.g. category nav cards, taglist columns.
37
+ *
38
+ * @default false
39
+ */
40
+ applyDefaultLocaleOnlyFilter?: boolean;
41
+ /**
42
+ * Controls whether `unlisted: true` docs survive the merge.
43
+ *
44
+ * - `true` — unlisted docs are RETAINED (locale + base). Route/sitemap
45
+ * enumeration uses this: unlisted pages have real HTML files, so
46
+ * they must be built; nav callers rely on `isNavVisible`
47
+ * downstream to hide them from the tree.
48
+ * - `false` (default) — unlisted docs are DROPPED from both locale and base.
49
+ * Tag aggregation uses this so hidden pages don't contribute tags.
50
+ *
51
+ * @default false
52
+ */
53
+ keepUnlisted?: boolean;
54
+ /**
55
+ * Host-injected predicate: returns true when a path should be excluded from
56
+ * the non-default-locale merge (i.e. it belongs to the default locale only).
57
+ *
58
+ * Only called when `applyDefaultLocaleOnlyFilter` is true. The host stub
59
+ * passes `isDefaultLocaleOnlyPath` from `@/utils/base`.
60
+ *
61
+ * When omitted (or when `applyDefaultLocaleOnlyFilter` is false), no path
62
+ * filtering is applied.
63
+ *
64
+ * Example: host passes `(path) => isDefaultLocaleOnlyPath(path)` where
65
+ * `isDefaultLocaleOnlyPath` is from `src/utils/base.ts`.
66
+ */
67
+ isDefaultLocaleOnlyPath?: (path: string) => boolean;
68
+ }
69
+ /**
70
+ * Result of mergeLocaleDocs.
71
+ *
72
+ * **Array identity:** Each call returns a fresh array — no module-level
73
+ * memoization is applied. If a caller keys a cache on the docs array identity
74
+ * (e.g. a nav-tree cache), it should memoize the result itself rather than
75
+ * relying on reference stability from this helper.
76
+ *
77
+ * This contract is intentionally unchanged from the original. The
78
+ * identity-stable layer for nav-source arrays lives ABOVE this helper:
79
+ * `pages/lib/_nav-source-docs.ts` memoizes the merge result on the
80
+ * snapshot-anchored input arrays + option signature (see
81
+ * `pages/lib/_nav-source-cache.ts`), so `mergeLocaleDocs` itself stays a pure,
82
+ * memo-free function (#1902).
83
+ *
84
+ * The generic `T` mirrors the parameter on {@link MergeLocaleDocsOptions} so
85
+ * the returned `docs` array preserves the subtype of the input arrays.
86
+ */
87
+ export interface MergeLocaleDocsResult<T extends MergeDocsEntry = MergeDocsEntry> {
88
+ /**
89
+ * Merged doc array: locale docs first, followed by base docs for slugs not
90
+ * present in the locale collection (and not excluded by filter options).
91
+ */
92
+ docs: T[];
93
+ /**
94
+ * Set of slugs that came from the locale collection.
95
+ * Useful for callers that need to determine whether a page is a fallback
96
+ * (i.e. `isFallback = !localeSlugSet.has(slug)`).
97
+ */
98
+ localeSlugSet: ReadonlySet<string>;
99
+ }
100
+ /**
101
+ * Merge locale docs with base-locale fallbacks.
102
+ *
103
+ * Locale docs take priority; base docs fill in slugs not covered by the locale
104
+ * collection. Optionally excludes default-locale-only paths and/or unlisted pages.
105
+ *
106
+ * **Slug keying**: slug identity uses `d.data.slug ?? d.id`. Since `loadDocs`
107
+ * already strips the `/index` suffix (via `stripIndexSuffix` in `pages/_data.ts`),
108
+ * this key is consistent across all call sites regardless of whether they
109
+ * loaded docs via `loadDocs` or `bridgeEntries`.
110
+ *
111
+ * **Array identity**: returns a fresh array on each call — see
112
+ * {@link MergeLocaleDocsResult} for caching guidance.
113
+ */
114
+ export declare function mergeLocaleDocs<T extends MergeDocsEntry = MergeDocsEntry>(options: MergeLocaleDocsOptions<T>): MergeLocaleDocsResult<T>;
@@ -0,0 +1,27 @@
1
+ function mergeLocaleDocs(options) {
2
+ const {
3
+ baseDocs,
4
+ localeDocs,
5
+ applyDefaultLocaleOnlyFilter = false,
6
+ keepUnlisted = false,
7
+ isDefaultLocaleOnlyPath
8
+ } = options;
9
+ const filteredLocale = keepUnlisted ? localeDocs : localeDocs.filter((d) => !d.data.unlisted);
10
+ const filteredBase = keepUnlisted ? baseDocs : baseDocs.filter((d) => !d.data.unlisted);
11
+ const localeSlugSet = new Set(filteredLocale.map((d) => d.data.slug ?? d.id));
12
+ let fallbackDocs = filteredBase.filter(
13
+ (d) => !localeSlugSet.has(d.data.slug ?? d.id)
14
+ );
15
+ if (applyDefaultLocaleOnlyFilter && isDefaultLocaleOnlyPath) {
16
+ fallbackDocs = fallbackDocs.filter(
17
+ (d) => !isDefaultLocaleOnlyPath(`/docs/${d.data.slug ?? d.id}`)
18
+ );
19
+ }
20
+ return {
21
+ docs: [...filteredLocale, ...fallbackDocs],
22
+ localeSlugSet
23
+ };
24
+ }
25
+ export {
26
+ mergeLocaleDocs
27
+ };
@@ -0,0 +1,18 @@
1
+ /** @jsxRuntime automatic */
2
+ /** @jsxImportSource preact */
3
+ import type { VNode } from "preact";
4
+ export interface MathBlockProps {
5
+ /** Raw LaTeX source string. */
6
+ latex: string;
7
+ /** When true, renders as a block (display) equation; otherwise inline. */
8
+ block?: boolean;
9
+ }
10
+ /**
11
+ * Server-rendered KaTeX math component.
12
+ *
13
+ * Block mode wraps the output in `<div class="math math-display">`;
14
+ * inline mode uses `<span class="math math-inline">`. The class names
15
+ * match the standard rehype-katex output so existing CSS (e.g. the
16
+ * KaTeX stylesheet) still applies.
17
+ */
18
+ export declare function MathBlock({ latex, block }: MathBlockProps): VNode;
@@ -0,0 +1,29 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ import katex from "katex";
3
+ function MathBlock({ latex, block = false }) {
4
+ const html = katex.renderToString(latex, {
5
+ displayMode: block,
6
+ // Never throw — malformed LaTeX renders a visible error span instead
7
+ // of crashing the entire page build.
8
+ throwOnError: false
9
+ });
10
+ if (block) {
11
+ return /* @__PURE__ */ jsx(
12
+ "div",
13
+ {
14
+ class: "math math-display",
15
+ dangerouslySetInnerHTML: { __html: html }
16
+ }
17
+ );
18
+ }
19
+ return /* @__PURE__ */ jsx(
20
+ "span",
21
+ {
22
+ class: "math math-inline",
23
+ dangerouslySetInnerHTML: { __html: html }
24
+ }
25
+ );
26
+ }
27
+ export {
28
+ MathBlock
29
+ };
@@ -3,7 +3,7 @@
3
3
  * keys pass through via the index signature. Mirrors the host project's
4
4
  * docs schema (`src/config/docs-schema.ts`) for the fields listed here.
5
5
  */
6
- interface MdDocFrontmatter {
6
+ export interface MdDocFrontmatter {
7
7
  title?: string;
8
8
  description?: string;
9
9
  /**
@@ -37,7 +37,7 @@ interface MdDocFrontmatter {
37
37
  * pipeline leaked into descriptions (zudo-doc#2175). Do not add other new
38
38
  * rules without also updating the byte-equality fixtures (topic-plugin-audit).
39
39
  */
40
- declare function stripMarkdown(md: string): string;
40
+ export declare function stripMarkdown(md: string): string;
41
41
  /**
42
42
  * Walk `dir` recursively and return every `*.md` / `*.mdx` file's
43
43
  * absolute path together with its filesystem-derived slug. Files (or
@@ -46,7 +46,7 @@ declare function stripMarkdown(md: string): string;
46
46
  * them are not built as pages, so emitting them would yield entries
47
47
  * whose links 404.
48
48
  */
49
- declare function collectMdFiles(dir: string): Array<{
49
+ export declare function collectMdFiles(dir: string): Array<{
50
50
  filePath: string;
51
51
  slug: string;
52
52
  }>;
@@ -59,12 +59,12 @@ declare function collectMdFiles(dir: string): Array<{
59
59
  * Callers must pass the EFFECTIVE slug (`data.slug ?? filesystem slug`) —
60
60
  * the frontmatter override is resolved at the call site, not here.
61
61
  */
62
- declare function slugToUrl(slug: string, locale: string | null, base: string, siteUrl?: string): string;
62
+ export declare function slugToUrl(slug: string, locale: string | null, base: string, siteUrl?: string): string;
63
63
  /**
64
64
  * Parse a markdown file into frontmatter + body. Returns `null` when
65
65
  * the file is unreadable so callers can simply skip it.
66
66
  */
67
- declare function parseMarkdownFile(filePath: string): {
67
+ export declare function parseMarkdownFile(filePath: string): {
68
68
  data: MdDocFrontmatter;
69
69
  content: string;
70
70
  } | null;
@@ -73,6 +73,4 @@ declare function parseMarkdownFile(filePath: string): {
73
73
  * unlisted, or a `category_no_page` metadata-only category index (no
74
74
  * built route to link to).
75
75
  */
76
- declare function isExcluded(data: MdDocFrontmatter): boolean;
77
-
78
- export { type MdDocFrontmatter, collectMdFiles, isExcluded, parseMarkdownFile, slugToUrl, stripMarkdown };
76
+ export declare function isExcluded(data: MdDocFrontmatter): boolean;
@@ -1,6 +1,7 @@
1
1
  import { readFileSync, readdirSync } from "node:fs";
2
2
  import { join, relative } from "node:path";
3
3
  import matter from "gray-matter";
4
+ import { toRouteSlug } from "../slug/index.js";
4
5
  function stripMarkdown(md) {
5
6
  return md.replace(/```[\s\S]*?```/g, "").replace(/`[^`]+`/g, "").replace(/\{\/\*[\s\S]*?\*\/\}/g, "").replace(/<[^>]+>/g, "").replace(/^#{1,6}\s+/gm, "").replace(/\*{1,3}([^*]+)\*{1,3}/g, "$1").replace(/_{1,3}([^_]+)_{1,3}/g, "$1").replace(/!\[[^\]]*\]\([^)]+\)/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^>\s+/gm, "").replace(/^[-*_]{3,}\s*$/gm, "").replace(/^[\s]*[-*+]\s+/gm, "").replace(/^[\s]*\d+\.\s+/gm, "").replace(/^import\s+.*$/gm, "").replace(/^export\s+.*$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
6
7
  }
@@ -19,7 +20,7 @@ function collectMdFiles(dir) {
19
20
  if (entry.name.startsWith("_")) continue;
20
21
  walk(fullPath, baseDir);
21
22
  } else if (/\.mdx?$/.test(entry.name) && !entry.name.startsWith("_")) {
22
- const rel = relative(baseDir, fullPath).replace(/\.mdx?$/, "").replace(/\/index$/, "").replace(/^index$/, "");
23
+ const rel = toRouteSlug(relative(baseDir, fullPath).replace(/\.mdx?$/, ""));
23
24
  results.push({ filePath: fullPath, slug: rel });
24
25
  }
25
26
  }
@@ -0,0 +1,46 @@
1
+ import type { Settings } from "../settings.js";
2
+ /** Any Preact-renderable component (function returning a VNode/children). */
3
+ type AnyComponent = (props: Record<string, unknown>) => unknown;
4
+ /**
5
+ * The 4 host-supplied, locale-aware nav wrappers. Each accepts a `lang` prop;
6
+ * the factory injects the active `locale` so the wrapper queries the correct
7
+ * collection. `SiteTreeNav` is reused for both the `SiteTreeNav` and
8
+ * `SiteTreeNavDemo` MDX tags (matching the showcase mapping).
9
+ */
10
+ export interface MdxNavData {
11
+ CategoryNav: AnyComponent;
12
+ CategoryTreeNav: AnyComponent;
13
+ SiteTreeNav: AnyComponent;
14
+ }
15
+ export interface CreateMdxComponentsOptions {
16
+ /**
17
+ * The host's resolved settings object. Read for `base` (img rewrite),
18
+ * `imageEnlarge` (enlargeable-`p`). Only these fields are consumed here.
19
+ */
20
+ settings: Pick<Settings, "base" | "imageEnlarge">;
21
+ /**
22
+ * Active locale for this render. Injected into each `navData` wrapper as the
23
+ * `lang` prop so `/ja` pages resolve the JA collection. Load-bearing — do not
24
+ * drop it.
25
+ */
26
+ locale: string;
27
+ /** Host-supplied locale-aware nav wrappers. */
28
+ navData: MdxNavData;
29
+ /**
30
+ * Further host-bound bindings, spread LAST so the host always wins. Typical
31
+ * contents: `HtmlPreview`, `Details`, `Island`, `PresetGenerator`, and the
32
+ * showcase stubs (`Avatar`/`Button`/`Card`/…).
33
+ */
34
+ extras?: Record<string, unknown>;
35
+ }
36
+ /**
37
+ * Build the locale-bound MDX components map.
38
+ *
39
+ * Called once per page render with the active `locale`. Bakes all
40
+ * package-resident components and threads `locale` into the host-supplied
41
+ * `navData` wrappers (the /ja-correctness mechanism), then spreads `extras`
42
+ * last so host bindings (HtmlPreview, Details, Island, PresetGenerator,
43
+ * showcase stubs) win over any same-named default.
44
+ */
45
+ export declare function createMdxComponents(options: CreateMdxComponentsOptions): Record<string, unknown>;
46
+ export {};