@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,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tag governance enforcement level.
|
|
3
|
+
*
|
|
4
|
+
* - `"off"` — no vocabulary-aware enforcement (pre-vocabulary behaviour).
|
|
5
|
+
* - `"warn"` — tag audit reports unknown tags but the build still passes.
|
|
6
|
+
* - `"strict"` — unknown tags fail `pnpm check` / `pnpm build` via Zod.
|
|
7
|
+
*
|
|
8
|
+
* Orthogonal to `tagVocabulary`. `tagGovernance` controls the enforcement
|
|
9
|
+
* level when the vocabulary is consulted; `tagVocabulary` controls whether
|
|
10
|
+
* it is consulted at all.
|
|
11
|
+
*/
|
|
12
|
+
export type TagGovernanceMode = "off" | "warn" | "strict";
|
|
13
|
+
/**
|
|
14
|
+
* A single entry in the tag vocabulary.
|
|
15
|
+
*
|
|
16
|
+
* - `id` — canonical tag id. What content files should ideally use.
|
|
17
|
+
* - `label` — optional human-readable label (falls back to `id`).
|
|
18
|
+
* - `description`— optional short description for tooling / tag index pages.
|
|
19
|
+
* - `group` — optional grouping key used by the grouped tag footer
|
|
20
|
+
* (e.g. `"type"`, `"level"`, `"topic"`).
|
|
21
|
+
* - `aliases` — alternate strings that content files may use. Alias
|
|
22
|
+
* resolution rewrites these to `id` before aggregation.
|
|
23
|
+
* - `deprecated` — `true` marks the tag as deprecated with no redirect: the
|
|
24
|
+
* canonical id is dropped from aggregation. Pass
|
|
25
|
+
* `{ redirect: "<other-id>" }` to rewrite this tag to another
|
|
26
|
+
* canonical id when it appears in content.
|
|
27
|
+
*/
|
|
28
|
+
export interface TagVocabularyEntry {
|
|
29
|
+
id: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
group?: string;
|
|
33
|
+
aliases?: readonly string[];
|
|
34
|
+
deprecated?: boolean | {
|
|
35
|
+
redirect?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface HeaderNavChildItem {
|
|
39
|
+
label: string;
|
|
40
|
+
labelKey?: string;
|
|
41
|
+
path: string;
|
|
42
|
+
categoryMatch?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface HeaderNavItem extends HeaderNavChildItem {
|
|
45
|
+
children?: HeaderNavChildItem[];
|
|
46
|
+
}
|
|
47
|
+
export type HeaderRightComponentName = "theme-toggle" | "language-switcher" | "version-switcher" | "github-link" | "search";
|
|
48
|
+
export type HeaderRightTriggerName = "design-token-panel" | "ai-chat";
|
|
49
|
+
export interface HeaderRightComponentItem {
|
|
50
|
+
type: "component";
|
|
51
|
+
component: HeaderRightComponentName;
|
|
52
|
+
}
|
|
53
|
+
export interface HeaderRightTriggerItem {
|
|
54
|
+
type: "trigger";
|
|
55
|
+
trigger: HeaderRightTriggerName;
|
|
56
|
+
}
|
|
57
|
+
export interface HeaderRightLinkItem {
|
|
58
|
+
type: "link";
|
|
59
|
+
href: string;
|
|
60
|
+
label?: string;
|
|
61
|
+
ariaLabel?: string;
|
|
62
|
+
icon?: "github";
|
|
63
|
+
}
|
|
64
|
+
export interface HeaderRightHtmlItem {
|
|
65
|
+
type: "html";
|
|
66
|
+
html: string;
|
|
67
|
+
}
|
|
68
|
+
export type HeaderRightItem = HeaderRightComponentItem | HeaderRightTriggerItem | HeaderRightLinkItem | HeaderRightHtmlItem;
|
|
69
|
+
export interface BodyFootUtilAreaConfig {
|
|
70
|
+
docHistory?: boolean;
|
|
71
|
+
viewSourceLink?: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface ColorModeConfig {
|
|
74
|
+
defaultMode: "light" | "dark";
|
|
75
|
+
lightScheme: string;
|
|
76
|
+
darkScheme: string;
|
|
77
|
+
respectPrefersColorScheme: boolean;
|
|
78
|
+
}
|
|
79
|
+
export interface LocaleConfig {
|
|
80
|
+
label: string;
|
|
81
|
+
dir: string;
|
|
82
|
+
}
|
|
83
|
+
export interface FooterLinkItem {
|
|
84
|
+
label: string;
|
|
85
|
+
href: string;
|
|
86
|
+
locales?: Record<string, {
|
|
87
|
+
label: string;
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
export interface FooterLinkColumn {
|
|
91
|
+
title: string;
|
|
92
|
+
items: FooterLinkItem[];
|
|
93
|
+
locales?: Record<string, {
|
|
94
|
+
title: string;
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Per-locale overrides for the footer taglist labels.
|
|
99
|
+
*
|
|
100
|
+
* `title` — overrides `taglist.title` on this locale.
|
|
101
|
+
* `groupTitles` — per-group title overrides keyed by vocabulary `group`.
|
|
102
|
+
*/
|
|
103
|
+
export interface FooterTaglistLocaleConfig {
|
|
104
|
+
title?: string;
|
|
105
|
+
groupTitles?: Record<string, string>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Opt-in footer tag index.
|
|
109
|
+
*
|
|
110
|
+
* Renders one or more columns of tag links inside the existing footer grid.
|
|
111
|
+
* Off by default: when `enabled: false` (or the field is omitted entirely),
|
|
112
|
+
* the footer renders unchanged.
|
|
113
|
+
*
|
|
114
|
+
* - `groupBy: "group"` — one column per vocabulary `group`, in the order the
|
|
115
|
+
* groups first appear in `tag-vocabulary.ts`. Each column's title comes from
|
|
116
|
+
* `groupTitles[group]`, falling back to a capitalised version of the group
|
|
117
|
+
* name.
|
|
118
|
+
* - `groupBy: "flat"` — a single column titled `title` listing every tag
|
|
119
|
+
* alphabetically. This is also the fallback used when the vocabulary is
|
|
120
|
+
* inactive (`tagVocabulary: false` or `tagGovernance: "off"`).
|
|
121
|
+
*/
|
|
122
|
+
export interface FooterTaglistConfig {
|
|
123
|
+
enabled: boolean;
|
|
124
|
+
/** Column title used in flat mode (and as fallback for ungrouped tags). */
|
|
125
|
+
title?: string;
|
|
126
|
+
/** Default `"group"` when the vocabulary is active, otherwise forced to `"flat"`. */
|
|
127
|
+
groupBy?: "group" | "flat";
|
|
128
|
+
/** English (default-locale) group titles, e.g. `{ type: "By type" }`. */
|
|
129
|
+
groupTitles?: Record<string, string>;
|
|
130
|
+
/** Locale-specific overrides for `title` and `groupTitles`. */
|
|
131
|
+
locales?: Record<string, FooterTaglistLocaleConfig>;
|
|
132
|
+
}
|
|
133
|
+
export interface FooterConfig {
|
|
134
|
+
links: FooterLinkColumn[];
|
|
135
|
+
/** Copyright text displayed at the bottom of the footer. HTML is supported. */
|
|
136
|
+
copyright?: string;
|
|
137
|
+
/** Opt-in footer tag index. Off by default. */
|
|
138
|
+
taglist?: FooterTaglistConfig;
|
|
139
|
+
}
|
|
140
|
+
export interface HtmlPreviewConfig {
|
|
141
|
+
/** Raw HTML injected into <head> (links, meta, fonts) */
|
|
142
|
+
head?: string;
|
|
143
|
+
/** CSS injected as <style> after preflight */
|
|
144
|
+
css?: string;
|
|
145
|
+
/** JS injected as <script> before </body> */
|
|
146
|
+
js?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface FrontmatterPreviewConfig {
|
|
149
|
+
/**
|
|
150
|
+
* Completely replaces the default ignore list.
|
|
151
|
+
* When set, `extraIgnoreKeys` is ignored.
|
|
152
|
+
*/
|
|
153
|
+
ignoreKeys?: string[];
|
|
154
|
+
/**
|
|
155
|
+
* Additional keys to ignore on top of the defaults.
|
|
156
|
+
* Has no effect when `ignoreKeys` is also set.
|
|
157
|
+
*/
|
|
158
|
+
extraIgnoreKeys?: string[];
|
|
159
|
+
}
|
|
160
|
+
export type TagPlacement = "after-title" | "before-pager";
|
|
161
|
+
export interface VersionConfig {
|
|
162
|
+
/** Version identifier, used in URL path (e.g., "1.0", "v1") */
|
|
163
|
+
slug: string;
|
|
164
|
+
/** Display label (e.g., "1.0.0", "Version 1") */
|
|
165
|
+
label: string;
|
|
166
|
+
/** Content directory for this version's English docs */
|
|
167
|
+
docsDir: string;
|
|
168
|
+
/** Per-locale content directories for this version */
|
|
169
|
+
locales?: Record<string, {
|
|
170
|
+
dir: string;
|
|
171
|
+
}>;
|
|
172
|
+
/** Banner text shown on versioned pages (e.g., "unmaintained", "unreleased") */
|
|
173
|
+
banner?: "unmaintained" | "unreleased" | false;
|
|
174
|
+
}
|
|
175
|
+
export interface MetaTagsConfig {
|
|
176
|
+
/** Emit <meta name="description">. Default true. */
|
|
177
|
+
description: boolean;
|
|
178
|
+
/** Emit <meta name="keywords"> with a comma-separated string. false = omit. Default false. */
|
|
179
|
+
keywords: string | false;
|
|
180
|
+
/** og:image (and twitter:image) path. false = omit. Default false. Showcase: '/img/ogp.png'. */
|
|
181
|
+
ogImage: string | false;
|
|
182
|
+
/** Emit og:site_name. Default true (preserves current og:site_name). */
|
|
183
|
+
ogSiteName: boolean;
|
|
184
|
+
/** TwitterCard type. false = omit entire twitter:card block. Default false. Showcase: 'summary_large_image'. */
|
|
185
|
+
twitterCard: "summary" | "summary_large_image" | false;
|
|
186
|
+
/** twitter:site handle (e.g. '@yourbrand'). Optional. */
|
|
187
|
+
twitterSite?: string;
|
|
188
|
+
/** twitter:creator handle. Optional. */
|
|
189
|
+
twitterCreator?: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The full zudo-doc project settings interface.
|
|
193
|
+
*
|
|
194
|
+
* Consumer projects declare their concrete settings object using `satisfies Settings`
|
|
195
|
+
* to get type-checking against this interface:
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* import type { Settings } from "@takazudo/zudo-doc/settings";
|
|
199
|
+
* export const settings = { ... } satisfies Settings;
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
export interface Settings {
|
|
203
|
+
colorScheme: string;
|
|
204
|
+
colorMode: ColorModeConfig | false;
|
|
205
|
+
siteName: string;
|
|
206
|
+
siteDescription: string;
|
|
207
|
+
base: string;
|
|
208
|
+
trailingSlash: boolean;
|
|
209
|
+
docsDir: string;
|
|
210
|
+
defaultLocale: string;
|
|
211
|
+
locales: Record<string, LocaleConfig>;
|
|
212
|
+
mermaid: boolean;
|
|
213
|
+
noindex: boolean;
|
|
214
|
+
editUrl: string | false;
|
|
215
|
+
githubUrl: string | false;
|
|
216
|
+
/** "owner/repo" — enables `#123` / SHA autolinks in markdown. Omit or leave undefined to disable. */
|
|
217
|
+
githubAutolinksRepo?: string;
|
|
218
|
+
siteUrl: string;
|
|
219
|
+
metaTags: MetaTagsConfig;
|
|
220
|
+
sitemap: boolean;
|
|
221
|
+
docMetainfo: boolean;
|
|
222
|
+
docTags: boolean;
|
|
223
|
+
tagPlacement: TagPlacement;
|
|
224
|
+
tagGovernance: TagGovernanceMode;
|
|
225
|
+
tagVocabulary: boolean;
|
|
226
|
+
llmsTxt: boolean;
|
|
227
|
+
math: boolean;
|
|
228
|
+
cjkFriendly: boolean;
|
|
229
|
+
onBrokenMarkdownLinks: "warn" | "error" | "ignore";
|
|
230
|
+
aiAssistant: boolean;
|
|
231
|
+
aiChatDemoMode: boolean;
|
|
232
|
+
aiChatAllowedOrigins: string[];
|
|
233
|
+
aiChatGlobalDailyLimit: number | false;
|
|
234
|
+
designTokenPanel: boolean;
|
|
235
|
+
tocMinDepth: number;
|
|
236
|
+
tocMaxDepth: number;
|
|
237
|
+
headingIdStrategy: "flat" | "hierarchical";
|
|
238
|
+
sidebarResizer: boolean;
|
|
239
|
+
sidebarToggle: boolean;
|
|
240
|
+
imageEnlarge: boolean;
|
|
241
|
+
dynamicPageTransition: boolean;
|
|
242
|
+
frontmatterPreview: FrontmatterPreviewConfig | false;
|
|
243
|
+
docHistory: boolean;
|
|
244
|
+
bodyFootUtilArea: BodyFootUtilAreaConfig | false;
|
|
245
|
+
htmlPreview: HtmlPreviewConfig | undefined;
|
|
246
|
+
versions: VersionConfig[] | false;
|
|
247
|
+
claudeResources: {
|
|
248
|
+
claudeDir: string;
|
|
249
|
+
projectRoot?: string;
|
|
250
|
+
} | false;
|
|
251
|
+
defaultLocaleOnlyPrefixes: string[];
|
|
252
|
+
footer: FooterConfig | false;
|
|
253
|
+
headerNav: HeaderNavItem[];
|
|
254
|
+
headerRightItems: HeaderRightItem[];
|
|
255
|
+
/**
|
|
256
|
+
* Build-time package-owned route injection (epic Package-First Finale #2356,
|
|
257
|
+
* ADR `docs/adr/route-injection-seam.md`). When `true`, the preset adds the
|
|
258
|
+
* `@takazudo/zudo-doc/plugins/routes` plugin, which injects the doc routes
|
|
259
|
+
* from the package instead of requiring project-shipped `pages/*.tsx` stubs.
|
|
260
|
+
*
|
|
261
|
+
* On by default since the fast-follow (#2372 — upstream zfb dev-render support
|
|
262
|
+
* landed): the showcase and create-zudo-doc emit `packageOwnedRoutes: true` into
|
|
263
|
+
* their generated `settings.ts`. The preset reads this value truthily with no
|
|
264
|
+
* central defaulting, so a hand-written settings object that omits the field is
|
|
265
|
+
* treated as off. Any injected route whose URL shape collides with a kept
|
|
266
|
+
* `pages/` stub is silently dropped (user `pages/` wins), so existing stubs
|
|
267
|
+
* are a harmless no-op.
|
|
268
|
+
*/
|
|
269
|
+
packageOwnedRoutes?: boolean;
|
|
270
|
+
}
|
package/dist/settings.js
ADDED
|
File without changes
|
package/dist/sidebar/index.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public entry for the framework-agnostic sidebar shell.
|
|
3
|
+
*
|
|
4
|
+
* Consumers import from `@takazudo/zudo-doc/sidebar`:
|
|
5
|
+
*
|
|
6
|
+
* import {
|
|
7
|
+
* Sidebar,
|
|
8
|
+
* type SidebarProps,
|
|
9
|
+
* type SidebarNavNode,
|
|
10
|
+
* type SidebarRootMenuItem,
|
|
11
|
+
* type SidebarLocaleLink,
|
|
12
|
+
* type SidebarTreeIslandProps,
|
|
13
|
+
* } from "@takazudo/zudo-doc/sidebar";
|
|
14
|
+
*
|
|
15
|
+
* The shell does NOT include the SidebarTree island itself — the host
|
|
16
|
+
* project's existing Preact island is plugged in via the
|
|
17
|
+
* `treeComponent` prop (or rendered as `children`).
|
|
18
|
+
*/
|
|
19
|
+
export { Sidebar } from "./sidebar.js";
|
|
20
|
+
export type { SidebarProps } from "./sidebar.js";
|
|
21
|
+
export type { SidebarLocaleLink, SidebarNavNode, SidebarRootMenuItem, SidebarTreeIslandProps, } from "./types.js";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { FunctionComponent, ComponentChildren, VNode } from 'preact';
|
|
2
|
-
import { SidebarTreeIslandProps } from './types.js';
|
|
3
|
-
|
|
4
1
|
/** @jsxRuntime automatic */
|
|
5
2
|
/** @jsxImportSource preact */
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import type { ComponentChildren, FunctionComponent, VNode } from "preact";
|
|
4
|
+
import type { SidebarTreeIslandProps } from "./types.js";
|
|
5
|
+
export interface SidebarProps extends SidebarTreeIslandProps {
|
|
8
6
|
/**
|
|
9
7
|
* The host's SidebarTree component. When present, the shell renders
|
|
10
8
|
* `<TreeComponent {...islandProps} />` with the typed props below.
|
|
@@ -46,9 +44,7 @@ interface SidebarProps extends SidebarTreeIslandProps {
|
|
|
46
44
|
* `<Island>` wrapper here exists so the shell can host data-only
|
|
47
45
|
* variants in the future without losing the marker contract.
|
|
48
46
|
*/
|
|
49
|
-
declare function Sidebar(props: SidebarProps): VNode | null;
|
|
50
|
-
declare namespace Sidebar {
|
|
47
|
+
export declare function Sidebar(props: SidebarProps): VNode | null;
|
|
48
|
+
export declare namespace Sidebar {
|
|
51
49
|
var displayName: string;
|
|
52
50
|
}
|
|
53
|
-
|
|
54
|
-
export { Sidebar, type SidebarProps };
|
package/dist/sidebar/types.d.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* One node in the navigation tree the SidebarTree island renders.
|
|
25
25
|
* Matches `NavNode` in the host project's `src/utils/docs.ts`.
|
|
26
26
|
*/
|
|
27
|
-
interface SidebarNavNode {
|
|
27
|
+
export interface SidebarNavNode {
|
|
28
28
|
slug: string;
|
|
29
29
|
label: string;
|
|
30
30
|
description?: string;
|
|
@@ -39,7 +39,7 @@ interface SidebarNavNode {
|
|
|
39
39
|
* Item in the root-level "Docusaurus-style" menu shown above the
|
|
40
40
|
* doc tree on mobile / inside the back-to-menu view.
|
|
41
41
|
*/
|
|
42
|
-
interface SidebarRootMenuItem {
|
|
42
|
+
export interface SidebarRootMenuItem {
|
|
43
43
|
label: string;
|
|
44
44
|
href: string;
|
|
45
45
|
children?: SidebarRootMenuItem[];
|
|
@@ -48,7 +48,7 @@ interface SidebarRootMenuItem {
|
|
|
48
48
|
* Locale switcher link rendered inside the mobile sidebar footer.
|
|
49
49
|
* Matches `LocaleLink` in the host project's `src/types/locale.ts`.
|
|
50
50
|
*/
|
|
51
|
-
interface SidebarLocaleLink {
|
|
51
|
+
export interface SidebarLocaleLink {
|
|
52
52
|
code: string;
|
|
53
53
|
label: string;
|
|
54
54
|
href: string;
|
|
@@ -59,7 +59,7 @@ interface SidebarLocaleLink {
|
|
|
59
59
|
* to whichever component the host plugs in via {@link SidebarProps.treeComponent}
|
|
60
60
|
* (or to nothing, when the host renders its own tree as `children`).
|
|
61
61
|
*/
|
|
62
|
-
interface SidebarTreeIslandProps {
|
|
62
|
+
export interface SidebarTreeIslandProps {
|
|
63
63
|
nodes: SidebarNavNode[];
|
|
64
64
|
currentSlug?: string;
|
|
65
65
|
rootMenuItems?: SidebarRootMenuItem[];
|
|
@@ -67,5 +67,3 @@ interface SidebarTreeIslandProps {
|
|
|
67
67
|
localeLinks?: SidebarLocaleLink[];
|
|
68
68
|
themeDefaultMode?: "light" | "dark";
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
export type { SidebarLocaleLink, SidebarNavNode, SidebarRootMenuItem, SidebarTreeIslandProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
export interface SidebarPrepaintProps {
|
|
5
|
+
/**
|
|
6
|
+
* Mirrors the page's `hide_sidebar: true` frontmatter. When true the desktop
|
|
7
|
+
* toggle is skipped — there is no visible sidebar for it to collapse.
|
|
8
|
+
*/
|
|
9
|
+
hideSidebar?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Settings subset read by {@link createSidebarPrepaint}. */
|
|
12
|
+
export interface SidebarPrepaintSettings {
|
|
13
|
+
sidebarToggle?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a `SidebarPrepaint` component bound to the host's settings.
|
|
17
|
+
*
|
|
18
|
+
* The host stub calls this once with `{ sidebarToggle: settings.sidebarToggle }`
|
|
19
|
+
* and re-exports the result.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createSidebarPrepaint(settings: SidebarPrepaintSettings): (props: SidebarPrepaintProps) => JSX.Element | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { Island } from "@takazudo/zfb";
|
|
3
|
+
import { DesktopSidebarToggle } from "../desktop-sidebar-toggle-island/index.js";
|
|
4
|
+
function createSidebarPrepaint(settings) {
|
|
5
|
+
function SidebarPrepaint({
|
|
6
|
+
hideSidebar
|
|
7
|
+
}) {
|
|
8
|
+
if (!settings.sidebarToggle || hideSidebar) return void 0;
|
|
9
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
+
/* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: {
|
|
11
|
+
__html: `(function(){try{if(localStorage.getItem('zudo-doc-sidebar-visible')==='false'){document.documentElement.setAttribute('data-sidebar-hidden','');}}catch(e){}})();`
|
|
12
|
+
} }),
|
|
13
|
+
Island({
|
|
14
|
+
when: "load",
|
|
15
|
+
children: /* @__PURE__ */ jsx(DesktopSidebarToggle, {})
|
|
16
|
+
})
|
|
17
|
+
] });
|
|
18
|
+
}
|
|
19
|
+
return SidebarPrepaint;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
createSidebarPrepaint
|
|
23
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export { SIDEBAR_RESIZER_INIT_SCRIPT, SIDEBAR_RESIZER_RESTORE_SCRIPT, SidebarResizerInit, SidebarResizerRestore } from './sidebar-resizer-init.js';
|
|
2
|
-
import 'preact';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* Attach the sidebar drag handle to `#desktop-sidebar`. Idempotent —
|
|
6
3
|
* safe to call repeatedly (e.g. after each route swap). No-op if the
|
|
@@ -9,6 +6,5 @@ import 'preact';
|
|
|
9
6
|
* Designed to be called from the browser only. Guards against `document`
|
|
10
7
|
* being undefined so accidental SSR invocation does not throw.
|
|
11
8
|
*/
|
|
12
|
-
declare function initSidebarResizer(): void;
|
|
13
|
-
|
|
14
|
-
export { initSidebarResizer };
|
|
9
|
+
export declare function initSidebarResizer(): void;
|
|
10
|
+
export { SidebarResizerInit, SIDEBAR_RESIZER_INIT_SCRIPT, SidebarResizerRestore, SIDEBAR_RESIZER_RESTORE_SCRIPT, } from "./sidebar-resizer-init.js";
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { JSX } from 'preact';
|
|
2
|
-
|
|
3
1
|
/** @jsxImportSource preact */
|
|
4
|
-
|
|
5
|
-
declare const SIDEBAR_RESIZER_INIT_SCRIPT: string;
|
|
2
|
+
import type { JSX } from "preact";
|
|
3
|
+
export declare const SIDEBAR_RESIZER_INIT_SCRIPT: string;
|
|
6
4
|
/**
|
|
7
5
|
* Drop-in JSX body-end script for sidebar resize initialization.
|
|
8
6
|
*
|
|
@@ -15,9 +13,9 @@ declare const SIDEBAR_RESIZER_INIT_SCRIPT: string;
|
|
|
15
13
|
* Strategy B SPA navigation support.
|
|
16
14
|
* - Idempotent: repeated calls on the same DOM are safe.
|
|
17
15
|
*/
|
|
18
|
-
declare function SidebarResizerInit(): JSX.Element;
|
|
19
|
-
|
|
20
|
-
declare const SIDEBAR_RESIZER_RESTORE_SCRIPT = "(function(){try{var w=localStorage.getItem(\"zudo-doc-sidebar-width\");if(!w)return;var n=parseFloat(w);if(!isFinite(n))return;if(n<192)n=192;else if(n>448)n=448;document.documentElement.style.setProperty(\"--zd-sidebar-w\",n+\"px\");}catch(e){}})();";
|
|
16
|
+
export declare function SidebarResizerInit(): JSX.Element;
|
|
17
|
+
export default SidebarResizerInit;
|
|
18
|
+
export declare const SIDEBAR_RESIZER_RESTORE_SCRIPT = "(function(){try{var w=localStorage.getItem(\"zudo-doc-sidebar-width\");if(!w)return;var n=parseFloat(w);if(!isFinite(n))return;if(n<192)n=192;else if(n>448)n=448;document.documentElement.style.setProperty(\"--zd-sidebar-w\",n+\"px\");}catch(e){}})();";
|
|
21
19
|
/**
|
|
22
20
|
* Drop-in JSX `<head>` script that restores the persisted sidebar width
|
|
23
21
|
* before first paint.
|
|
@@ -35,6 +33,4 @@ declare const SIDEBAR_RESIZER_RESTORE_SCRIPT = "(function(){try{var w=localStora
|
|
|
35
33
|
* It silently no-ops in privacy / disabled-storage modes (try/catch),
|
|
36
34
|
* matches the resilience of the runtime `applyWidth` writer.
|
|
37
35
|
*/
|
|
38
|
-
declare function SidebarResizerRestore(): JSX.Element;
|
|
39
|
-
|
|
40
|
-
export { SIDEBAR_RESIZER_INIT_SCRIPT, SIDEBAR_RESIZER_RESTORE_SCRIPT, SidebarResizerInit, SidebarResizerRestore, SidebarResizerInit as default };
|
|
36
|
+
export declare function SidebarResizerRestore(): JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SidebarNavNode, SidebarRootMenuItem, SidebarLocaleLink } from "../sidebar/types.js";
|
|
2
|
+
export interface SidebarToggleProps {
|
|
3
|
+
nodes: SidebarNavNode[];
|
|
4
|
+
currentSlug?: string;
|
|
5
|
+
rootMenuItems?: SidebarRootMenuItem[];
|
|
6
|
+
backToMenuLabel?: string;
|
|
7
|
+
localeLinks?: SidebarLocaleLink[];
|
|
8
|
+
themeDefaultMode?: "light" | "dark";
|
|
9
|
+
}
|
|
10
|
+
export declare function SidebarToggle({ nodes, currentSlug, rootMenuItems, backToMenuLabel, localeLinks, themeDefaultMode, }: SidebarToggleProps): import("preact").JSX.Element;
|
|
11
|
+
export declare namespace SidebarToggle {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
3
|
+
import { useState, useEffect } from "preact/hooks";
|
|
4
|
+
import { AFTER_NAVIGATE_EVENT } from "../transitions/index.js";
|
|
5
|
+
import { SidebarTree } from "../sidebar-tree-island/index.js";
|
|
6
|
+
const cx = (...classes) => classes.filter(Boolean).join(" ");
|
|
7
|
+
function SidebarToggle({
|
|
8
|
+
nodes,
|
|
9
|
+
currentSlug,
|
|
10
|
+
rootMenuItems,
|
|
11
|
+
backToMenuLabel,
|
|
12
|
+
localeLinks,
|
|
13
|
+
themeDefaultMode
|
|
14
|
+
}) {
|
|
15
|
+
const [open, setOpen] = useState(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (open) {
|
|
18
|
+
document.body.style.overflow = "hidden";
|
|
19
|
+
} else {
|
|
20
|
+
document.body.style.overflow = "";
|
|
21
|
+
}
|
|
22
|
+
return () => {
|
|
23
|
+
document.body.style.overflow = "";
|
|
24
|
+
};
|
|
25
|
+
}, [open]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
function handleSwap() {
|
|
28
|
+
setOpen(false);
|
|
29
|
+
}
|
|
30
|
+
document.addEventListener(AFTER_NAVIGATE_EVENT, handleSwap);
|
|
31
|
+
return () => document.removeEventListener(AFTER_NAVIGATE_EVENT, handleSwap);
|
|
32
|
+
}, []);
|
|
33
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "button",
|
|
38
|
+
onClick: () => setOpen(!open),
|
|
39
|
+
className: "lg:hidden px-hsp-sm py-vsp-xs -ml-hsp-sm mr-hsp-sm text-muted hover:text-fg",
|
|
40
|
+
"aria-label": open ? "Close sidebar" : "Open sidebar",
|
|
41
|
+
"aria-expanded": open,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"svg",
|
|
45
|
+
{
|
|
46
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
47
|
+
className: cx("h-icon-lg w-icon-lg", !open && "hidden"),
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
fill: "none",
|
|
50
|
+
viewBox: "0 0 24 24",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeWidth: 2,
|
|
53
|
+
children: /* @__PURE__ */ jsx(
|
|
54
|
+
"path",
|
|
55
|
+
{
|
|
56
|
+
strokeLinecap: "round",
|
|
57
|
+
strokeLinejoin: "round",
|
|
58
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
"svg",
|
|
65
|
+
{
|
|
66
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
67
|
+
className: cx("h-icon-lg w-icon-lg", open && "hidden"),
|
|
68
|
+
"aria-hidden": "true",
|
|
69
|
+
fill: "none",
|
|
70
|
+
viewBox: "0 0 24 24",
|
|
71
|
+
stroke: "currentColor",
|
|
72
|
+
strokeWidth: 2,
|
|
73
|
+
children: /* @__PURE__ */ jsx(
|
|
74
|
+
"path",
|
|
75
|
+
{
|
|
76
|
+
strokeLinecap: "round",
|
|
77
|
+
strokeLinejoin: "round",
|
|
78
|
+
d: "M4 6h16M4 12h16M4 18h16"
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: cx("fixed inset-0 z-modal-backdrop bg-overlay/30 lg:hidden", !open && "hidden"),
|
|
90
|
+
"aria-hidden": !open,
|
|
91
|
+
onClick: () => setOpen(false)
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
"aside",
|
|
96
|
+
{
|
|
97
|
+
inert: !open,
|
|
98
|
+
className: `
|
|
99
|
+
fixed top-[3.5rem] left-0 z-modal h-[calc(100vh-3.5rem)] w-[16rem] flex flex-col
|
|
100
|
+
border-r border-muted bg-bg transition-transform duration-200
|
|
101
|
+
lg:hidden
|
|
102
|
+
${open ? "translate-x-0" : "-translate-x-full"}
|
|
103
|
+
`,
|
|
104
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx(
|
|
105
|
+
SidebarTree,
|
|
106
|
+
{
|
|
107
|
+
nodes,
|
|
108
|
+
currentSlug,
|
|
109
|
+
rootMenuItems,
|
|
110
|
+
backToMenuLabel,
|
|
111
|
+
localeLinks,
|
|
112
|
+
themeDefaultMode
|
|
113
|
+
}
|
|
114
|
+
) })
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] });
|
|
118
|
+
}
|
|
119
|
+
SidebarToggle.displayName = "SidebarToggle";
|
|
120
|
+
export {
|
|
121
|
+
SidebarToggle
|
|
122
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { SidebarFrontmatter, CollectionEntryLike, BuildSidebarTreeOptions, SidebarNode } from './types.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Framework-agnostic sidebar tree builder.
|
|
5
3
|
*
|
|
@@ -11,7 +9,7 @@ import { SidebarFrontmatter, CollectionEntryLike, BuildSidebarTreeOptions, Sideb
|
|
|
11
9
|
*
|
|
12
10
|
* Ported from src/utils/docs.ts in the legacy zudo-doc Astro project.
|
|
13
11
|
*/
|
|
14
|
-
|
|
12
|
+
import type { BuildSidebarTreeOptions, CollectionEntryLike, SidebarFrontmatter, SidebarNode } from "./types.js";
|
|
15
13
|
/**
|
|
16
14
|
* Build a recursive sidebar tree from `entries`. Visibility filtering is
|
|
17
15
|
* applied first; the resulting structure mirrors the filesystem.
|
|
@@ -25,19 +23,17 @@ import { SidebarFrontmatter, CollectionEntryLike, BuildSidebarTreeOptions, Sideb
|
|
|
25
23
|
* slug, with the parent's `sortOrder` (from `_category_.json`) flipping
|
|
26
24
|
* the comparator when set to `"desc"`.
|
|
27
25
|
*/
|
|
28
|
-
declare function buildSidebarTree<T extends SidebarFrontmatter = SidebarFrontmatter>(entries: CollectionEntryLike<T>[], locale: string, options?: BuildSidebarTreeOptions): SidebarNode[];
|
|
26
|
+
export declare function buildSidebarTree<T extends SidebarFrontmatter = SidebarFrontmatter>(entries: CollectionEntryLike<T>[], locale: string, options?: BuildSidebarTreeOptions): SidebarNode[];
|
|
29
27
|
/**
|
|
30
28
|
* Find a node by id (path slug) anywhere in the tree. Useful for sidebar
|
|
31
29
|
* config layers that resolve named doc references and for the breadcrumb
|
|
32
30
|
* builder. Exported alongside `buildSidebarTree` because both downstream
|
|
33
31
|
* topics (sub-tasks 4 and 5) need it.
|
|
34
32
|
*/
|
|
35
|
-
declare function findSidebarNode(nodes: SidebarNode[], id: string): SidebarNode | undefined;
|
|
33
|
+
export declare function findSidebarNode(nodes: SidebarNode[], id: string): SidebarNode | undefined;
|
|
36
34
|
/**
|
|
37
35
|
* Depth-first flatten — only nodes with a backing page are emitted, in
|
|
38
36
|
* traversal order. Mirrors the legacy `flattenTree` used for prev/next
|
|
39
37
|
* navigation.
|
|
40
38
|
*/
|
|
41
|
-
declare function flattenSidebarTree(nodes: SidebarNode[]): SidebarNode[];
|
|
42
|
-
|
|
43
|
-
export { buildSidebarTree, findSidebarNode, flattenSidebarTree };
|
|
39
|
+
export declare function flattenSidebarTree(nodes: SidebarNode[]): SidebarNode[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { CategoryMeta } from
|
|
2
|
-
|
|
1
|
+
import type { CategoryMeta } from "./types.js";
|
|
3
2
|
/**
|
|
4
3
|
* Scan `contentDir` recursively for `_category_.json` files. Each file's
|
|
5
4
|
* parent directory becomes a map key, expressed as a path relative to
|
|
@@ -12,8 +11,6 @@ import { CategoryMeta } from './types.js';
|
|
|
12
11
|
* page route in the same process; re-reading thousands of `_category_.json`
|
|
13
12
|
* files for each page is wasteful.
|
|
14
13
|
*/
|
|
15
|
-
declare function loadCategoryMeta(contentDir: string): Map<string, CategoryMeta>;
|
|
14
|
+
export declare function loadCategoryMeta(contentDir: string): Map<string, CategoryMeta>;
|
|
16
15
|
/** Test/HMR escape hatch — clears the per-directory cache. */
|
|
17
|
-
declare function clearCategoryMetaCache(): void;
|
|
18
|
-
|
|
19
|
-
export { clearCategoryMetaCache, loadCategoryMeta };
|
|
16
|
+
export declare function clearCategoryMetaCache(): void;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public entry for the framework-agnostic sidebar tree builder.
|
|
3
|
+
*
|
|
4
|
+
* Consumers import from `@takazudo/zudo-doc/sidebar-tree`:
|
|
5
|
+
*
|
|
6
|
+
* import {
|
|
7
|
+
* buildSidebarTree,
|
|
8
|
+
* loadCategoryMeta,
|
|
9
|
+
* type SidebarNode,
|
|
10
|
+
* } from "@takazudo/zudo-doc/sidebar-tree";
|
|
11
|
+
*
|
|
12
|
+
* The builder takes a flat list of content collection entries (in either
|
|
13
|
+
* Astro or zfb shape) plus a locale, and emits a recursive `SidebarNode[]`
|
|
14
|
+
* suitable for rendering or for further sidebar-config processing.
|
|
15
|
+
*/
|
|
16
|
+
export { buildSidebarTree, findSidebarNode, flattenSidebarTree, } from "./build-tree.js";
|
|
17
|
+
export { loadCategoryMeta, clearCategoryMetaCache } from "./category-meta.js";
|
|
18
|
+
export type { BuildHref, BuildSidebarTreeOptions, CategoryMeta, CollectionEntryLike, SidebarFrontmatter, SidebarNode, } from "./types.js";
|