@takazudo/zudo-doc 0.2.20 → 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 (276) 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-nav.js +1 -1
  166. package/dist/nav-indexing/category-tree-nav.d.ts +4 -8
  167. package/dist/nav-indexing/doc-card-grid.d.ts +4 -8
  168. package/dist/nav-indexing/docs-sitemap.d.ts +4 -8
  169. package/dist/nav-indexing/index.d.ts +37 -10
  170. package/dist/nav-indexing/nav-card-grid.d.ts +4 -8
  171. package/dist/nav-indexing/site-tree-nav-demo.d.ts +4 -8
  172. package/dist/nav-indexing/tag-nav.d.ts +6 -10
  173. package/dist/nav-indexing/types.d.ts +6 -8
  174. package/dist/nav-indexing/versions-page-content.d.ts +4 -8
  175. package/dist/nav-scope/index.d.ts +41 -0
  176. package/dist/nav-scope/index.js +41 -0
  177. package/dist/nav-source-cache/index.d.ts +13 -0
  178. package/dist/nav-source-cache/index.js +28 -0
  179. package/dist/nav-source-docs/index.d.ts +169 -0
  180. package/dist/nav-source-docs/index.js +123 -0
  181. package/dist/page-loading/index.d.ts +1 -2
  182. package/dist/page-loading/page-loading-overlay.d.ts +4 -8
  183. package/dist/plugins/claude-resources.d.ts +3 -0
  184. package/dist/plugins/claude-resources.js +27 -0
  185. package/dist/plugins/connect-adapter.d.ts +31 -0
  186. package/dist/plugins/connect-adapter.js +78 -0
  187. package/dist/plugins/doc-history.d.ts +3 -0
  188. package/dist/plugins/doc-history.js +54 -0
  189. package/dist/plugins/llms-txt.d.ts +3 -0
  190. package/dist/plugins/llms-txt.js +48 -0
  191. package/dist/plugins/plugin-utils.d.ts +17 -0
  192. package/dist/plugins/plugin-utils.js +11 -0
  193. package/dist/plugins/search-index.d.ts +3 -0
  194. package/dist/plugins/search-index.js +24 -0
  195. package/dist/preset.d.ts +152 -0
  196. package/dist/preset.js +169 -0
  197. package/dist/render-markdown/index.d.ts +5 -0
  198. package/dist/render-markdown/index.js +115 -0
  199. package/dist/robots.d.ts +36 -0
  200. package/dist/robots.js +17 -0
  201. package/dist/route-enumerators/index.d.ts +204 -0
  202. package/dist/route-enumerators/index.js +156 -0
  203. package/dist/safelist.css +1 -1
  204. package/dist/search-widget/index.d.ts +38 -0
  205. package/dist/search-widget/index.js +169 -0
  206. package/dist/search-widget-script/index.d.ts +18 -0
  207. package/dist/search-widget-script/index.js +465 -0
  208. package/dist/settings.d.ts +255 -0
  209. package/dist/settings.js +0 -0
  210. package/dist/sidebar/index.d.ts +21 -3
  211. package/dist/sidebar/sidebar.d.ts +5 -9
  212. package/dist/sidebar/types.d.ts +4 -6
  213. package/dist/sidebar-prepaint/index.d.ts +21 -0
  214. package/dist/sidebar-prepaint/index.js +23 -0
  215. package/dist/sidebar-resizer/index.d.ts +2 -6
  216. package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +6 -10
  217. package/dist/sidebar-toggle-island/index.d.ts +13 -0
  218. package/dist/sidebar-toggle-island/index.js +122 -0
  219. package/dist/sidebar-tree/build-tree.d.ts +4 -8
  220. package/dist/sidebar-tree/category-meta.d.ts +3 -6
  221. package/dist/sidebar-tree/index.d.ts +18 -3
  222. package/dist/sidebar-tree/types.d.ts +6 -8
  223. package/dist/sidebar-tree-island/index.d.ts +13 -0
  224. package/dist/sidebar-tree-island/index.js +454 -0
  225. package/dist/sidebar-utils/index.d.ts +64 -0
  226. package/dist/sidebar-utils/index.js +88 -0
  227. package/dist/sidebar-with-defaults/index.d.ts +38 -0
  228. package/dist/sidebar-with-defaults/index.js +45 -0
  229. package/dist/site-tree-nav/index.d.ts +71 -0
  230. package/dist/site-tree-nav/index.js +36 -0
  231. package/dist/site-tree-nav-island/index.d.ts +11 -0
  232. package/dist/site-tree-nav-island/index.js +176 -0
  233. package/dist/slug/index.d.ts +4 -0
  234. package/dist/slug/index.js +19 -0
  235. package/dist/smart-break/index.d.ts +55 -0
  236. package/dist/{toc/smart-break.js → smart-break/index.js} +30 -3
  237. package/dist/tab-item/index.d.ts +2 -2
  238. package/dist/tab-item/tab-item.d.ts +6 -7
  239. package/dist/tag-helpers/index.d.ts +40 -0
  240. package/dist/tag-helpers/index.js +54 -0
  241. package/dist/tag-pages/index.d.ts +114 -0
  242. package/dist/tag-pages/index.js +146 -0
  243. package/dist/tags-audit.d.ts +107 -0
  244. package/dist/tags-audit.js +321 -0
  245. package/dist/theme/color-scheme-provider.d.ts +4 -8
  246. package/dist/theme/color-tweak-export-modal.d.ts +4 -7
  247. package/dist/theme/design-token-serde.d.ts +14 -17
  248. package/dist/theme/design-token-types.d.ts +4 -6
  249. package/dist/theme/iframe-bridge.d.ts +12 -14
  250. package/dist/theme/index.d.ts +7 -9
  251. package/dist/theme/theme-toggle.d.ts +3 -8
  252. package/dist/theme-toggle/color-scheme-sync.d.ts +5 -7
  253. package/dist/theme-toggle/index.d.ts +4 -8
  254. package/dist/toc/cx.d.ts +2 -3
  255. package/dist/toc/index.d.ts +8 -6
  256. package/dist/toc/mobile-toc.d.ts +5 -9
  257. package/dist/toc/mobile-toc.js +1 -1
  258. package/dist/toc/toc-title.d.ts +1 -3
  259. package/dist/toc/toc.d.ts +5 -9
  260. package/dist/toc/toc.js +1 -1
  261. package/dist/toc/types.d.ts +1 -3
  262. package/dist/toc/use-active-heading.d.ts +4 -7
  263. package/dist/transitions/index.d.ts +1 -1
  264. package/dist/transitions/page-events.d.ts +4 -6
  265. package/dist/tree-nav-shared/index.d.ts +22 -0
  266. package/dist/tree-nav-shared/index.js +66 -0
  267. package/dist/url-helpers/index.d.ts +37 -0
  268. package/dist/url-helpers/index.js +106 -0
  269. package/dist/url-normalizer/index.d.ts +39 -1
  270. package/dist/url-normalizer/normalize.d.ts +3 -5
  271. package/dist/use-modal-dialog/index.d.ts +70 -0
  272. package/dist/use-modal-dialog/index.js +73 -0
  273. package/dist/versions-page/index.d.ts +55 -0
  274. package/dist/versions-page/index.js +73 -0
  275. package/package.json +290 -10
  276. package/dist/toc/smart-break.d.ts +0 -27
