@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
package/dist/footer/footer.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { VNode } from 'preact';
|
|
2
|
-
import { FooterLinkColumn, FooterTagColumn } from './types.js';
|
|
3
|
-
|
|
4
1
|
/** @jsxRuntime automatic */
|
|
5
2
|
/** @jsxImportSource preact */
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import type { VNode } from "preact";
|
|
4
|
+
import type { FooterLinkColumn, FooterTagColumn } from "./types.js";
|
|
5
|
+
export interface FooterProps {
|
|
8
6
|
/**
|
|
9
7
|
* Already-localized link columns. Each item's href should be
|
|
10
8
|
* base-prefixed and locale-aware; `isExternal` controls the
|
|
@@ -37,6 +35,4 @@ interface FooterProps {
|
|
|
37
35
|
* configured. The inner content (link grid, copyright) is only emitted
|
|
38
36
|
* when the respective slots carry data.
|
|
39
37
|
*/
|
|
40
|
-
declare function Footer(props: FooterProps): VNode;
|
|
41
|
-
|
|
42
|
-
export { Footer, type FooterProps };
|
|
38
|
+
export declare function Footer(props: FooterProps): VNode;
|
package/dist/footer/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public entry for the framework-agnostic footer shell.
|
|
3
|
+
*
|
|
4
|
+
* Consumers import from `@takazudo/zudo-doc/footer`:
|
|
5
|
+
*
|
|
6
|
+
* import { Footer, type FooterProps } from "@takazudo/zudo-doc/footer";
|
|
7
|
+
*
|
|
8
|
+
* The shell is purely presentational — see `./types.ts` for the data
|
|
9
|
+
* shapes the host project assembles upstream.
|
|
10
|
+
*/
|
|
11
|
+
export { Footer } from "./footer.js";
|
|
12
|
+
export type { FooterProps } from "./footer.js";
|
|
13
|
+
export type { FooterLinkColumn, FooterLinkItem, FooterTagColumn, FooterTagItem, } from "./types.js";
|
package/dist/footer/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* already-localized, already-resolved hrefs in.
|
|
15
15
|
*/
|
|
16
16
|
/** A single link rendered inside a {@link FooterLinkColumn}. */
|
|
17
|
-
interface FooterLinkItem {
|
|
17
|
+
export interface FooterLinkItem {
|
|
18
18
|
/** Visible label (already locale-resolved by the caller). */
|
|
19
19
|
label: string;
|
|
20
20
|
/** Resolved href (already base-prefixed and locale-aware). */
|
|
@@ -27,13 +27,13 @@ interface FooterLinkItem {
|
|
|
27
27
|
isExternal?: boolean;
|
|
28
28
|
}
|
|
29
29
|
/** One column in the footer's link grid. */
|
|
30
|
-
interface FooterLinkColumn {
|
|
30
|
+
export interface FooterLinkColumn {
|
|
31
31
|
/** Visible heading for the column (already locale-resolved). */
|
|
32
32
|
title: string;
|
|
33
33
|
items: FooterLinkItem[];
|
|
34
34
|
}
|
|
35
35
|
/** A single tag rendered inside a {@link FooterTagColumn}. */
|
|
36
|
-
interface FooterTagItem {
|
|
36
|
+
export interface FooterTagItem {
|
|
37
37
|
/** Canonical tag id (rendered as `#<tag>`). */
|
|
38
38
|
tag: string;
|
|
39
39
|
/** Document count shown next to the tag. */
|
|
@@ -42,7 +42,7 @@ interface FooterTagItem {
|
|
|
42
42
|
href: string;
|
|
43
43
|
}
|
|
44
44
|
/** One column in the footer's tag grid. */
|
|
45
|
-
interface FooterTagColumn {
|
|
45
|
+
export interface FooterTagColumn {
|
|
46
46
|
/**
|
|
47
47
|
* Group identifier — usually a vocabulary group name like `"topic"`,
|
|
48
48
|
* or the literal `"__flat__"` sentinel for the ungrouped/flat column.
|
|
@@ -54,5 +54,3 @@ interface FooterTagColumn {
|
|
|
54
54
|
title: string;
|
|
55
55
|
tags: FooterTagItem[];
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
export type { FooterLinkColumn, FooterLinkItem, FooterTagColumn, FooterTagItem };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { VNode } from "preact";
|
|
4
|
+
/** Tag info returned by the host's `collectTags` (what the factory sees). */
|
|
5
|
+
export interface FooterTagInfo {
|
|
6
|
+
tag: string;
|
|
7
|
+
count: number;
|
|
8
|
+
}
|
|
9
|
+
/** Tag vocabulary entry subset the factory reads. */
|
|
10
|
+
export interface FooterVocabularyEntry {
|
|
11
|
+
id: string;
|
|
12
|
+
group?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The `settings.footer` subset the factory reads. */
|
|
15
|
+
export interface FooterConfig {
|
|
16
|
+
links: Array<{
|
|
17
|
+
title: string;
|
|
18
|
+
locales?: Record<string, {
|
|
19
|
+
title: string;
|
|
20
|
+
} | undefined>;
|
|
21
|
+
items: Array<{
|
|
22
|
+
label: string;
|
|
23
|
+
href: string;
|
|
24
|
+
locales?: Record<string, {
|
|
25
|
+
label: string;
|
|
26
|
+
} | undefined>;
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
copyright?: string;
|
|
30
|
+
taglist?: {
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
groupBy?: "flat" | "group";
|
|
33
|
+
title?: string;
|
|
34
|
+
groupTitles?: Record<string, string>;
|
|
35
|
+
locales?: Record<string, {
|
|
36
|
+
title?: string;
|
|
37
|
+
groupTitles?: Record<string, string>;
|
|
38
|
+
} | undefined>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Settings subset read by {@link createFooterWithDefaults}. */
|
|
42
|
+
export interface FooterWithDefaultsSettings {
|
|
43
|
+
footer?: FooterConfig | false | null;
|
|
44
|
+
tagVocabulary?: unknown;
|
|
45
|
+
tagGovernance?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Dependencies injected by the host stub. */
|
|
48
|
+
export interface FooterWithDefaultsDeps {
|
|
49
|
+
settings: FooterWithDefaultsSettings;
|
|
50
|
+
defaultLocale: string;
|
|
51
|
+
tagVocabulary: readonly FooterVocabularyEntry[];
|
|
52
|
+
isExternal: (href: string) => boolean;
|
|
53
|
+
resolveHref: (href: string) => string;
|
|
54
|
+
withBase: (path: string) => string;
|
|
55
|
+
loadTagsForLocale: (lang: string) => FooterTagInfo[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create a `FooterWithDefaults` component bound to the host's settings
|
|
59
|
+
* and data-prep utilities.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createFooterWithDefaults(deps: FooterWithDefaultsDeps): (props: {
|
|
62
|
+
lang?: string;
|
|
63
|
+
}) => VNode;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { Footer } from "../footer/index.js";
|
|
3
|
+
function createFooterWithDefaults(deps) {
|
|
4
|
+
const {
|
|
5
|
+
settings,
|
|
6
|
+
defaultLocale,
|
|
7
|
+
tagVocabulary,
|
|
8
|
+
isExternal,
|
|
9
|
+
resolveHref,
|
|
10
|
+
withBase,
|
|
11
|
+
loadTagsForLocale
|
|
12
|
+
} = deps;
|
|
13
|
+
function localizeHref(href, lang) {
|
|
14
|
+
if (isExternal(href)) return href;
|
|
15
|
+
if (lang !== defaultLocale) {
|
|
16
|
+
const path = href.startsWith("/") ? href : `/${href}`;
|
|
17
|
+
return resolveHref(`/${lang}${path}`);
|
|
18
|
+
}
|
|
19
|
+
return resolveHref(href);
|
|
20
|
+
}
|
|
21
|
+
function tagHref(tag, lang) {
|
|
22
|
+
const encoded = encodeURIComponent(tag);
|
|
23
|
+
const path = lang === defaultLocale ? `/docs/tags/${encoded}` : `/${lang}/docs/tags/${encoded}`;
|
|
24
|
+
return withBase(path);
|
|
25
|
+
}
|
|
26
|
+
function FooterWithDefaults({
|
|
27
|
+
lang = defaultLocale
|
|
28
|
+
}) {
|
|
29
|
+
const footer = settings.footer;
|
|
30
|
+
const persistKey = `footer-${lang}`;
|
|
31
|
+
if (!footer) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Footer, { persistKey });
|
|
33
|
+
}
|
|
34
|
+
const { links, copyright, taglist } = footer;
|
|
35
|
+
const linkColumns = links.map((column) => ({
|
|
36
|
+
title: column.locales?.[lang]?.title ?? column.title,
|
|
37
|
+
items: column.items.map((item) => ({
|
|
38
|
+
label: item.locales?.[lang]?.label ?? item.label,
|
|
39
|
+
href: localizeHref(item.href, lang),
|
|
40
|
+
isExternal: isExternal(item.href)
|
|
41
|
+
}))
|
|
42
|
+
}));
|
|
43
|
+
let tagColumns = [];
|
|
44
|
+
if (taglist?.enabled) {
|
|
45
|
+
const allTags = loadTagsForLocale(lang);
|
|
46
|
+
const vocabularyActive = Boolean(settings.tagVocabulary) && settings.tagGovernance !== "off";
|
|
47
|
+
const requestedGroupBy = taglist.groupBy ?? "group";
|
|
48
|
+
const effectiveGroupBy = vocabularyActive ? requestedGroupBy : "flat";
|
|
49
|
+
const localeOverrides = taglist.locales?.[lang];
|
|
50
|
+
const groupTitles = {
|
|
51
|
+
...taglist.groupTitles,
|
|
52
|
+
...localeOverrides?.groupTitles
|
|
53
|
+
};
|
|
54
|
+
const flatTitle = localeOverrides?.title ?? taglist.title ?? "Tags";
|
|
55
|
+
if (effectiveGroupBy === "flat" || !vocabularyActive) {
|
|
56
|
+
if (allTags.length > 0) {
|
|
57
|
+
tagColumns = [
|
|
58
|
+
{
|
|
59
|
+
group: "__flat__",
|
|
60
|
+
title: flatTitle,
|
|
61
|
+
tags: allTags.map(({ tag, count }) => ({
|
|
62
|
+
tag,
|
|
63
|
+
count,
|
|
64
|
+
href: tagHref(tag, lang)
|
|
65
|
+
}))
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
const groupByCanonical = /* @__PURE__ */ new Map();
|
|
71
|
+
const groupOrder = [];
|
|
72
|
+
const seenGroups = /* @__PURE__ */ new Set();
|
|
73
|
+
for (const entry of tagVocabulary) {
|
|
74
|
+
if (!entry.group) continue;
|
|
75
|
+
groupByCanonical.set(entry.id, entry.group);
|
|
76
|
+
if (!seenGroups.has(entry.group)) {
|
|
77
|
+
seenGroups.add(entry.group);
|
|
78
|
+
groupOrder.push(entry.group);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
82
|
+
for (const group of groupOrder) buckets.set(group, []);
|
|
83
|
+
const ungrouped = [];
|
|
84
|
+
for (const info of allTags) {
|
|
85
|
+
const group = groupByCanonical.get(info.tag);
|
|
86
|
+
if (group && buckets.has(group)) {
|
|
87
|
+
buckets.get(group).push(info);
|
|
88
|
+
} else {
|
|
89
|
+
ungrouped.push(info);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
tagColumns = groupOrder.filter((g) => (buckets.get(g)?.length ?? 0) > 0).map((g) => ({
|
|
93
|
+
group: g,
|
|
94
|
+
title: groupTitles[g] ?? g.charAt(0).toUpperCase() + g.slice(1),
|
|
95
|
+
tags: buckets.get(g).map(({ tag, count }) => ({
|
|
96
|
+
tag,
|
|
97
|
+
count,
|
|
98
|
+
href: tagHref(tag, lang)
|
|
99
|
+
}))
|
|
100
|
+
}));
|
|
101
|
+
if (ungrouped.length > 0) {
|
|
102
|
+
tagColumns.push({
|
|
103
|
+
group: "__flat__",
|
|
104
|
+
title: flatTitle,
|
|
105
|
+
tags: ungrouped.map(({ tag, count }) => ({
|
|
106
|
+
tag,
|
|
107
|
+
count,
|
|
108
|
+
href: tagHref(tag, lang)
|
|
109
|
+
}))
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return /* @__PURE__ */ jsx(
|
|
115
|
+
Footer,
|
|
116
|
+
{
|
|
117
|
+
linkColumns,
|
|
118
|
+
tagColumns,
|
|
119
|
+
copyright,
|
|
120
|
+
persistKey
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
return FooterWithDefaults;
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
createFooterWithDefaults
|
|
128
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FrontmatterPreviewConfig } from "../settings.js";
|
|
2
|
+
export type { FrontmatterPreviewConfig };
|
|
3
|
+
/**
|
|
4
|
+
* Config the factory reads from the host's settings.
|
|
5
|
+
*
|
|
6
|
+
* `frontmatterPreview` is the host's resolved `settings.frontmatterPreview`
|
|
7
|
+
* field (a `FrontmatterPreviewConfig` object or `false`/`undefined`).
|
|
8
|
+
* `defaultIgnoreKeys` is the host-supplied schema-managed key list
|
|
9
|
+
* (typically `DEFAULT_FRONTMATTER_IGNORE_KEYS` from the host's config).
|
|
10
|
+
*/
|
|
11
|
+
export interface FrontmatterPreviewDataConfig {
|
|
12
|
+
frontmatterPreview: FrontmatterPreviewConfig | false | undefined;
|
|
13
|
+
defaultIgnoreKeys: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a `buildFrontmatterPreviewEntries` helper bound to the given config.
|
|
17
|
+
*
|
|
18
|
+
* The host stub calls this once with its concrete settings and re-exports the
|
|
19
|
+
* result, mirroring the shape of `makeUrlHelpers` (S1a) and
|
|
20
|
+
* `createComposeMetaTitle`.
|
|
21
|
+
*
|
|
22
|
+
* Returning an empty array suppresses the frontmatter block — the v2
|
|
23
|
+
* `<FrontmatterPreview>` component short-circuits with `null` when
|
|
24
|
+
* `entries` is empty.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createBuildFrontmatterPreviewEntries(config: FrontmatterPreviewDataConfig): (data: Record<string, unknown> | null | undefined) => Array<[string, unknown]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function createBuildFrontmatterPreviewEntries(config) {
|
|
2
|
+
return function buildFrontmatterPreviewEntries(data) {
|
|
3
|
+
if (!data) return [];
|
|
4
|
+
const fmConfig = config.frontmatterPreview;
|
|
5
|
+
if (fmConfig === false || fmConfig === void 0) return [];
|
|
6
|
+
const ignoreSet = new Set(
|
|
7
|
+
fmConfig.ignoreKeys ?? [
|
|
8
|
+
...config.defaultIgnoreKeys,
|
|
9
|
+
...fmConfig.extraIgnoreKeys ?? []
|
|
10
|
+
]
|
|
11
|
+
);
|
|
12
|
+
const entries = [];
|
|
13
|
+
for (const [key, value] of Object.entries(data)) {
|
|
14
|
+
if (ignoreSet.has(key)) continue;
|
|
15
|
+
if (value === null || value === void 0) continue;
|
|
16
|
+
entries.push([key, value]);
|
|
17
|
+
}
|
|
18
|
+
return entries;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
createBuildFrontmatterPreviewEntries
|
|
23
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the GitHub repository root URL, or null if githubUrl is not configured.
|
|
3
|
+
*
|
|
4
|
+
* Parameterized version of the host's `buildGitHubRepoUrl()`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildGitHubRepoUrl(githubUrl: string | false | null | undefined): string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Build a view-source GitHub URL pointing at a content file, or null when
|
|
9
|
+
* githubUrl is not set.
|
|
10
|
+
*
|
|
11
|
+
* Parameterized version of the host's `buildGitHubSourceUrl(contentDir, entryId)`.
|
|
12
|
+
*
|
|
13
|
+
* @param githubUrl - The repository base URL (e.g. `settings.githubUrl`).
|
|
14
|
+
* @param contentDir - Content directory relative to the repo root (e.g. "src/content/docs").
|
|
15
|
+
* @param entryId - File path within contentDir (e.g. "getting-started/intro.mdx").
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildGitHubSourceUrl(githubUrl: string | false | null | undefined, contentDir: string, entryId: string): string | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function trimTrailingSlash(url) {
|
|
2
|
+
return url.replace(/\/+$/, "");
|
|
3
|
+
}
|
|
4
|
+
function buildGitHubRepoUrl(githubUrl) {
|
|
5
|
+
if (!githubUrl) return null;
|
|
6
|
+
return trimTrailingSlash(githubUrl);
|
|
7
|
+
}
|
|
8
|
+
function buildGitHubSourceUrl(githubUrl, contentDir, entryId) {
|
|
9
|
+
const repoUrl = buildGitHubRepoUrl(githubUrl);
|
|
10
|
+
if (!repoUrl) return null;
|
|
11
|
+
return `${repoUrl}/blob/HEAD/${contentDir}/${entryId}`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
buildGitHubRepoUrl,
|
|
15
|
+
buildGitHubSourceUrl
|
|
16
|
+
};
|
package/dist/head/doc-head.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { JSX } from
|
|
2
|
-
import { HeadProps } from
|
|
3
|
-
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
import type { HeadProps } from "./types.js";
|
|
4
3
|
/**
|
|
5
4
|
* Framework head tag emission. Renders only the meta-tag layer of <head>;
|
|
6
5
|
* provider components such as ColorSchemeProvider or astro:transitions'
|
|
@@ -28,6 +27,4 @@ import { HeadProps } from './types.js';
|
|
|
28
27
|
* Never reorder existing slots; append new tag families at the end so
|
|
29
28
|
* downstream byte-diffs remain stable.
|
|
30
29
|
*/
|
|
31
|
-
declare function DocHead(props: HeadProps): JSX.Element;
|
|
32
|
-
|
|
33
|
-
export { DocHead };
|
|
30
|
+
export declare function DocHead(props: HeadProps): JSX.Element;
|
package/dist/head/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public entry for the head topic. Hosts import the JSX component primitive
|
|
3
|
+
* and the input type from this module; all other files in `head/` are
|
|
4
|
+
* implementation detail.
|
|
5
|
+
*/
|
|
6
|
+
export { DocHead } from "./doc-head.js";
|
|
7
|
+
export { OgTags } from "./og-tags.js";
|
|
8
|
+
export { TwitterCard } from "./twitter-card.js";
|
|
9
|
+
export type { HeadProps } from "./types.js";
|
package/dist/head/og-tags.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { JSX } from
|
|
2
|
-
import { HeadProps } from
|
|
3
|
-
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
import type { HeadProps } from "./types.js";
|
|
4
3
|
/**
|
|
5
4
|
* Open Graph meta tags. Emits og:title (always — defaults to `title`) plus
|
|
6
5
|
* any other og:* fields the caller has supplied.
|
|
@@ -10,7 +9,7 @@ import { HeadProps } from './types.js';
|
|
|
10
9
|
* New og:* tags should be appended at the end of the list, never reordered,
|
|
11
10
|
* to keep snapshot diffs minimal.
|
|
12
11
|
*/
|
|
13
|
-
declare function OgTags(props: {
|
|
12
|
+
export declare function OgTags(props: {
|
|
14
13
|
title: string;
|
|
15
14
|
description?: string;
|
|
16
15
|
ogTitle?: string;
|
|
@@ -20,6 +19,4 @@ declare function OgTags(props: {
|
|
|
20
19
|
ogImage?: string;
|
|
21
20
|
ogSiteName?: string;
|
|
22
21
|
}): JSX.Element;
|
|
23
|
-
type OgInputs = Pick<HeadProps, "ogTitle" | "ogDescription" | "ogType" | "ogUrl" | "ogImage" | "ogSiteName">;
|
|
24
|
-
|
|
25
|
-
export { type OgInputs, OgTags };
|
|
22
|
+
export type OgInputs = Pick<HeadProps, "ogTitle" | "ogDescription" | "ogType" | "ogUrl" | "ogImage" | "ogSiteName">;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { JSX } from
|
|
2
|
-
import { HeadProps } from
|
|
3
|
-
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
import type { HeadProps } from "./types.js";
|
|
4
3
|
/**
|
|
5
4
|
* Twitter card meta tags. The host renders this only when a card type is
|
|
6
5
|
* configured; this component itself assumes `card` is set and emits twitter:card
|
|
@@ -9,7 +8,7 @@ import { HeadProps } from './types.js';
|
|
|
9
8
|
* Field order: card → site → creator → title → description → image. Preserve
|
|
10
9
|
* this order to keep snapshot diffs predictable.
|
|
11
10
|
*/
|
|
12
|
-
declare function TwitterCard(props: {
|
|
11
|
+
export declare function TwitterCard(props: {
|
|
13
12
|
card: NonNullable<HeadProps["twitterCard"]>;
|
|
14
13
|
site?: string;
|
|
15
14
|
creator?: string;
|
|
@@ -17,5 +16,3 @@ declare function TwitterCard(props: {
|
|
|
17
16
|
description?: string;
|
|
18
17
|
image?: string;
|
|
19
18
|
}): JSX.Element;
|
|
20
|
-
|
|
21
|
-
export { TwitterCard };
|
package/dist/head/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* portable across Astro and zfb hosts and lets us assert byte-parity in
|
|
8
8
|
* unit tests without bootstrapping a full runtime.
|
|
9
9
|
*/
|
|
10
|
-
interface HeadProps {
|
|
10
|
+
export interface HeadProps {
|
|
11
11
|
/**
|
|
12
12
|
* Full title string. The caller is responsible for composing
|
|
13
13
|
* "{Page Title} | {Site Name}" — DocHead does not append the site name.
|
|
@@ -79,5 +79,3 @@ interface HeadProps {
|
|
|
79
79
|
crossorigin?: "anonymous" | "use-credentials";
|
|
80
80
|
}>;
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
export type { HeadProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
import type { HeadProps } from "../head/types.js";
|
|
5
|
+
import type { ColorSchemeProviderColorMode } from "../theme/color-scheme-provider.js";
|
|
6
|
+
export interface HeadWithDefaultsProps {
|
|
7
|
+
/** Page title forwarded to og:title. Required. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Optional page description forwarded to og:description. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Absolute canonical URL for this page. When supplied, emits
|
|
13
|
+
* `<link rel="canonical" href="...">`.
|
|
14
|
+
*/
|
|
15
|
+
canonical?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Settings subset read by {@link createHeadWithDefaults}. */
|
|
18
|
+
export interface HeadWithDefaultsSettings {
|
|
19
|
+
metaTags: {
|
|
20
|
+
description?: boolean | null;
|
|
21
|
+
ogImage?: string | false;
|
|
22
|
+
ogSiteName?: boolean;
|
|
23
|
+
keywords?: string | false;
|
|
24
|
+
twitterCard?: HeadProps["twitterCard"] | false;
|
|
25
|
+
twitterSite?: string;
|
|
26
|
+
twitterCreator?: string;
|
|
27
|
+
};
|
|
28
|
+
siteName: string;
|
|
29
|
+
colorMode?: ColorSchemeProviderColorMode | null | false;
|
|
30
|
+
sidebarResizer?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Factory dependencies injected by the host stub. */
|
|
33
|
+
export interface HeadWithDefaultsDeps {
|
|
34
|
+
settings: HeadWithDefaultsSettings;
|
|
35
|
+
composeMetaTitle: (title: string) => string;
|
|
36
|
+
withBase: (path: string) => string;
|
|
37
|
+
absoluteUrl: (pageUrl: string) => string | undefined;
|
|
38
|
+
generateCssCustomProperties: () => string;
|
|
39
|
+
generateLightDarkCssProperties: () => string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a `HeadWithDefaults` component bound to the host's settings and
|
|
43
|
+
* URL helpers.
|
|
44
|
+
*
|
|
45
|
+
* The host stub calls this once with its concrete dependencies and re-exports
|
|
46
|
+
* the result, mirroring the shape of `createComposeMetaTitle` (S1b) and
|
|
47
|
+
* `createBuildFrontmatterPreviewEntries`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createHeadWithDefaults(deps: HeadWithDefaultsDeps): (props: HeadWithDefaultsProps) => JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { OgTags, TwitterCard } from "../head/index.js";
|
|
3
|
+
import { SIDEBAR_RESIZER_RESTORE_SCRIPT } from "../sidebar-resizer/index.js";
|
|
4
|
+
import ColorSchemeProvider from "../theme/color-scheme-provider.js";
|
|
5
|
+
function createHeadWithDefaults(deps) {
|
|
6
|
+
const {
|
|
7
|
+
settings,
|
|
8
|
+
composeMetaTitle,
|
|
9
|
+
withBase,
|
|
10
|
+
absoluteUrl,
|
|
11
|
+
generateCssCustomProperties,
|
|
12
|
+
generateLightDarkCssProperties
|
|
13
|
+
} = deps;
|
|
14
|
+
function HeadWithDefaults({
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
canonical
|
|
18
|
+
}) {
|
|
19
|
+
const { metaTags } = settings;
|
|
20
|
+
const ogImageUrl = metaTags.ogImage != null && metaTags.ogImage !== false ? absoluteUrl(withBase(metaTags.ogImage)) : void 0;
|
|
21
|
+
const colorMode = settings.colorMode ? settings.colorMode : null;
|
|
22
|
+
const cssText = colorMode ? generateLightDarkCssProperties() : generateCssCustomProperties();
|
|
23
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
OgTags,
|
|
26
|
+
{
|
|
27
|
+
title: composeMetaTitle(title),
|
|
28
|
+
description: metaTags.description ? description : void 0,
|
|
29
|
+
ogType: "website",
|
|
30
|
+
ogUrl: canonical,
|
|
31
|
+
ogImage: ogImageUrl,
|
|
32
|
+
ogSiteName: metaTags.ogSiteName ? settings.siteName : void 0
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
metaTags.keywords !== false && metaTags.keywords && metaTags.keywords.length > 0 && /* @__PURE__ */ jsx("meta", { name: "keywords", content: metaTags.keywords }),
|
|
36
|
+
ogImageUrl !== void 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
|
+
/* @__PURE__ */ jsx("meta", { property: "og:image:width", content: "1200" }),
|
|
38
|
+
/* @__PURE__ */ jsx("meta", { property: "og:image:height", content: "630" }),
|
|
39
|
+
/* @__PURE__ */ jsx("meta", { property: "og:image:alt", content: composeMetaTitle(title) })
|
|
40
|
+
] }),
|
|
41
|
+
metaTags.twitterCard !== false && metaTags.twitterCard !== void 0 && /* @__PURE__ */ jsx(
|
|
42
|
+
TwitterCard,
|
|
43
|
+
{
|
|
44
|
+
card: metaTags.twitterCard,
|
|
45
|
+
image: ogImageUrl,
|
|
46
|
+
site: metaTags.twitterSite,
|
|
47
|
+
creator: metaTags.twitterCreator
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx(ColorSchemeProvider, { cssText, colorMode }),
|
|
51
|
+
settings.sidebarResizer && /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: SIDEBAR_RESIZER_RESTORE_SCRIPT } }),
|
|
52
|
+
/* @__PURE__ */ jsx("link", { rel: "icon", href: withBase("/favicon.ico"), sizes: "any" }),
|
|
53
|
+
/* @__PURE__ */ jsx("link", { rel: "icon", type: "image/png", sizes: "32x32", href: withBase("/favicon-32x32.png") }),
|
|
54
|
+
/* @__PURE__ */ jsx("link", { rel: "icon", type: "image/png", sizes: "16x16", href: withBase("/favicon-16x16.png") }),
|
|
55
|
+
canonical !== void 0 && /* @__PURE__ */ jsx("link", { rel: "canonical", href: canonical })
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
return HeadWithDefaults;
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
createHeadWithDefaults
|
|
62
|
+
};
|
package/dist/header/header.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { ComponentChildren, JSX } from 'preact';
|
|
2
|
-
import { Locale, HeaderNavItem, HeaderRightItem } from './types.js';
|
|
3
|
-
|
|
4
1
|
/** @jsxRuntime automatic */
|
|
5
2
|
/** @jsxImportSource preact */
|
|
6
|
-
|
|
3
|
+
import type { ComponentChildren, JSX } from "preact";
|
|
4
|
+
import type { HeaderNavItem, HeaderRightItem, Locale } from "./types.js";
|
|
7
5
|
/**
|
|
8
6
|
* Boundary helpers the host injects into `<Header>`. These are the URL
|
|
9
7
|
* builders the legacy header.tsx used to import from `@/utils/base` —
|
|
10
8
|
* pulled into a single prop bag so the v2 package is host-agnostic.
|
|
11
9
|
*/
|
|
12
|
-
interface HeaderUrlHelpers {
|
|
10
|
+
export interface HeaderUrlHelpers {
|
|
13
11
|
withBase(path: string): string;
|
|
14
12
|
stripBase(path: string): string;
|
|
15
13
|
navHref(path: string, lang?: Locale, currentVersion?: string): string;
|
|
@@ -19,7 +17,7 @@ interface HeaderUrlHelpers {
|
|
|
19
17
|
* `<Header>`. Matches the surface the legacy header.tsx used from
|
|
20
18
|
* `@/config/i18n`.
|
|
21
19
|
*/
|
|
22
|
-
interface HeaderI18n {
|
|
20
|
+
export interface HeaderI18n {
|
|
23
21
|
defaultLocale: string;
|
|
24
22
|
locales: readonly string[];
|
|
25
23
|
t(key: string, lang?: string): string;
|
|
@@ -29,7 +27,7 @@ interface HeaderI18n {
|
|
|
29
27
|
* `Props` interface plus a small set of slot props that replace child
|
|
30
28
|
* Astro components and named `<slot>` outlets.
|
|
31
29
|
*/
|
|
32
|
-
interface HeaderProps {
|
|
30
|
+
export interface HeaderProps {
|
|
33
31
|
/** Active locale; `undefined` matches the legacy "no-lang" code path. */
|
|
34
32
|
lang?: Locale;
|
|
35
33
|
/** Current page URL path (as the layout passes from `Astro.url.pathname`). */
|
|
@@ -162,6 +160,4 @@ interface HeaderProps {
|
|
|
162
160
|
* re-runs after View Transitions (via `AFTER_NAVIGATE_EVENT` from
|
|
163
161
|
* `../transitions/page-events`).
|
|
164
162
|
*/
|
|
165
|
-
declare function Header(props: HeaderProps): JSX.Element;
|
|
166
|
-
|
|
167
|
-
export { Header, type HeaderI18n, type HeaderProps, type HeaderUrlHelpers };
|
|
163
|
+
export declare function Header(props: HeaderProps): JSX.Element;
|
package/dist/header/index.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
1
|
+
/**
|
|
2
|
+
* Public entry for the JSX `<Header />` port.
|
|
3
|
+
*
|
|
4
|
+
* Consumers import from `@takazudo/zudo-doc/header`:
|
|
5
|
+
*
|
|
6
|
+
* import { Header } from "@takazudo/zudo-doc/header";
|
|
7
|
+
*
|
|
8
|
+
* The pure helpers used to compute active-link state are also exposed
|
|
9
|
+
* so downstream tests / custom layouts can reuse them without rebuilding
|
|
10
|
+
* the `pathForMatch` / `computeActiveNavPath` regex logic.
|
|
11
|
+
*/
|
|
12
|
+
export type { Locale, HeaderNavChildItem, HeaderNavItem, HeaderRightComponentItem, HeaderRightComponentName, HeaderRightHtmlItem, HeaderRightItem, HeaderRightLinkItem, HeaderRightTriggerItem, HeaderRightTriggerName, } from "./types.js";
|
|
13
|
+
export { filterHeaderRightItems, type HeaderRightItemFlags, } from "./right-items.js";
|
|
14
|
+
export { Header, type HeaderProps } from "./header.js";
|
|
15
|
+
export { computeActiveNavPath, isNavItemActive, pathForMatch, type NavItemLike, } from "./nav-active.js";
|
|
16
|
+
export { NAV_OVERFLOW_SCRIPT } from "./nav-overflow-script.js";
|