@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,229 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import pc from "picocolors";
|
|
4
|
+
const EJECTABLE = {
|
|
5
|
+
header: {
|
|
6
|
+
packageSubpath: "@takazudo/zudo-doc/header",
|
|
7
|
+
localDir: "src/components/zudo-doc/header"
|
|
8
|
+
},
|
|
9
|
+
footer: {
|
|
10
|
+
packageSubpath: "@takazudo/zudo-doc/footer",
|
|
11
|
+
localDir: "src/components/zudo-doc/footer"
|
|
12
|
+
},
|
|
13
|
+
breadcrumb: {
|
|
14
|
+
packageSubpath: "@takazudo/zudo-doc/breadcrumb",
|
|
15
|
+
localDir: "src/components/zudo-doc/breadcrumb"
|
|
16
|
+
},
|
|
17
|
+
toc: {
|
|
18
|
+
packageSubpath: "@takazudo/zudo-doc/toc",
|
|
19
|
+
localDir: "src/components/zudo-doc/toc"
|
|
20
|
+
},
|
|
21
|
+
sidebar: {
|
|
22
|
+
packageSubpath: "@takazudo/zudo-doc/sidebar",
|
|
23
|
+
localDir: "src/components/zudo-doc/sidebar"
|
|
24
|
+
},
|
|
25
|
+
"theme-toggle": {
|
|
26
|
+
packageSubpath: "@takazudo/zudo-doc/theme-toggle",
|
|
27
|
+
localDir: "src/components/zudo-doc/theme-toggle"
|
|
28
|
+
},
|
|
29
|
+
"page-loading": {
|
|
30
|
+
packageSubpath: "@takazudo/zudo-doc/page-loading",
|
|
31
|
+
localDir: "src/components/zudo-doc/page-loading"
|
|
32
|
+
},
|
|
33
|
+
"tab-item": {
|
|
34
|
+
packageSubpath: "@takazudo/zudo-doc/tab-item",
|
|
35
|
+
localDir: "src/components/zudo-doc/tab-item"
|
|
36
|
+
},
|
|
37
|
+
"doc-pager": {
|
|
38
|
+
packageSubpath: "@takazudo/zudo-doc/doc-pager",
|
|
39
|
+
localDir: "src/components/zudo-doc/doc-pager"
|
|
40
|
+
},
|
|
41
|
+
"content-admonition": {
|
|
42
|
+
packageSubpath: "@takazudo/zudo-doc/content-admonition",
|
|
43
|
+
localDir: "src/components/zudo-doc/content-admonition"
|
|
44
|
+
},
|
|
45
|
+
"code-group": {
|
|
46
|
+
packageSubpath: "@takazudo/zudo-doc/code-group",
|
|
47
|
+
localDir: "src/components/zudo-doc/code-group"
|
|
48
|
+
},
|
|
49
|
+
details: {
|
|
50
|
+
packageSubpath: "@takazudo/zudo-doc/details",
|
|
51
|
+
localDir: "src/components/zudo-doc/details"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
async function rewireImports(dir) {
|
|
55
|
+
const re = /(from\s+)(["'])\.\.\/([\w-]+)\/[^"']+\2/g;
|
|
56
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
if (entry.isDirectory()) continue;
|
|
59
|
+
if (!/\.[cm]?[jt]sx?$/.test(entry.name)) continue;
|
|
60
|
+
const filePath = path.join(dir, entry.name);
|
|
61
|
+
const original = await fs.readFile(filePath, "utf8");
|
|
62
|
+
const rewritten = original.replace(re, (_, from, quote, seg) => {
|
|
63
|
+
return `${from}${quote}@takazudo/zudo-doc/${seg}${quote}`;
|
|
64
|
+
});
|
|
65
|
+
if (rewritten !== original) {
|
|
66
|
+
await fs.writeFile(filePath, rewritten, "utf8");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function rewireHostCallSites(projectRoot, component, localDir) {
|
|
71
|
+
const packageSubpath = EJECTABLE[component].packageSubpath;
|
|
72
|
+
const escapedSubpath = packageSubpath.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
73
|
+
const re = new RegExp(`(from\\s+)(["'])${escapedSubpath}\\2`, "g");
|
|
74
|
+
const searchDirs = [
|
|
75
|
+
path.join(projectRoot, "src"),
|
|
76
|
+
path.join(projectRoot, "pages")
|
|
77
|
+
];
|
|
78
|
+
let rewroteCount = 0;
|
|
79
|
+
for (const searchDir of searchDirs) {
|
|
80
|
+
if (!await fs.pathExists(searchDir)) continue;
|
|
81
|
+
const rewriteDir = async (dir, relFromProject) => {
|
|
82
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
83
|
+
for (const entry of entries) {
|
|
84
|
+
const abs = path.join(dir, entry.name);
|
|
85
|
+
if (entry.isDirectory()) {
|
|
86
|
+
await rewriteDir(abs, path.join(relFromProject, entry.name));
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (!/\.[cm]?[jt]sx?$/.test(entry.name)) continue;
|
|
90
|
+
const original = await fs.readFile(abs, "utf8");
|
|
91
|
+
if (!original.includes(packageSubpath)) continue;
|
|
92
|
+
const fileDir = path.join(projectRoot, relFromProject);
|
|
93
|
+
const destAbs = path.join(projectRoot, localDir);
|
|
94
|
+
let rel = path.relative(fileDir, destAbs).split(path.sep).join("/");
|
|
95
|
+
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
96
|
+
const rewritten = original.replace(re, (_, from, quote) => {
|
|
97
|
+
return `${from}${quote}${rel}${quote}`;
|
|
98
|
+
});
|
|
99
|
+
if (rewritten !== original) {
|
|
100
|
+
await fs.writeFile(abs, rewritten, "utf8");
|
|
101
|
+
rewroteCount++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const relBase = path.relative(projectRoot, searchDir);
|
|
106
|
+
await rewriteDir(searchDir, relBase);
|
|
107
|
+
}
|
|
108
|
+
return rewroteCount;
|
|
109
|
+
}
|
|
110
|
+
function defaultResolvePackageRoot(cwd) {
|
|
111
|
+
let dir = cwd;
|
|
112
|
+
while (true) {
|
|
113
|
+
const candidate = path.join(dir, "node_modules/@takazudo/zudo-doc");
|
|
114
|
+
if (fs.pathExistsSync(candidate)) return candidate;
|
|
115
|
+
const parent = path.dirname(dir);
|
|
116
|
+
if (parent === dir) break;
|
|
117
|
+
dir = parent;
|
|
118
|
+
}
|
|
119
|
+
throw new Error(
|
|
120
|
+
`Could not find @takazudo/zudo-doc in node_modules from ${cwd}.
|
|
121
|
+
Run \`pnpm install\` first.`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
async function eject(component, options = {}) {
|
|
125
|
+
const cwd = options.cwd ?? process.cwd();
|
|
126
|
+
const resolvePackageRoot = options.resolvePackageRoot ?? defaultResolvePackageRoot;
|
|
127
|
+
if (!Object.prototype.hasOwnProperty.call(EJECTABLE, component)) {
|
|
128
|
+
const valid = Object.keys(EJECTABLE).sort().join(", ");
|
|
129
|
+
console.error(
|
|
130
|
+
pc.red(`Unknown component "${component}".`) + `
|
|
131
|
+
Ejectable components: ${valid}`
|
|
132
|
+
);
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
const entry = EJECTABLE[component];
|
|
136
|
+
const localDir = entry.localDir;
|
|
137
|
+
const destAbs = path.join(cwd, localDir);
|
|
138
|
+
const provenancePath = path.join(cwd, ".zudo-doc.json");
|
|
139
|
+
let provenance = { packageVersion: "unknown", ejected: {} };
|
|
140
|
+
if (await fs.pathExists(provenancePath)) {
|
|
141
|
+
try {
|
|
142
|
+
provenance = await fs.readJson(provenancePath);
|
|
143
|
+
} catch {
|
|
144
|
+
provenance = { packageVersion: "unknown", ejected: {} };
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (Object.prototype.hasOwnProperty.call(provenance.ejected, component)) {
|
|
148
|
+
const recorded = provenance.ejected[component];
|
|
149
|
+
console.log(
|
|
150
|
+
pc.yellow(`already ejected at ${recorded}`) + ` \u2014 skipping (re-eject is a safe no-op)`
|
|
151
|
+
);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (await fs.pathExists(destAbs)) {
|
|
155
|
+
console.log(
|
|
156
|
+
pc.yellow(`Destination ${localDir} already exists`) + ` but is not recorded in .zudo-doc.json.
|
|
157
|
+
Treating as already ejected \u2014 skipping to avoid clobbering local edits.
|
|
158
|
+
If you want to re-eject, remove the directory and its .zudo-doc.json entry manually.`
|
|
159
|
+
);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
let pkgRoot;
|
|
163
|
+
try {
|
|
164
|
+
pkgRoot = resolvePackageRoot(cwd);
|
|
165
|
+
} catch (err) {
|
|
166
|
+
console.error(pc.red(String(err)));
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
const ejectSrcDir = path.join(pkgRoot, "eject", component);
|
|
170
|
+
if (!await fs.pathExists(ejectSrcDir)) {
|
|
171
|
+
const pkgJsonPath = path.join(pkgRoot, "package.json");
|
|
172
|
+
let version = "unknown";
|
|
173
|
+
try {
|
|
174
|
+
const pkgJson = await fs.readJson(pkgJsonPath);
|
|
175
|
+
version = pkgJson.version ?? "unknown";
|
|
176
|
+
} catch {
|
|
177
|
+
}
|
|
178
|
+
console.error(
|
|
179
|
+
pc.red(
|
|
180
|
+
`@takazudo/zudo-doc@${version} does not ship eject sources for "${component}".
|
|
181
|
+
Bump @takazudo/zudo-doc to a version that includes the eject/ tree and retry.`
|
|
182
|
+
)
|
|
183
|
+
);
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
186
|
+
let installedVersion = provenance.packageVersion;
|
|
187
|
+
try {
|
|
188
|
+
const pkgJson = await fs.readJson(path.join(pkgRoot, "package.json"));
|
|
189
|
+
installedVersion = pkgJson.version ?? installedVersion;
|
|
190
|
+
} catch {
|
|
191
|
+
}
|
|
192
|
+
await fs.ensureDir(destAbs);
|
|
193
|
+
await fs.copy(ejectSrcDir, destAbs);
|
|
194
|
+
console.log(pc.green(`Copied ${component} source \u2192 ${localDir}`));
|
|
195
|
+
await rewireImports(destAbs);
|
|
196
|
+
console.log(pc.dim(` Rewired cross-component imports in ${localDir}`));
|
|
197
|
+
const rewroteCount = await rewireHostCallSites(cwd, component, localDir);
|
|
198
|
+
if (rewroteCount > 0) {
|
|
199
|
+
console.log(
|
|
200
|
+
pc.dim(` Rewrote ${rewroteCount} host file(s) to import from ${localDir}`)
|
|
201
|
+
);
|
|
202
|
+
} else {
|
|
203
|
+
console.log(
|
|
204
|
+
pc.dim(
|
|
205
|
+
` No host call sites found for ${entry.packageSubpath}.
|
|
206
|
+
Update your imports manually: change the \`"${entry.packageSubpath}"\`
|
|
207
|
+
specifier to a local one, e.g. \`"@/${localDir}/index.js"\` or a relative path.`
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
provenance.packageVersion = installedVersion;
|
|
212
|
+
provenance.ejected[component] = localDir;
|
|
213
|
+
await fs.writeJson(provenancePath, provenance, { spaces: 2 });
|
|
214
|
+
console.log(pc.green(`Updated .zudo-doc.json`));
|
|
215
|
+
console.log(
|
|
216
|
+
pc.bold(
|
|
217
|
+
`
|
|
218
|
+
${pc.green("\u2713")} Ejected ${component} from @takazudo/zudo-doc@${installedVersion}
|
|
219
|
+
Source: node_modules/@takazudo/zudo-doc/eject/${component}/
|
|
220
|
+
Destination: ${localDir}/
|
|
221
|
+
Provenance: .zudo-doc.json
|
|
222
|
+
`
|
|
223
|
+
)
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
export {
|
|
227
|
+
EJECTABLE,
|
|
228
|
+
eject
|
|
229
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Heading-ID (anchor) strategy. Mirrors `settings.headingIdStrategy`. */
|
|
2
|
+
export type HeadingIdStrategy = "flat" | "hierarchical";
|
|
3
|
+
/**
|
|
4
|
+
* Slugify one heading's text — a byte-faithful TS port of zfb's Rust `slugify`
|
|
5
|
+
* (`crates/zfb-content/src/plugins/heading_links.rs`). Using the exact upstream
|
|
6
|
+
* algorithm (rather than npm `github-slugger`, which strips punctuation
|
|
7
|
+
* differently) is what keeps the TOC anchor identical to the rendered `id`.
|
|
8
|
+
*
|
|
9
|
+
* Rule: walk code points; whitespace, ASCII control, or a {@link SLUGIFY_STRIPPED}
|
|
10
|
+
* char collapses to a single `-` (runs coalesce); every other char is lowercased
|
|
11
|
+
* and kept (Unicode letters/digits, `-`, `_` survive). A single trailing `-` is
|
|
12
|
+
* dropped; a leading `-` is never emitted.
|
|
13
|
+
*/
|
|
14
|
+
export declare function slugify(input: string): string;
|
|
15
|
+
export interface HeadingItem {
|
|
16
|
+
readonly depth: number;
|
|
17
|
+
readonly slug: string;
|
|
18
|
+
readonly text: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Extract TOC headings from a raw MDX/markdown body.
|
|
22
|
+
*
|
|
23
|
+
* Uses the same slugging algorithm as zfb's `HeadingLinks` plugin (selected by
|
|
24
|
+
* `opts.strategy`) so the `href="#slug"` values in the TOC match the rendered
|
|
25
|
+
* heading element IDs. Allocates over ALL matched h2–h6 (keeping the dedup
|
|
26
|
+
* counter and hierarchical ancestor stack in sync with the renderer) but only
|
|
27
|
+
* pushes depth 2–4 items into the result (configurable via opts). h1 is not
|
|
28
|
+
* matched — the renderer does not assign ids to h1.
|
|
29
|
+
*
|
|
30
|
+
* Unlike the original showcase version, this function takes all settings as
|
|
31
|
+
* explicit parameters rather than reading from the project's `settings` singleton.
|
|
32
|
+
* This keeps the package import-graph free of project singletons.
|
|
33
|
+
*
|
|
34
|
+
* @param body - Raw markdown body string (frontmatter already stripped).
|
|
35
|
+
* @param opts - Settings for heading depth window and ID strategy. Production
|
|
36
|
+
* call sites should pass values from the project's `settings` object.
|
|
37
|
+
* @returns Array of `{ depth, slug, text }` items in document order.
|
|
38
|
+
*/
|
|
39
|
+
export declare function extractHeadings(body: string, opts?: {
|
|
40
|
+
tocMinDepth?: number;
|
|
41
|
+
tocMaxDepth?: number;
|
|
42
|
+
strategy?: HeadingIdStrategy;
|
|
43
|
+
}): HeadingItem[];
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const SLUGIFY_STRIPPED = new Set(
|
|
2
|
+
"!\"#$%&'()*+,./:;<=>?@[\\]^`{|}~".split("")
|
|
3
|
+
);
|
|
4
|
+
function slugify(input) {
|
|
5
|
+
let out = "";
|
|
6
|
+
let lastDash = true;
|
|
7
|
+
for (const ch of input) {
|
|
8
|
+
const cp = ch.codePointAt(0) ?? 0;
|
|
9
|
+
const isControl = cp <= 31 || cp >= 127 && cp <= 159;
|
|
10
|
+
if (isControl || /\s/u.test(ch) || SLUGIFY_STRIPPED.has(ch)) {
|
|
11
|
+
if (!lastDash) {
|
|
12
|
+
out += "-";
|
|
13
|
+
lastDash = true;
|
|
14
|
+
}
|
|
15
|
+
} else {
|
|
16
|
+
out += ch.toLowerCase();
|
|
17
|
+
lastDash = false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (out.endsWith("-")) out = out.slice(0, -1);
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
class SlugAllocator {
|
|
24
|
+
strategy;
|
|
25
|
+
/** Dedup counter, keyed by the (possibly ancestor-prefixed) slug path. */
|
|
26
|
+
seen = /* @__PURE__ */ new Map();
|
|
27
|
+
/** Hierarchical ancestor stack of `{ depth, final id }` (unused when flat). */
|
|
28
|
+
stack = [];
|
|
29
|
+
constructor(strategy) {
|
|
30
|
+
this.strategy = strategy;
|
|
31
|
+
}
|
|
32
|
+
allocate(depth, text) {
|
|
33
|
+
const base = slugify(text);
|
|
34
|
+
if (this.strategy === "flat") {
|
|
35
|
+
return this.nextSlug(base);
|
|
36
|
+
}
|
|
37
|
+
if (base === "") return "";
|
|
38
|
+
for (let top = this.stack.at(-1); top !== void 0 && top.depth >= depth; top = this.stack.at(-1)) {
|
|
39
|
+
this.stack.pop();
|
|
40
|
+
}
|
|
41
|
+
const parent = this.stack.at(-1);
|
|
42
|
+
const candidate = parent !== void 0 ? `${parent.id}-${base}` : base;
|
|
43
|
+
const id = this.nextSlug(candidate);
|
|
44
|
+
this.stack.push({ depth, id });
|
|
45
|
+
return id;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Repeat-numbering on an already-slugified candidate: first occurrence returns
|
|
49
|
+
* `candidate`, later ones `candidate-1`, `candidate-2`, …. Mirrors zfb's
|
|
50
|
+
* `next_slug` — including the empty-string short-circuit (an empty base never
|
|
51
|
+
* advances the counter), so it does NOT re-slugify (the candidate is already a
|
|
52
|
+
* valid slug path).
|
|
53
|
+
*/
|
|
54
|
+
nextSlug(candidate) {
|
|
55
|
+
if (candidate === "") return "";
|
|
56
|
+
const count = this.seen.get(candidate) ?? 0;
|
|
57
|
+
this.seen.set(candidate, count + 1);
|
|
58
|
+
return count === 0 ? candidate : `${candidate}-${count}`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function stripInlineMarkdown(raw) {
|
|
62
|
+
return raw.replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/(?<![\w])__([^_]+)__(?![\w])/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/(?<![\w])_([^_]+)_(?![\w])/g, "$1").trim();
|
|
63
|
+
}
|
|
64
|
+
function resolveDepthWindow(rawMin, rawMax) {
|
|
65
|
+
const min = Math.trunc(Number(rawMin));
|
|
66
|
+
const max = Math.trunc(Number(rawMax));
|
|
67
|
+
if (Number.isFinite(min) && Number.isFinite(max) && min >= 2 && min <= max && max <= 4) {
|
|
68
|
+
return { lo: min, hi: max };
|
|
69
|
+
}
|
|
70
|
+
return { lo: 2, hi: 4 };
|
|
71
|
+
}
|
|
72
|
+
function extractHeadings(body, opts) {
|
|
73
|
+
const { lo, hi } = resolveDepthWindow(
|
|
74
|
+
opts?.tocMinDepth ?? 2,
|
|
75
|
+
opts?.tocMaxDepth ?? 4
|
|
76
|
+
);
|
|
77
|
+
const allocator = new SlugAllocator(opts?.strategy ?? "flat");
|
|
78
|
+
const headings = [];
|
|
79
|
+
let codeFenceOpener = null;
|
|
80
|
+
for (const line of body.split("\n")) {
|
|
81
|
+
const trimmed = line.trimStart();
|
|
82
|
+
const fenceMatch = /^([`~]{3,})/.exec(trimmed);
|
|
83
|
+
if (fenceMatch) {
|
|
84
|
+
const fence = fenceMatch[1];
|
|
85
|
+
if (fence === void 0) continue;
|
|
86
|
+
if (codeFenceOpener === null) {
|
|
87
|
+
codeFenceOpener = fence;
|
|
88
|
+
} else if (fence[0] === codeFenceOpener[0] && fence.length >= codeFenceOpener.length) {
|
|
89
|
+
codeFenceOpener = null;
|
|
90
|
+
}
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (codeFenceOpener !== null) continue;
|
|
94
|
+
const match = /^(#{2,6})[ \t]+(.+)$/.exec(line.trim());
|
|
95
|
+
if (!match) continue;
|
|
96
|
+
const hashes = match[1];
|
|
97
|
+
const rawText = match[2];
|
|
98
|
+
if (hashes === void 0 || rawText === void 0) continue;
|
|
99
|
+
const depth = hashes.length;
|
|
100
|
+
const text = stripInlineMarkdown(rawText.trim());
|
|
101
|
+
const slug = allocator.allocate(depth, text);
|
|
102
|
+
if (depth >= lo && depth <= hi) {
|
|
103
|
+
headings.push({ depth, slug, text });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return headings;
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
extractHeadings,
|
|
110
|
+
slugify
|
|
111
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Settings } from "../settings.js";
|
|
2
|
+
/**
|
|
3
|
+
* The i18n surface a factory may read. Parameterizes what `base.ts` used to read
|
|
4
|
+
* off the project's `@/config/i18n` singleton directly, so URL/locale logic moves
|
|
5
|
+
* into the package as pure functions (see `makeUrlHelpers`).
|
|
6
|
+
*
|
|
7
|
+
* `Locale` is kept as a plain `string` at the package boundary — the concrete
|
|
8
|
+
* union (`"en" | "ja" | …`) is a project-specific narrowing the host supplies; the
|
|
9
|
+
* package only needs the structural contract.
|
|
10
|
+
*/
|
|
11
|
+
export interface FactoryI18n {
|
|
12
|
+
/** Default locale code (served from the un-prefixed `/docs/...` routes). */
|
|
13
|
+
defaultLocale: string;
|
|
14
|
+
/** All supported locale codes, default locale first. */
|
|
15
|
+
locales: readonly string[];
|
|
16
|
+
/** Display label for a locale (e.g. `"EN"`, `"日本語"`). */
|
|
17
|
+
getLocaleLabel: (locale: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Translate a UI string key for a locale, falling back to the default locale
|
|
20
|
+
* then the key itself. Optional: factories that emit no UI strings omit it.
|
|
21
|
+
*/
|
|
22
|
+
t?: (key: string, locale?: string) => string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ALLOWED `{ components }` slots — the host-supplied, project-bound component
|
|
26
|
+
* bindings a factory may inject. This is an **explicit allowlist, NOT an open
|
|
27
|
+
* bag**: every key here is a component the package cannot own because it depends
|
|
28
|
+
* on the host's content collections, settings wiring, or showcase-specific
|
|
29
|
+
* markup. Each slot is documented in `packages/zudo-doc/CLAUDE.md`. Do NOT widen
|
|
30
|
+
* this into a dumping ground — a new slot needs a real cross-package coupling
|
|
31
|
+
* reason and a CLAUDE.md entry. All slots are optional so a factory takes only
|
|
32
|
+
* the ones it needs.
|
|
33
|
+
*
|
|
34
|
+
* Components are typed as the structural `FactoryComponent` (a function
|
|
35
|
+
* returning Preact-renderable output) rather than a concrete signature, so the
|
|
36
|
+
* type stays node-free and Preact-version-agnostic at the boundary.
|
|
37
|
+
*/
|
|
38
|
+
export interface FactoryComponents {
|
|
39
|
+
/** Locale-aware category nav wrapper (reads the project's content collection). */
|
|
40
|
+
CategoryNav?: FactoryComponent;
|
|
41
|
+
/** Locale-aware category-tree nav wrapper. */
|
|
42
|
+
CategoryTreeNav?: FactoryComponent;
|
|
43
|
+
/** Locale-aware site-tree nav wrapper (also used for the demo variant). */
|
|
44
|
+
SiteTreeNav?: FactoryComponent;
|
|
45
|
+
/** HTML-preview wrapper bound to the host's preview config. */
|
|
46
|
+
HtmlPreview?: FactoryComponent;
|
|
47
|
+
/** `<details>` content override. */
|
|
48
|
+
Details?: FactoryComponent;
|
|
49
|
+
/** zfb `<Island>` pass-through (host owns the import so the scanner walks it). */
|
|
50
|
+
Island?: FactoryComponent;
|
|
51
|
+
/** PresetGenerator SSR shell (showcase-only; downstream projects stub it). */
|
|
52
|
+
PresetGenerator?: FactoryComponent;
|
|
53
|
+
}
|
|
54
|
+
/** Any Preact-renderable component — a function returning a VNode/children. */
|
|
55
|
+
export type FactoryComponent = (props: Record<string, unknown>) => unknown;
|
|
56
|
+
/**
|
|
57
|
+
* Opaque per-locale nav-source handle. The host owns the actual content-loader
|
|
58
|
+
* implementation (it reads project content collections, which cannot live in the
|
|
59
|
+
* package); a factory receives this handle and passes it to the package's pure
|
|
60
|
+
* nav builders (`buildNavTree`, sidebar/nav-scope helpers) without knowing its
|
|
61
|
+
* internals. Typed `unknown` on purpose — narrowing belongs to the host stub.
|
|
62
|
+
*/
|
|
63
|
+
export type NavSource = unknown;
|
|
64
|
+
/**
|
|
65
|
+
* The injected context every relocated `pages/lib/*` factory receives.
|
|
66
|
+
*
|
|
67
|
+
* @typeParam S - the host's concrete settings shape (defaults to the package
|
|
68
|
+
* `Settings`). A factory that reads only a subset may accept `Pick<Settings, …>`
|
|
69
|
+
* at its own call site; this context type carries the full object.
|
|
70
|
+
*/
|
|
71
|
+
export interface FactoryContext<S = Settings> {
|
|
72
|
+
/** The host's resolved settings object (single source of config truth). */
|
|
73
|
+
settings: S;
|
|
74
|
+
/** The i18n surface (locales, labels, optional translator). */
|
|
75
|
+
i18n: FactoryI18n;
|
|
76
|
+
/** Host-supplied, project-bound component bindings (explicit allowlist). */
|
|
77
|
+
components: FactoryComponents;
|
|
78
|
+
/** Opaque per-locale nav-source handle passed to the pure nav builders. */
|
|
79
|
+
navSource: NavSource;
|
|
80
|
+
}
|
|
File without changes
|