@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,161 @@
|
|
|
1
|
+
import { toChildArray } from "preact";
|
|
2
|
+
import { htmlOverrides } from "../content/index.js";
|
|
3
|
+
import { makeAdmonition } from "../content-admonition/index.js";
|
|
4
|
+
import { CodeGroup } from "../code-group/index.js";
|
|
5
|
+
import { Tabs } from "../code-syntax/index.js";
|
|
6
|
+
import { TabItem } from "../tab-item/index.js";
|
|
7
|
+
import { MathBlock } from "../math-block/index.js";
|
|
8
|
+
function makeContentImg(base) {
|
|
9
|
+
const normalizedBase = base.replace(/\/+$/, "");
|
|
10
|
+
return function ContentImg(props) {
|
|
11
|
+
const src = props.src;
|
|
12
|
+
const rewrittenSrc = typeof src === "string" && src.startsWith("/") && !src.startsWith("//") && normalizedBase !== "" ? `${normalizedBase}${src}` : src;
|
|
13
|
+
const { title, ...restProps } = props;
|
|
14
|
+
const finalTitle = title === "no-enlarge" ? void 0 : title;
|
|
15
|
+
const mergedProps = { ...restProps, src: rewrittenSrc };
|
|
16
|
+
if (finalTitle !== void 0) {
|
|
17
|
+
mergedProps.title = finalTitle;
|
|
18
|
+
}
|
|
19
|
+
return { type: "img", props: mergedProps, key: null, constructor: void 0 };
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const ENLARGE_SVG = {
|
|
23
|
+
type: "svg",
|
|
24
|
+
props: {
|
|
25
|
+
viewBox: "0 0 38.99 38.99",
|
|
26
|
+
fill: "currentColor",
|
|
27
|
+
focusable: "false",
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
children: [
|
|
30
|
+
{
|
|
31
|
+
type: "polygon",
|
|
32
|
+
props: {
|
|
33
|
+
points: "16.2 13.74 5.92 3.47 11.2 3.47 11.2 0 3.47 0 0 0 0 3.47 0 11.2 3.47 11.2 3.47 5.92 13.74 16.2 16.2 13.74"
|
|
34
|
+
},
|
|
35
|
+
key: null,
|
|
36
|
+
constructor: void 0
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: "polygon",
|
|
40
|
+
props: {
|
|
41
|
+
points: "25.24 16.2 35.52 5.92 35.52 11.2 38.99 11.2 38.99 3.47 38.99 0 35.52 0 27.79 0 27.79 3.47 33.07 3.47 22.79 13.74 25.24 16.2"
|
|
42
|
+
},
|
|
43
|
+
key: null,
|
|
44
|
+
constructor: void 0
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "polygon",
|
|
48
|
+
props: {
|
|
49
|
+
points: "22.79 25.24 33.07 35.52 27.79 35.52 27.79 38.99 35.52 38.99 38.99 38.99 38.99 35.52 38.99 27.79 35.52 27.79 35.52 33.07 25.24 22.79 22.79 25.24"
|
|
50
|
+
},
|
|
51
|
+
key: null,
|
|
52
|
+
constructor: void 0
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "polygon",
|
|
56
|
+
props: {
|
|
57
|
+
points: "13.74 22.79 3.47 33.07 3.47 27.79 0 27.79 0 35.52 0 38.99 3.47 38.99 11.2 38.99 11.2 35.52 5.92 35.52 16.2 25.24 13.74 22.79"
|
|
58
|
+
},
|
|
59
|
+
key: null,
|
|
60
|
+
constructor: void 0
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
key: null,
|
|
65
|
+
constructor: void 0
|
|
66
|
+
};
|
|
67
|
+
function makeEnlargeableParagraph(imageEnlarge, ContentImg) {
|
|
68
|
+
return function EnlargeableParagraph(props) {
|
|
69
|
+
const { children } = props;
|
|
70
|
+
const kids = toChildArray(children).filter((child) => {
|
|
71
|
+
if (typeof child === "string" || typeof child === "number") {
|
|
72
|
+
return String(child).trim() !== "";
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
});
|
|
76
|
+
if (imageEnlarge && kids.length === 1) {
|
|
77
|
+
const kid = kids[0];
|
|
78
|
+
if (kid !== null && typeof kid === "object" && "type" in kid && "props" in kid) {
|
|
79
|
+
const vnode = kid;
|
|
80
|
+
if (vnode.type === ContentImg || vnode.type === "img") {
|
|
81
|
+
const imgProps = vnode.props ?? {};
|
|
82
|
+
if (imgProps.title !== "no-enlarge") {
|
|
83
|
+
const enlargeBtn = {
|
|
84
|
+
type: "button",
|
|
85
|
+
props: {
|
|
86
|
+
type: "button",
|
|
87
|
+
class: "zd-enlarge-btn",
|
|
88
|
+
hidden: true,
|
|
89
|
+
"aria-label": "Enlarge image",
|
|
90
|
+
children: ENLARGE_SVG
|
|
91
|
+
},
|
|
92
|
+
key: null,
|
|
93
|
+
constructor: void 0
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
type: "figure",
|
|
97
|
+
props: {
|
|
98
|
+
class: "zd-enlargeable",
|
|
99
|
+
children: [vnode, enlargeBtn]
|
|
100
|
+
},
|
|
101
|
+
key: null,
|
|
102
|
+
constructor: void 0
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return htmlOverrides.p(props);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function createMdxComponents(options) {
|
|
112
|
+
const { settings, locale, navData, extras } = options;
|
|
113
|
+
const ContentImg = makeContentImg(settings.base);
|
|
114
|
+
const EnlargeableParagraph = makeEnlargeableParagraph(
|
|
115
|
+
settings.imageEnlarge,
|
|
116
|
+
ContentImg
|
|
117
|
+
);
|
|
118
|
+
const CategoryNavBound = (props) => navData.CategoryNav({ ...props, lang: locale });
|
|
119
|
+
const CategoryTreeNavBound = (props) => navData.CategoryTreeNav({ ...props, lang: locale });
|
|
120
|
+
const SiteTreeNavBound = (props) => navData.SiteTreeNav({ ...props, lang: locale });
|
|
121
|
+
return {
|
|
122
|
+
...htmlOverrides,
|
|
123
|
+
// img override: rewrites root-relative src to include settings.base.
|
|
124
|
+
img: ContentImg,
|
|
125
|
+
// p override: wraps block-level images in <figure class="zd-enlargeable">.
|
|
126
|
+
// Must come AFTER ...htmlOverrides to override ContentParagraph.
|
|
127
|
+
p: EnlargeableParagraph,
|
|
128
|
+
// Admonitions — real typed Preact components emitting the
|
|
129
|
+
// `.admonition` / `data-admonition` structure the design-system CSS
|
|
130
|
+
// targets. `:::note` directives emit <Note>; `<Note title="…">` JSX is
|
|
131
|
+
// also authored directly. github-alerts [!IMPORTANT]/[!CAUTION] map to
|
|
132
|
+
// Important/Caution — omitting those two 500s their SSR render.
|
|
133
|
+
Note: makeAdmonition("note"),
|
|
134
|
+
Tip: makeAdmonition("tip"),
|
|
135
|
+
Info: makeAdmonition("info"),
|
|
136
|
+
Warning: makeAdmonition("warning"),
|
|
137
|
+
Danger: makeAdmonition("danger"),
|
|
138
|
+
Important: makeAdmonition("important"),
|
|
139
|
+
Caution: makeAdmonition("caution"),
|
|
140
|
+
// codeTabs Option A: zfb emits <CodeGroup tabs={[...]}> for :::code-group.
|
|
141
|
+
CodeGroup,
|
|
142
|
+
Tabs,
|
|
143
|
+
TabItem,
|
|
144
|
+
// Math — KaTeX via server-side katex.renderToString(). math-equations.mdx
|
|
145
|
+
// writes <MathBlock latex="…" block /> directly (zfb's Rust emitter does
|
|
146
|
+
// not yet support $$…$$ — zudo-front-builder #93).
|
|
147
|
+
MathBlock,
|
|
148
|
+
// Locale-bound nav wrappers (host-supplied; locale injected above).
|
|
149
|
+
// SiteTreeNav is reused for the SiteTreeNavDemo tag.
|
|
150
|
+
CategoryNav: CategoryNavBound,
|
|
151
|
+
CategoryTreeNav: CategoryTreeNavBound,
|
|
152
|
+
SiteTreeNav: SiteTreeNavBound,
|
|
153
|
+
SiteTreeNavDemo: SiteTreeNavBound,
|
|
154
|
+
// Host extras win over any same-named default above (Details, HtmlPreview,
|
|
155
|
+
// Island, PresetGenerator, showcase stubs, etc.).
|
|
156
|
+
...extras ?? {}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
export {
|
|
160
|
+
createMdxComponents
|
|
161
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function MermaidEnlarge(): import("preact").JSX.Element;
|
|
2
|
+
export declare namespace MermaidEnlarge {
|
|
3
|
+
var displayName: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Static SSR fallback for the {@link MermaidEnlarge} island.
|
|
7
|
+
*
|
|
8
|
+
* Renders an empty, closed `<dialog class="zd-mermaid-dialog ...">` so the
|
|
9
|
+
* dist HTML carries the dialog shell even before hydration.
|
|
10
|
+
*/
|
|
11
|
+
export declare function MermaidEnlargeSsrFallback(): import("preact").JSX.Element;
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
3
|
+
import { useState, useEffect, useRef, useCallback } from "preact/compat";
|
|
4
|
+
import { AFTER_NAVIGATE_EVENT } from "../transitions/index.js";
|
|
5
|
+
import { useModalDialog } from "../use-modal-dialog/index.js";
|
|
6
|
+
import {
|
|
7
|
+
MERMAID_ENLARGE_DIALOG_CLASS,
|
|
8
|
+
ENLARGE_DIALOG_STYLE
|
|
9
|
+
} from "../island-types/index.js";
|
|
10
|
+
const CONTENT_SCOPE_SELECTOR = "main .zd-content";
|
|
11
|
+
const DIAGRAM_SVG_SELECTOR = ":scope > svg";
|
|
12
|
+
const BTN_INJECTED_ATTR = "data-mermaid-enlarge-ready";
|
|
13
|
+
const ZOOM_STEP = 1.25;
|
|
14
|
+
const MIN_SCALE = 1;
|
|
15
|
+
const MAX_SCALE = 4;
|
|
16
|
+
const ARROW_PAN_STEP = 40;
|
|
17
|
+
function PlusIcon() {
|
|
18
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": "true", focusable: "false", children: [
|
|
19
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
20
|
+
/* @__PURE__ */ jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
function MinusIcon() {
|
|
24
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
25
|
+
}
|
|
26
|
+
function PanIcon() {
|
|
27
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinejoin: "round", strokeLinecap: "round", "aria-hidden": "true", focusable: "false", children: [
|
|
28
|
+
/* @__PURE__ */ jsx("path", { d: "M9 11V5.5a1.5 1.5 0 0 1 3 0V11" }),
|
|
29
|
+
/* @__PURE__ */ jsx("path", { d: "M12 11V4.5a1.5 1.5 0 0 1 3 0V11" }),
|
|
30
|
+
/* @__PURE__ */ jsx("path", { d: "M15 11V6a1.5 1.5 0 0 1 3 0v6.5a6.5 6.5 0 0 1-6.5 6.5h-1a6 6 0 0 1-4.6-2.16l-2.2-2.86a1.5 1.5 0 0 1 2.3-1.92L9 13" }),
|
|
31
|
+
/* @__PURE__ */ jsx("path", { d: "M9 11V8a1.5 1.5 0 0 0-3 0v5" })
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
function MermaidEnlarge() {
|
|
35
|
+
const [open, setOpen] = useState(null);
|
|
36
|
+
const [scale, setScale] = useState(1);
|
|
37
|
+
const [translate, setTranslate] = useState({ x: 0, y: 0 });
|
|
38
|
+
const [panActive, setPanActive] = useState(false);
|
|
39
|
+
const innerRef = useRef(null);
|
|
40
|
+
const dragState = useRef({ dragging: false, startX: 0, startY: 0, originX: 0, originY: 0 });
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
let mutationObserver = null;
|
|
43
|
+
function injectButton(container) {
|
|
44
|
+
if (container.hasAttribute(BTN_INJECTED_ATTR)) return;
|
|
45
|
+
const rendered = container.hasAttribute("data-mermaid-rendered") || container.querySelector(DIAGRAM_SVG_SELECTOR) !== null;
|
|
46
|
+
if (!rendered) return;
|
|
47
|
+
container.setAttribute(BTN_INJECTED_ATTR, "");
|
|
48
|
+
container.classList.add("zd-mermaid-enlargeable");
|
|
49
|
+
const btn = document.createElement("button");
|
|
50
|
+
btn.type = "button";
|
|
51
|
+
btn.className = "zd-enlarge-btn";
|
|
52
|
+
btn.setAttribute("aria-label", "Enlarge diagram");
|
|
53
|
+
btn.innerHTML = '<svg viewBox="0 0 38.99 38.99" fill="currentColor" focusable="false" aria-hidden="true"><polygon points="16.2 13.74 5.92 3.47 11.2 3.47 11.2 0 3.47 0 0 0 0 3.47 0 11.2 3.47 11.2 3.47 5.92 13.74 16.2 16.2 13.74" /><polygon points="25.24 16.2 35.52 5.92 35.52 11.2 38.99 11.2 38.99 3.47 38.99 0 35.52 0 27.79 0 27.79 3.47 33.07 3.47 22.79 13.74 25.24 16.2" /><polygon points="22.79 25.24 33.07 35.52 27.79 35.52 27.79 38.99 35.52 38.99 38.99 38.99 38.99 35.52 38.99 27.79 35.52 27.79 35.52 33.07 25.24 22.79 22.79 25.24" /><polygon points="13.74 22.79 3.47 33.07 3.47 27.79 0 27.79 0 35.52 0 38.99 3.47 38.99 11.2 38.99 11.2 35.52 5.92 35.52 16.2 25.24 13.74 22.79" /></svg>';
|
|
54
|
+
container.appendChild(btn);
|
|
55
|
+
}
|
|
56
|
+
function scan() {
|
|
57
|
+
const scope = document.querySelector(CONTENT_SCOPE_SELECTOR);
|
|
58
|
+
if (!scope) return;
|
|
59
|
+
scope.querySelectorAll(".mermaid").forEach((el) => injectButton(el));
|
|
60
|
+
}
|
|
61
|
+
function startObserving() {
|
|
62
|
+
const scope = document.querySelector(CONTENT_SCOPE_SELECTOR);
|
|
63
|
+
if (scope) {
|
|
64
|
+
mutationObserver = new MutationObserver(() => scan());
|
|
65
|
+
mutationObserver.observe(scope, {
|
|
66
|
+
childList: true,
|
|
67
|
+
subtree: true,
|
|
68
|
+
attributes: true,
|
|
69
|
+
attributeFilter: ["data-mermaid-rendered"]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
scan();
|
|
73
|
+
}
|
|
74
|
+
function handleAfterNavigate() {
|
|
75
|
+
mutationObserver?.disconnect();
|
|
76
|
+
mutationObserver = null;
|
|
77
|
+
startObserving();
|
|
78
|
+
}
|
|
79
|
+
startObserving();
|
|
80
|
+
document.addEventListener(AFTER_NAVIGATE_EVENT, handleAfterNavigate);
|
|
81
|
+
return () => {
|
|
82
|
+
mutationObserver?.disconnect();
|
|
83
|
+
document.removeEventListener(AFTER_NAVIGATE_EVENT, handleAfterNavigate);
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
function handleDocumentClick(e) {
|
|
88
|
+
const target = e.target;
|
|
89
|
+
const container = target.closest(".zd-mermaid-enlargeable");
|
|
90
|
+
if (!container) return;
|
|
91
|
+
if (!target.closest(".zd-enlarge-btn")) return;
|
|
92
|
+
const svg = container.querySelector(DIAGRAM_SVG_SELECTOR);
|
|
93
|
+
if (!svg) return;
|
|
94
|
+
setScale(1);
|
|
95
|
+
setTranslate({ x: 0, y: 0 });
|
|
96
|
+
setPanActive(false);
|
|
97
|
+
setOpen({ container, svgHtml: svg.outerHTML });
|
|
98
|
+
}
|
|
99
|
+
document.addEventListener("click", handleDocumentClick);
|
|
100
|
+
return () => document.removeEventListener("click", handleDocumentClick);
|
|
101
|
+
}, []);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (!open) return;
|
|
104
|
+
const { container } = open;
|
|
105
|
+
const observer = new MutationObserver(() => {
|
|
106
|
+
const svg = container.querySelector(DIAGRAM_SVG_SELECTOR);
|
|
107
|
+
if (svg && svg.outerHTML !== open.svgHtml) {
|
|
108
|
+
setOpen({ container, svgHtml: svg.outerHTML });
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
observer.observe(container, { childList: true, subtree: true });
|
|
112
|
+
return () => observer.disconnect();
|
|
113
|
+
}, [open]);
|
|
114
|
+
const handleClose = useCallback(() => setOpen(null), []);
|
|
115
|
+
const { dialogRef, handleBackdropClick } = useModalDialog({
|
|
116
|
+
isOpen: open !== null,
|
|
117
|
+
onClose: handleClose,
|
|
118
|
+
navigateEvent: AFTER_NAVIGATE_EVENT,
|
|
119
|
+
backdropClickClose: true
|
|
120
|
+
});
|
|
121
|
+
const zoomIn = useCallback(() => {
|
|
122
|
+
setScale((s) => Math.min(MAX_SCALE, s * ZOOM_STEP));
|
|
123
|
+
}, []);
|
|
124
|
+
const zoomOut = useCallback(() => {
|
|
125
|
+
setScale((s) => {
|
|
126
|
+
const next = Math.max(MIN_SCALE, s / ZOOM_STEP);
|
|
127
|
+
if (next <= MIN_SCALE) {
|
|
128
|
+
setTranslate({ x: 0, y: 0 });
|
|
129
|
+
setPanActive(false);
|
|
130
|
+
}
|
|
131
|
+
return next;
|
|
132
|
+
});
|
|
133
|
+
}, []);
|
|
134
|
+
const togglePan = useCallback(() => {
|
|
135
|
+
setPanActive((p) => !p);
|
|
136
|
+
}, []);
|
|
137
|
+
const clampTranslate = useCallback(
|
|
138
|
+
(x, y, s) => {
|
|
139
|
+
const inner = innerRef.current;
|
|
140
|
+
if (!inner) return { x, y };
|
|
141
|
+
const rect = inner.getBoundingClientRect();
|
|
142
|
+
const baseW = rect.width / s;
|
|
143
|
+
const baseH = rect.height / s;
|
|
144
|
+
const maxX = Math.max(0, (baseW * s - baseW) / 2);
|
|
145
|
+
const maxY = Math.max(0, (baseH * s - baseH) / 2);
|
|
146
|
+
return {
|
|
147
|
+
x: Math.max(-maxX, Math.min(maxX, x)),
|
|
148
|
+
y: Math.max(-maxY, Math.min(maxY, y))
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
[]
|
|
152
|
+
);
|
|
153
|
+
const onPointerDown = useCallback(
|
|
154
|
+
(e) => {
|
|
155
|
+
if (!panActive || scale <= MIN_SCALE) return;
|
|
156
|
+
const d = dragState.current;
|
|
157
|
+
d.dragging = true;
|
|
158
|
+
d.startX = e.clientX;
|
|
159
|
+
d.startY = e.clientY;
|
|
160
|
+
d.originX = translate.x;
|
|
161
|
+
d.originY = translate.y;
|
|
162
|
+
e.currentTarget.setPointerCapture?.(e.pointerId);
|
|
163
|
+
},
|
|
164
|
+
[panActive, scale, translate]
|
|
165
|
+
);
|
|
166
|
+
const onPointerMove = useCallback(
|
|
167
|
+
(e) => {
|
|
168
|
+
const d = dragState.current;
|
|
169
|
+
if (!d.dragging) return;
|
|
170
|
+
const nextX = d.originX + (e.clientX - d.startX);
|
|
171
|
+
const nextY = d.originY + (e.clientY - d.startY);
|
|
172
|
+
setTranslate(clampTranslate(nextX, nextY, scale));
|
|
173
|
+
},
|
|
174
|
+
[scale, clampTranslate]
|
|
175
|
+
);
|
|
176
|
+
const onPointerUp = useCallback((e) => {
|
|
177
|
+
const d = dragState.current;
|
|
178
|
+
if (!d.dragging) return;
|
|
179
|
+
d.dragging = false;
|
|
180
|
+
e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
181
|
+
}, []);
|
|
182
|
+
const onViewportKeyDown = useCallback(
|
|
183
|
+
(e) => {
|
|
184
|
+
if (scale <= MIN_SCALE) return;
|
|
185
|
+
let dx = 0;
|
|
186
|
+
let dy = 0;
|
|
187
|
+
if (e.key === "ArrowLeft") dx = ARROW_PAN_STEP;
|
|
188
|
+
else if (e.key === "ArrowRight") dx = -ARROW_PAN_STEP;
|
|
189
|
+
else if (e.key === "ArrowUp") dy = ARROW_PAN_STEP;
|
|
190
|
+
else if (e.key === "ArrowDown") dy = -ARROW_PAN_STEP;
|
|
191
|
+
else return;
|
|
192
|
+
e.preventDefault();
|
|
193
|
+
setTranslate((t) => clampTranslate(t.x + dx, t.y + dy, scale));
|
|
194
|
+
},
|
|
195
|
+
[scale, clampTranslate]
|
|
196
|
+
);
|
|
197
|
+
const zoomed = scale > MIN_SCALE;
|
|
198
|
+
const atMax = scale >= MAX_SCALE;
|
|
199
|
+
return /* @__PURE__ */ jsx(
|
|
200
|
+
"dialog",
|
|
201
|
+
{
|
|
202
|
+
ref: dialogRef,
|
|
203
|
+
onClick: handleBackdropClick,
|
|
204
|
+
"aria-label": "Enlarged diagram",
|
|
205
|
+
className: MERMAID_ENLARGE_DIALOG_CLASS,
|
|
206
|
+
style: ENLARGE_DIALOG_STYLE,
|
|
207
|
+
children: open && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
208
|
+
/* @__PURE__ */ jsx(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
className: "zd-mermaid-viewport",
|
|
212
|
+
tabIndex: 0,
|
|
213
|
+
onPointerDown,
|
|
214
|
+
onPointerMove,
|
|
215
|
+
onPointerUp,
|
|
216
|
+
onPointerCancel: onPointerUp,
|
|
217
|
+
onKeyDown: onViewportKeyDown,
|
|
218
|
+
"data-pan-active": panActive && zoomed ? "" : void 0,
|
|
219
|
+
children: /* @__PURE__ */ jsx(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
ref: innerRef,
|
|
223
|
+
className: "zd-mermaid-transform",
|
|
224
|
+
style: {
|
|
225
|
+
transform: `translate(${translate.x}px, ${translate.y}px) scale(${scale})`,
|
|
226
|
+
transformOrigin: "center"
|
|
227
|
+
},
|
|
228
|
+
dangerouslySetInnerHTML: { __html: open.svgHtml }
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ jsxs("div", { className: "zd-mermaid-toolbar", role: "toolbar", "aria-label": "Diagram zoom controls", children: [
|
|
234
|
+
/* @__PURE__ */ jsx(
|
|
235
|
+
"button",
|
|
236
|
+
{
|
|
237
|
+
type: "button",
|
|
238
|
+
className: "zd-mermaid-tool-btn",
|
|
239
|
+
"aria-label": "Zoom in",
|
|
240
|
+
onClick: zoomIn,
|
|
241
|
+
disabled: atMax,
|
|
242
|
+
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ jsx(
|
|
246
|
+
"button",
|
|
247
|
+
{
|
|
248
|
+
type: "button",
|
|
249
|
+
className: "zd-mermaid-tool-btn",
|
|
250
|
+
"aria-label": "Zoom out",
|
|
251
|
+
onClick: zoomOut,
|
|
252
|
+
disabled: !zoomed,
|
|
253
|
+
children: /* @__PURE__ */ jsx(MinusIcon, {})
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
"button",
|
|
258
|
+
{
|
|
259
|
+
type: "button",
|
|
260
|
+
className: "zd-mermaid-tool-btn",
|
|
261
|
+
"aria-label": "Toggle pan mode",
|
|
262
|
+
"aria-pressed": panActive,
|
|
263
|
+
onClick: togglePan,
|
|
264
|
+
disabled: !zoomed,
|
|
265
|
+
children: /* @__PURE__ */ jsx(PanIcon, {})
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
] }),
|
|
269
|
+
/* @__PURE__ */ jsx(
|
|
270
|
+
"button",
|
|
271
|
+
{
|
|
272
|
+
type: "button",
|
|
273
|
+
onClick: () => dialogRef.current?.close(),
|
|
274
|
+
className: "zd-enlarge-dialog-close",
|
|
275
|
+
"aria-label": "Close enlarged diagram",
|
|
276
|
+
children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 161.03 161.03", fill: "currentColor", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx("polygon", { points: "161.03 10.27 150.76 0 80.51 70.24 10.27 0 0 10.27 70.24 80.51 0 150.76 10.27 161.03 80.51 90.78 150.76 161.03 161.03 150.76 90.78 80.51 161.03 10.27" }) })
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
] })
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
MermaidEnlarge.displayName = "MermaidEnlarge";
|
|
284
|
+
function MermaidEnlargeSsrFallback() {
|
|
285
|
+
return /* @__PURE__ */ jsx("dialog", { "aria-label": "Enlarged diagram", className: MERMAID_ENLARGE_DIALOG_CLASS, style: ENLARGE_DIALOG_STYLE });
|
|
286
|
+
}
|
|
287
|
+
export {
|
|
288
|
+
MermaidEnlarge,
|
|
289
|
+
MermaidEnlargeSsrFallback
|
|
290
|
+
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { VNode } from 'preact';
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime automatic */
|
|
4
2
|
/** @jsxImportSource preact */
|
|
5
|
-
|
|
6
|
-
interface DocMetainfoProps {
|
|
3
|
+
import type { VNode } from "preact";
|
|
4
|
+
export interface DocMetainfoProps {
|
|
7
5
|
/**
|
|
8
6
|
* Pre-formatted creation date string (e.g. `"Jan 1, 2024"`).
|
|
9
7
|
* The legacy `doc-metainfo` called `formatDate(gitInfo.createdAt,
|
|
@@ -31,8 +29,8 @@ interface DocMetainfoProps {
|
|
|
31
29
|
*/
|
|
32
30
|
updatedLabel?: string;
|
|
33
31
|
}
|
|
34
|
-
declare const DEFAULT_CREATED_LABEL = "Created";
|
|
35
|
-
declare const DEFAULT_UPDATED_LABEL = "Updated";
|
|
32
|
+
export declare const DEFAULT_CREATED_LABEL = "Created";
|
|
33
|
+
export declare const DEFAULT_UPDATED_LABEL = "Updated";
|
|
36
34
|
/**
|
|
37
35
|
* Document meta-information strip (created date, updated date, author)
|
|
38
36
|
* — JSX port of `src/components/doc-metainfo`.
|
|
@@ -45,6 +43,4 @@ declare const DEFAULT_UPDATED_LABEL = "Updated";
|
|
|
45
43
|
* Returns `null` when no displayable field is provided, mirroring the
|
|
46
44
|
* original `hasInfo && (...)` guard.
|
|
47
45
|
*/
|
|
48
|
-
declare function DocMetainfo(props: DocMetainfoProps): VNode | null;
|
|
49
|
-
|
|
50
|
-
export { DEFAULT_CREATED_LABEL, DEFAULT_UPDATED_LABEL, DocMetainfo, type DocMetainfoProps };
|
|
46
|
+
export declare function DocMetainfo(props: DocMetainfoProps): VNode | null;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { VNode } from 'preact';
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime automatic */
|
|
4
2
|
/** @jsxImportSource preact */
|
|
5
|
-
|
|
3
|
+
import type { VNode } from "preact";
|
|
6
4
|
/**
|
|
7
5
|
* A single resolved tag with its navigation href. The legacy
|
|
8
6
|
* `doc-tags` called `resolvePageTags(tags)` and used `TagNav`
|
|
@@ -10,7 +8,7 @@ import { VNode } from 'preact';
|
|
|
10
8
|
* caller so the component has no upward dependency on project routing
|
|
11
9
|
* utilities.
|
|
12
10
|
*/
|
|
13
|
-
interface ResolvedTag {
|
|
11
|
+
export interface ResolvedTag {
|
|
14
12
|
/** Raw tag string (e.g. `"typescript"`). */
|
|
15
13
|
tag: string;
|
|
16
14
|
/** Pre-computed href for the tag page. */
|
|
@@ -25,8 +23,8 @@ interface ResolvedTag {
|
|
|
25
23
|
* - `"before-footer"` — extra top space, no bottom margin
|
|
26
24
|
* (`mt-vsp-xl mb-0`).
|
|
27
25
|
*/
|
|
28
|
-
type TagPlacement = "after-title" | "before-footer";
|
|
29
|
-
interface DocTagsProps {
|
|
26
|
+
export type TagPlacement = "after-title" | "before-footer";
|
|
27
|
+
export interface DocTagsProps {
|
|
30
28
|
/**
|
|
31
29
|
* Resolved tags with pre-computed hrefs. Pass an empty array (or
|
|
32
30
|
* omit) to suppress rendering — mirrors the legacy
|
|
@@ -49,8 +47,8 @@ interface DocTagsProps {
|
|
|
49
47
|
*/
|
|
50
48
|
taggedWithLabel?: string;
|
|
51
49
|
}
|
|
52
|
-
declare const DEFAULT_TAGS_LABEL = "Tags";
|
|
53
|
-
declare const DEFAULT_TAGGED_WITH_LABEL = "Tagged with";
|
|
50
|
+
export declare const DEFAULT_TAGS_LABEL = "Tags";
|
|
51
|
+
export declare const DEFAULT_TAGGED_WITH_LABEL = "Tagged with";
|
|
54
52
|
/**
|
|
55
53
|
* Page-level tag chips — JSX port of `src/components/doc-tags`
|
|
56
54
|
* (page-variant rendering from `src/components/tag-nav`).
|
|
@@ -61,6 +59,4 @@ declare const DEFAULT_TAGGED_WITH_LABEL = "Tagged with";
|
|
|
61
59
|
* The pointed-chip shape is reproduced verbatim from the page-variant
|
|
62
60
|
* branch of `tag-nav` using the same `clip-path` values.
|
|
63
61
|
*/
|
|
64
|
-
declare function DocTags(props: DocTagsProps): VNode | null;
|
|
65
|
-
|
|
66
|
-
export { DEFAULT_TAGGED_WITH_LABEL, DEFAULT_TAGS_LABEL, DocTags, type DocTagsProps, type ResolvedTag, type TagPlacement };
|
|
62
|
+
export declare function DocTags(props: DocTagsProps): VNode | null;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ComponentChildren, VNode } from 'preact';
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime automatic */
|
|
4
2
|
/** @jsxImportSource preact */
|
|
5
|
-
|
|
3
|
+
import type { ComponentChildren, VNode } from "preact";
|
|
6
4
|
/**
|
|
7
5
|
* Props passed to a per-key custom renderer component.
|
|
8
6
|
*
|
|
@@ -10,7 +8,7 @@ import { ComponentChildren, VNode } from 'preact';
|
|
|
10
8
|
* before invoking `FrontmatterPreview`. Renderers are therefore guaranteed
|
|
11
9
|
* to receive only non-null, non-ignored values.
|
|
12
10
|
*/
|
|
13
|
-
interface FrontmatterCellRendererProps {
|
|
11
|
+
export interface FrontmatterCellRendererProps {
|
|
14
12
|
/** The frontmatter value (null/undefined values are never passed). */
|
|
15
13
|
value: NonNullable<unknown>;
|
|
16
14
|
/** The frontmatter key name. */
|
|
@@ -26,8 +24,8 @@ interface FrontmatterCellRendererProps {
|
|
|
26
24
|
* Return `null` or `undefined` to fall through to the built-in
|
|
27
25
|
* `renderValue()` plain-text path.
|
|
28
26
|
*/
|
|
29
|
-
type FrontmatterCellRenderer = (props: FrontmatterCellRendererProps) => ComponentChildren;
|
|
30
|
-
interface FrontmatterPreviewProps {
|
|
27
|
+
export type FrontmatterCellRenderer = (props: FrontmatterCellRendererProps) => ComponentChildren;
|
|
28
|
+
export interface FrontmatterPreviewProps {
|
|
31
29
|
/**
|
|
32
30
|
* Pre-filtered `[key, value]` pairs to display. The legacy component
|
|
33
31
|
* owned the filtering logic (ignore-keys, null/undefined removal,
|
|
@@ -76,9 +74,9 @@ interface FrontmatterPreviewProps {
|
|
|
76
74
|
*/
|
|
77
75
|
locale?: string;
|
|
78
76
|
}
|
|
79
|
-
declare const DEFAULT_FRONTMATTER_PREVIEW_TITLE = "Frontmatter";
|
|
80
|
-
declare const DEFAULT_KEY_COL_LABEL = "Key";
|
|
81
|
-
declare const DEFAULT_VALUE_COL_LABEL = "Value";
|
|
77
|
+
export declare const DEFAULT_FRONTMATTER_PREVIEW_TITLE = "Frontmatter";
|
|
78
|
+
export declare const DEFAULT_KEY_COL_LABEL = "Key";
|
|
79
|
+
export declare const DEFAULT_VALUE_COL_LABEL = "Value";
|
|
82
80
|
/**
|
|
83
81
|
* Frontmatter data table — JSX port of
|
|
84
82
|
* `src/components/frontmatter-preview`.
|
|
@@ -90,6 +88,4 @@ declare const DEFAULT_VALUE_COL_LABEL = "Value";
|
|
|
90
88
|
* the matching renderer. A renderer that returns `null` or `undefined` falls
|
|
91
89
|
* through to the built-in `renderValue()` plain-text path.
|
|
92
90
|
*/
|
|
93
|
-
declare function FrontmatterPreview(props: FrontmatterPreviewProps): VNode | null;
|
|
94
|
-
|
|
95
|
-
export { DEFAULT_FRONTMATTER_PREVIEW_TITLE, DEFAULT_KEY_COL_LABEL, DEFAULT_VALUE_COL_LABEL, type FrontmatterCellRenderer, type FrontmatterCellRendererProps, FrontmatterPreview, type FrontmatterPreviewProps };
|
|
91
|
+
export declare function FrontmatterPreview(props: FrontmatterPreviewProps): VNode | null;
|
package/dist/metainfo/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { DEFAULT_CREATED_LABEL, DEFAULT_UPDATED_LABEL,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
|
|
1
|
+
export { DocMetainfo, DEFAULT_CREATED_LABEL, DEFAULT_UPDATED_LABEL, } from "./doc-metainfo.js";
|
|
2
|
+
export type { DocMetainfoProps } from "./doc-metainfo.js";
|
|
3
|
+
export { DocTags, DEFAULT_TAGS_LABEL, DEFAULT_TAGGED_WITH_LABEL, } from "./doc-tags.js";
|
|
4
|
+
export type { DocTagsProps, ResolvedTag, TagPlacement } from "./doc-tags.js";
|
|
5
|
+
export { FrontmatterPreview, DEFAULT_FRONTMATTER_PREVIEW_TITLE, DEFAULT_KEY_COL_LABEL, DEFAULT_VALUE_COL_LABEL, } from "./frontmatter-preview.js";
|
|
6
|
+
export type { FrontmatterPreviewProps, FrontmatterCellRenderer, FrontmatterCellRendererProps, } from "./frontmatter-preview.js";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { LocaleLink } from "../url-helpers/index.js";
|
|
2
|
+
export type { LocaleLink };
|
|
3
|
+
/** Minimal nav node shape required by nav-data-prep functions. */
|
|
4
|
+
export interface NavDataPrepNode {
|
|
5
|
+
slug: string;
|
|
6
|
+
href?: string;
|
|
7
|
+
label: string;
|
|
8
|
+
children: NavDataPrepNode[];
|
|
9
|
+
}
|
|
10
|
+
/** Minimal headerNav item shape the nav-data-prep functions need. */
|
|
11
|
+
export interface NavDataPrepHeaderNavItem {
|
|
12
|
+
label: string;
|
|
13
|
+
labelKey?: string;
|
|
14
|
+
path: string;
|
|
15
|
+
children?: Array<{
|
|
16
|
+
label: string;
|
|
17
|
+
labelKey?: string;
|
|
18
|
+
path: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/** Color mode config shape (subset of settings.colorMode). */
|
|
22
|
+
export interface NavDataPrepColorMode {
|
|
23
|
+
defaultMode?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Root-menu item emitted by {@link buildRootMenuItems}. */
|
|
26
|
+
export interface RootMenuItem {
|
|
27
|
+
label: string;
|
|
28
|
+
href: string;
|
|
29
|
+
children?: Array<{
|
|
30
|
+
label: string;
|
|
31
|
+
href: string;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Walk the nav tree and rewrite each node's `href` to its versioned form.
|
|
36
|
+
*
|
|
37
|
+
* `buildNavTree` always emits hrefs via `docsUrl()`; when the active route
|
|
38
|
+
* lives under `/v/{version}/...` we need the same nodes pointing at the
|
|
39
|
+
* versioned URL so internal nav clicks stay inside the version. Skips
|
|
40
|
+
* nodes without an href (link-only or category placeholders).
|
|
41
|
+
*
|
|
42
|
+
* Parameterized version of `remapVersionedHrefs` from `_nav-data-prep.ts` —
|
|
43
|
+
* receives `versionedDocsUrl` as an argument instead of importing from `@/utils/base`.
|
|
44
|
+
*
|
|
45
|
+
* Generic so callers can pass their concrete node type and get back the same
|
|
46
|
+
* type without an unsafe cast.
|
|
47
|
+
*/
|
|
48
|
+
export declare function remapVersionedHrefs<T extends NavDataPrepNode>(nodes: T[], version: string, nodeLang: string, versionedDocsUrl: (slug: string, version: string, lang: string) => string): T[];
|
|
49
|
+
/**
|
|
50
|
+
* Root-menu items derived from headerNav (mobile "back to menu" list).
|
|
51
|
+
*
|
|
52
|
+
* Parameterized version of `buildRootMenuItems` from `_nav-data-prep.ts` —
|
|
53
|
+
* receives the headerNav, `t()`, and `navHref` as arguments instead of
|
|
54
|
+
* importing from `@/config/settings`, `@/config/i18n`, `@/utils/base`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildRootMenuItems(lang: string, currentVersion: string | undefined, headerNav: NavDataPrepHeaderNavItem[], t: (key: string, lang: string) => string, navHref: (path: string, lang: string | undefined, version: string | undefined) => string): RootMenuItem[];
|
|
57
|
+
/**
|
|
58
|
+
* Locale-switcher links for the mobile sidebar footer and language switcher.
|
|
59
|
+
* Returns `undefined` when only one locale is configured (single-locale guard).
|
|
60
|
+
*
|
|
61
|
+
* Parameterized version of `buildLocaleLinksForNav` from `_nav-data-prep.ts`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function buildLocaleLinksForNav(currentPath: string, lang: string, localeCount: number, buildLocaleLinks: (path: string, lang: string) => LocaleLink[]): LocaleLink[] | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Extract the configured default color mode from the colorMode setting.
|
|
66
|
+
* Returns `undefined` when color mode is not configured (single-scheme projects).
|
|
67
|
+
* Only the string values `"light"` and `"dark"` are returned — any other
|
|
68
|
+
* `defaultMode` value is treated as absent.
|
|
69
|
+
*
|
|
70
|
+
* Parameterized version of `getThemeDefaultMode` from `_nav-data-prep.ts`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getThemeDefaultMode(colorMode: NavDataPrepColorMode | null | undefined | false): "light" | "dark" | undefined;
|