@takazudo/zudo-doc 0.1.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 (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -0
  3. package/dist/body-foot-util/body-foot-util-area.d.ts +55 -0
  4. package/dist/body-foot-util/body-foot-util-area.js +71 -0
  5. package/dist/body-foot-util/edit-link.d.ts +45 -0
  6. package/dist/body-foot-util/edit-link.js +42 -0
  7. package/dist/body-foot-util/index.d.ts +3 -0
  8. package/dist/body-foot-util/index.js +11 -0
  9. package/dist/breadcrumb/breadcrumb.d.ts +57 -0
  10. package/dist/breadcrumb/breadcrumb.js +113 -0
  11. package/dist/breadcrumb/find-path.d.ts +16 -0
  12. package/dist/breadcrumb/find-path.js +13 -0
  13. package/dist/breadcrumb/index.d.ts +4 -0
  14. package/dist/breadcrumb/index.js +7 -0
  15. package/dist/breadcrumb/types.d.ts +32 -0
  16. package/dist/breadcrumb/types.js +0 -0
  17. package/dist/code-syntax/code-block-enhancer-script.d.ts +3 -0
  18. package/dist/code-syntax/code-block-enhancer-script.js +165 -0
  19. package/dist/code-syntax/code-block-enhancer.d.ts +22 -0
  20. package/dist/code-syntax/code-block-enhancer.js +13 -0
  21. package/dist/code-syntax/index.d.ts +8 -0
  22. package/dist/code-syntax/index.js +29 -0
  23. package/dist/code-syntax/mermaid-init-script.d.ts +51 -0
  24. package/dist/code-syntax/mermaid-init-script.js +225 -0
  25. package/dist/code-syntax/mermaid-init.d.ts +48 -0
  26. package/dist/code-syntax/mermaid-init.js +14 -0
  27. package/dist/code-syntax/tabs-init-script.d.ts +3 -0
  28. package/dist/code-syntax/tabs-init-script.js +106 -0
  29. package/dist/code-syntax/tabs-init.d.ts +24 -0
  30. package/dist/code-syntax/tabs-init.js +10 -0
  31. package/dist/code-syntax/tabs.d.ts +36 -0
  32. package/dist/code-syntax/tabs.js +62 -0
  33. package/dist/content/component-map.d.ts +51 -0
  34. package/dist/content/component-map.js +29 -0
  35. package/dist/content/content-blockquote.d.ts +11 -0
  36. package/dist/content/content-blockquote.js +14 -0
  37. package/dist/content/content-code.d.ts +26 -0
  38. package/dist/content/content-code.js +39 -0
  39. package/dist/content/content-link.d.ts +12 -0
  40. package/dist/content/content-link.js +43 -0
  41. package/dist/content/content-ol.d.ts +11 -0
  42. package/dist/content/content-ol.js +15 -0
  43. package/dist/content/content-paragraph.d.ts +10 -0
  44. package/dist/content/content-paragraph.js +7 -0
  45. package/dist/content/content-strong.d.ts +11 -0
  46. package/dist/content/content-strong.js +14 -0
  47. package/dist/content/content-table.d.ts +11 -0
  48. package/dist/content/content-table.js +14 -0
  49. package/dist/content/content-ul.d.ts +11 -0
  50. package/dist/content/content-ul.js +15 -0
  51. package/dist/content/heading-h2.d.ts +14 -0
  52. package/dist/content/heading-h2.js +18 -0
  53. package/dist/content/heading-h3.d.ts +14 -0
  54. package/dist/content/heading-h3.js +18 -0
  55. package/dist/content/heading-h4.d.ts +14 -0
  56. package/dist/content/heading-h4.js +18 -0
  57. package/dist/content/index.d.ts +13 -0
  58. package/dist/content/index.js +27 -0
  59. package/dist/details/details.d.ts +26 -0
  60. package/dist/details/details.js +10 -0
  61. package/dist/details/index.d.ts +2 -0
  62. package/dist/details/index.js +4 -0
  63. package/dist/doclayout/anchors.d.ts +55 -0
  64. package/dist/doclayout/anchors.js +42 -0
  65. package/dist/doclayout/doc-layout-with-defaults.d.ts +83 -0
  66. package/dist/doclayout/doc-layout-with-defaults.js +159 -0
  67. package/dist/doclayout/doc-layout.d.ts +121 -0
  68. package/dist/doclayout/doc-layout.js +89 -0
  69. package/dist/doclayout/index.d.ts +6 -0
  70. package/dist/doclayout/index.js +17 -0
  71. package/dist/footer/footer.d.ts +42 -0
  72. package/dist/footer/footer.js +79 -0
  73. package/dist/footer/index.d.ts +3 -0
  74. package/dist/footer/index.js +4 -0
  75. package/dist/footer/types.d.ts +58 -0
  76. package/dist/footer/types.js +0 -0
  77. package/dist/head/doc-head.d.ts +33 -0
  78. package/dist/head/doc-head.js +90 -0
  79. package/dist/head/index.d.ts +5 -0
  80. package/dist/head/index.js +8 -0
  81. package/dist/head/og-tags.d.ts +25 -0
  82. package/dist/head/og-tags.js +16 -0
  83. package/dist/head/twitter-card.d.ts +21 -0
  84. package/dist/head/twitter-card.js +14 -0
  85. package/dist/head/types.d.ts +83 -0
  86. package/dist/head/types.js +0 -0
  87. package/dist/header/header.d.ts +158 -0
  88. package/dist/header/header.js +367 -0
  89. package/dist/header/index.d.ts +6 -0
  90. package/dist/header/index.js +18 -0
  91. package/dist/header/nav-active.d.ts +39 -0
  92. package/dist/header/nav-active.js +24 -0
  93. package/dist/header/nav-overflow-script.d.ts +3 -0
  94. package/dist/header/nav-overflow-script.js +169 -0
  95. package/dist/header/right-items.d.ts +38 -0
  96. package/dist/header/right-items.js +30 -0
  97. package/dist/header/types.d.ts +40 -0
  98. package/dist/header/types.js +0 -0
  99. package/dist/html-preview-wrapper/dedent.d.ts +10 -0
  100. package/dist/html-preview-wrapper/dedent.js +16 -0
  101. package/dist/html-preview-wrapper/highlighted-code.d.ts +18 -0
  102. package/dist/html-preview-wrapper/highlighted-code.js +53 -0
  103. package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +60 -0
  104. package/dist/html-preview-wrapper/html-preview-wrapper.js +36 -0
  105. package/dist/html-preview-wrapper/html-preview.d.ts +35 -0
  106. package/dist/html-preview-wrapper/html-preview.js +75 -0
  107. package/dist/html-preview-wrapper/index.d.ts +5 -0
  108. package/dist/html-preview-wrapper/index.js +12 -0
  109. package/dist/html-preview-wrapper/preflight.d.ts +13 -0
  110. package/dist/html-preview-wrapper/preflight.js +108 -0
  111. package/dist/html-preview-wrapper/preview-base.d.ts +29 -0
  112. package/dist/html-preview-wrapper/preview-base.js +127 -0
  113. package/dist/i18n-version/index.d.ts +5 -0
  114. package/dist/i18n-version/index.js +14 -0
  115. package/dist/i18n-version/language-switcher.d.ts +24 -0
  116. package/dist/i18n-version/language-switcher.js +25 -0
  117. package/dist/i18n-version/types.d.ts +43 -0
  118. package/dist/i18n-version/types.js +0 -0
  119. package/dist/i18n-version/version-banner.d.ts +30 -0
  120. package/dist/i18n-version/version-banner.js +21 -0
  121. package/dist/i18n-version/version-switcher.d.ts +112 -0
  122. package/dist/i18n-version/version-switcher.js +157 -0
  123. package/dist/index.d.ts +2 -0
  124. package/dist/index.js +0 -0
  125. package/dist/integrations/claude-resources/escape-for-mdx.d.ts +8 -0
  126. package/dist/integrations/claude-resources/escape-for-mdx.js +131 -0
  127. package/dist/integrations/claude-resources/generate.d.ts +13 -0
  128. package/dist/integrations/claude-resources/generate.js +404 -0
  129. package/dist/integrations/claude-resources/index.d.ts +46 -0
  130. package/dist/integrations/claude-resources/index.js +24 -0
  131. package/dist/integrations/doc-history/index.d.ts +137 -0
  132. package/dist/integrations/doc-history/index.js +138 -0
  133. package/dist/integrations/doc-history/pre-build.d.ts +58 -0
  134. package/dist/integrations/doc-history/pre-build.js +67 -0
  135. package/dist/integrations/llms-txt/dev-middleware.d.ts +40 -0
  136. package/dist/integrations/llms-txt/dev-middleware.js +76 -0
  137. package/dist/integrations/llms-txt/emit.d.ts +22 -0
  138. package/dist/integrations/llms-txt/emit.js +55 -0
  139. package/dist/integrations/llms-txt/generate.d.ts +26 -0
  140. package/dist/integrations/llms-txt/generate.js +36 -0
  141. package/dist/integrations/llms-txt/index.d.ts +7 -0
  142. package/dist/integrations/llms-txt/index.js +27 -0
  143. package/dist/integrations/llms-txt/load.d.ts +51 -0
  144. package/dist/integrations/llms-txt/load.js +83 -0
  145. package/dist/integrations/llms-txt/strip.d.ts +22 -0
  146. package/dist/integrations/llms-txt/strip.js +10 -0
  147. package/dist/integrations/llms-txt/types.d.ts +145 -0
  148. package/dist/integrations/llms-txt/types.js +0 -0
  149. package/dist/integrations/search-index/build-emitter.d.ts +30 -0
  150. package/dist/integrations/search-index/build-emitter.js +15 -0
  151. package/dist/integrations/search-index/collect.d.ts +12 -0
  152. package/dist/integrations/search-index/collect.js +48 -0
  153. package/dist/integrations/search-index/content-files.d.ts +32 -0
  154. package/dist/integrations/search-index/content-files.js +50 -0
  155. package/dist/integrations/search-index/dev-middleware.d.ts +16 -0
  156. package/dist/integrations/search-index/dev-middleware.js +30 -0
  157. package/dist/integrations/search-index/index.d.ts +5 -0
  158. package/dist/integrations/search-index/index.js +14 -0
  159. package/dist/integrations/search-index/types.d.ts +38 -0
  160. package/dist/integrations/search-index/types.js +6 -0
  161. package/dist/metainfo/doc-metainfo.d.ts +50 -0
  162. package/dist/metainfo/doc-metainfo.js +107 -0
  163. package/dist/metainfo/doc-tags.d.ts +66 -0
  164. package/dist/metainfo/doc-tags.js +53 -0
  165. package/dist/metainfo/frontmatter-preview.d.ts +95 -0
  166. package/dist/metainfo/frontmatter-preview.js +55 -0
  167. package/dist/metainfo/index.d.ts +4 -0
  168. package/dist/metainfo/index.js +28 -0
  169. package/dist/nav-indexing/category-nav.d.ts +28 -0
  170. package/dist/nav-indexing/category-nav.js +41 -0
  171. package/dist/nav-indexing/category-tree-nav.d.ts +27 -0
  172. package/dist/nav-indexing/category-tree-nav.js +49 -0
  173. package/dist/nav-indexing/doc-card-grid.d.ts +38 -0
  174. package/dist/nav-indexing/doc-card-grid.js +40 -0
  175. package/dist/nav-indexing/docs-sitemap.d.ts +25 -0
  176. package/dist/nav-indexing/docs-sitemap.js +40 -0
  177. package/dist/nav-indexing/index.d.ts +10 -0
  178. package/dist/nav-indexing/index.js +18 -0
  179. package/dist/nav-indexing/nav-card-grid.d.ts +31 -0
  180. package/dist/nav-indexing/nav-card-grid.js +43 -0
  181. package/dist/nav-indexing/site-tree-nav-demo.d.ts +39 -0
  182. package/dist/nav-indexing/site-tree-nav-demo.js +65 -0
  183. package/dist/nav-indexing/tag-nav.d.ts +38 -0
  184. package/dist/nav-indexing/tag-nav.js +96 -0
  185. package/dist/nav-indexing/types.d.ts +95 -0
  186. package/dist/nav-indexing/types.js +0 -0
  187. package/dist/nav-indexing/versions-page-content.d.ts +29 -0
  188. package/dist/nav-indexing/versions-page-content.js +76 -0
  189. package/dist/page-loading/index.d.ts +2 -0
  190. package/dist/page-loading/index.js +10 -0
  191. package/dist/page-loading/page-loading-overlay.d.ts +35 -0
  192. package/dist/page-loading/page-loading-overlay.js +50 -0
  193. package/dist/sidebar/index.d.ts +3 -0
  194. package/dist/sidebar/index.js +4 -0
  195. package/dist/sidebar/sidebar.d.ts +54 -0
  196. package/dist/sidebar/sidebar.js +35 -0
  197. package/dist/sidebar/types.d.ts +71 -0
  198. package/dist/sidebar/types.js +0 -0
  199. package/dist/sidebar-resizer/index.d.ts +14 -0
  200. package/dist/sidebar-resizer/index.js +165 -0
  201. package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +20 -0
  202. package/dist/sidebar-resizer/sidebar-resizer-init.js +119 -0
  203. package/dist/sidebar-tree/build-tree.d.ts +43 -0
  204. package/dist/sidebar-tree/build-tree.js +127 -0
  205. package/dist/sidebar-tree/category-meta.d.ts +19 -0
  206. package/dist/sidebar-tree/category-meta.js +63 -0
  207. package/dist/sidebar-tree/index.d.ts +3 -0
  208. package/dist/sidebar-tree/index.js +13 -0
  209. package/dist/sidebar-tree/types.d.ts +120 -0
  210. package/dist/sidebar-tree/types.js +0 -0
  211. package/dist/tab-item/index.d.ts +2 -0
  212. package/dist/tab-item/index.js +5 -0
  213. package/dist/tab-item/tab-item.d.ts +38 -0
  214. package/dist/tab-item/tab-item.js +25 -0
  215. package/dist/theme/color-scheme-provider.d.ts +32 -0
  216. package/dist/theme/color-scheme-provider.js +43 -0
  217. package/dist/theme/color-tweak-export-modal.d.ts +20 -0
  218. package/dist/theme/color-tweak-export-modal.js +138 -0
  219. package/dist/theme/design-token-serde.d.ts +136 -0
  220. package/dist/theme/design-token-serde.js +254 -0
  221. package/dist/theme/design-token-tweak-panel.d.ts +11 -0
  222. package/dist/theme/design-token-tweak-panel.js +10 -0
  223. package/dist/theme/design-token-types.d.ts +19 -0
  224. package/dist/theme/design-token-types.js +6 -0
  225. package/dist/theme/iframe-bridge.d.ts +44 -0
  226. package/dist/theme/iframe-bridge.js +70 -0
  227. package/dist/theme/index.d.ts +9 -0
  228. package/dist/theme/index.js +42 -0
  229. package/dist/theme/theme-toggle.d.ts +17 -0
  230. package/dist/theme/theme-toggle.js +91 -0
  231. package/dist/toc/cx.d.ts +16 -0
  232. package/dist/toc/cx.js +22 -0
  233. package/dist/toc/index.d.ts +5 -0
  234. package/dist/toc/index.js +9 -0
  235. package/dist/toc/mobile-toc.d.ts +46 -0
  236. package/dist/toc/mobile-toc.js +88 -0
  237. package/dist/toc/smart-break.d.ts +27 -0
  238. package/dist/toc/smart-break.js +36 -0
  239. package/dist/toc/toc-title.d.ts +10 -0
  240. package/dist/toc/toc-title.js +14 -0
  241. package/dist/toc/toc.d.ts +60 -0
  242. package/dist/toc/toc.js +56 -0
  243. package/dist/toc/types.d.ts +23 -0
  244. package/dist/toc/types.js +0 -0
  245. package/dist/toc/use-active-heading.d.ts +30 -0
  246. package/dist/toc/use-active-heading.js +106 -0
  247. package/dist/transitions/index.d.ts +1 -0
  248. package/dist/transitions/index.js +12 -0
  249. package/dist/transitions/page-events.d.ts +41 -0
  250. package/dist/transitions/page-events.js +20 -0
  251. package/dist/url-normalizer/index.d.ts +1 -0
  252. package/dist/url-normalizer/index.js +6 -0
  253. package/dist/url-normalizer/normalize.d.ts +104 -0
  254. package/dist/url-normalizer/normalize.js +22 -0
  255. package/package.json +186 -0
@@ -0,0 +1,18 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function HeadingH3({ id, children, className, ...rest }) {
3
+ return /* @__PURE__ */ jsx(
4
+ "h3",
5
+ {
6
+ id,
7
+ className: `text-body font-bold leading-snug pt-vsp-xs border-t-[2px] border-transparent${className ? ` ${className}` : ""}`,
8
+ style: {
9
+ borderImage: "linear-gradient(to right, var(--color-muted), transparent) 1"
10
+ },
11
+ ...rest,
12
+ children
13
+ }
14
+ );
15
+ }
16
+ export {
17
+ HeadingH3
18
+ };
@@ -0,0 +1,14 @@
1
+ import { ComponentChildren, JSX } from 'preact';
2
+
3
+ /** @jsxRuntime automatic */
4
+ /** @jsxImportSource preact */
5
+
6
+ type Props = {
7
+ id?: string;
8
+ className?: string;
9
+ children?: ComponentChildren;
10
+ [key: string]: any;
11
+ };
12
+ declare function HeadingH4({ id, children, className, ...rest }: Props): JSX.Element;
13
+
14
+ export { HeadingH4 };
@@ -0,0 +1,18 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function HeadingH4({ id, children, className, ...rest }) {
3
+ return /* @__PURE__ */ jsx(
4
+ "h4",
5
+ {
6
+ id,
7
+ className: `text-body font-semibold leading-snug pt-vsp-xs border-t border-transparent${className ? ` ${className}` : ""}`,
8
+ style: {
9
+ borderImage: "linear-gradient(to right, var(--color-muted), transparent) 1"
10
+ },
11
+ ...rest,
12
+ children
13
+ }
14
+ );
15
+ }
16
+ export {
17
+ HeadingH4
18
+ };
@@ -0,0 +1,13 @@
1
+ export { HeadingH2 } from './heading-h2.js';
2
+ export { HeadingH3 } from './heading-h3.js';
3
+ export { HeadingH4 } from './heading-h4.js';
4
+ export { ContentParagraph } from './content-paragraph.js';
5
+ export { ContentLink } from './content-link.js';
6
+ export { ContentStrong } from './content-strong.js';
7
+ export { ContentBlockquote } from './content-blockquote.js';
8
+ export { ContentUl } from './content-ul.js';
9
+ export { ContentOl } from './content-ol.js';
10
+ export { ContentTable } from './content-table.js';
11
+ export { ContentCode } from './content-code.js';
12
+ export { defaultComponents, htmlOverrides } from './component-map.js';
13
+ import 'preact';
@@ -0,0 +1,27 @@
1
+ import { HeadingH2 } from "./heading-h2.js";
2
+ import { HeadingH3 } from "./heading-h3.js";
3
+ import { HeadingH4 } from "./heading-h4.js";
4
+ import { ContentParagraph } from "./content-paragraph.js";
5
+ import { ContentLink } from "./content-link.js";
6
+ import { ContentStrong } from "./content-strong.js";
7
+ import { ContentBlockquote } from "./content-blockquote.js";
8
+ import { ContentUl } from "./content-ul.js";
9
+ import { ContentOl } from "./content-ol.js";
10
+ import { ContentTable } from "./content-table.js";
11
+ import { ContentCode } from "./content-code.js";
12
+ import { htmlOverrides, defaultComponents } from "./component-map.js";
13
+ export {
14
+ ContentBlockquote,
15
+ ContentCode,
16
+ ContentLink,
17
+ ContentOl,
18
+ ContentParagraph,
19
+ ContentStrong,
20
+ ContentTable,
21
+ ContentUl,
22
+ HeadingH2,
23
+ HeadingH3,
24
+ HeadingH4,
25
+ defaultComponents,
26
+ htmlOverrides
27
+ };
@@ -0,0 +1,26 @@
1
+ import { ComponentChildren, VNode } from 'preact';
2
+
3
+ /** @jsxRuntime automatic */
4
+ /** @jsxImportSource preact */
5
+
6
+ interface DetailsProps {
7
+ /**
8
+ * Summary / toggle label shown in the `<summary>` element.
9
+ * Defaults to `"Details"` — the same fallback used by the legacy
10
+ * `src/components/details.astro`.
11
+ */
12
+ title?: string;
13
+ /** Slot content rendered inside the collapsed body. */
14
+ children?: ComponentChildren;
15
+ }
16
+ /**
17
+ * Collapsible `<details>` / `<summary>` block — JSX port of
18
+ * `src/components/details.astro`.
19
+ *
20
+ * Keeps layout and token classes identical to the original template.
21
+ * The legacy component used Astro's `<slot />`; v2 accepts standard
22
+ * Preact `children`.
23
+ */
24
+ declare function Details({ title, children }: DetailsProps): VNode;
25
+
26
+ export { Details, type DetailsProps };
@@ -0,0 +1,10 @@
1
+ import { jsx, jsxs } from "preact/jsx-runtime";
2
+ function Details({ title = "Details", children }) {
3
+ return /* @__PURE__ */ jsxs("details", { class: "my-vsp-md border border-muted rounded-lg overflow-hidden", children: [
4
+ /* @__PURE__ */ jsx("summary", { class: "cursor-pointer px-hsp-lg py-vsp-sm bg-surface font-medium text-fg select-none hover:text-accent", children: title }),
5
+ /* @__PURE__ */ jsx("div", { class: "px-hsp-lg py-vsp-sm zd-content", children })
6
+ ] });
7
+ }
8
+ export {
9
+ Details
10
+ };
@@ -0,0 +1,2 @@
1
+ export { Details, DetailsProps } from './details.js';
2
+ import 'preact';
@@ -0,0 +1,4 @@
1
+ import { Details } from "./details.js";
2
+ export {
3
+ Details
4
+ };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Anchor identifier — the unique fragment after `@slot:doc-layout:` in
3
+ * the literal anchor text. This is the stable key the drift checker keys
4
+ * off of; the surrounding comment syntax is derived from `kind`.
5
+ */
6
+ type DocLayoutAnchorId = "imports" | "frontmatter" | "head-scripts" | "head-links" | "header-call:start" | "header-call:end" | "after-sidebar" | "content-wrapper:start" | "content-wrapper:end" | "breadcrumb:start" | "breadcrumb:end" | "after-breadcrumb" | "after-content" | "footer" | "body-end-components" | "body-end-scripts";
7
+ /**
8
+ * Whether the anchor lives in the frontmatter region (`---` block in
9
+ * Astro / module-scope in JSX) or in the body markup region.
10
+ *
11
+ * - `frontmatter` anchors are emitted as `// @slot:doc-layout:<id>` line
12
+ * comments — both Astro frontmatter and TS module scope accept them.
13
+ * - `body` anchors are emitted as `<!-- @slot:doc-layout:<id> -->` HTML
14
+ * comments — JSX accepts these as `{/* … *\/}` blocks (we keep the
15
+ * literal HTML form for byte-for-byte parity with the existing
16
+ * create-zudo-doc anchor strings).
17
+ */
18
+ type DocLayoutAnchorKind = "frontmatter" | "body";
19
+ interface DocLayoutAnchor {
20
+ readonly id: DocLayoutAnchorId;
21
+ readonly kind: DocLayoutAnchorKind;
22
+ }
23
+ /**
24
+ * The 16 doc-layout anchors, in the order they appear in a scaffolded
25
+ * `doc-layout.astro`. Order is informational (useful for the drift
26
+ * checker's diagnostic output); identity is what matters.
27
+ */
28
+ declare const DOC_LAYOUT_ANCHORS: readonly DocLayoutAnchor[];
29
+ /**
30
+ * Build the literal anchor *comment string* the drift checker greps for
31
+ * in a scaffolded file.
32
+ *
33
+ * - `frontmatter` → `// @slot:doc-layout:<id>`
34
+ * - `body` → `<!-- @slot:doc-layout:<id> -->`
35
+ *
36
+ * Examples:
37
+ * anchorComment({ id: "imports", kind: "frontmatter" })
38
+ * // "// @slot:doc-layout:imports"
39
+ * anchorComment({ id: "footer", kind: "body" })
40
+ * // "<!-- @slot:doc-layout:footer -->"
41
+ */
42
+ declare function anchorComment(anchor: DocLayoutAnchor): string;
43
+ /**
44
+ * Convenience: every anchor's comment string, in declaration order. The
45
+ * drift checker can iterate this and assert each substring appears in the
46
+ * scaffolded `doc-layout.astro`.
47
+ */
48
+ declare function allAnchorComments(): readonly string[];
49
+ /**
50
+ * Convenience: anchor IDs as a typed set. Useful when a caller wants to
51
+ * verify "is this id one of ours?" without scanning the full list.
52
+ */
53
+ declare const DOC_LAYOUT_ANCHOR_IDS: ReadonlySet<DocLayoutAnchorId>;
54
+
55
+ export { DOC_LAYOUT_ANCHORS, DOC_LAYOUT_ANCHOR_IDS, type DocLayoutAnchor, type DocLayoutAnchorId, type DocLayoutAnchorKind, allAnchorComments, anchorComment };
@@ -0,0 +1,42 @@
1
+ const DOC_LAYOUT_ANCHORS = [
2
+ { id: "imports", kind: "frontmatter" },
3
+ { id: "frontmatter", kind: "frontmatter" },
4
+ { id: "head-scripts", kind: "body" },
5
+ { id: "head-links", kind: "body" },
6
+ { id: "header-call:start", kind: "body" },
7
+ { id: "header-call:end", kind: "body" },
8
+ { id: "after-sidebar", kind: "body" },
9
+ { id: "content-wrapper:start", kind: "body" },
10
+ { id: "content-wrapper:end", kind: "body" },
11
+ { id: "breadcrumb:start", kind: "body" },
12
+ { id: "breadcrumb:end", kind: "body" },
13
+ { id: "after-breadcrumb", kind: "body" },
14
+ { id: "after-content", kind: "body" },
15
+ { id: "footer", kind: "body" },
16
+ { id: "body-end-components", kind: "body" },
17
+ { id: "body-end-scripts", kind: "body" }
18
+ ];
19
+ const EXPECTED_ANCHOR_COUNT = 16;
20
+ if (DOC_LAYOUT_ANCHORS.length !== EXPECTED_ANCHOR_COUNT) {
21
+ throw new Error(
22
+ `DOC_LAYOUT_ANCHORS must have exactly ${EXPECTED_ANCHOR_COUNT} entries, got ${DOC_LAYOUT_ANCHORS.length}`
23
+ );
24
+ }
25
+ function anchorComment(anchor) {
26
+ if (anchor.kind === "frontmatter") {
27
+ return `// @slot:doc-layout:${anchor.id}`;
28
+ }
29
+ return `<!-- @slot:doc-layout:${anchor.id} -->`;
30
+ }
31
+ function allAnchorComments() {
32
+ return DOC_LAYOUT_ANCHORS.map(anchorComment);
33
+ }
34
+ const DOC_LAYOUT_ANCHOR_IDS = new Set(
35
+ DOC_LAYOUT_ANCHORS.map((a) => a.id)
36
+ );
37
+ export {
38
+ DOC_LAYOUT_ANCHORS,
39
+ DOC_LAYOUT_ANCHOR_IDS,
40
+ allAnchorComments,
41
+ anchorComment
42
+ };
@@ -0,0 +1,83 @@
1
+ import { DocLayoutProps } from './doc-layout.js';
2
+ import { ComponentChildren, JSX } from 'preact';
3
+ import { HeadingItem } from '../toc/types.js';
4
+ import { VersionBannerLabels } from '../i18n-version/version-banner.js';
5
+ export { DOC_LAYOUT_ANCHORS, DOC_LAYOUT_ANCHOR_IDS, DocLayoutAnchor, DocLayoutAnchorId, DocLayoutAnchorKind, allAnchorComments, anchorComment } from './anchors.js';
6
+
7
+ /** @jsxImportSource preact */
8
+
9
+ /**
10
+ * Override slots for the default-bearing wrapper. Any slot that the
11
+ * caller wants to replace can be passed here; otherwise the package
12
+ * defaults are used.
13
+ *
14
+ * Footer default: a bare `<Footer />` shell so the contentinfo ARIA
15
+ * landmark is always present. Callers that want full footer content
16
+ * (link columns, copyright, taglist) pass `footerOverride` with a
17
+ * host-side data-aware wrapper — see `pages/lib/footer-with-defaults.tsx`.
18
+ */
19
+ interface DocLayoutWithDefaultsProps extends Omit<DocLayoutProps, "header" | "sidebar" | "toc" | "mobileToc" | "breadcrumb" | "footer" | "main"> {
20
+ /** The page's article body. Required. */
21
+ children: ComponentChildren;
22
+ /** Replace the default site header. */
23
+ headerOverride?: ComponentChildren;
24
+ /** Replace the default sidebar contents. */
25
+ sidebarOverride?: ComponentChildren;
26
+ /** Replace the default desktop TOC. */
27
+ tocOverride?: ComponentChildren;
28
+ /** Replace the default mobile TOC. */
29
+ mobileTocOverride?: ComponentChildren;
30
+ /** Replace the default breadcrumb. */
31
+ breadcrumbOverride?: ComponentChildren;
32
+ /** Replace the default footer. */
33
+ footerOverride?: ComponentChildren;
34
+ /**
35
+ * Heading items extracted from the page's MDX body. When provided, the
36
+ * default Toc and MobileToc instances render the full item list in SSG
37
+ * HTML (anchor links visible to crawlers and JS-off users). Auto-index
38
+ * pages and pages with no qualifying headings should pass `[]` or omit
39
+ * this prop — the components gracefully handle both cases.
40
+ */
41
+ headings?: readonly HeadingItem[];
42
+ /**
43
+ * Absolute canonical URL for this page. When supplied, the host page
44
+ * should pass this through to `<HeadWithDefaults canonical={...} />` in
45
+ * the `head` slot so `<link rel="canonical">` is emitted. Compute as:
46
+ * settings.siteUrl.replace(/\/$/, '') + pageUrl
47
+ * when settings.siteUrl is non-empty; omit otherwise.
48
+ *
49
+ * This prop is declared here so the host's call sites have a single
50
+ * place to express the canonical intent. The actual emission happens in
51
+ * the `head` slot child (HeadWithDefaults).
52
+ */
53
+ canonical?: string;
54
+ /**
55
+ * Version-banner variant. When set, a `<VersionBanner>` is rendered in
56
+ * the `afterBreadcrumb` slot. `false` / `undefined` suppress it. This
57
+ * matches the legacy `version.banner` frontmatter shape.
58
+ *
59
+ * The host must also pass `versionBannerLatestUrl` and
60
+ * `versionBannerLabels` so the banner can render a localized notice
61
+ * with a link to the latest version of the current page.
62
+ */
63
+ versionBanner?: "unmaintained" | "unreleased" | false;
64
+ /** Pre-resolved href used by the version banner's "view latest" link. */
65
+ versionBannerLatestUrl?: string;
66
+ /** Localized labels used by the version banner. */
67
+ versionBannerLabels?: VersionBannerLabels;
68
+ }
69
+
70
+ /**
71
+ * Default-bearing wrapper. Consumers who don't need composable layout
72
+ * control reach for this; it forwards to `<DocLayout>` and inserts
73
+ * sensible (and overridable) defaults into each slot.
74
+ *
75
+ * The body of this component contains every body-region injection
76
+ * anchor as a JSX comment expression, so a literal-substring drift
77
+ * check between this file and the scaffolded `doc-layout.astro` will
78
+ * find each anchor in both places. JSX comment expressions are
79
+ * compile-time-only and do not affect runtime output.
80
+ */
81
+ declare function DocLayoutWithDefaults(props: DocLayoutWithDefaultsProps): JSX.Element;
82
+
83
+ export { DocLayoutWithDefaults, type DocLayoutWithDefaultsProps };
@@ -0,0 +1,159 @@
1
+ import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
2
+ import { Island } from "@takazudo/zfb";
3
+ import { DocLayout } from "./doc-layout.js";
4
+ import { Sidebar } from "../sidebar/sidebar.js";
5
+ import { Toc } from "../toc/toc.js";
6
+ import { MobileToc } from "../toc/mobile-toc.js";
7
+ import { getTocTitle } from "../toc/toc-title.js";
8
+ import ThemeToggle from "../theme/theme-toggle.js";
9
+ import { Footer } from "../footer/footer.js";
10
+ import { CodeBlockEnhancer } from "../code-syntax/code-block-enhancer.js";
11
+ import { MermaidInit } from "../code-syntax/mermaid-init.js";
12
+ import { TabsInit } from "../code-syntax/tabs-init.js";
13
+ import { VERSION_SWITCHER_INIT_SCRIPT } from "../i18n-version/version-switcher.js";
14
+ import {
15
+ VersionBanner
16
+ } from "../i18n-version/version-banner.js";
17
+ import {
18
+ DOC_LAYOUT_ANCHORS,
19
+ DOC_LAYOUT_ANCHOR_IDS,
20
+ allAnchorComments,
21
+ anchorComment
22
+ } from "./anchors.js";
23
+ function DocLayoutWithDefaults(props) {
24
+ const {
25
+ children,
26
+ headerOverride,
27
+ sidebarOverride,
28
+ tocOverride,
29
+ mobileTocOverride,
30
+ breadcrumbOverride,
31
+ footerOverride,
32
+ headings,
33
+ bodyEndComponents,
34
+ bodyEndScripts,
35
+ afterSidebar,
36
+ afterBreadcrumb,
37
+ afterContent,
38
+ head,
39
+ lang,
40
+ canonical,
41
+ versionBanner,
42
+ versionBannerLatestUrl,
43
+ versionBannerLabels,
44
+ ...rest
45
+ } = props;
46
+ void canonical;
47
+ const versionBannerActive = versionBanner !== void 0 && versionBanner !== false;
48
+ const versionBannerComplete = versionBannerLatestUrl !== void 0 && versionBannerLabels !== void 0;
49
+ if (versionBannerActive && !versionBannerComplete && typeof process !== "undefined" && process.env?.NODE_ENV !== "production") {
50
+ const missing = [];
51
+ if (versionBannerLatestUrl === void 0) missing.push("versionBannerLatestUrl");
52
+ if (versionBannerLabels === void 0) missing.push("versionBannerLabels");
53
+ console.warn(
54
+ `[doc-layout] versionBanner=${String(versionBanner)} requires ${missing.join(
55
+ " + "
56
+ )}; banner will be skipped.`
57
+ );
58
+ }
59
+ const composedAfterBreadcrumb = versionBanner !== void 0 && versionBanner !== false && versionBannerLatestUrl !== void 0 && versionBannerLabels !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
60
+ /* @__PURE__ */ jsx(
61
+ VersionBanner,
62
+ {
63
+ type: versionBanner,
64
+ latestUrl: versionBannerLatestUrl,
65
+ labels: versionBannerLabels
66
+ }
67
+ ),
68
+ afterBreadcrumb
69
+ ] }) : afterBreadcrumb;
70
+ const tocHeadings = headings ?? [];
71
+ const tocTitle = getTocTitle(lang);
72
+ const shouldRenderDefaultToc = !props.hideToc && tocHeadings.length > 0;
73
+ const defaultToc = shouldRenderDefaultToc ? Island({
74
+ when: "load",
75
+ children: /* @__PURE__ */ jsx(Toc, { headings: tocHeadings, title: tocTitle })
76
+ }) : void 0;
77
+ const defaultMobileToc = shouldRenderDefaultToc ? Island({
78
+ when: "load",
79
+ children: /* @__PURE__ */ jsx(MobileToc, { headings: tocHeadings, title: tocTitle })
80
+ }) : void 0;
81
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
82
+ DocLayout,
83
+ {
84
+ ...rest,
85
+ lang,
86
+ head,
87
+ header: headerOverride ?? // Minimal default header — surfaces a `<ThemeToggle>` island
88
+ // so SSG output emits `data-zfb-island="ThemeToggle"` on
89
+ // every page. Pages with bespoke chrome should pass
90
+ // `headerOverride` to swap this out wholesale.
91
+ /* @__PURE__ */ jsx(
92
+ "header",
93
+ {
94
+ class: "sticky top-0 z-50 flex h-[3.5rem] items-center justify-end border-b border-muted bg-surface px-hsp-lg",
95
+ "data-header": true,
96
+ children: /* @__PURE__ */ jsx(ThemeToggle, {})
97
+ }
98
+ ),
99
+ sidebar: (
100
+ // Empty-data Sidebar emits the SSG marker via an explicit
101
+ // `<Island when="load">` wrap at this call site (not inside
102
+ // `<Sidebar>` itself) so the bundle's hydrate pass targets
103
+ // the bare component and Preact doesn't append a duplicate
104
+ // wrapper-div alongside the SSR'd tree. See `../sidebar/sidebar.tsx`
105
+ // for the full diagnosis. Hosts that have a real nav tree
106
+ // pass it through `sidebarOverride` and apply their own
107
+ // `<Island>` wrap (see `pages/lib/_sidebar-with-defaults.tsx`
108
+ // in the host project).
109
+ sidebarOverride ?? Island({
110
+ when: "load",
111
+ children: /* @__PURE__ */ jsx(Sidebar, { nodes: [] })
112
+ })
113
+ ),
114
+ toc: tocOverride ?? defaultToc,
115
+ mobileToc: mobileTocOverride ?? defaultMobileToc,
116
+ breadcrumb: breadcrumbOverride,
117
+ afterBreadcrumb: composedAfterBreadcrumb,
118
+ afterSidebar,
119
+ afterContent,
120
+ footer: footerOverride ?? /* @__PURE__ */ jsx(Footer, {}),
121
+ bodyEndComponents,
122
+ bodyEndScripts: bodyEndScripts ?? // Default body-end scripts:
123
+ // - CodeBlockEnhancer wraps every <pre class="syntect-*"> with
124
+ // copy + word-wrap controls and emits an SR-announce live
125
+ // region for clipboard feedback. Idempotent on pages with no
126
+ // fenced code.
127
+ // - TabsInit activates the correct tab panel and wires click
128
+ // handlers for <Tabs> components.
129
+ // - MermaidInit lazily imports the mermaid library from
130
+ // `MERMAID_CDN_MODULE_URL` (esm.sh by default) on
131
+ // `AFTER_NAVIGATE_EVENT` and renders any `[data-mermaid]`
132
+ // containers emitted by zfb's MermaidPlugin (zfb#104).
133
+ // Pages without diagrams pay zero runtime cost because
134
+ // the dynamic import is gated on a non-empty
135
+ // `querySelectorAll("[data-mermaid]:not([data-mermaid-rendered])")`.
136
+ // - The version-switcher script wires the dropdown toggle /
137
+ // outside-click / Escape-key behavior for every
138
+ // [data-version-switcher] element.
139
+ // All four scripts are idempotent and safe on pages that have
140
+ // no matching elements, so they are included unconditionally.
141
+ // Callers that need a different body-end script set should pass
142
+ // `bodyEndScripts` explicitly to override this default.
143
+ /* @__PURE__ */ jsxs(Fragment, { children: [
144
+ /* @__PURE__ */ jsx(CodeBlockEnhancer, {}),
145
+ /* @__PURE__ */ jsx(TabsInit, {}),
146
+ /* @__PURE__ */ jsx(MermaidInit, {}),
147
+ /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: VERSION_SWITCHER_INIT_SCRIPT } })
148
+ ] }),
149
+ main: children
150
+ }
151
+ ) });
152
+ }
153
+ export {
154
+ DOC_LAYOUT_ANCHORS,
155
+ DOC_LAYOUT_ANCHOR_IDS,
156
+ DocLayoutWithDefaults,
157
+ allAnchorComments,
158
+ anchorComment
159
+ };
@@ -0,0 +1,121 @@
1
+ import { ComponentChildren, JSX } from 'preact';
2
+
3
+ /** @jsxImportSource preact */
4
+
5
+ /**
6
+ * Direction-and-mode metadata for the root `<html>` element. Keeps the
7
+ * shell from depending on a project's i18n module.
8
+ */
9
+ interface DocLayoutHtmlAttrs {
10
+ /** BCP-47 language tag, e.g. `"en"`, `"ja"`. Defaults to `"en"`. */
11
+ lang?: string;
12
+ /**
13
+ * Optional `data-theme` attribute value (e.g. `"light"` / `"dark"`).
14
+ * Set per `<html>`-level color-scheme strategy.
15
+ */
16
+ dataTheme?: string;
17
+ /**
18
+ * Optional inline `style` value to apply to `<html>` — in practice this
19
+ * is `color-scheme: light` / `color-scheme: dark`.
20
+ */
21
+ htmlStyle?: string;
22
+ }
23
+ /**
24
+ * Full prop surface for the composable layout. Every "slot" is a
25
+ * `ComponentChildren` so consumers can pass arbitrary JSX (Preact, zfb
26
+ * Island wrappers, server-rendered output projected through the
27
+ * boundary, etc.).
28
+ */
29
+ interface DocLayoutProps extends DocLayoutHtmlAttrs {
30
+ /** Page title — rendered as the `<title>` value. */
31
+ title: string;
32
+ /** Optional `<meta name="description">`. */
33
+ description?: string;
34
+ /** Optional `<meta name="robots" content="noindex">` toggle. */
35
+ noindex?: boolean;
36
+ /**
37
+ * Free-form children injected at the top of `<head>`, after the
38
+ * baseline `<title>` / charset / viewport meta. Use this for OG/
39
+ * Twitter meta, preload hints, color-scheme provider scripts, RSS
40
+ * links, the `<ClientRouter />` (Astro) or its zfb-equivalent — the
41
+ * shell stays out of the way.
42
+ */
43
+ head?: ComponentChildren;
44
+ /** Required. The site header. Consumer ships its own `<header>`. */
45
+ header: ComponentChildren;
46
+ /**
47
+ * Optional sidebar content. When omitted (or when `hideSidebar` is
48
+ * true) the desktop-sidebar `<aside>` is not rendered and the
49
+ * content-margin wrapper collapses to full width.
50
+ */
51
+ sidebar?: ComponentChildren;
52
+ /**
53
+ * Hide the sidebar even if the slot is provided. Mirrors the
54
+ * `hide_sidebar` page frontmatter flag.
55
+ */
56
+ hideSidebar?: boolean;
57
+ /**
58
+ * When present, sets `data-zfb-transition-persist` on the desktop
59
+ * sidebar `<aside>`. Keyed as `sidebar-{lang}-{navSection}` so zfb's
60
+ * Strategy B persist swaps reuse the same DOM node across same-locale +
61
+ * same-section navigations. Omit for back-compat (no attribute). Must
62
+ * NOT be passed when `hideSidebar` is true — the sr-only aside contains
63
+ * no real sidebar content and persisting it conflicts with the new
64
+ * page's tree on cross-type navigations. Resolves #1546.
65
+ */
66
+ sidebarPersistKey?: string;
67
+ /**
68
+ * Slot rendered between the desktop sidebar and the content-margin
69
+ * wrapper. Used by the sidebar-toggle feature in `create-zudo-doc`.
70
+ */
71
+ afterSidebar?: ComponentChildren;
72
+ /** Optional breadcrumb shown above the article. */
73
+ breadcrumb?: ComponentChildren;
74
+ /** Optional content slot rendered between breadcrumb and article. */
75
+ afterBreadcrumb?: ComponentChildren;
76
+ /** Optional mobile-only TOC, rendered above the article. */
77
+ mobileToc?: ComponentChildren;
78
+ /** Required. The page's article body. */
79
+ main: ComponentChildren;
80
+ /**
81
+ * Optional content slot rendered immediately after `<article>` but
82
+ * still inside `<main>`. Used by the body-foot util area and the
83
+ * doc-history feature.
84
+ */
85
+ afterContent?: ComponentChildren;
86
+ /** Optional desktop TOC rendered alongside `<main>` on wide screens. */
87
+ toc?: ComponentChildren;
88
+ /** Hide the TOC (both desktop and mobile) regardless of slot value. */
89
+ hideToc?: boolean;
90
+ /** Optional footer rendered below the content. */
91
+ footer?: ComponentChildren;
92
+ /**
93
+ * Components rendered just before `</body>`. Use for modals,
94
+ * design-token panels, code-block enhancers, mock initializers, and
95
+ * other globally-mounted islands.
96
+ */
97
+ bodyEndComponents?: ComponentChildren;
98
+ /**
99
+ * Scripts / inline `<script>` islands rendered last in `</body>`.
100
+ * Kept distinct from `bodyEndComponents` because the original Astro
101
+ * layout had two separate anchors here, and downstream features (e.g.
102
+ * the sidebar resizer) inject into the scripts slot specifically.
103
+ */
104
+ bodyEndScripts?: ComponentChildren;
105
+ }
106
+ /**
107
+ * `id` attribute of the desktop sidebar `<aside>`. Used by consumer code
108
+ * (e.g. sidebar-toggle island) to locate the element in the DOM.
109
+ */
110
+ declare const DESKTOP_SIDEBAR_ID = "desktop-sidebar";
111
+ /**
112
+ * Composable documentation-page layout shell.
113
+ *
114
+ * Renders a complete `<html>` document. Treat this as the *outermost*
115
+ * component; do not nest another `<html>` around it. The slot props let
116
+ * a downstream framework (e.g. `<DocLayoutWithDefaults>` or a fully
117
+ * custom layout) decide what fills each region.
118
+ */
119
+ declare function DocLayout(props: DocLayoutProps): JSX.Element;
120
+
121
+ export { DESKTOP_SIDEBAR_ID, DocLayout, type DocLayoutHtmlAttrs, type DocLayoutProps };