@@ -0,0 +1,123 @@
1
+ import { memoizeDerived } from "../nav-source-cache/index.js";
2
+ import { mergeLocaleDocs } from "../locale-merge/index.js";
3
+ function optionSig(o) {
4
+ return `dlo=${o.applyDefaultLocaleOnlyFilter ? 1 : 0};ku=${o.keepUnlisted ? 1 : 0}`;
5
+ }
6
+ const EMPTY_SLUG_SET = /* @__PURE__ */ new Set();
7
+ function createNavSourceDocs(ctx) {
8
+ const {
9
+ defaultLocale,
10
+ docsDir,
11
+ getVersions,
12
+ getLocaleConfig,
13
+ loadCategoryMeta,
14
+ isNavVisible,
15
+ isDefaultLocaleOnlyPath,
16
+ stableDocs
17
+ } = ctx;
18
+ const mergedCategoryMetaCache = /* @__PURE__ */ new Map();
19
+ function stableMergeCategoryMeta(baseDir, localeDir) {
20
+ const key = `${baseDir}
21
+ ${localeDir}`;
22
+ const cached = mergedCategoryMetaCache.get(key);
23
+ if (cached) return cached;
24
+ const merged = new Map([
25
+ ...loadCategoryMeta(baseDir),
26
+ ...loadCategoryMeta(localeDir)
27
+ ]);
28
+ mergedCategoryMetaCache.set(key, merged);
29
+ return merged;
30
+ }
31
+ function stableNavDocs(docs) {
32
+ return memoizeDerived(
33
+ [docs],
34
+ "navVisible",
35
+ () => docs.filter(isNavVisible)
36
+ );
37
+ }
38
+ const EMPTY_DOCS = [];
39
+ function resolveVersionedLocaleSource(versionSlug, versionDocsDir, lang, localeDir, options = {}) {
40
+ const sig = optionSig(options);
41
+ const baseDocs = stableDocs(`docs-v-${versionSlug}`);
42
+ const localeDocs = localeDir ? stableDocs(`docs-v-${versionSlug}-${lang}`) : EMPTY_DOCS;
43
+ const merged = memoizeDerived(
44
+ localeDir ? [baseDocs, localeDocs] : [baseDocs],
45
+ `vmerge;${lang};${sig}`,
46
+ () => mergeLocaleDocs({
47
+ baseDocs,
48
+ localeDocs,
49
+ applyDefaultLocaleOnlyFilter: options.applyDefaultLocaleOnlyFilter,
50
+ keepUnlisted: options.keepUnlisted,
51
+ isDefaultLocaleOnlyPath
52
+ })
53
+ );
54
+ const docs = merged.docs;
55
+ const resolvedVersionDocsDir = versionDocsDir ?? docsDir;
56
+ const categoryMeta = localeDir ? stableMergeCategoryMeta(resolvedVersionDocsDir, localeDir) : loadCategoryMeta(resolvedVersionDocsDir);
57
+ const navDocs = stableNavDocs(docs);
58
+ return { docs, navDocs, categoryMeta, localeSlugSet: merged.localeSlugSet };
59
+ }
60
+ function resolveNavSource(lang, currentVersion, options = {}) {
61
+ const sig = optionSig(options);
62
+ if (currentVersion) {
63
+ const versions = getVersions();
64
+ const versionConfig = Array.isArray(versions) ? versions.find((v) => v.slug === currentVersion) : void 0;
65
+ const localeDir2 = versionConfig?.locales?.[lang]?.dir;
66
+ if (lang !== defaultLocale && localeDir2) {
67
+ return resolveVersionedLocaleSource(
68
+ currentVersion,
69
+ versionConfig?.docsDir,
70
+ lang,
71
+ localeDir2,
72
+ options
73
+ );
74
+ }
75
+ const docs2 = stableDocs(`docs-v-${currentVersion}`);
76
+ const categoryMeta2 = loadCategoryMeta(
77
+ versionConfig?.docsDir ?? docsDir
78
+ );
79
+ const navDocs2 = stableNavDocs(docs2);
80
+ return { docs: docs2, navDocs: navDocs2, categoryMeta: categoryMeta2, localeSlugSet: EMPTY_SLUG_SET };
81
+ }
82
+ if (lang === defaultLocale) {
83
+ const docs2 = stableDocs("docs");
84
+ const categoryMeta2 = loadCategoryMeta(docsDir);
85
+ const navDocs2 = stableNavDocs(docs2);
86
+ return { docs: docs2, navDocs: navDocs2, categoryMeta: categoryMeta2, localeSlugSet: EMPTY_SLUG_SET };
87
+ }
88
+ const baseDocs = stableDocs("docs");
89
+ const localeDocs = stableDocs(`docs-${lang}`);
90
+ const merged = memoizeDerived(
91
+ [baseDocs, localeDocs],
92
+ `merge;${sig}`,
93
+ () => mergeLocaleDocs({
94
+ baseDocs,
95
+ localeDocs,
96
+ applyDefaultLocaleOnlyFilter: options.applyDefaultLocaleOnlyFilter,
97
+ keepUnlisted: options.keepUnlisted,
98
+ isDefaultLocaleOnlyPath
99
+ })
100
+ );
101
+ const docs = merged.docs;
102
+ const localeDir = getLocaleConfig(lang)?.dir ?? docsDir;
103
+ const categoryMeta = stableMergeCategoryMeta(docsDir, localeDir);
104
+ const navDocs = stableNavDocs(docs);
105
+ return { docs, navDocs, categoryMeta, localeSlugSet: merged.localeSlugSet };
106
+ }
107
+ function loadNavSourceDocs(lang, currentVersion) {
108
+ return resolveNavSource(lang, currentVersion, {
109
+ applyDefaultLocaleOnlyFilter: true,
110
+ keepUnlisted: true
111
+ });
112
+ }
113
+ return {
114
+ resolveNavSource,
115
+ resolveVersionedLocaleSource,
116
+ loadNavSourceDocs,
117
+ stableMergeCategoryMeta,
118
+ stableNavDocs
119
+ };
120
+ }
121
+ export {
122
+ createNavSourceDocs
123
+ };
@@ -1,2 +1 @@
1
- export { PAGE_LOADING_OVERLAY_ID, default as PageLoadingOverlay, PageLoadingOverlayProps, buildPageLoadingOverlayBootstrap } from './page-loading-overlay.js';
2
- import 'preact';
1
+ export { default as PageLoadingOverlay, PAGE_LOADING_OVERLAY_ID, buildPageLoadingOverlayBootstrap, type PageLoadingOverlayProps, } from "./page-loading-overlay.js";
@@ -1,10 +1,8 @@
1
- import * as preact from 'preact';
2
-
3
1
  /** @jsxRuntime automatic */
