@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,125 @@
|
|
|
1
|
+
import type { DocPageEntry, DocNavNode, AutoIndexNode, DocPageBaseProps } from "../doc-page-props/index.js";
|
|
2
|
+
import type { NavSourceDocs } from "../nav-source-docs/index.js";
|
|
3
|
+
import type { BreadcrumbItem } from "../breadcrumb/types.js";
|
|
4
|
+
import type { HeadingItem } from "../extract-headings/index.js";
|
|
5
|
+
export type { DocPageEntry, DocNavNode, AutoIndexNode, DocPageBaseProps, NavSourceDocs };
|
|
6
|
+
/** One enumerated doc route: a content entry or an auto-generated category
|
|
7
|
+
* index, with all per-page derived data pre-computed. */
|
|
8
|
+
export interface DocRouteEntry {
|
|
9
|
+
/** Canonical route slug ("" for the docs root index — #1891). */
|
|
10
|
+
slug: string;
|
|
11
|
+
/** Optional-catchall params array — `toSlugParams(slug)` ([] for the root). */
|
|
12
|
+
slugParams: string[];
|
|
13
|
+
/**
|
|
14
|
+
* True when the entry came from the base collection rather than the locale
|
|
15
|
+
* collection (`!localeSlugSet.has(slug)`). Only meaningful on routes whose
|
|
16
|
+
* nav source performs a locale merge — routes without one (default-locale /
|
|
17
|
+
* versioned-EN, where `localeSlugSet` is empty) must ignore this field.
|
|
18
|
+
* Always false for autoIndex items.
|
|
19
|
+
*/
|
|
20
|
+
isFallback: boolean;
|
|
21
|
+
/** Shared page props (kind/entry/autoIndex/breadcrumbs/prev/next/headings). */
|
|
22
|
+
props: DocPageBaseProps;
|
|
23
|
+
}
|
|
24
|
+
export interface BuildDocRouteEntriesArgs {
|
|
25
|
+
/** Identity-stable nav source for this route's (locale, version) context. */
|
|
26
|
+
source: NavSourceDocs;
|
|
27
|
+
/** Active locale for nav-tree labels and breadcrumbs. */
|
|
28
|
+
locale: string;
|
|
29
|
+
/**
|
|
30
|
+
* Unique memo signature for this route context. Each route file passes its
|
|
31
|
+
* own prefix plus the loop variables (version slug / locale), e.g.
|
|
32
|
+
* "docs;en", "locale-docs;ja", "v-docs;1.0", "v-locale-docs;1.0;ja" —
|
|
33
|
+
* call sites that share a docs array identity must never collide on a key.
|
|
34
|
+
*/
|
|
35
|
+
routeSig: string;
|
|
36
|
+
/** Versioned URL closure bound to the route's version (+ locale). Presence
|
|
37
|
+
* switches the versioned behaviors (breadcrumbs, prev/next, child hrefs). */
|
|
38
|
+
urlFor?: (slug: string) => string;
|
|
39
|
+
}
|
|
40
|
+
export type { BreadcrumbItem, HeadingItem };
|
|
41
|
+
/**
|
|
42
|
+
* Injected context for `createDocRouteEntries`.
|
|
43
|
+
*/
|
|
44
|
+
export interface DocRouteEntriesContext {
|
|
45
|
+
/**
|
|
46
|
+
* Build the nav tree for a locale from a flat entry array and category meta.
|
|
47
|
+
* Host passes `buildNavTree` from `@/utils/docs`.
|
|
48
|
+
*/
|
|
49
|
+
buildNavTree: (docs: DocPageEntry[], locale: string, categoryMeta: Map<string, unknown>) => DocNavNode[];
|
|
50
|
+
/**
|
|
51
|
+
* Build breadcrumb trail by walking the nav tree.
|
|
52
|
+
* Host passes `buildBreadcrumbs` from `@/utils/docs`.
|
|
53
|
+
*/
|
|
54
|
+
buildBreadcrumbs: (tree: DocNavNode[], slug: string, locale: string, urlFor?: (slug: string) => string) => BreadcrumbItem[];
|
|
55
|
+
/**
|
|
56
|
+
* Collect all auto-generated index nodes (categories without index.mdx).
|
|
57
|
+
* Host passes `collectAutoIndexNodes` from `@/utils/docs`.
|
|
58
|
+
*/
|
|
59
|
+
collectAutoIndexNodes: (tree: DocNavNode[]) => AutoIndexNode[];
|
|
60
|
+
/**
|
|
61
|
+
* Determine the nav section (categoryMatch) for a slug.
|
|
62
|
+
* Host passes `getNavSectionForSlug` from `@/utils/nav-scope`.
|
|
63
|
+
*/
|
|
64
|
+
getNavSectionForSlug: (slug: string) => string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Filter top-level nav nodes by a categoryMatch value.
|
|
67
|
+
* Host passes `getNavSubtree` from `@/utils/nav-scope`.
|
|
68
|
+
*/
|
|
69
|
+
getNavSubtree: (tree: DocNavNode[], categoryMatch?: string) => DocNavNode[];
|
|
70
|
+
/**
|
|
71
|
+
* Convert a content entry slug to a canonical route slug.
|
|
72
|
+
* Host passes `toRouteSlug` from `@/utils/slug` (or the package's
|
|
73
|
+
* `@takazudo/zudo-doc/slug`).
|
|
74
|
+
*/
|
|
75
|
+
toRouteSlug: (id: string) => string;
|
|
76
|
+
/**
|
|
77
|
+
* Convert a canonical route slug to an optional-catchall params array.
|
|
78
|
+
* Host passes `toSlugParams` from `@/utils/slug`.
|
|
79
|
+
*/
|
|
80
|
+
toSlugParams: (slug: string) => string[];
|
|
81
|
+
/**
|
|
82
|
+
* Extract headings from a raw MDX body.
|
|
83
|
+
* Host passes the wrapper from `pages/lib/_extract-headings.ts`.
|
|
84
|
+
*/
|
|
85
|
+
extractHeadings: (body: string) => HeadingItem[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Result of `createDocRouteEntries`. Contains the `buildDocRouteEntries`
|
|
89
|
+
* function bound to the injected context.
|
|
90
|
+
*/
|
|
91
|
+
export interface DocRouteEntriesAPI {
|
|
92
|
+
/**
|
|
93
|
+
* Enumerate all doc routes for one (locale, version) context, with per-entry
|
|
94
|
+
* derived data pre-computed. Memoized per build on the identity-stable
|
|
95
|
+
* `source.docs` array.
|
|
96
|
+
*/
|
|
97
|
+
buildDocRouteEntries: (args: BuildDocRouteEntriesArgs) => DocRouteEntry[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create the `buildDocRouteEntries` function bound to the host's injected
|
|
101
|
+
* context.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* // pages/lib/_doc-route-entries.ts (thin stub)
|
|
106
|
+
* import { createDocRouteEntries } from "@takazudo/zudo-doc/doc-route-entries";
|
|
107
|
+
* import { buildNavTree, buildBreadcrumbs, collectAutoIndexNodes } from "@/utils/docs";
|
|
108
|
+
* import { getNavSectionForSlug, getNavSubtree } from "@/utils/nav-scope";
|
|
109
|
+
* import { toRouteSlug, toSlugParams } from "@/utils/slug";
|
|
110
|
+
* import { extractHeadings } from "./_extract-headings";
|
|
111
|
+
*
|
|
112
|
+
* export const { buildDocRouteEntries } = createDocRouteEntries({
|
|
113
|
+
* buildNavTree,
|
|
114
|
+
* buildBreadcrumbs,
|
|
115
|
+
* collectAutoIndexNodes,
|
|
116
|
+
* getNavSectionForSlug,
|
|
117
|
+
* getNavSubtree,
|
|
118
|
+
* toRouteSlug,
|
|
119
|
+
* toSlugParams,
|
|
120
|
+
* extractHeadings,
|
|
121
|
+
* });
|
|
122
|
+
* export type { DocRouteEntry, BuildDocRouteEntriesArgs };
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare function createDocRouteEntries(ctx: DocRouteEntriesContext): DocRouteEntriesAPI;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { memoizeDerived } from "../nav-source-cache/index.js";
|
|
2
|
+
import {
|
|
3
|
+
resolveDocPrevNext,
|
|
4
|
+
flattenSubtree,
|
|
5
|
+
rewriteNavHref,
|
|
6
|
+
remapNavChildHrefs
|
|
7
|
+
} from "../doc-route-paths/index.js";
|
|
8
|
+
function createDocRouteEntries(ctx) {
|
|
9
|
+
const {
|
|
10
|
+
buildNavTree,
|
|
11
|
+
buildBreadcrumbs,
|
|
12
|
+
collectAutoIndexNodes,
|
|
13
|
+
getNavSectionForSlug,
|
|
14
|
+
getNavSubtree,
|
|
15
|
+
toRouteSlug,
|
|
16
|
+
toSlugParams,
|
|
17
|
+
extractHeadings
|
|
18
|
+
} = ctx;
|
|
19
|
+
function buildDocRouteEntries(args) {
|
|
20
|
+
const { source, locale, routeSig, urlFor } = args;
|
|
21
|
+
return memoizeDerived([source.docs], `docRouteEntries;${routeSig}`, () => {
|
|
22
|
+
const { docs, navDocs, categoryMeta, localeSlugSet } = source;
|
|
23
|
+
const tree = buildNavTree(navDocs, locale, categoryMeta);
|
|
24
|
+
const breadcrumbTree = urlFor ? tree : buildNavTree(docs, locale, categoryMeta);
|
|
25
|
+
const result = [];
|
|
26
|
+
for (const entry of docs) {
|
|
27
|
+
if (entry.data.category_no_page === true) continue;
|
|
28
|
+
const slug = entry.data.slug ?? toRouteSlug(entry.slug);
|
|
29
|
+
const navSection = getNavSectionForSlug(slug);
|
|
30
|
+
const subtree = getNavSubtree(tree, navSection);
|
|
31
|
+
const { prev: prevNode, next: nextNode } = resolveDocPrevNext(
|
|
32
|
+
tree,
|
|
33
|
+
flattenSubtree(subtree),
|
|
34
|
+
slug,
|
|
35
|
+
entry.data
|
|
36
|
+
);
|
|
37
|
+
result.push({
|
|
38
|
+
slug,
|
|
39
|
+
slugParams: toSlugParams(slug),
|
|
40
|
+
isFallback: !localeSlugSet.has(slug),
|
|
41
|
+
props: {
|
|
42
|
+
kind: "entry",
|
|
43
|
+
entry,
|
|
44
|
+
breadcrumbs: buildBreadcrumbs(breadcrumbTree, slug, locale, urlFor),
|
|
45
|
+
prev: rewriteNavHref(prevNode, urlFor),
|
|
46
|
+
next: rewriteNavHref(nextNode, urlFor),
|
|
47
|
+
headings: extractHeadings(entry.body ?? "")
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
for (const node of collectAutoIndexNodes(tree)) {
|
|
52
|
+
result.push({
|
|
53
|
+
slug: node.slug,
|
|
54
|
+
slugParams: toSlugParams(node.slug),
|
|
55
|
+
isFallback: false,
|
|
56
|
+
props: {
|
|
57
|
+
kind: "autoIndex",
|
|
58
|
+
autoIndex: urlFor ? {
|
|
59
|
+
...node,
|
|
60
|
+
children: remapNavChildHrefs(node.children, urlFor)
|
|
61
|
+
} : node,
|
|
62
|
+
breadcrumbs: buildBreadcrumbs(breadcrumbTree, node.slug, locale, urlFor),
|
|
63
|
+
prev: null,
|
|
64
|
+
next: null,
|
|
65
|
+
headings: []
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return { buildDocRouteEntries };
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
createDocRouteEntries
|
|
76
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DocNavNode } from "../doc-page-props/index.js";
|
|
2
|
+
export type { DocNavNode };
|
|
3
|
+
/**
|
|
4
|
+
* Flatten a nav tree into a pre-order traversal array.
|
|
5
|
+
* Mirrors `flattenTree` from `src/utils/docs.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function flattenTree(nodes: DocNavNode[]): DocNavNode[];
|
|
8
|
+
/**
|
|
9
|
+
* Find a single nav node by slug in a tree.
|
|
10
|
+
* Mirrors `findNode` from `src/utils/docs.ts`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findNode(nodes: DocNavNode[], slug: string): DocNavNode | undefined;
|
|
13
|
+
/** The two pagination-override fields read off entry frontmatter. */
|
|
14
|
+
export interface PaginationOverrides {
|
|
15
|
+
/** `undefined` = no override; `null` = suppress; string = target slug. */
|
|
16
|
+
pagination_prev?: string | null;
|
|
17
|
+
pagination_next?: string | null;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolve prev/next nav nodes for an entry against the route's OWN nav tree.
|
|
21
|
+
*
|
|
22
|
+
* - Sequential prev/next come from the flattened sub-tree (`subtreeFlat`).
|
|
23
|
+
* - Frontmatter `pagination_prev` / `pagination_next` overrides resolve via
|
|
24
|
+
* `findNode(tree, …)` against the SAME `tree` the route built — never a
|
|
25
|
+
* foreign tree. The caller passes its own version/locale-scoped tree, so a
|
|
26
|
+
* `/v/` override resolves to a `/v/` node and a latest override to a latest
|
|
27
|
+
* node. (#1916 — pagination-override must bind to the correct tree.)
|
|
28
|
+
*
|
|
29
|
+
* Returns the raw DocNavNodes (hrefs untouched). Callers that need versioned
|
|
30
|
+
* hrefs run the result through `rewriteNavHref` with their `urlFor` closure.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveDocPrevNext(tree: DocNavNode[], subtreeFlat: DocNavNode[], slug: string, overrides: PaginationOverrides): {
|
|
33
|
+
prev: DocNavNode | null;
|
|
34
|
+
next: DocNavNode | null;
|
|
35
|
+
};
|
|
36
|
+
/** Flatten the relevant sub-tree for an entry — convenience over flattenTree. */
|
|
37
|
+
export declare function flattenSubtree(subtree: DocNavNode[]): DocNavNode[];
|
|
38
|
+
/**
|
|
39
|
+
* Rewrite a single nav node's href via the route's `urlFor` closure.
|
|
40
|
+
*
|
|
41
|
+
* Returns `null` for a `null` node. Latest routes pass `undefined` (leave the
|
|
42
|
+
* href as the latest `docsUrl` already baked into the node); versioned routes
|
|
43
|
+
* pass `urlFor` so prev/next links point at the versioned URL.
|
|
44
|
+
*/
|
|
45
|
+
export declare function rewriteNavHref(node: DocNavNode | null, urlFor: ((slug: string) => string) | undefined): DocNavNode | null;
|
|
46
|
+
/**
|
|
47
|
+
* Remap an auto-index node's child-card hrefs via `urlFor`.
|
|
48
|
+
*
|
|
49
|
+
* #1916 #2: on versioned routes the children carry latest `docsUrl` hrefs
|
|
50
|
+
* (every nav node does — see toNavNodes). They MUST be overridden to the
|
|
51
|
+
* versioned URL ALWAYS, not only when `c.href` is missing. Passing `urlFor`
|
|
52
|
+
* here does exactly that. Latest routes pass `undefined` to keep the original.
|
|
53
|
+
*/
|
|
54
|
+
export declare function remapNavChildHrefs(children: DocNavNode[], urlFor: ((slug: string) => string) | undefined): DocNavNode[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
function flattenTree(nodes) {
|
|
2
|
+
const result = [];
|
|
3
|
+
flattenInto(nodes, result);
|
|
4
|
+
return result;
|
|
5
|
+
}
|
|
6
|
+
function flattenInto(nodes, acc) {
|
|
7
|
+
for (const node of nodes) {
|
|
8
|
+
if (node.hasPage) acc.push(node);
|
|
9
|
+
flattenInto(node.children, acc);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function findNode(nodes, slug) {
|
|
13
|
+
for (const node of nodes) {
|
|
14
|
+
if (node.slug === slug) return node;
|
|
15
|
+
const found = findNode(node.children, slug);
|
|
16
|
+
if (found) return found;
|
|
17
|
+
}
|
|
18
|
+
return void 0;
|
|
19
|
+
}
|
|
20
|
+
function resolveDocPrevNext(tree, subtreeFlat, slug, overrides) {
|
|
21
|
+
const idx = subtreeFlat.findIndex((n) => n.slug === slug);
|
|
22
|
+
let prev = idx > 0 ? subtreeFlat[idx - 1] ?? null : null;
|
|
23
|
+
let next = idx >= 0 && idx < subtreeFlat.length - 1 ? subtreeFlat[idx + 1] ?? null : null;
|
|
24
|
+
if (overrides.pagination_prev !== void 0) {
|
|
25
|
+
if (overrides.pagination_prev === null) {
|
|
26
|
+
prev = null;
|
|
27
|
+
} else {
|
|
28
|
+
const found = findNode(tree, overrides.pagination_prev);
|
|
29
|
+
prev = found ?? prev;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (overrides.pagination_next !== void 0) {
|
|
33
|
+
if (overrides.pagination_next === null) {
|
|
34
|
+
next = null;
|
|
35
|
+
} else {
|
|
36
|
+
const found = findNode(tree, overrides.pagination_next);
|
|
37
|
+
next = found ?? next;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return { prev, next };
|
|
41
|
+
}
|
|
42
|
+
function flattenSubtree(subtree) {
|
|
43
|
+
return flattenTree(subtree);
|
|
44
|
+
}
|
|
45
|
+
function rewriteNavHref(node, urlFor) {
|
|
46
|
+
if (!node) return null;
|
|
47
|
+
if (!urlFor) return node;
|
|
48
|
+
return { ...node, href: urlFor(node.slug) };
|
|
49
|
+
}
|
|
50
|
+
function remapNavChildHrefs(children, urlFor) {
|
|
51
|
+
if (!urlFor) return children;
|
|
52
|
+
return children.map((c) => ({ ...c, href: urlFor(c.slug) }));
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
findNode,
|
|
56
|
+
flattenSubtree,
|
|
57
|
+
flattenTree,
|
|
58
|
+
remapNavChildHrefs,
|
|
59
|
+
resolveDocPrevNext,
|
|
60
|
+
rewriteNavHref
|
|
61
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { VNode } from "preact";
|
|
4
|
+
import type { TagVocabularyEntry, TagGovernanceMode } from "../settings.js";
|
|
5
|
+
/** Settings subset read by the DocTagsArea factory. */
|
|
6
|
+
export interface DocTagsAreaSettings {
|
|
7
|
+
docTags: boolean;
|
|
8
|
+
tagVocabulary: boolean | readonly TagVocabularyEntry[];
|
|
9
|
+
tagGovernance: TagGovernanceMode;
|
|
10
|
+
}
|
|
11
|
+
/** Dependencies injected by the host stub. */
|
|
12
|
+
export interface DocTagsAreaDeps {
|
|
13
|
+
settings: DocTagsAreaSettings;
|
|
14
|
+
/** Default locale code (e.g. "en"). */
|
|
15
|
+
defaultLocale: string;
|
|
16
|
+
/** Tag vocabulary entries (from the host's `@/config/tag-vocabulary`). */
|
|
17
|
+
tagVocabularyEntries: readonly TagVocabularyEntry[];
|
|
18
|
+
/**
|
|
19
|
+
* Build the base-prefixed tag detail page href for the given tag and locale.
|
|
20
|
+
* Host passes a pre-bound function using `withBase` and `defaultLocale`.
|
|
21
|
+
*/
|
|
22
|
+
tagHref: (tag: string, locale: string) => string;
|
|
23
|
+
/** Translate a UI string key for a locale. */
|
|
24
|
+
t: (key: string, locale: string) => string;
|
|
25
|
+
}
|
|
26
|
+
export interface DocTagsAreaProps {
|
|
27
|
+
/** Page slug, e.g. "guides/sidebar". */
|
|
28
|
+
slug: string;
|
|
29
|
+
/** Active locale string, e.g. "en", "ja". */
|
|
30
|
+
locale: string;
|
|
31
|
+
/** Raw tag strings from the page frontmatter (entry.data.tags). */
|
|
32
|
+
tags: readonly string[] | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a `DocTagsArea` component bound to the host's settings and
|
|
36
|
+
* injected dependencies.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createDocTagsArea(deps: DocTagsAreaDeps): (props: DocTagsAreaProps) => VNode | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { DocTags } from "../metainfo/index.js";
|
|
3
|
+
import { resolvePageTags } from "../tag-helpers/index.js";
|
|
4
|
+
function createDocTagsArea(deps) {
|
|
5
|
+
const { settings, tagVocabularyEntries, tagHref, t } = deps;
|
|
6
|
+
function DocTagsArea({ locale, tags }) {
|
|
7
|
+
if (!settings.docTags) return null;
|
|
8
|
+
const rawTags = tags ?? [];
|
|
9
|
+
const vocab = settings.tagVocabulary ? tagVocabularyEntries : false;
|
|
10
|
+
const canonicalTags = resolvePageTags(rawTags, vocab, settings.tagGovernance);
|
|
11
|
+
if (canonicalTags.length === 0) return null;
|
|
12
|
+
const resolvedTags = canonicalTags.map((tag) => ({
|
|
13
|
+
tag,
|
|
14
|
+
href: tagHref(tag, locale)
|
|
15
|
+
}));
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
DocTags,
|
|
18
|
+
{
|
|
19
|
+
placement: "after-title",
|
|
20
|
+
tags: resolvedTags,
|
|
21
|
+
tagsLabel: t("doc.tags", locale),
|
|
22
|
+
taggedWithLabel: t("doc.taggedWith", locale)
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return DocTagsArea;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
createDocTagsArea
|
|
30
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* the literal anchor text. This is the stable key the drift checker keys
|
|
4
4
|
* off of; the surrounding comment syntax is derived from `kind`.
|
|
5
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";
|
|
6
|
+
export 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
7
|
/**
|
|
8
8
|
* Whether the anchor lives in the frontmatter region (`---` block in
|
|
9
9
|
* Astro / module-scope in JSX) or in the body markup region.
|
|
@@ -15,8 +15,8 @@ type DocLayoutAnchorId = "imports" | "frontmatter" | "head-scripts" | "head-link
|
|
|
15
15
|
* literal HTML form for byte-for-byte parity with the existing
|
|
16
16
|
* create-zudo-doc anchor strings).
|
|
17
17
|
*/
|
|
18
|
-
type DocLayoutAnchorKind = "frontmatter" | "body";
|
|
19
|
-
interface DocLayoutAnchor {
|
|
18
|
+
export type DocLayoutAnchorKind = "frontmatter" | "body";
|
|
19
|
+
export interface DocLayoutAnchor {
|
|
20
20
|
readonly id: DocLayoutAnchorId;
|
|
21
21
|
readonly kind: DocLayoutAnchorKind;
|
|
22
22
|
}
|
|
@@ -25,7 +25,7 @@ interface DocLayoutAnchor {
|
|
|
25
25
|
* doc-layout file. Order is informational (useful for the drift
|
|
26
26
|
* checker's diagnostic output); identity is what matters.
|
|
27
27
|
*/
|
|
28
|
-
declare const DOC_LAYOUT_ANCHORS: readonly DocLayoutAnchor[];
|
|
28
|
+
export declare const DOC_LAYOUT_ANCHORS: readonly DocLayoutAnchor[];
|
|
29
29
|
/**
|
|
30
30
|
* Build the literal anchor *comment string* the drift checker greps for
|
|
31
31
|
* in a scaffolded file.
|
|
@@ -39,17 +39,15 @@ declare const DOC_LAYOUT_ANCHORS: readonly DocLayoutAnchor[];
|
|
|
39
39
|
* anchorComment({ id: "footer", kind: "body" })
|
|
40
40
|
* // "<!-- @slot:doc-layout:footer -->"
|
|
41
41
|
*/
|
|
42
|
-
declare function anchorComment(anchor: DocLayoutAnchor): string;
|
|
42
|
+
export declare function anchorComment(anchor: DocLayoutAnchor): string;
|
|
43
43
|
/**
|
|
44
44
|
* Convenience: every anchor's comment string, in declaration order. The
|
|
45
45
|
* drift checker can iterate this and assert each substring appears in the
|
|
46
46
|
* scaffolded doc-layout file.
|
|
47
47
|
*/
|
|
48
|
-
declare function allAnchorComments(): readonly string[];
|
|
48
|
+
export declare function allAnchorComments(): readonly string[];
|
|
49
49
|
/**
|
|
50
50
|
* Convenience: anchor IDs as a typed set. Useful when a caller wants to
|
|
51
51
|
* verify "is this id one of ours?" without scanning the full list.
|
|
52
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 };
|
|
53
|
+
export declare const DOC_LAYOUT_ANCHOR_IDS: ReadonlySet<DocLayoutAnchorId>;
|
|
@@ -1,11 +1,8 @@
|
|
|
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
1
|
/** @jsxImportSource preact */
|
|
8
|
-
|
|
2
|
+
import type { ComponentChildren, JSX } from "preact";
|
|
3
|
+
import { type DocLayoutProps } from "./doc-layout.js";
|
|
4
|
+
import type { HeadingItem } from "../toc/types.js";
|
|
5
|
+
import { type VersionBannerLabels } from "../i18n-version/version-banner.js";
|
|
9
6
|
/**
|
|
10
7
|
* Override slots for the default-bearing wrapper. Any slot that the
|
|
11
8
|
* caller wants to replace can be passed here; otherwise the package
|
|
@@ -16,7 +13,7 @@ export { DOC_LAYOUT_ANCHORS, DOC_LAYOUT_ANCHOR_IDS, DocLayoutAnchor, DocLayoutAn
|
|
|
16
13
|
* (link columns, copyright, taglist) pass `footerOverride` with a
|
|
17
14
|
* host-side data-aware wrapper — see `pages/lib/footer-with-defaults.tsx`.
|
|
18
15
|
*/
|
|
19
|
-
interface DocLayoutWithDefaultsProps extends Omit<DocLayoutProps, "header" | "sidebar" | "toc" | "mobileToc" | "breadcrumb" | "footer" | "main"> {
|
|
16
|
+
export interface DocLayoutWithDefaultsProps extends Omit<DocLayoutProps, "header" | "sidebar" | "toc" | "mobileToc" | "breadcrumb" | "footer" | "main"> {
|
|
20
17
|
/** The page's article body. Required. */
|
|
21
18
|
children: ComponentChildren;
|
|
22
19
|
/** Replace the default site header. */
|
|
@@ -66,7 +63,16 @@ interface DocLayoutWithDefaultsProps extends Omit<DocLayoutProps, "header" | "si
|
|
|
66
63
|
/** Localized labels used by the version banner. */
|
|
67
64
|
versionBannerLabels?: VersionBannerLabels;
|
|
68
65
|
}
|
|
69
|
-
|
|
66
|
+
/**
|
|
67
|
+
* The 16 `@slot:doc-layout:*` injection-anchor strings. Wraps the
|
|
68
|
+
* canonical list from `./anchors.ts` so consumers (the drift checker,
|
|
69
|
+
* tests) can verify in one place that this wrapper carries every anchor
|
|
70
|
+
* `create-zudo-doc` knows about.
|
|
71
|
+
*
|
|
72
|
+
* The values are exposed both as the literal comment strings (what the
|
|
73
|
+
* drift checker greps for) and as the structured anchor list.
|
|
74
|
+
*/
|
|
75
|
+
export { DOC_LAYOUT_ANCHORS, DOC_LAYOUT_ANCHOR_IDS, allAnchorComments, anchorComment, type DocLayoutAnchor, type DocLayoutAnchorId, type DocLayoutAnchorKind, } from "./anchors.js";
|
|
70
76
|
/**
|
|
71
77
|
* Default-bearing wrapper. Consumers who don't need composable layout
|
|
72
78
|
* control reach for this; it forwards to `<DocLayout>` and inserts
|
|
@@ -78,6 +84,4 @@ interface DocLayoutWithDefaultsProps extends Omit<DocLayoutProps, "header" | "si
|
|
|
78
84
|
* find each anchor in both places. JSX comment expressions are
|
|
79
85
|
* compile-time-only and do not affect runtime output.
|
|
80
86
|
*/
|
|
81
|
-
declare function DocLayoutWithDefaults(props: DocLayoutWithDefaultsProps): JSX.Element;
|
|
82
|
-
|
|
83
|
-
export { DocLayoutWithDefaults, type DocLayoutWithDefaultsProps };
|
|
87
|
+
export declare function DocLayoutWithDefaults(props: DocLayoutWithDefaultsProps): JSX.Element;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { ComponentChildren, JSX } from 'preact';
|
|
2
|
-
|
|
3
1
|
/** @jsxImportSource preact */
|
|
4
|
-
|
|
2
|
+
import type { ComponentChildren, JSX } from "preact";
|
|
5
3
|
/**
|
|
6
4
|
* Direction-and-mode metadata for the root `<html>` element. Keeps the
|
|
7
5
|
* shell from depending on a project's i18n module.
|
|
8
6
|
*/
|
|
9
|
-
interface DocLayoutHtmlAttrs {
|
|
7
|
+
export interface DocLayoutHtmlAttrs {
|
|
10
8
|
/** BCP-47 language tag, e.g. `"en"`, `"ja"`. Defaults to `"en"`. */
|
|
11
9
|
lang?: string;
|
|
12
10
|
/**
|
|
@@ -26,7 +24,7 @@ interface DocLayoutHtmlAttrs {
|
|
|
26
24
|
* Island wrappers, server-rendered output projected through the
|
|
27
25
|
* boundary, etc.).
|
|
28
26
|
*/
|
|
29
|
-
interface DocLayoutProps extends DocLayoutHtmlAttrs {
|
|
27
|
+
export interface DocLayoutProps extends DocLayoutHtmlAttrs {
|
|
30
28
|
/** Page title — rendered as the `<title>` value. */
|
|
31
29
|
title: string;
|
|
32
30
|
/** Optional `<meta name="description">`. */
|
|
@@ -115,7 +113,7 @@ interface DocLayoutProps extends DocLayoutHtmlAttrs {
|
|
|
115
113
|
* `id` attribute of the desktop sidebar `<aside>`. Used by consumer code
|
|
116
114
|
* (e.g. sidebar-toggle island) to locate the element in the DOM.
|
|
117
115
|
*/
|
|
118
|
-
declare const DESKTOP_SIDEBAR_ID = "desktop-sidebar";
|
|
116
|
+
export declare const DESKTOP_SIDEBAR_ID = "desktop-sidebar";
|
|
119
117
|
/**
|
|
120
118
|
* Composable documentation-page layout shell.
|
|
121
119
|
*
|
|
@@ -124,6 +122,4 @@ declare const DESKTOP_SIDEBAR_ID = "desktop-sidebar";
|
|
|
124
122
|
* a downstream framework (e.g. `<DocLayoutWithDefaults>` or a fully
|
|
125
123
|
* custom layout) decide what fills each region.
|
|
126
124
|
*/
|
|
127
|
-
declare function DocLayout(props: DocLayoutProps): JSX.Element;
|
|
128
|
-
|
|
129
|
-
export { DESKTOP_SIDEBAR_ID, DocLayout, type DocLayoutHtmlAttrs, type DocLayoutProps };
|
|
125
|
+
export declare function DocLayout(props: DocLayoutProps): JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export { DocLayout, DESKTOP_SIDEBAR_ID } from "./doc-layout.js";
|
|
2
|
+
export type { DocLayoutProps, DocLayoutHtmlAttrs, } from "./doc-layout.js";
|
|
3
|
+
export { DocLayoutWithDefaults } from "./doc-layout-with-defaults.js";
|
|
4
|
+
export type { DocLayoutWithDefaultsProps } from "./doc-layout-with-defaults.js";
|
|
5
|
+
export { DOC_LAYOUT_ANCHORS, DOC_LAYOUT_ANCHOR_IDS, allAnchorComments, anchorComment, } from "./anchors.js";
|
|
6
|
+
export type { DocLayoutAnchor, DocLayoutAnchorId, DocLayoutAnchorKind, } from "./anchors.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface EjectableEntry {
|
|
2
|
+
/** Package subpath, e.g. `@takazudo/zudo-doc/header` */
|
|
3
|
+
packageSubpath: string;
|
|
4
|
+
/** Local destination dir, project-relative POSIX (no trailing slash) */
|
|
5
|
+
localDir: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const EJECTABLE: Record<string, EjectableEntry>;
|
|
8
|
+
export interface ZudoDocJson {
|
|
9
|
+
/** @takazudo/zudo-doc version the ejected source came from */
|
|
10
|
+
packageVersion: string;
|
|
11
|
+
/** component name → local dir (project-relative POSIX, no trailing slash) */
|
|
12
|
+
ejected: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface EjectOptions {
|
|
15
|
+
/** Project root to eject into. Defaults to `process.cwd()`. */
|
|
16
|
+
cwd?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Injectable resolver for the installed `@takazudo/zudo-doc` package root.
|
|
19
|
+
* Defaults to resolving `@takazudo/zudo-doc/package.json` from `cwd`
|
|
20
|
+
* node_modules. Override in tests to point at a fixture.
|
|
21
|
+
*/
|
|
22
|
+
resolvePackageRoot?: (cwd: string) => string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Eject a single component into the project.
|
|
26
|
+
*
|
|
27
|
+
* - If already ejected (recorded in `.zudo-doc.json`): prints a notice and
|
|
28
|
+
* exits cleanly (safe no-op — never clobbers local edits).
|
|
29
|
+
* - Otherwise: copies the TS source from the installed package's `eject/`
|
|
30
|
+
* tree, rewires parent-relative imports, rewrites host call sites, and
|
|
31
|
+
* records the entry in `.zudo-doc.json`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function eject(component: string, options?: EjectOptions): Promise<void>;
|