@takazudo/zudo-doc 0.2.21 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/gen-z-index.mjs +164 -0
- package/bin/tags-audit-runner.ts +126 -0
- package/bin/tags-audit.mjs +64 -0
- package/bin/zudo-doc.mjs +83 -0
- package/dist/ai-chat-modal/index.d.ts +8 -0
- package/dist/ai-chat-modal/index.js +243 -0
- package/dist/body-foot-util/body-foot-util-area.d.ts +4 -8
- package/dist/body-foot-util/edit-link.d.ts +4 -8
- package/dist/body-foot-util/index.d.ts +4 -3
- package/dist/breadcrumb/breadcrumb.d.ts +5 -9
- package/dist/breadcrumb/find-path.d.ts +2 -5
- package/dist/breadcrumb/index.d.ts +4 -4
- package/dist/breadcrumb/types.d.ts +3 -5
- package/dist/category-nav/index.d.ts +86 -0
- package/dist/category-nav/index.js +44 -0
- package/dist/category-tree-nav/index.d.ts +65 -0
- package/dist/category-tree-nav/index.js +24 -0
- package/dist/code-group/index.d.ts +10 -0
- package/dist/code-group/index.js +37 -0
- package/dist/code-syntax/code-block-enhancer-script.d.ts +1 -3
- package/dist/code-syntax/code-block-enhancer.d.ts +3 -6
- package/dist/code-syntax/index.d.ts +9 -8
- package/dist/code-syntax/mermaid-init-script.d.ts +3 -5
- package/dist/code-syntax/mermaid-init.d.ts +4 -7
- package/dist/code-syntax/tabs-init-script.d.ts +1 -3
- package/dist/code-syntax/tabs-init.d.ts +3 -6
- package/dist/code-syntax/tabs.d.ts +4 -7
- package/dist/color-scheme-utils.d.ts +125 -0
- package/dist/color-scheme-utils.js +151 -0
- package/dist/compose-meta-title/index.d.ts +7 -0
- package/dist/compose-meta-title/index.js +10 -0
- package/dist/content/component-map.d.ts +13 -17
- package/dist/content/content-blockquote.d.ts +3 -6
- package/dist/content/content-code.d.ts +3 -6
- package/dist/content/content-code.js +1 -1
- package/dist/content/content-link.d.ts +3 -6
- package/dist/content/content-link.js +1 -1
- package/dist/content/content-ol.d.ts +3 -6
- package/dist/content/content-paragraph.d.ts +3 -6
- package/dist/content/content-strong.d.ts +3 -6
- package/dist/content/content-table.d.ts +3 -6
- package/dist/content/content-ul.d.ts +3 -6
- package/dist/content/heading-h2.d.ts +3 -6
- package/dist/content/heading-h3.d.ts +3 -6
- package/dist/content/heading-h4.d.ts +3 -6
- package/dist/content/index.d.ts +29 -13
- package/dist/content-admonition/index.d.ts +15 -0
- package/dist/content-admonition/index.js +14 -0
- package/dist/design-token-panel-bootstrap.d.ts +38 -0
- package/dist/design-token-panel-bootstrap.js +29 -0
- package/dist/desktop-sidebar-toggle-island/index.d.ts +5 -0
- package/dist/desktop-sidebar-toggle-island/index.js +62 -0
- package/dist/details/details.d.ts +3 -7
- package/dist/details/index.d.ts +2 -2
- package/dist/doc-body-end/index.d.ts +21 -0
- package/dist/doc-body-end/index.js +15 -0
- package/dist/doc-content-header/index.d.ts +69 -0
- package/dist/doc-content-header/index.js +49 -0
- package/dist/doc-history/index.d.ts +10 -0
- package/dist/doc-history/index.js +407 -0
- package/dist/doc-history-area/index.d.ts +84 -0
- package/dist/doc-history-area/index.js +76 -0
- package/dist/doc-metainfo-area/index.d.ts +46 -0
- package/dist/doc-metainfo-area/index.js +41 -0
- package/dist/doc-page-props/index.d.ts +93 -0
- package/dist/doc-page-props/index.js +0 -0
- package/dist/doc-page-renderer/index.d.ts +128 -0
- package/dist/doc-page-renderer/index.js +103 -0
- package/dist/doc-page-shell/index.d.ts +136 -0
- package/dist/doc-page-shell/index.js +127 -0
- package/dist/doc-pager/index.d.ts +25 -0
- package/dist/doc-pager/index.js +41 -0
- package/dist/doc-route-entries/index.d.ts +125 -0
- package/dist/doc-route-entries/index.js +76 -0
- package/dist/doc-route-paths/index.d.ts +54 -0
- package/dist/doc-route-paths/index.js +61 -0
- package/dist/doc-tags-area/index.d.ts +38 -0
- package/dist/doc-tags-area/index.js +30 -0
- package/dist/doclayout/anchors.d.ts +7 -9
- package/dist/doclayout/doc-layout-with-defaults.d.ts +16 -12
- package/dist/doclayout/doc-layout.d.ts +5 -9
- package/dist/doclayout/index.d.ts +6 -6
- package/dist/eject/index.d.ts +33 -0
- package/dist/eject/index.js +229 -0
- package/dist/extract-headings/index.d.ts +43 -0
- package/dist/extract-headings/index.js +111 -0
- package/dist/factory-context/index.d.ts +80 -0
- package/dist/factory-context/index.js +0 -0
- package/dist/features.css +882 -0
- package/dist/footer/footer.d.ts +4 -8
- package/dist/footer/index.d.ts +13 -3
- package/dist/footer/types.d.ts +4 -6
- package/dist/footer-with-defaults/index.d.ts +63 -0
- package/dist/footer-with-defaults/index.js +128 -0
- package/dist/frontmatter-preview-data/index.d.ts +26 -0
- package/dist/frontmatter-preview-data/index.js +23 -0
- package/dist/github-helpers/index.d.ts +17 -0
- package/dist/github-helpers/index.js +16 -0
- package/dist/head/doc-head.d.ts +3 -6
- package/dist/head/index.d.ts +9 -5
- package/dist/head/og-tags.d.ts +4 -7
- package/dist/head/twitter-card.d.ts +3 -6
- package/dist/head/types.d.ts +1 -3
- package/dist/head-with-defaults/index.d.ts +49 -0
- package/dist/head-with-defaults/index.js +62 -0
- package/dist/header/header.d.ts +6 -10
- package/dist/header/index.d.ts +16 -6
- package/dist/header/nav-active.d.ts +5 -7
- package/dist/header/nav-overflow-script.d.ts +1 -3
- package/dist/header/right-items.d.ts +3 -6
- package/dist/header/types.d.ts +10 -12
- package/dist/header-with-defaults/index.d.ts +77 -0
- package/dist/header-with-defaults/index.js +163 -0
- package/dist/html-preview-wrapper/dedent.d.ts +1 -3
- package/dist/html-preview-wrapper/highlighted-code.d.ts +3 -7
- package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +6 -10
- package/dist/html-preview-wrapper/html-preview.d.ts +5 -9
- package/dist/html-preview-wrapper/index.d.ts +8 -5
- package/dist/html-preview-wrapper/preflight.d.ts +1 -3
- package/dist/html-preview-wrapper/preview-base.d.ts +4 -8
- package/dist/i18n-version/index.d.ts +7 -5
- package/dist/i18n-version/language-switcher.d.ts +5 -8
- package/dist/i18n-version/types.d.ts +3 -5
- package/dist/i18n-version/version-banner.d.ts +4 -8
- package/dist/i18n-version/version-switcher.d.ts +7 -10
- package/dist/icons/index.d.ts +9 -13
- package/dist/image-enlarge/index.d.ts +13 -0
- package/dist/image-enlarge/index.js +176 -0
- package/dist/index.d.ts +26 -2
- package/dist/inline-version-switcher/index.d.ts +31 -0
- package/dist/inline-version-switcher/index.js +44 -0
- package/dist/integrations/claude-resources/escape-for-mdx.d.ts +1 -3
- package/dist/integrations/claude-resources/generate.d.ts +2 -4
- package/dist/integrations/claude-resources/index.d.ts +7 -10
- package/dist/integrations/doc-history/index.d.ts +21 -24
- package/dist/integrations/doc-history/pre-build.d.ts +7 -9
- package/dist/integrations/llms-txt/dev-middleware.d.ts +7 -11
- package/dist/integrations/llms-txt/emit.d.ts +2 -7
- package/dist/integrations/llms-txt/generate.d.ts +3 -8
- package/dist/integrations/llms-txt/index.d.ts +33 -8
- package/dist/integrations/llms-txt/load.d.ts +3 -7
- package/dist/integrations/llms-txt/strip.d.ts +2 -6
- package/dist/integrations/llms-txt/types.d.ts +9 -13
- package/dist/integrations/search-index/build-emitter.d.ts +4 -7
- package/dist/integrations/search-index/collect.d.ts +2 -5
- package/dist/integrations/search-index/dev-middleware.d.ts +5 -8
- package/dist/integrations/search-index/index.d.ts +7 -5
- package/dist/integrations/search-index/types.d.ts +5 -7
- package/dist/island-types/index.d.ts +44 -0
- package/dist/island-types/index.js +12 -0
- package/dist/locale-merge/index.d.ts +114 -0
- package/dist/locale-merge/index.js +27 -0
- package/dist/math-block/index.d.ts +18 -0
- package/dist/math-block/index.js +29 -0
- package/dist/md-utils/index.d.ts +6 -8
- package/dist/md-utils/index.js +2 -1
- package/dist/mdx-components/index.d.ts +46 -0
- package/dist/mdx-components/index.js +161 -0
- package/dist/mermaid-enlarge/index.d.ts +11 -0
- package/dist/mermaid-enlarge/index.js +290 -0
- package/dist/metainfo/doc-metainfo.d.ts +5 -9
- package/dist/metainfo/doc-tags.d.ts +7 -11
- package/dist/metainfo/frontmatter-preview.d.ts +8 -12
- package/dist/metainfo/index.d.ts +6 -4
- package/dist/nav-data-prep/index.d.ts +72 -0
- package/dist/nav-data-prep/index.js +34 -0
- package/dist/nav-indexing/category-nav.d.ts +4 -8
- package/dist/nav-indexing/category-tree-nav.d.ts +4 -8
- package/dist/nav-indexing/doc-card-grid.d.ts +4 -8
- package/dist/nav-indexing/docs-sitemap.d.ts +4 -8
- package/dist/nav-indexing/index.d.ts +37 -10
- package/dist/nav-indexing/nav-card-grid.d.ts +4 -8
- package/dist/nav-indexing/site-tree-nav-demo.d.ts +4 -8
- package/dist/nav-indexing/tag-nav.d.ts +6 -10
- package/dist/nav-indexing/types.d.ts +6 -8
- package/dist/nav-indexing/versions-page-content.d.ts +4 -8
- package/dist/nav-scope/index.d.ts +41 -0
- package/dist/nav-scope/index.js +41 -0
- package/dist/nav-source-cache/index.d.ts +13 -0
- package/dist/nav-source-cache/index.js +28 -0
- package/dist/nav-source-docs/index.d.ts +169 -0
- package/dist/nav-source-docs/index.js +123 -0
- package/dist/page-loading/index.d.ts +1 -2
- package/dist/page-loading/page-loading-overlay.d.ts +4 -8
- package/dist/plugins/claude-resources.d.ts +3 -0
- package/dist/plugins/claude-resources.js +27 -0
- package/dist/plugins/connect-adapter.d.ts +31 -0
- package/dist/plugins/connect-adapter.js +78 -0
- package/dist/plugins/doc-history.d.ts +3 -0
- package/dist/plugins/doc-history.js +54 -0
- package/dist/plugins/llms-txt.d.ts +3 -0
- package/dist/plugins/llms-txt.js +48 -0
- package/dist/plugins/plugin-utils.d.ts +17 -0
- package/dist/plugins/plugin-utils.js +11 -0
- package/dist/plugins/routes.d.ts +2 -0
- package/dist/plugins/routes.js +100 -0
- package/dist/plugins/search-index.d.ts +3 -0
- package/dist/plugins/search-index.js +24 -0
- package/dist/preset.d.ts +198 -0
- package/dist/preset.js +185 -0
- package/dist/render-markdown/index.d.ts +5 -0
- package/dist/render-markdown/index.js +115 -0
- package/dist/robots.d.ts +36 -0
- package/dist/robots.js +17 -0
- package/dist/route-enumerators/index.d.ts +204 -0
- package/dist/route-enumerators/index.js +156 -0
- package/dist/routes/404.d.ts +7 -0
- package/dist/routes/404.js +47 -0
- package/dist/routes/_chrome.d.ts +32 -0
- package/dist/routes/_chrome.js +365 -0
- package/dist/routes/_context.d.ts +56 -0
- package/dist/routes/_context.js +222 -0
- package/dist/routes/_docs-helpers.d.ts +43 -0
- package/dist/routes/_docs-helpers.js +173 -0
- package/dist/routes/_virtual.d.js +0 -0
- package/dist/routes/api-ai-chat.d.ts +5 -0
- package/dist/routes/api-ai-chat.js +24 -0
- package/dist/routes/docs-slug.d.ts +21 -0
- package/dist/routes/docs-slug.js +26 -0
- package/dist/routes/docs-tags-index.d.ts +7 -0
- package/dist/routes/docs-tags-index.js +11 -0
- package/dist/routes/docs-tags-tag.d.ts +23 -0
- package/dist/routes/docs-tags-tag.js +19 -0
- package/dist/routes/docs-versions.d.ts +7 -0
- package/dist/routes/docs-versions.js +11 -0
- package/dist/routes/index.d.ts +7 -0
- package/dist/routes/index.js +117 -0
- package/dist/routes/locale-docs-slug.d.ts +27 -0
- package/dist/routes/locale-docs-slug.js +40 -0
- package/dist/routes/locale-docs-tags-index.d.ts +18 -0
- package/dist/routes/locale-docs-tags-index.js +15 -0
- package/dist/routes/locale-docs-tags-tag.d.ts +25 -0
- package/dist/routes/locale-docs-tags-tag.js +22 -0
- package/dist/routes/locale-docs-versions.d.ts +18 -0
- package/dist/routes/locale-docs-versions.js +15 -0
- package/dist/routes/locale-index.d.ts +24 -0
- package/dist/routes/locale-index.js +132 -0
- package/dist/routes/robots.txt.d.ts +3 -0
- package/dist/routes/robots.txt.js +8 -0
- package/dist/routes/sitemap.xml.d.ts +5 -0
- package/dist/routes/sitemap.xml.js +31 -0
- package/dist/routes/v-docs-slug.d.ts +27 -0
- package/dist/routes/v-docs-slug.js +34 -0
- package/dist/routes/v-locale-docs-slug.d.ts +31 -0
- package/dist/routes/v-locale-docs-slug.js +50 -0
- package/dist/safelist.css +1 -1
- package/dist/search-widget/index.d.ts +38 -0
- package/dist/search-widget/index.js +169 -0
- package/dist/search-widget-script/index.d.ts +18 -0
- package/dist/search-widget-script/index.js +465 -0
- package/dist/settings.d.ts +270 -0
- package/dist/settings.js +0 -0
- package/dist/sidebar/index.d.ts +21 -3
- package/dist/sidebar/sidebar.d.ts +5 -9
- package/dist/sidebar/types.d.ts +4 -6
- package/dist/sidebar-prepaint/index.d.ts +21 -0
- package/dist/sidebar-prepaint/index.js +23 -0
- package/dist/sidebar-resizer/index.d.ts +2 -6
- package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +6 -10
- package/dist/sidebar-toggle-island/index.d.ts +13 -0
- package/dist/sidebar-toggle-island/index.js +122 -0
- package/dist/sidebar-tree/build-tree.d.ts +4 -8
- package/dist/sidebar-tree/category-meta.d.ts +3 -6
- package/dist/sidebar-tree/index.d.ts +18 -3
- package/dist/sidebar-tree/types.d.ts +6 -8
- package/dist/sidebar-tree-island/index.d.ts +13 -0
- package/dist/sidebar-tree-island/index.js +454 -0
- package/dist/sidebar-utils/index.d.ts +64 -0
- package/dist/sidebar-utils/index.js +88 -0
- package/dist/sidebar-with-defaults/index.d.ts +38 -0
- package/dist/sidebar-with-defaults/index.js +45 -0
- package/dist/site-tree-nav/index.d.ts +71 -0
- package/dist/site-tree-nav/index.js +36 -0
- package/dist/site-tree-nav-island/index.d.ts +11 -0
- package/dist/site-tree-nav-island/index.js +176 -0
- package/dist/slug/index.d.ts +4 -0
- package/dist/slug/index.js +19 -0
- package/dist/smart-break/index.d.ts +55 -0
- package/dist/{toc/smart-break.js → smart-break/index.js} +30 -3
- package/dist/tab-item/index.d.ts +2 -2
- package/dist/tab-item/tab-item.d.ts +6 -7
- package/dist/tag-helpers/index.d.ts +40 -0
- package/dist/tag-helpers/index.js +54 -0
- package/dist/tag-pages/index.d.ts +114 -0
- package/dist/tag-pages/index.js +146 -0
- package/dist/tags-audit.d.ts +107 -0
- package/dist/tags-audit.js +321 -0
- package/dist/theme/color-scheme-provider.d.ts +4 -8
- package/dist/theme/color-tweak-export-modal.d.ts +4 -7
- package/dist/theme/design-token-serde.d.ts +14 -17
- package/dist/theme/design-token-types.d.ts +4 -6
- package/dist/theme/iframe-bridge.d.ts +12 -14
- package/dist/theme/index.d.ts +7 -9
- package/dist/theme/theme-toggle.d.ts +3 -8
- package/dist/theme-toggle/color-scheme-sync.d.ts +5 -7
- package/dist/theme-toggle/index.d.ts +4 -8
- package/dist/toc/cx.d.ts +2 -3
- package/dist/toc/index.d.ts +8 -6
- package/dist/toc/mobile-toc.d.ts +5 -9
- package/dist/toc/mobile-toc.js +1 -1
- package/dist/toc/toc-title.d.ts +1 -3
- package/dist/toc/toc.d.ts +5 -9
- package/dist/toc/toc.js +1 -1
- package/dist/toc/types.d.ts +1 -3
- package/dist/toc/use-active-heading.d.ts +4 -7
- package/dist/transitions/index.d.ts +1 -1
- package/dist/transitions/page-events.d.ts +4 -6
- package/dist/tree-nav-shared/index.d.ts +22 -0
- package/dist/tree-nav-shared/index.js +66 -0
- package/dist/url-helpers/index.d.ts +37 -0
- package/dist/url-helpers/index.js +106 -0
- package/dist/url-normalizer/index.d.ts +39 -1
- package/dist/url-normalizer/normalize.d.ts +3 -5
- package/dist/use-modal-dialog/index.d.ts +70 -0
- package/dist/use-modal-dialog/index.js +73 -0
- package/dist/versions-page/index.d.ts +55 -0
- package/dist/versions-page/index.js +73 -0
- package/eject/breadcrumb/breadcrumb.tsx +194 -0
- package/eject/breadcrumb/find-path.ts +26 -0
- package/eject/breadcrumb/index.ts +4 -0
- package/eject/breadcrumb/types.ts +32 -0
- package/eject/code-group/index.tsx +78 -0
- package/eject/content-admonition/index.tsx +50 -0
- package/eject/details/details.tsx +34 -0
- package/eject/details/index.ts +4 -0
- package/eject/doc-pager/index.tsx +91 -0
- package/eject/footer/footer.tsx +167 -0
- package/eject/footer/index.ts +19 -0
- package/eject/footer/types.ts +60 -0
- package/eject/header/header.tsx +725 -0
- package/eject/header/index.ts +36 -0
- package/eject/header/nav-active.ts +122 -0
- package/eject/header/nav-overflow-script.ts +302 -0
- package/eject/header/right-items.ts +78 -0
- package/eject/header/types.ts +69 -0
- package/eject/page-loading/index.ts +10 -0
- package/eject/page-loading/page-loading-overlay.tsx +103 -0
- package/eject/sidebar/index.ts +27 -0
- package/eject/sidebar/sidebar.tsx +137 -0
- package/eject/sidebar/types.ts +73 -0
- package/eject/tab-item/index.ts +7 -0
- package/eject/tab-item/tab-item.tsx +70 -0
- package/eject/theme-toggle/color-scheme-sync.ts +73 -0
- package/eject/theme-toggle/index.tsx +120 -0
- package/eject/toc/cx.ts +38 -0
- package/eject/toc/index.ts +11 -0
- package/eject/toc/mobile-toc.tsx +133 -0
- package/eject/toc/toc-title.ts +33 -0
- package/eject/toc/toc.tsx +119 -0
- package/eject/toc/types.ts +14 -0
- package/eject/toc/use-active-heading.ts +162 -0
- package/package.json +371 -11
- package/routes-src/404.tsx +49 -0
- package/routes-src/_chrome.tsx +470 -0
- package/routes-src/_context.ts +314 -0
- package/routes-src/_docs-helpers.ts +284 -0
- package/routes-src/_virtual.d.ts +15 -0
- package/routes-src/api-ai-chat.tsx +46 -0
- package/routes-src/docs-slug.tsx +43 -0
- package/routes-src/docs-tags-index.tsx +14 -0
- package/routes-src/docs-tags-tag.tsx +29 -0
- package/routes-src/docs-versions.tsx +15 -0
- package/routes-src/index.tsx +134 -0
- package/routes-src/locale-docs-slug.tsx +69 -0
- package/routes-src/locale-docs-tags-index.tsx +23 -0
- package/routes-src/locale-docs-tags-tag.tsx +39 -0
- package/routes-src/locale-docs-versions.tsx +23 -0
- package/routes-src/locale-index.tsx +150 -0
- package/routes-src/robots.txt.tsx +13 -0
- package/routes-src/sitemap.xml.tsx +48 -0
- package/routes-src/v-docs-slug.tsx +64 -0
- package/routes-src/v-locale-docs-slug.tsx +85 -0
- package/dist/toc/smart-break.d.ts +0 -27
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export type { HeadingItem } from "../extract-headings/index.js";
|
|
2
|
+
import type { HeadingItem } from "../extract-headings/index.js";
|
|
3
|
+
import type { BreadcrumbItem } from "../breadcrumb/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Nav tree node shape as consumed by doc-route pages.
|
|
6
|
+
*
|
|
7
|
+
* Structurally identical to the host project's `NavNode` from
|
|
8
|
+
* `src/utils/docs.ts`. Defined here so the package types do not import
|
|
9
|
+
* the host `@/` alias. The host's `NavNode` is a structural subtype and
|
|
10
|
+
* assignable wherever `DocNavNode` is expected.
|
|
11
|
+
*/
|
|
12
|
+
export interface DocNavNode {
|
|
13
|
+
slug: string;
|
|
14
|
+
label: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
position: number;
|
|
17
|
+
href?: string;
|
|
18
|
+
hasPage: boolean;
|
|
19
|
+
children: DocNavNode[];
|
|
20
|
+
sortOrder?: "asc" | "desc";
|
|
21
|
+
collapsed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Minimal docs frontmatter shape consumed by the doc-page types.
|
|
25
|
+
*
|
|
26
|
+
* A structural subset of the host's `DocsData` — only the fields that
|
|
27
|
+
* `DocPageEntry` and `DocPageBaseProps` actually read. The full `DocsData`
|
|
28
|
+
* (from `src/config/docs-schema.ts`) is a structural supertype and is
|
|
29
|
+
* assignable here.
|
|
30
|
+
*/
|
|
31
|
+
export interface DocPageFrontmatter {
|
|
32
|
+
title: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
slug?: string;
|
|
35
|
+
draft?: boolean;
|
|
36
|
+
unlisted?: boolean;
|
|
37
|
+
standalone?: boolean;
|
|
38
|
+
category_no_page?: boolean;
|
|
39
|
+
pagination_prev?: string | null;
|
|
40
|
+
pagination_next?: string | null;
|
|
41
|
+
tags?: string[];
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A zfb content collection entry augmented with the `id`/`collection` fields
|
|
46
|
+
* the host's `@/utils/docs` helpers expect, plus the typed `data` and
|
|
47
|
+
* renderer surface.
|
|
48
|
+
*
|
|
49
|
+
* Structural counterpart of the host's `DocPageEntry` (from
|
|
50
|
+
* `pages/lib/doc-page-props.ts`). The host stub re-exports this type under
|
|
51
|
+
* the original name.
|
|
52
|
+
*/
|
|
53
|
+
export interface DocPageEntry {
|
|
54
|
+
/** zfb content engine slug (filename without `.md`/`.mdx`). */
|
|
55
|
+
slug: string;
|
|
56
|
+
/** Bridged from `slug` for host `@/utils/docs` compat. */
|
|
57
|
+
id: string;
|
|
58
|
+
/** Collection name, e.g. "docs", "docs-ja", "docs-v-1.0". */
|
|
59
|
+
collection: string;
|
|
60
|
+
/** Parsed frontmatter. Structural superset of `DocPageFrontmatter`. */
|
|
61
|
+
data: DocPageFrontmatter;
|
|
62
|
+
/** Raw MDX body (for heading extraction). */
|
|
63
|
+
body?: string;
|
|
64
|
+
/** zfb module specifier (for Content bridge). */
|
|
65
|
+
module_specifier: string;
|
|
66
|
+
/** zfb content renderer — callable Preact component. */
|
|
67
|
+
Content: unknown;
|
|
68
|
+
}
|
|
69
|
+
export interface AutoIndexNode extends DocNavNode {
|
|
70
|
+
children: DocNavNode[];
|
|
71
|
+
}
|
|
72
|
+
/** Shared fields present in every doc-page route. */
|
|
73
|
+
interface DocPagePropsBase {
|
|
74
|
+
breadcrumbs: BreadcrumbItem[];
|
|
75
|
+
prev: DocNavNode | null;
|
|
76
|
+
next: DocNavNode | null;
|
|
77
|
+
/** Depth-2/3/4 headings extracted from the MDX body, for SSG TOC links. */
|
|
78
|
+
headings: HeadingItem[];
|
|
79
|
+
}
|
|
80
|
+
/** Branch: a real content entry. `autoIndex` is absent. */
|
|
81
|
+
export interface DocPageEntryProps extends DocPagePropsBase {
|
|
82
|
+
kind: "entry";
|
|
83
|
+
entry: DocPageEntry;
|
|
84
|
+
autoIndex?: undefined;
|
|
85
|
+
}
|
|
86
|
+
/** Branch: an auto-generated category index. `entry` is absent. */
|
|
87
|
+
export interface DocPageAutoIndexProps extends DocPagePropsBase {
|
|
88
|
+
kind: "autoIndex";
|
|
89
|
+
autoIndex: AutoIndexNode;
|
|
90
|
+
entry?: undefined;
|
|
91
|
+
}
|
|
92
|
+
/** Discriminated union for the `kind` prop. Narrow via `props.kind === "entry"`. */
|
|
93
|
+
export type DocPageBaseProps = DocPageEntryProps | DocPageAutoIndexProps;
|
|
File without changes
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX, VNode } from "preact";
|
|
4
|
+
import type { DocPageBaseProps, DocNavNode, DocPageEntry } from "../doc-page-props/index.js";
|
|
5
|
+
import type { VersionBannerLabels } from "../i18n-version/index.js";
|
|
6
|
+
export type { DocPageBaseProps };
|
|
7
|
+
/**
|
|
8
|
+
* Version config shape — structural subset of the host's `VersionConfig`.
|
|
9
|
+
* Defined here so the package does not import the host `@/` alias.
|
|
10
|
+
*/
|
|
11
|
+
export interface RenderDocPageVersionConfig {
|
|
12
|
+
/** Version slug, e.g. "1.0". */
|
|
13
|
+
slug: string;
|
|
14
|
+
/** Banner type drives the VersionBanner element (`false` = no banner). */
|
|
15
|
+
banner?: "unmaintained" | "unreleased" | false;
|
|
16
|
+
}
|
|
17
|
+
export interface RenderDocPageOptions {
|
|
18
|
+
/** Active locale — drives nav wrappers, labels, and URL building. */
|
|
19
|
+
locale: string;
|
|
20
|
+
/** Version config when rendering a versioned route; undefined = latest. */
|
|
21
|
+
version?: RenderDocPageVersionConfig;
|
|
22
|
+
/** True when this page falls back to the base EN collection (locale
|
|
23
|
+
* routes). Drives the fallback notice + history-area hint. */
|
|
24
|
+
isFallback?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Content directory for the doc-history view-source link (e.g. the active
|
|
27
|
+
* locale's dir, or the base docsDir for EN/fallback pages). Latest routes
|
|
28
|
+
* pass it; versioned routes omit it — doc history is hidden on versioned
|
|
29
|
+
* pages regardless (#1916 #5).
|
|
30
|
+
*/
|
|
31
|
+
docHistoryContentDir?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Dependencies injected by the host stub. */
|
|
34
|
+
export interface DocPageRendererDeps {
|
|
35
|
+
/** Build a docs URL: `docsUrl(slug, lang?)` → base-prefixed path. */
|
|
36
|
+
docsUrl: (slug: string, lang?: string) => string;
|
|
37
|
+
/** Build a versioned docs URL: `versionedDocsUrl(slug, versionSlug, lang?)`. */
|
|
38
|
+
versionedDocsUrl: (slug: string, versionSlug: string, lang?: string) => string;
|
|
39
|
+
/** Build an absolute URL: `absoluteUrl(path)` → siteUrl-prefixed. */
|
|
40
|
+
absoluteUrl: (path: string) => string | undefined;
|
|
41
|
+
/** Determine the nav section (categoryMatch) for a slug. */
|
|
42
|
+
getNavSectionForSlug: (slug: string) => string | undefined;
|
|
43
|
+
/** Convert a content entry slug to a canonical route slug. */
|
|
44
|
+
toRouteSlug: (id: string) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Build locale-aware MDX components bag.
|
|
47
|
+
* Host passes `createMdxComponents` (from `pages/_mdx-components.ts`).
|
|
48
|
+
*/
|
|
49
|
+
createMdxComponents: (locale: string) => Record<string, unknown>;
|
|
50
|
+
/** Translate a UI string key for a locale. */
|
|
51
|
+
t: (key: string, locale: string) => string;
|
|
52
|
+
/**
|
|
53
|
+
* Build an inline version switcher VNode for the breadcrumb rightSlot.
|
|
54
|
+
* Host passes `buildInlineVersionSwitcher` from `pages/lib/_inline-version-switcher.tsx`.
|
|
55
|
+
*/
|
|
56
|
+
buildInlineVersionSwitcher: (slug: string, locale: string, currentVersion?: string) => JSX.Element | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* The `DocPageShell` component (host-side factory result from
|
|
59
|
+
* `@takazudo/zudo-doc/doc-page-shell`).
|
|
60
|
+
*/
|
|
61
|
+
DocPageShell: (props: {
|
|
62
|
+
kind: "entry" | "autoIndex";
|
|
63
|
+
locale: string;
|
|
64
|
+
slug: string;
|
|
65
|
+
title: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
canonical?: string;
|
|
68
|
+
breadcrumbs: Array<{
|
|
69
|
+
label: string;
|
|
70
|
+
href?: string;
|
|
71
|
+
}>;
|
|
72
|
+
prev: DocNavNode | null;
|
|
73
|
+
next: DocNavNode | null;
|
|
74
|
+
headings: Array<{
|
|
75
|
+
depth: number;
|
|
76
|
+
slug: string;
|
|
77
|
+
text: string;
|
|
78
|
+
}>;
|
|
79
|
+
navSection: string | undefined;
|
|
80
|
+
sidebarPersistKey: string | undefined;
|
|
81
|
+
hideSidebar?: boolean;
|
|
82
|
+
hideToc?: boolean;
|
|
83
|
+
currentPath: string;
|
|
84
|
+
currentVersion?: string;
|
|
85
|
+
versionSwitcher: JSX.Element | undefined;
|
|
86
|
+
versionBanner?: "unmaintained" | "unreleased";
|
|
87
|
+
versionBannerLatestUrl?: string;
|
|
88
|
+
versionBannerLabels?: VersionBannerLabels;
|
|
89
|
+
autoIndexLabel?: string;
|
|
90
|
+
autoIndexChildren?: DocNavNode[];
|
|
91
|
+
metainfoSlot?: VNode | null;
|
|
92
|
+
contentHeaderSlot?: VNode;
|
|
93
|
+
contentSlot?: VNode;
|
|
94
|
+
docHistorySlot?: VNode | null;
|
|
95
|
+
}) => JSX.Element;
|
|
96
|
+
/**
|
|
97
|
+
* The `DocContentHeader` component (host-side factory result).
|
|
98
|
+
*/
|
|
99
|
+
DocContentHeader: (props: {
|
|
100
|
+
entry: DocPageEntry;
|
|
101
|
+
slug: string;
|
|
102
|
+
locale: string;
|
|
103
|
+
isFallback?: boolean;
|
|
104
|
+
version?: string;
|
|
105
|
+
}) => JSX.Element;
|
|
106
|
+
/**
|
|
107
|
+
* The `DocMetainfoArea` component (host-side factory result).
|
|
108
|
+
*/
|
|
109
|
+
DocMetainfoArea: (props: {
|
|
110
|
+
slug: string;
|
|
111
|
+
locale: string;
|
|
112
|
+
isFallback?: boolean;
|
|
113
|
+
}) => JSX.Element | null;
|
|
114
|
+
/**
|
|
115
|
+
* The `DocHistoryArea` component (host-side factory result).
|
|
116
|
+
*/
|
|
117
|
+
DocHistoryArea: (props: {
|
|
118
|
+
slug: string;
|
|
119
|
+
locale: string;
|
|
120
|
+
entrySlug?: string;
|
|
121
|
+
contentDir?: string;
|
|
122
|
+
isFallback?: boolean;
|
|
123
|
+
}) => VNode | null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create a `renderDocPage` function bound to the host's injected dependencies.
|
|
127
|
+
*/
|
|
128
|
+
export declare function createRenderDocPage(deps: DocPageRendererDeps): (props: DocPageBaseProps, opts: RenderDocPageOptions) => JSX.Element;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
function createRenderDocPage(deps) {
|
|
3
|
+
const {
|
|
4
|
+
docsUrl,
|
|
5
|
+
versionedDocsUrl,
|
|
6
|
+
absoluteUrl,
|
|
7
|
+
getNavSectionForSlug,
|
|
8
|
+
toRouteSlug,
|
|
9
|
+
createMdxComponents,
|
|
10
|
+
t,
|
|
11
|
+
buildInlineVersionSwitcher,
|
|
12
|
+
DocPageShell,
|
|
13
|
+
DocContentHeader,
|
|
14
|
+
DocMetainfoArea,
|
|
15
|
+
DocHistoryArea
|
|
16
|
+
} = deps;
|
|
17
|
+
function renderDocPage(props, opts) {
|
|
18
|
+
const { breadcrumbs, prev, next, headings } = props;
|
|
19
|
+
const { locale, version, isFallback } = opts;
|
|
20
|
+
const slug = props.kind === "autoIndex" ? props.autoIndex.slug : props.entry.data.slug ?? toRouteSlug(props.entry.slug);
|
|
21
|
+
const title = props.kind === "autoIndex" ? props.autoIndex.label : props.entry.data.title;
|
|
22
|
+
const description = props.kind === "autoIndex" ? props.autoIndex.description : props.entry.data.description;
|
|
23
|
+
const components = createMdxComponents(locale);
|
|
24
|
+
const autoIndexChildren = props.kind === "autoIndex" ? version ? props.autoIndex.children.filter((c) => c.hasPage || c.children.length > 0) : props.autoIndex.children.filter((c) => c.hasPage || c.children.length > 0).map((c) => ({
|
|
25
|
+
...c,
|
|
26
|
+
href: c.href ?? docsUrl(c.slug, locale)
|
|
27
|
+
})) : [];
|
|
28
|
+
const versionBannerType = version?.banner ? version.banner : void 0;
|
|
29
|
+
const versionBannerLatestUrl = versionBannerType ? docsUrl(slug, locale) : void 0;
|
|
30
|
+
const versionBannerLabels = versionBannerType ? {
|
|
31
|
+
message: versionBannerType === "unmaintained" ? t("version.banner.unmaintained", locale) : t("version.banner.unreleased", locale),
|
|
32
|
+
latestLink: t("version.banner.latestLink", locale)
|
|
33
|
+
} : void 0;
|
|
34
|
+
const currentPath = version ? versionedDocsUrl(slug, version.slug, locale) : docsUrl(slug, locale);
|
|
35
|
+
const canonical = absoluteUrl(currentPath);
|
|
36
|
+
const navSection = getNavSectionForSlug(slug);
|
|
37
|
+
const hideSidebar = props.kind === "entry" ? props.entry.data.hide_sidebar : void 0;
|
|
38
|
+
const sidebarPersistKey = hideSidebar ? void 0 : `sidebar-${locale}-${navSection ?? "default"}`;
|
|
39
|
+
const ContentComponent = props.kind === "entry" ? props.entry.Content : null;
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
DocPageShell,
|
|
42
|
+
{
|
|
43
|
+
kind: props.kind,
|
|
44
|
+
locale,
|
|
45
|
+
slug,
|
|
46
|
+
title,
|
|
47
|
+
description,
|
|
48
|
+
canonical,
|
|
49
|
+
breadcrumbs,
|
|
50
|
+
prev,
|
|
51
|
+
next,
|
|
52
|
+
headings,
|
|
53
|
+
navSection,
|
|
54
|
+
sidebarPersistKey,
|
|
55
|
+
hideSidebar,
|
|
56
|
+
hideToc: props.kind === "entry" ? props.entry.data.hide_toc : void 0,
|
|
57
|
+
currentPath,
|
|
58
|
+
currentVersion: version?.slug,
|
|
59
|
+
versionSwitcher: buildInlineVersionSwitcher(slug, locale, version?.slug),
|
|
60
|
+
versionBanner: versionBannerType,
|
|
61
|
+
versionBannerLatestUrl,
|
|
62
|
+
versionBannerLabels,
|
|
63
|
+
autoIndexLabel: props.kind === "autoIndex" ? props.autoIndex.label : void 0,
|
|
64
|
+
autoIndexChildren,
|
|
65
|
+
metainfoSlot: (
|
|
66
|
+
// Versioned gate mirrors DocContentHeader: the doc-history-meta
|
|
67
|
+
// manifest is built from latest dirs only, so a bare versioned slug
|
|
68
|
+
// would surface the LATEST page's Created/Updated/Author.
|
|
69
|
+
!version && props.kind === "autoIndex" ? /* @__PURE__ */ jsx(DocMetainfoArea, { slug, locale, isFallback }) : null
|
|
70
|
+
),
|
|
71
|
+
contentHeaderSlot: props.kind === "entry" ? /* @__PURE__ */ jsx(
|
|
72
|
+
DocContentHeader,
|
|
73
|
+
{
|
|
74
|
+
entry: props.entry,
|
|
75
|
+
slug,
|
|
76
|
+
locale,
|
|
77
|
+
isFallback,
|
|
78
|
+
version: version?.slug
|
|
79
|
+
}
|
|
80
|
+
) : void 0,
|
|
81
|
+
contentSlot: ContentComponent ? /* @__PURE__ */ jsx(ContentComponent, { components }) : void 0,
|
|
82
|
+
docHistorySlot: (
|
|
83
|
+
// #1916 #5: doc-history hidden on versioned pages until versioned
|
|
84
|
+
// history is supported.
|
|
85
|
+
!version && opts.docHistoryContentDir !== void 0 && props.kind === "entry" && !props.entry.data.unlisted ? /* @__PURE__ */ jsx(
|
|
86
|
+
DocHistoryArea,
|
|
87
|
+
{
|
|
88
|
+
slug,
|
|
89
|
+
locale,
|
|
90
|
+
entrySlug: props.entry.slug,
|
|
91
|
+
contentDir: opts.docHistoryContentDir,
|
|
92
|
+
isFallback
|
|
93
|
+
}
|
|
94
|
+
) : null
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
return renderDocPage;
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
createRenderDocPage
|
|
103
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { ComponentChildren, JSX, VNode } from "preact";
|
|
4
|
+
import type { VersionBannerLabels } from "../i18n-version/index.js";
|
|
5
|
+
/** A heading item for the TOC. */
|
|
6
|
+
export interface DocPageHeading {
|
|
7
|
+
depth: number;
|
|
8
|
+
slug: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}
|
|
11
|
+
/** A breadcrumb item. */
|
|
12
|
+
export interface DocPageBreadcrumbItem {
|
|
13
|
+
label: string;
|
|
14
|
+
href?: string;
|
|
15
|
+
}
|
|
16
|
+
/** A nav node for prev/next/autoIndex. */
|
|
17
|
+
export interface DocPageNavNode {
|
|
18
|
+
slug: string;
|
|
19
|
+
label: string;
|
|
20
|
+
href?: string;
|
|
21
|
+
hasPage: boolean;
|
|
22
|
+
children: DocPageNavNode[];
|
|
23
|
+
}
|
|
24
|
+
/** Slots and parameters that vary between the 4 doc routes. */
|
|
25
|
+
export interface DocPageShellProps {
|
|
26
|
+
/** Discriminates the body: a real entry vs an auto-generated category index. */
|
|
27
|
+
kind: "entry" | "autoIndex";
|
|
28
|
+
/** Active locale string, e.g. "en", "ja". */
|
|
29
|
+
locale: string;
|
|
30
|
+
/** Canonical route slug for this page (no version/locale prefix). */
|
|
31
|
+
slug: string;
|
|
32
|
+
/** Page title (entry title or auto-index label). */
|
|
33
|
+
title: string;
|
|
34
|
+
/** Page description (may be undefined). */
|
|
35
|
+
description?: string;
|
|
36
|
+
/** Absolute canonical URL, or undefined when siteUrl is unset. */
|
|
37
|
+
canonical?: string;
|
|
38
|
+
/** Pre-resolved breadcrumb trail (hrefs already remapped per route). */
|
|
39
|
+
breadcrumbs: DocPageBreadcrumbItem[];
|
|
40
|
+
/** Pre-resolved prev/next nav nodes (hrefs already remapped per route). */
|
|
41
|
+
prev: DocPageNavNode | null;
|
|
42
|
+
next: DocPageNavNode | null;
|
|
43
|
+
/** Depth-2/3/4 headings for the SSG TOC. */
|
|
44
|
+
headings: DocPageHeading[];
|
|
45
|
+
/** Sidebar/header nav-section key for this slug. */
|
|
46
|
+
navSection: string | undefined;
|
|
47
|
+
/** Per-page sidebar persist key (undefined when the sidebar is hidden). */
|
|
48
|
+
sidebarPersistKey: string | undefined;
|
|
49
|
+
/** Whether to hide the sidebar entirely (entry frontmatter). */
|
|
50
|
+
hideSidebar?: boolean;
|
|
51
|
+
/** Whether to hide the TOC (entry frontmatter). */
|
|
52
|
+
hideToc?: boolean;
|
|
53
|
+
/** Path of THIS page used by Header/Sidebar to mark the active item. */
|
|
54
|
+
currentPath: string;
|
|
55
|
+
/** Version slug for Header/Sidebar active-state, or undefined on latest routes. */
|
|
56
|
+
currentVersion?: string;
|
|
57
|
+
/** Inline version switcher VNode for the breadcrumb right-slot. */
|
|
58
|
+
versionSwitcher: ComponentChildren;
|
|
59
|
+
/** Version banner type ("unmaintained" | "unreleased") or undefined on latest. */
|
|
60
|
+
versionBanner?: "unmaintained" | "unreleased";
|
|
61
|
+
/** URL of the latest equivalent page for the version banner link. */
|
|
62
|
+
versionBannerLatestUrl?: string;
|
|
63
|
+
/** Localized version-banner labels. */
|
|
64
|
+
versionBannerLabels?: VersionBannerLabels;
|
|
65
|
+
/** Auto-index branch: label heading text. */
|
|
66
|
+
autoIndexLabel?: string;
|
|
67
|
+
/** Auto-index branch: pre-filtered + href-remapped child cards. */
|
|
68
|
+
autoIndexChildren?: DocPageNavNode[];
|
|
69
|
+
/**
|
|
70
|
+
* Auto-index branch slot: the build-time date block (DocMetainfoArea), or
|
|
71
|
+
* null to omit it.
|
|
72
|
+
*/
|
|
73
|
+
metainfoSlot?: VNode | null;
|
|
74
|
+
/**
|
|
75
|
+
* Entry branch slot: the content header (h1 + meta + tags + description +
|
|
76
|
+
* frontmatter preview), built per route (carries isFallback).
|
|
77
|
+
*/
|
|
78
|
+
contentHeaderSlot?: VNode;
|
|
79
|
+
/** Entry branch slot: the rendered MDX `<Content />`. */
|
|
80
|
+
contentSlot?: VNode;
|
|
81
|
+
/**
|
|
82
|
+
* Entry branch slot: the document-utilities area (DocHistoryArea), or null
|
|
83
|
+
* to omit it.
|
|
84
|
+
*/
|
|
85
|
+
docHistorySlot?: VNode | null;
|
|
86
|
+
}
|
|
87
|
+
/** Settings subset read by {@link createDocPageShell}. */
|
|
88
|
+
export interface DocPageShellSettings {
|
|
89
|
+
metaTags: {
|
|
90
|
+
description?: boolean | null;
|
|
91
|
+
};
|
|
92
|
+
noindex?: boolean;
|
|
93
|
+
dynamicPageTransition?: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** Dependencies injected by the host stub. */
|
|
96
|
+
export interface DocPageShellDeps {
|
|
97
|
+
settings: DocPageShellSettings;
|
|
98
|
+
composeMetaTitle: (title: string) => string;
|
|
99
|
+
getTocTitle: (locale: string) => string;
|
|
100
|
+
HeadWithDefaults: (props: {
|
|
101
|
+
title: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
canonical?: string;
|
|
104
|
+
}) => JSX.Element;
|
|
105
|
+
SidebarWithDefaults: (props: {
|
|
106
|
+
currentSlug?: string;
|
|
107
|
+
lang?: string;
|
|
108
|
+
navSection?: string;
|
|
109
|
+
currentVersion?: string;
|
|
110
|
+
currentPath?: string;
|
|
111
|
+
}) => JSX.Element;
|
|
112
|
+
HeaderWithDefaults: (props: {
|
|
113
|
+
lang?: string;
|
|
114
|
+
currentSlug?: string;
|
|
115
|
+
navSection?: string;
|
|
116
|
+
currentVersion?: string;
|
|
117
|
+
currentPath?: string;
|
|
118
|
+
}) => JSX.Element;
|
|
119
|
+
FooterWithDefaults: (props: {
|
|
120
|
+
lang?: string;
|
|
121
|
+
}) => JSX.Element;
|
|
122
|
+
SidebarPrepaint: (props: {
|
|
123
|
+
hideSidebar?: boolean;
|
|
124
|
+
}) => JSX.Element | undefined;
|
|
125
|
+
DocBodyEnd: (props: Record<string, never>) => JSX.Element;
|
|
126
|
+
DocPager: (props: {
|
|
127
|
+
prev: DocPageNavNode | null;
|
|
128
|
+
next: DocPageNavNode | null;
|
|
129
|
+
locale: string;
|
|
130
|
+
}) => JSX.Element;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Create a `DocPageShell` component bound to the host's settings and
|
|
134
|
+
* component dependencies.
|
|
135
|
+
*/
|
|
136
|
+
export declare function createDocPageShell(deps: DocPageShellDeps): (props: DocPageShellProps) => JSX.Element;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { Island } from "@takazudo/zfb";
|
|
3
|
+
import { DocLayoutWithDefaults } from "../doclayout/index.js";
|
|
4
|
+
import { Toc, MobileToc } from "../toc/index.js";
|
|
5
|
+
import { Breadcrumb } from "../breadcrumb/index.js";
|
|
6
|
+
import { NavCardGrid } from "../nav-indexing/index.js";
|
|
7
|
+
function createDocPageShell(deps) {
|
|
8
|
+
const {
|
|
9
|
+
settings,
|
|
10
|
+
composeMetaTitle,
|
|
11
|
+
getTocTitle,
|
|
12
|
+
HeadWithDefaults,
|
|
13
|
+
SidebarWithDefaults,
|
|
14
|
+
HeaderWithDefaults,
|
|
15
|
+
FooterWithDefaults,
|
|
16
|
+
SidebarPrepaint,
|
|
17
|
+
DocBodyEnd,
|
|
18
|
+
DocPager
|
|
19
|
+
} = deps;
|
|
20
|
+
function DocPageShell(props) {
|
|
21
|
+
const {
|
|
22
|
+
kind,
|
|
23
|
+
locale,
|
|
24
|
+
title,
|
|
25
|
+
description,
|
|
26
|
+
canonical,
|
|
27
|
+
breadcrumbs,
|
|
28
|
+
prev,
|
|
29
|
+
next,
|
|
30
|
+
headings,
|
|
31
|
+
navSection,
|
|
32
|
+
sidebarPersistKey,
|
|
33
|
+
hideSidebar,
|
|
34
|
+
hideToc,
|
|
35
|
+
currentPath,
|
|
36
|
+
currentVersion,
|
|
37
|
+
versionSwitcher,
|
|
38
|
+
versionBanner,
|
|
39
|
+
versionBannerLatestUrl,
|
|
40
|
+
versionBannerLabels,
|
|
41
|
+
autoIndexLabel,
|
|
42
|
+
autoIndexChildren,
|
|
43
|
+
metainfoSlot,
|
|
44
|
+
contentHeaderSlot,
|
|
45
|
+
contentSlot,
|
|
46
|
+
docHistorySlot
|
|
47
|
+
} = props;
|
|
48
|
+
const tocTitle = getTocTitle(locale);
|
|
49
|
+
const shouldRenderToc = !hideToc && headings.length > 0;
|
|
50
|
+
const tocOverride = shouldRenderToc ? Island({
|
|
51
|
+
when: "load",
|
|
52
|
+
children: /* @__PURE__ */ jsx(Toc, { headings, title: tocTitle })
|
|
53
|
+
}) : void 0;
|
|
54
|
+
const mobileTocOverride = shouldRenderToc ? Island({
|
|
55
|
+
when: "load",
|
|
56
|
+
children: /* @__PURE__ */ jsx(MobileToc, { headings, title: tocTitle })
|
|
57
|
+
}) : void 0;
|
|
58
|
+
return /* @__PURE__ */ jsx(
|
|
59
|
+
DocLayoutWithDefaults,
|
|
60
|
+
{
|
|
61
|
+
title: composeMetaTitle(title),
|
|
62
|
+
description: settings.metaTags.description ? description : void 0,
|
|
63
|
+
head: /* @__PURE__ */ jsx(HeadWithDefaults, { title, description, canonical }),
|
|
64
|
+
lang: locale,
|
|
65
|
+
noindex: settings.noindex,
|
|
66
|
+
hideSidebar,
|
|
67
|
+
hideToc,
|
|
68
|
+
headings,
|
|
69
|
+
canonical,
|
|
70
|
+
sidebarPersistKey,
|
|
71
|
+
versionBanner: versionBanner ?? false,
|
|
72
|
+
versionBannerLatestUrl,
|
|
73
|
+
versionBannerLabels,
|
|
74
|
+
headerOverride: /* @__PURE__ */ jsx(
|
|
75
|
+
HeaderWithDefaults,
|
|
76
|
+
{
|
|
77
|
+
lang: locale,
|
|
78
|
+
currentSlug: props.slug,
|
|
79
|
+
navSection,
|
|
80
|
+
currentVersion,
|
|
81
|
+
currentPath
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
breadcrumbOverride: breadcrumbs.length > 0 ? /* @__PURE__ */ jsx(Breadcrumb, { items: breadcrumbs, rightSlot: versionSwitcher }) : void 0,
|
|
85
|
+
sidebarOverride: /* @__PURE__ */ jsx(
|
|
86
|
+
SidebarWithDefaults,
|
|
87
|
+
{
|
|
88
|
+
currentSlug: props.slug,
|
|
89
|
+
lang: locale,
|
|
90
|
+
navSection,
|
|
91
|
+
currentVersion,
|
|
92
|
+
currentPath
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
tocOverride,
|
|
96
|
+
mobileTocOverride,
|
|
97
|
+
afterSidebar: /* @__PURE__ */ jsx(SidebarPrepaint, { hideSidebar }),
|
|
98
|
+
footerOverride: /* @__PURE__ */ jsx(FooterWithDefaults, { lang: locale }),
|
|
99
|
+
bodyEndComponents: /* @__PURE__ */ jsx(DocBodyEnd, {}),
|
|
100
|
+
enableClientRouter: settings.dynamicPageTransition,
|
|
101
|
+
children: kind === "autoIndex" ? (
|
|
102
|
+
/* Auto-index page: category without an index.mdx.
|
|
103
|
+
Fragment (not <div>) so children become direct children of
|
|
104
|
+
<article class="zd-content">, picking up the flow-space rule. */
|
|
105
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
106
|
+
/* @__PURE__ */ jsx("h1", { class: "text-heading font-bold mb-vsp-xs", children: autoIndexLabel }),
|
|
107
|
+
metainfoSlot,
|
|
108
|
+
description && /* @__PURE__ */ jsx("p", { class: "mb-vsp-lg text-title text-muted", children: description }),
|
|
109
|
+
/* @__PURE__ */ jsx(NavCardGrid, { children: autoIndexChildren ?? [] })
|
|
110
|
+
] })
|
|
111
|
+
) : (
|
|
112
|
+
/* Regular doc page. Fragment (not <div>) for the same reason. */
|
|
113
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
114
|
+
contentHeaderSlot,
|
|
115
|
+
contentSlot,
|
|
116
|
+
/* @__PURE__ */ jsx(DocPager, { prev, next, locale }),
|
|
117
|
+
docHistorySlot
|
|
118
|
+
] })
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return DocPageShell;
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
createDocPageShell
|
|
127
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
interface PagerNode {
|
|
5
|
+
href?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DocPagerProps {
|
|
9
|
+
/** Previous page node (null = no previous page → renders placeholder). */
|
|
10
|
+
prev: PagerNode | null;
|
|
11
|
+
/** Next page node (null = no next page → renders placeholder). */
|
|
12
|
+
next: PagerNode | null;
|
|
13
|
+
/** Active locale for translated "Previous" / "Next" labels. */
|
|
14
|
+
locale: string;
|
|
15
|
+
}
|
|
16
|
+
/** Dependencies injected by the host stub. */
|
|
17
|
+
export interface DocPagerDeps {
|
|
18
|
+
/** Translate a UI string key for a locale. */
|
|
19
|
+
t: (key: string, locale: string) => string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create a `DocPager` component bound to the host's injected `t` translator.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createDocPager(deps: DocPagerDeps): (props: DocPagerProps) => JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { ChevronLeft, ChevronRight } from "../icons/index.js";
|
|
3
|
+
function createDocPager(deps) {
|
|
4
|
+
const { t } = deps;
|
|
5
|
+
function DocPager({ prev, next, locale }) {
|
|
6
|
+
return /* @__PURE__ */ jsxs("nav", { class: "mt-vsp-2xl grid grid-cols-2 gap-hsp-xl", children: [
|
|
7
|
+
prev ? /* @__PURE__ */ jsxs(
|
|
8
|
+
"a",
|
|
9
|
+
{
|
|
10
|
+
href: prev.href,
|
|
11
|
+
class: "group border border-muted rounded-lg p-hsp-lg hover:border-accent",
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-center gap-hsp-xs text-caption text-muted mb-vsp-2xs", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(ChevronLeft, { className: "h-[1.125rem] w-[1.125rem]" }),
|
|
15
|
+
/* @__PURE__ */ jsx("span", { class: "no-underline", children: t("nav.previous", locale) })
|
|
16
|
+
] }),
|
|
17
|
+
/* @__PURE__ */ jsx("p", { class: "text-small font-semibold underline group-hover:text-accent", children: prev.label })
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
) : /* @__PURE__ */ jsx("div", {}),
|
|
21
|
+
next ? /* @__PURE__ */ jsxs(
|
|
22
|
+
"a",
|
|
23
|
+
{
|
|
24
|
+
href: next.href,
|
|
25
|
+
class: "group border border-muted rounded-lg p-hsp-lg hover:border-accent text-right",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-center justify-end gap-hsp-xs text-caption text-muted mb-vsp-2xs", children: [
|
|
28
|
+
/* @__PURE__ */ jsx("span", { class: "no-underline", children: t("nav.next", locale) }),
|
|
29
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "h-[1.125rem] w-[1.125rem]" })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ jsx("p", { class: "text-small font-semibold underline group-hover:text-accent", children: next.label })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
) : /* @__PURE__ */ jsx("div", {})
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
return DocPager;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
createDocPager
|
|
41
|
+
};
|