4
2
  /** @jsxImportSource preact */
5
3
  /** Default `id` for the overlay element. Stable so test rigs can target it. */
6
- declare const PAGE_LOADING_OVERLAY_ID = "page-loading-overlay";
7
- interface PageLoadingOverlayProps {
4
+ export declare const PAGE_LOADING_OVERLAY_ID = "page-loading-overlay";
5
+ export interface PageLoadingOverlayProps {
8
6
  /**
9
7
  * Override the DOM `id` used by both the overlay element and the
10
8
  * bootstrap script. Useful when multiple overlays could co-exist on
@@ -16,7 +14,7 @@ interface PageLoadingOverlayProps {
16
14
  * Build the inline bootstrap script body. Exported so test rigs can
17
15
  * inspect / snapshot it without rendering the component.
18
16
  */
19
- declare function buildPageLoadingOverlayBootstrap(overlayId: string): string;
17
+ export declare function buildPageLoadingOverlayBootstrap(overlayId: string): string;
20
18
  /**
21
19
  * Full-page loading overlay shown during view-transition navigations.
22
20
  *
@@ -30,6 +28,4 @@ declare function buildPageLoadingOverlayBootstrap(overlayId: string): string;
30
28
  * element-permitted-content and fails html-validate (same fix applied to the
31
29
  * version-switcher in zudolab/zudo-doc#1505; regression caught in W2A #1543).
32
30
  */
33
- declare function PageLoadingOverlay({ id, }?: PageLoadingOverlayProps): preact.JSX.Element;
34
-
35
- export { PAGE_LOADING_OVERLAY_ID, type PageLoadingOverlayProps, buildPageLoadingOverlayBootstrap, PageLoadingOverlay as default };
31
+ export default function PageLoadingOverlay({ id, }?: PageLoadingOverlayProps): import("preact").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { ZfbPlugin } from "@takazudo/zfb/plugins";
2
+ declare const plugin: ZfbPlugin;
3
+ export default plugin;
@@ -0,0 +1,27 @@
1
+ import { runClaudeResourcesPreStep } from "../integrations/claude-resources/index.js";
2
+ const PLUGIN_NAME = "@takazudo/zudo-doc-claude-resources";
3
+ const plugin = {
4
+ name: PLUGIN_NAME,
5
+ async preBuild(ctx) {
6
+ const claudeDir = ctx.options["claudeDir"];
7
+ if (typeof claudeDir !== "string" || claudeDir.length === 0) {
8
+ throw new Error(
9
+ `[${PLUGIN_NAME}] preBuild: options.claudeDir must be a non-empty string (got ${JSON.stringify(claudeDir)})`
10
+ );
11
+ }
12
+ const projectRootOpt = ctx.options["projectRoot"];
13
+ const docsDirOpt = ctx.options["docsDir"];
14
+ const result = await runClaudeResourcesPreStep({
15
+ claudeDir,
16
+ projectRoot: typeof projectRootOpt === "string" ? projectRootOpt : ctx.projectRoot,
17
+ docsDir: typeof docsDirOpt === "string" ? docsDirOpt : "src/content/docs"
18
+ });
19
+ ctx.logger.info(
20
+ `claude-resources: ${result.claudemd} CLAUDE.md, ${result.commands} commands, ${result.skills} skills, ${result.agents} agents`
21
+ );
22
+ }
23
+ };
24
+ var claude_resources_default = plugin;
25
+ export {
26
+ claude_resources_default as default
27
+ };
@@ -0,0 +1,31 @@
1
+ import type { ZfbDevMiddlewareRequest, ZfbDevMiddlewareResponse } from "@takazudo/zfb/plugins";
2
+ /**
3
+ * Connect-style middleware: `(req, res, next) => void`.
4
+ * The req/res parameters are typed as `any` here because this adapter
5
+ * intentionally passes a plain-object shim that structurally satisfies the
6
+ * subset of `IncomingMessage` / `ServerResponse` that the v2 integration
7
+ * middlewares actually access — not the full Node.js types.
8
+ */
9
+ type ConnectMiddleware = (req: any, res: any, next: (err?: unknown) => void) => void;
10
+ /**
11
+ * Convert a Connect-style middleware to a zfb devMiddleware handler.
12
+ * The returned async function takes a `ZfbDevMiddlewareRequest` and
13
+ * returns either `undefined` (passthrough — zfb falls through to its
14
+ * built-in routes) or a `ZfbDevMiddlewareResponse` envelope.
15
+ *
16
+ * Behaviour:
17
+ *
18
+ * - `next()` from the middleware → resolves with `undefined`
19
+ * (passthrough).
20
+ * - `res.end(body)` → resolves with `{ status, headers, body }`.
21
+ * `status` defaults to 200 if the middleware didn't set one,
22
+ * mirroring Node's `ServerResponse` default.
23
+ * - `next(err)` or a thrown error → rejects so the host surfaces a
24
+ * 500 with the error message the same way it does for any other
25
+ * plugin throw.
26
+ * - Binary bodies (Buffer / Uint8Array) → encoded as base64 and
27
+ * flagged `bodyEncoding: "base64"` so the JSON envelope round-trip
28
+ * stays loss-less.
29
+ */
30
+ export declare function connectToZfbHandler(middleware: ConnectMiddleware): (zfbReq: ZfbDevMiddlewareRequest) => Promise<ZfbDevMiddlewareResponse | undefined>;
31
+ export {};
@@ -0,0 +1,78 @@
1
+ import { Buffer } from "node:buffer";
2
+ function connectToZfbHandler(middleware) {
3
+ return (zfbReq) => {
4
+ return new Promise((resolveResponse, rejectResponse) => {
5
+ const req = {
6
+ method: zfbReq.method,
7
+ url: zfbReq.url,
8
+ headers: zfbReq.headers ?? {}
9
+ };
10
+ let statusCode = 200;
11
+ const headers = {};
12
+ let settled = false;
13
+ const finish = (body) => {
14
+ if (settled) return;
15
+ settled = true;
16
+ const normalisedHeaders = {};
17
+ for (const [k, v] of Object.entries(headers)) {
18
+ normalisedHeaders[k.toLowerCase()] = String(v);
19
+ }
20
+ if (Buffer.isBuffer(body) || body instanceof Uint8Array) {
21
+ resolveResponse({
22
+ status: statusCode,
23
+ headers: normalisedHeaders,
24
+ body: Buffer.from(body).toString("base64"),
25
+ bodyEncoding: "base64"
26
+ });
27
+ return;
28
+ }
29
+ resolveResponse({
30
+ status: statusCode,
31
+ headers: normalisedHeaders,
32
+ body: body == null ? "" : String(body),
33
+ bodyEncoding: "utf8"
34
+ });
35
+ };
36
+ const res = {
37
+ get statusCode() {
38
+ return statusCode;
39
+ },
40
+ set statusCode(v) {
41
+ statusCode = v;
42
+ },
43
+ setHeader(name, value) {
44
+ headers[name.toLowerCase()] = String(value);
45
+ },
46
+ getHeader(name) {
47
+ return headers[name.toLowerCase()];
48
+ },
49
+ get headersSent() {
50
+ return settled;
51
+ },
52
+ end(body) {
53
+ finish(body);
54
+ }
55
+ };
56
+ const next = (err) => {
57
+ if (settled) return;
58
+ if (err) {
59
+ settled = true;
60
+ rejectResponse(err instanceof Error ? err : new Error(String(err)));
61
+ return;
62
+ }
63
+ settled = true;
64
+ resolveResponse(void 0);
65
+ };
66
+ try {
67
+ middleware(req, res, next);
68
+ } catch (err) {
69
+ if (settled) return;
70
+ settled = true;
71
+ rejectResponse(err instanceof Error ? err : new Error(String(err)));
72
+ }
73
+ });
74
+ };
75
+ }
76
+ export {
77
+ connectToZfbHandler
78
+ };
@@ -0,0 +1,3 @@
1
+ import type { ZfbPlugin } from "@takazudo/zfb/plugins";
2
+ declare const plugin: ZfbPlugin;
3
+ export default plugin;
@@ -0,0 +1,54 @@
1
+ import {
2
+ runDocHistoryMetaStep,
3
+ runDocHistoryPostBuild,
4
+ createDocHistoryDevMiddleware
5
+ } from "../integrations/doc-history/index.js";
6
+ import { connectToZfbHandler } from "./connect-adapter.js";
7
+ import { getBasePrefix } from "./plugin-utils.js";
8
+ const plugin = {
9
+ name: "doc-history",
10
+ async preBuild(ctx) {
11
+ const { docsDir, locales } = ctx.options;
12
+ if (locales != null) {
13
+ for (const [key, entry] of Object.entries(locales)) {
14
+ if (entry == null || typeof entry !== "object" || typeof entry["dir"] !== "string" || entry["dir"].length === 0) {
15
+ throw new Error(
16
+ `[doc-history] invalid locales entry "${key}": expected { dir: string }`
17
+ );
18
+ }
19
+ }
20
+ }
21
+ await runDocHistoryMetaStep({
22
+ projectRoot: ctx.projectRoot,
23
+ docsDir: typeof docsDir === "string" ? docsDir : "src/content/docs",
24
+ locales: locales != null ? locales : void 0
25
+ });
26
+ },
27
+ async postBuild(ctx) {
28
+ try {
29
+ await runDocHistoryPostBuild(ctx.options, {
30
+ outDir: ctx.outDir,
31
+ logger: ctx.logger
32
+ });
33
+ } catch (err) {
34
+ const msg = err instanceof Error ? err.message : String(err);
35
+ if (ctx.logger?.warn) {
36
+ ctx.logger.warn(`[doc-history] postBuild failed (non-fatal): ${msg}`);
37
+ } else {
38
+ console.warn(`[doc-history] postBuild failed (non-fatal): ${msg}`);
39
+ }
40
+ }
41
+ },
42
+ devMiddleware(ctx) {
43
+ const middleware = createDocHistoryDevMiddleware(
44
+ ctx.options,
45
+ ctx.logger
46
+ );
47
+ const basePrefix = getBasePrefix(ctx.options["base"]);
48
+ ctx.register(`${basePrefix}/doc-history`, connectToZfbHandler(middleware));
49
+ }
50
+ };
51
+ var doc_history_default = plugin;
52
+ export {
53
+ doc_history_default as default
54
+ };
@@ -0,0 +1,3 @@
1
+ import type { ZfbPlugin } from "@takazudo/zfb/plugins";
2
+ declare const plugin: ZfbPlugin;
3
+ export default plugin;
@@ -0,0 +1,48 @@
1
+ import { emitLlmsTxt, createLlmsTxtDevMiddleware } from "../integrations/llms-txt/index.js";
2
+ import { connectToZfbHandler } from "./connect-adapter.js";
3
+ import { getBasePrefix } from "./plugin-utils.js";
4
+ const plugin = {
5
+ name: "llms-txt",
6
+ async postBuild(ctx) {
7
+ await emitLlmsTxt({
8
+ ...ctx.options,
9
+ outDir: ctx.outDir,
10
+ // siteUrl is normalised to undefined when falsy because the runner
11
+ // switches between absolute and root-relative URLs based on its
12
+ // presence (matches legacy Astro behaviour).
13
+ siteUrl: ctx.options["siteUrl"] || void 0,
14
+ logger: ctx.logger
15
+ });
16
+ },
17
+ devMiddleware(ctx) {
18
+ const middleware = createLlmsTxtDevMiddleware(
19
+ ctx.options,
20
+ ctx.logger
21
+ );
22
+ const handler = connectToZfbHandler(middleware);
23
+ const basePrefix = getBasePrefix(ctx.options["base"]);
24
+ ctx.register(`${basePrefix}/llms.txt`, handler);
25
+ ctx.register(`${basePrefix}/llms-full.txt`, handler);
26
+ const locales = ctx.options["locales"];
27
+ if (Array.isArray(locales)) {
28
+ for (const locale of locales) {
29
+ if (locale && typeof locale === "object" && typeof locale["code"] === "string") {
30
+ const code = locale["code"];
31
+ ctx.register(`${basePrefix}/${code}/llms.txt`, handler);
32
+ ctx.register(`${basePrefix}/${code}/llms-full.txt`, handler);
33
+ } else {
34
+ const repr = JSON.stringify(locale);
35
+ if (ctx.logger?.warn) {
36
+ ctx.logger.warn(`[llms-txt] skipping malformed locale entry (expected { code: string }): ${repr}`);
37
+ } else {
38
+ console.warn(`[llms-txt] skipping malformed locale entry (expected { code: string }): ${repr}`);
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ };
45
+ var llms_txt_default = plugin;
46
+ export {
47
+ llms_txt_default as default
48
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Remove a trailing slash from a string. Returns an empty string for any
3
+ * empty or non-string input.
4
+ */
5
+ export declare function stripTrailingSlash(s: string): string;
6
+ /**
7
+ * Derive the base prefix to prepend to registered dev-middleware routes.
8
+ *
9
+ * zfb's `register(path, handler)` matches against the FULL request URL (no
10
+ * base-stripping), so for a non-root base (e.g. "/my-docs/") the caller must
11
+ * register the full base-prefixed route. For `base="/"` the prefix is empty
12
+ * and the caller's path is used as-is.
13
+ *
14
+ * @param base - The `base` field from the plugin's `ctx.options` (may be
15
+ * undefined/non-string if not set by the host config).
16
+ */
17
+ export declare function getBasePrefix(base: unknown): string;
@@ -0,0 +1,11 @@
1
+ function stripTrailingSlash(s) {
2
+ if (typeof s !== "string" || s.length === 0) return "";
3
+ return s.endsWith("/") ? s.slice(0, -1) : s;
4
+ }
5
+ function getBasePrefix(base) {
6
+ return stripTrailingSlash(typeof base === "string" ? base : "");
7
+ }
8
+ export {
9
+ getBasePrefix,
10
+ stripTrailingSlash
11
+ };
@@ -0,0 +1,3 @@
1
+ import type { ZfbPlugin } from "@takazudo/zfb/plugins";
2
+ declare const plugin: ZfbPlugin;
3
+ export default plugin;
@@ -0,0 +1,24 @@
1
+ import { emitSearchIndex, createSearchIndexDevMiddleware } from "../integrations/search-index/index.js";
2
+ import { connectToZfbHandler } from "./connect-adapter.js";
3
+ import { getBasePrefix } from "./plugin-utils.js";
4
+ const plugin = {
5
+ name: "search-index",
6
+ async postBuild(ctx) {
7
+ await emitSearchIndex({
8
+ ...ctx.options,
9
+ outDir: ctx.outDir,
10
+ logger: ctx.logger
11
+ });
12
+ },
13
+ devMiddleware(ctx) {
14
+ const middleware = createSearchIndexDevMiddleware(
15
+ ctx.options
16
+ );
17
+ const basePrefix = getBasePrefix(ctx.options["base"]);
18
+ ctx.register(`${basePrefix}/search-index.json`, connectToZfbHandler(middleware));
19
+ }
20
+ };
21
+ var search_index_default = plugin;
22
+ export {
23
+ search_index_default as default
24
+ };
@@ -0,0 +1,152 @@
1
+ /**
2
+ * `@takazudo/zudo-doc/preset` — the package-first config preset.
3
+ *
4
+ * `zudoDocPreset()` returns the zfb config fragment that every zudo-doc
5
+ * project previously hand-wrote in its `zfb.config.ts` (collections loop,
6
+ * markdown.features, dual-theme codeHighlight, resolveMarkdownLinks,
7
+ * stripMdExt, trailingSlash, and the integration plugins array). The host
8
+ * config spreads this fragment into `defineConfig` and supplies only the
9
+ * project-specific shell fields it still owns (`framework`, `port`,
10
+ * `tailwind`, `bundle`, `base`, `adapter`).
11
+ *
12
+ * ──────────────────────────────────────────────────────────────────────────
13
+ * NODE-BUILTIN-FREE EVAL GRAPH (non-negotiable — guarded by a unit test)
14
+ * ──────────────────────────────────────────────────────────────────────────
15
+ * zfb evaluates the config module through esbuild with `--platform=neutral`
16
+ * (mirrors zfb's `loader.rs:277`); a transitive `node:*` import fails the
17
+ * load. This preset is the central node in that eval graph, so it MUST stay
18
+ * free of `node:*` builtins:
19
+ *
20
+ * - The signature takes `buildDocsSchema` and `directiveVocabulary` as
21
+ * INPUTS rather than importing the project's `src/config/*` singletons.
22
+ * Those singletons (`settings`, `tag-vocabulary`, `docs-schema`) are
23
+ * already pulled into the config eval at the call site; re-importing them
24
+ * here would (a) double-import the singletons and (b) risk dragging a
25
+ * `node:*` dependency into this module's own import graph.
26
+ * - Plugins are emitted as **bare-specifier descriptors**
27
+ * (`{ name: "@takazudo/zudo-doc/plugins/<x>", options }`), NEVER imported
28
+ * plugin functions. zfb's plugin runtime loads each `name` as a module
29
+ * specifier and dispatches lifecycle hooks against it; importing the
30
+ * plugin modules here would pull their `node:fs` / `node:path` graph into
31
+ * the config eval.
32
+ * - The only runtime dependency is `zod` (for `z.toJSONSchema`), which
33
+ * bundles cleanly under `--platform=neutral` (verified: zero `node:*`).
34
+ */
35
+ import { z } from "zod";
36
+ /** A single locale's content directory (`settings.locales[code]`). */
37
+ export interface PresetLocaleConfig {
38
+ dir: string;
39
+ }
40
+ /** A single docs version (`settings.versions[n]`). */
41
+ export interface PresetVersionConfig {
42
+ slug: string;
43
+ docsDir: string;
44
+ locales?: Record<string, {
45
+ dir: string;
46
+ }>;
47
+ }
48
+ /** The `settings.claudeResources` block (or `false` when disabled). */
49
+ export interface PresetClaudeResourcesConfig {
50
+ claudeDir: string;
51
+ projectRoot?: string;
52
+ }
53
+ /**
54
+ * The subset of `settings` the preset reads. Any concrete `typeof settings`
55
+ * (this repo's or a generated project's) is assignable to this — the preset
56
+ * only consumes these fields.
57
+ */
58
+ export interface PresetSettings {
59
+ docsDir: string;
60
+ locales: Record<string, PresetLocaleConfig>;
61
+ versions?: PresetVersionConfig[] | false;
62
+ base: string;
63
+ siteName: string;
64
+ siteDescription: string;
65
+ siteUrl: string;
66
+ trailingSlash: boolean;
67
+ mermaid: boolean;
68
+ onBrokenMarkdownLinks: "warn" | "error" | "ignore";
69
+ headingIdStrategy: "flat" | "hierarchical";
70
+ llmsTxt?: boolean;
71
+ docHistory?: boolean;
72
+ claudeResources?: PresetClaudeResourcesConfig | false;
73
+ /** "owner/repo" — when set, enables `#123` / SHA autolinks in markdown. Omit to disable entirely. */
74
+ githubAutolinksRepo?: string;
75
+ }
76
+ /**
77
+ * The directives recipe map (`markdown.features.directives`): directive name →
78
+ * the JSX component name it resolves to (registered in the host's
79
+ * `pages/_mdx-components.ts`). Passed in rather than hardcoded so a project can
80
+ * register its own directives without editing the preset; the showcase passes
81
+ * the canonical seven (note/tip/info/warning/danger/caution/details).
82
+ */
83
+ export type DirectiveVocabulary = Record<string, string>;
84
+ /** Arguments to `zudoDocPreset`. */
85
+ export interface ZudoDocPresetArgs {
86
+ /** The project's `settings` object (structurally `PresetSettings`). */
87
+ settings: PresetSettings;
88
+ /**
89
+ * The project's `buildDocsSchema` — the zod schema builder from
90
+ * `src/config/docs-schema.ts`. Passed (not imported) so the preset never
91
+ * re-imports the project's `settings` / `tag-vocabulary` singletons, keeping
92
+ * this module's import graph node-builtin-free. Called once; the result is
93
+ * converted to JSON Schema and reused for every collection.
94
+ */
95
+ buildDocsSchema: () => z.ZodType;
96
+ /**
97
+ * The directives recipe map. See {@link DirectiveVocabulary}.
98
+ */
99
+ directiveVocabulary: DirectiveVocabulary;
100
+ }
101
+ export interface PresetCollection {
102
+ name: string;
103
+ path: string;
104
+ schema: Record<string, unknown>;
105
+ }
106
+ export interface PresetPlugin {
107
+ name: string;
108
+ options?: Record<string, unknown>;
109
+ }
110
+ export interface PresetResolveMarkdownLinks {
111
+ enabled: boolean;
112
+ dirs: Array<{
113
+ dir: string;
114
+ routePrefix: string;
115
+ }>;
116
+ onBrokenLinks: "warn" | "error" | "ignore";
117
+ }
118
+ export interface PresetMarkdown {
119
+ features: Record<string, boolean | Record<string, unknown>>;
120
+ }
121
+ export interface PresetCodeHighlight {
122
+ themeLight: string;
123
+ themeDark: string;
124
+ }
125
+ /** The config fragment returned by {@link zudoDocPreset}. */
126
+ export interface ZudoDocPresetResult {
127
+ collections: PresetCollection[];
128
+ plugins: PresetPlugin[];
129
+ markdown: PresetMarkdown;
130
+ codeHighlight: PresetCodeHighlight;
131
+ resolveMarkdownLinks: PresetResolveMarkdownLinks;
132
+ stripMdExt: boolean;
133
+ trailingSlash: boolean;
134
+ }
135
+ /**
136
+ * Build the zudo-doc zfb config fragment from project settings.
137
+ *
138
+ * Spread the result into `defineConfig`:
139
+ *
140
+ * ```ts
141
+ * export default defineConfig({
142
+ * framework: "preact",
143
+ * port: 4321,
144
+ * tailwind: { enabled: true },
145
+ * bundle: { exclude: [...] },
146
+ * base: settings.base,
147
+ * adapter: "@takazudo/zfb-adapter-cloudflare",
148
+ * ...zudoDocPreset({ settings, buildDocsSchema, directiveVocabulary }),
149
+ * });
150
+ * ```
151
+ */
152
+ export declare function zudoDocPreset({ settings, buildDocsSchema, directiveVocabulary, }: ZudoDocPresetArgs): ZudoDocPresetResult;