@takazudo/zudo-doc 5.28.2 → 6.0.1
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/CHANGELOG.md +33 -0
- package/README.md +49 -16
- package/bin/gen-z-index.mjs +18 -18
- package/dist/agent-docs/identity.d.ts +4 -0
- package/dist/agent-docs/identity.js +24 -0
- package/dist/agent-docs/index.d.ts +5 -0
- package/dist/agent-docs/index.js +5 -0
- package/dist/agent-docs/limits.d.ts +11 -0
- package/dist/agent-docs/limits.js +24 -0
- package/dist/agent-docs/search.d.ts +14 -0
- package/dist/agent-docs/search.js +82 -0
- package/dist/agent-docs/tokenize.d.ts +2 -0
- package/dist/agent-docs/tokenize.js +22 -0
- package/dist/agent-docs/types.d.ts +68 -0
- package/dist/agent-docs/types.js +0 -0
- package/dist/ai-chat-modal/index.d.ts +1 -4
- package/dist/ai-chat-modal/index.js +183 -123
- package/dist/asset-components/asset-card.d.ts +1 -2
- package/dist/asset-components/asset-card.js +12 -12
- package/dist/asset-components/asset-code.d.ts +1 -2
- package/dist/asset-components/asset-code.js +10 -10
- package/dist/asset-components/shared.d.ts +3 -4
- package/dist/asset-components/shared.js +4 -4
- package/dist/asset-index-page/body.d.ts +5 -6
- package/dist/asset-index-page/body.js +6 -6
- package/dist/asset-index-page/index.d.ts +1 -2
- package/dist/asset-index-page/index.js +1 -1
- package/dist/asset-page/body.d.ts +5 -9
- package/dist/asset-page/body.js +3 -3
- package/dist/asset-page/components.d.ts +16 -17
- package/dist/asset-page/components.js +10 -9
- package/dist/asset-page/index.d.ts +1 -2
- package/dist/asset-page/index.js +1 -1
- package/dist/auto-logo/index.d.ts +1 -2
- package/dist/auto-logo/index.js +2 -2
- package/dist/body-foot-util/body-foot-util-area.d.ts +3 -4
- package/dist/body-foot-util/body-foot-util-area.js +1 -2
- package/dist/body-foot-util/edit-link.d.ts +2 -3
- package/dist/body-foot-util/edit-link.js +1 -2
- package/dist/breadcrumb/breadcrumb.d.ts +6 -6
- package/dist/breadcrumb/breadcrumb.js +3 -4
- package/dist/catalog.js +1 -1
- package/dist/category-nav/index.d.ts +1 -2
- package/dist/category-nav/index.js +11 -5
- package/dist/category-tree-nav/index.d.ts +1 -2
- package/dist/category-tree-nav/index.js +3 -3
- package/dist/chrome/derive.d.ts +18 -27
- package/dist/chrome/derive.js +47 -29
- package/dist/chrome/index.d.ts +5 -5
- package/dist/chrome/index.js +1 -1
- package/dist/chrome/island-data.d.ts +4 -0
- package/dist/chrome/island-data.js +52 -0
- package/dist/chrome/primary-slots.d.ts +2 -3
- package/dist/chrome-bindings.d.ts +30 -22
- package/dist/code-group/index.d.ts +3 -4
- package/dist/code-group/index.js +3 -7
- package/dist/code-syntax/code-block-enhancer.d.ts +1 -2
- package/dist/code-syntax/code-block-enhancer.js +2 -2
- package/dist/code-syntax/mermaid-init.d.ts +1 -2
- package/dist/code-syntax/mermaid-init.js +5 -2
- package/dist/code-syntax/tabs-init-script.js +1 -1
- package/dist/code-syntax/tabs-init.d.ts +1 -2
- package/dist/code-syntax/tabs-init.js +2 -2
- package/dist/code-syntax/tabs.d.ts +6 -6
- package/dist/code-syntax/tabs.js +8 -8
- package/dist/compiled.css +2937 -2942
- package/dist/config/component-tokens.d.ts +1 -1
- package/dist/config/component-tokens.js +22 -0
- package/dist/config-assertions/index.d.ts +13 -0
- package/dist/config-assertions/index.js +14 -0
- package/dist/config.d.ts +36 -17
- package/dist/config.js +23 -95
- package/dist/content/content-blockquote.d.ts +2 -3
- package/dist/content/content-blockquote.js +3 -3
- package/dist/content/content-code.d.ts +3 -4
- package/dist/content/content-code.js +5 -5
- package/dist/content/content-link.d.ts +3 -4
- package/dist/content/content-link.js +10 -10
- package/dist/content/content-ol.d.ts +2 -3
- package/dist/content/content-ol.js +5 -4
- package/dist/content/content-paragraph.d.ts +2 -3
- package/dist/content/content-paragraph.js +1 -1
- package/dist/content/content-strong.d.ts +2 -3
- package/dist/content/content-strong.js +3 -3
- package/dist/content/content-table.d.ts +2 -3
- package/dist/content/content-table.js +4 -4
- package/dist/content/content-ul.d.ts +2 -3
- package/dist/content/content-ul.js +4 -4
- package/dist/content/heading-h2.d.ts +2 -3
- package/dist/content/heading-h2.js +4 -4
- package/dist/content/heading-h3.d.ts +2 -3
- package/dist/content/heading-h3.js +4 -4
- package/dist/content/heading-h4.d.ts +2 -3
- package/dist/content/heading-h4.js +4 -4
- package/dist/content-admonition/index.d.ts +3 -4
- package/dist/content-admonition/index.js +2 -2
- package/dist/content.css +35 -33
- package/dist/design-token-panel-bootstrap-controller.d.ts +178 -0
- package/dist/design-token-panel-bootstrap-controller.js +359 -0
- package/dist/design-token-panel-bootstrap-island.d.ts +5 -0
- package/dist/design-token-panel-bootstrap-island.js +19 -0
- package/dist/design-token-panel-bootstrap.d.ts +5 -195
- package/dist/design-token-panel-bootstrap.js +3 -288
- package/dist/desktop-sidebar-toggle-island/index.d.ts +2 -7
- package/dist/desktop-sidebar-toggle-island/index.js +2 -58
- package/dist/desktop-sidebar-toggle-island/island.d.ts +4 -0
- package/dist/desktop-sidebar-toggle-island/island.js +43 -0
- package/dist/desktop-sidebar-toggle-island/storage.d.ts +4 -0
- package/dist/desktop-sidebar-toggle-island/storage.js +29 -0
- package/dist/desktop-toc-toggle-island/index.d.ts +2 -7
- package/dist/desktop-toc-toggle-island/index.js +2 -58
- package/dist/desktop-toc-toggle-island/island.d.ts +4 -0
- package/dist/desktop-toc-toggle-island/island.js +43 -0
- package/dist/desktop-toc-toggle-island/storage.d.ts +4 -0
- package/dist/desktop-toc-toggle-island/storage.js +29 -0
- package/dist/details/details.d.ts +3 -4
- package/dist/details/details.js +1 -1
- package/dist/doc-body-end/index.d.ts +1 -2
- package/dist/doc-body-end/index.js +1 -1
- package/dist/doc-body-end-islands/design-token-panel-island.d.ts +2 -2
- package/dist/doc-body-end-islands/design-token-panel-island.js +3 -7
- package/dist/doc-body-end-islands/index.d.ts +4 -21
- package/dist/doc-body-end-islands/index.js +5 -3
- package/dist/doc-body-end-islands/theme-pack-switcher-island.d.ts +3 -13
- package/dist/doc-body-end-islands/theme-pack-switcher-island.js +11 -13
- package/dist/doc-content-header/index.d.ts +1 -2
- package/dist/doc-content-header/index.js +1 -1
- package/dist/doc-history/index.d.ts +1 -1
- package/dist/doc-history/index.js +166 -141
- package/dist/doc-history-area/index.d.ts +6 -4
- package/dist/doc-history-area/index.js +17 -16
- package/dist/doc-metainfo-area/index.d.ts +2 -3
- package/dist/doc-metainfo-area/index.js +1 -1
- package/dist/doc-page-renderer/index.d.ts +13 -7
- package/dist/doc-page-renderer/index.js +10 -1
- package/dist/doc-page-shell/index.d.ts +20 -7
- package/dist/doc-page-shell/index.js +17 -6
- package/dist/doc-pager/index.d.ts +1 -2
- package/dist/doc-pager/index.js +3 -3
- package/dist/doc-tags-area/index.d.ts +2 -3
- package/dist/doc-tags-area/index.js +1 -1
- package/dist/doclayout/doc-layout-with-defaults.d.ts +9 -9
- package/dist/doclayout/doc-layout-with-defaults.js +5 -15
- package/dist/doclayout/doc-layout.d.ts +26 -27
- package/dist/doclayout/doc-layout.js +23 -14
- package/dist/docs-schema/index.d.ts +4 -0
- package/dist/docs-schema/index.js +1 -0
- package/dist/extract-headings/index.js +43 -12
- package/dist/factory-context/index.d.ts +22 -19
- package/dist/features.css +75 -8
- package/dist/find-in-page/find-bar.d.ts +4 -2
- package/dist/find-in-page/find-bar.js +58 -69
- package/dist/find-in-page/index.d.ts +2 -8
- package/dist/find-in-page/index.js +33 -30
- package/dist/footer/footer.d.ts +3 -4
- package/dist/footer/footer.js +3 -3
- package/dist/footer-with-defaults/index.d.ts +2 -3
- package/dist/footer-with-defaults/index.js +1 -1
- package/dist/frontmatter-preview-defaults/index.js +1 -0
- package/dist/head/doc-head.d.ts +1 -1
- package/dist/head/doc-head.js +24 -32
- package/dist/head/og-tags.d.ts +1 -1
- package/dist/head/og-tags.js +8 -7
- package/dist/head/twitter-card.d.ts +1 -1
- package/dist/head/twitter-card.js +1 -1
- package/dist/head-with-defaults/index.d.ts +7 -2
- package/dist/head-with-defaults/index.js +46 -32
- package/dist/header/header.d.ts +8 -8
- package/dist/header/header.js +9 -11
- package/dist/header/types.d.ts +7 -7
- package/dist/header-with-defaults/index.d.ts +3 -4
- package/dist/header-with-defaults/index.js +27 -14
- package/dist/home-intro/index.d.ts +2 -5
- package/dist/home-intro/index.js +7 -5
- package/dist/home-intro/prepare.js +4 -3
- package/dist/home-page/index.d.ts +3 -3
- package/dist/home-page/index.js +19 -17
- package/dist/html-preview-wrapper/highlighted-code.d.ts +3 -4
- package/dist/html-preview-wrapper/highlighted-code.js +19 -17
- package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +4 -25
- package/dist/html-preview-wrapper/html-preview-wrapper.js +2 -87
- package/dist/html-preview-wrapper/html-preview.d.ts +3 -10
- package/dist/html-preview-wrapper/html-preview.js +13 -37
- package/dist/html-preview-wrapper/index.d.ts +2 -1
- package/dist/html-preview-wrapper/index.js +1 -1
- package/dist/html-preview-wrapper/preview-base.d.ts +3 -5
- package/dist/html-preview-wrapper/preview-base.js +56 -59
- package/dist/html-preview-wrapper/wrapper.d.ts +20 -0
- package/dist/html-preview-wrapper/wrapper.js +37 -0
- package/dist/hydration-pending.d.ts +3 -5
- package/dist/hydration-pending.js +7 -5
- package/dist/i18n-version/language-switcher.d.ts +5 -32
- package/dist/i18n-version/language-switcher.js +5 -106
- package/dist/i18n-version/switcher-generated-scripts.d.ts +2 -0
- package/dist/i18n-version/switcher-generated-scripts.js +107 -0
- package/dist/i18n-version/switcher-url-state.d.ts +76 -0
- package/dist/i18n-version/switcher-url-state.js +103 -0
- package/dist/i18n-version/version-banner.d.ts +2 -3
- package/dist/i18n-version/version-banner.js +1 -1
- package/dist/i18n-version/version-switcher.d.ts +5 -50
- package/dist/i18n-version/version-switcher.js +5 -157
- package/dist/icons/index.d.ts +18 -19
- package/dist/icons/index.js +17 -33
- package/dist/image-enlarge/index.d.ts +1 -10
- package/dist/image-enlarge/index.js +80 -55
- package/dist/image-enlarge/public.d.ts +2 -0
- package/dist/image-enlarge/public.js +6 -0
- package/dist/image-enlarge/ssr-fallback.d.ts +2 -0
- package/dist/image-enlarge/ssr-fallback.js +8 -0
- package/dist/index.d.ts +11 -4
- package/dist/inline-version-switcher/index.d.ts +1 -2
- package/dist/inline-version-switcher/index.js +1 -1
- package/dist/island-types/index.d.ts +2 -2
- package/dist/island-types/index.js +1 -5
- package/dist/math-block/index.d.ts +4 -7
- package/dist/math-block/index.js +5 -5
- package/dist/mcp/handler.d.ts +8 -0
- package/dist/mcp/handler.js +129 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/loader.d.ts +19 -0
- package/dist/mcp/loader.js +202 -0
- package/dist/mdx-components/index.js +40 -108
- package/dist/mermaid-enlarge/index.d.ts +1 -8
- package/dist/mermaid-enlarge/index.js +174 -158
- package/dist/mermaid-enlarge/public.d.ts +2 -0
- package/dist/mermaid-enlarge/public.js +6 -0
- package/dist/mermaid-enlarge/ssr-fallback.d.ts +2 -0
- package/dist/mermaid-enlarge/ssr-fallback.js +8 -0
- package/dist/metainfo/doc-metainfo.d.ts +2 -3
- package/dist/metainfo/doc-metainfo.js +1 -4
- package/dist/metainfo/doc-tags.d.ts +2 -3
- package/dist/metainfo/doc-tags.js +1 -1
- package/dist/metainfo/frontmatter-preview.d.ts +3 -4
- package/dist/metainfo/frontmatter-preview.js +1 -1
- package/dist/nav-data-prep/index.js +6 -4
- package/dist/nav-indexing/category-nav.d.ts +2 -3
- package/dist/nav-indexing/category-nav.js +1 -2
- package/dist/nav-indexing/category-tree-nav.d.ts +2 -3
- package/dist/nav-indexing/category-tree-nav.js +1 -1
- package/dist/nav-indexing/doc-card-grid.d.ts +2 -3
- package/dist/nav-indexing/doc-card-grid.js +1 -2
- package/dist/nav-indexing/docs-sitemap.d.ts +2 -3
- package/dist/nav-indexing/docs-sitemap.js +2 -2
- package/dist/nav-indexing/index.d.ts +1 -1
- package/dist/nav-indexing/nav-card-grid.d.ts +2 -3
- package/dist/nav-indexing/nav-card-grid.js +1 -2
- package/dist/nav-indexing/note-tray-index-parts/card-list.d.ts +1 -2
- package/dist/nav-indexing/note-tray-index-parts/card-list.js +4 -4
- package/dist/nav-indexing/note-tray-index-parts/date-line.d.ts +2 -3
- package/dist/nav-indexing/note-tray-index-parts/date-line.js +1 -1
- package/dist/nav-indexing/note-tray-index-parts/index-list.d.ts +1 -2
- package/dist/nav-indexing/note-tray-index-parts/index-list.js +2 -2
- package/dist/nav-indexing/note-tray-index-parts/timeline.d.ts +1 -2
- package/dist/nav-indexing/note-tray-index-parts/timeline.js +2 -2
- package/dist/nav-indexing/note-tray-index.d.ts +1 -2
- package/dist/nav-indexing/note-tray-index.js +1 -1
- package/dist/nav-indexing/site-tree-nav-demo.d.ts +2 -3
- package/dist/nav-indexing/site-tree-nav-demo.js +2 -2
- package/dist/nav-indexing/tag-nav.d.ts +1 -2
- package/dist/nav-indexing/tag-nav.js +1 -1
- package/dist/nav-indexing/types.d.ts +2 -2
- package/dist/nav-indexing/versions-page-content.d.ts +2 -3
- package/dist/nav-indexing/versions-page-content.js +8 -8
- package/dist/note-tray-index/index.d.ts +1 -2
- package/dist/note-tray-index/index.js +1 -1
- package/dist/page-loading/page-loading-overlay.d.ts +1 -2
- package/dist/page-loading/page-loading-overlay.js +3 -5
- package/dist/plugins/agent-export.d.ts +3 -0
- package/dist/plugins/agent-export.js +34 -0
- package/dist/plugins/internal/agent-export/chunk.d.ts +5 -0
- package/dist/plugins/internal/agent-export/chunk.js +90 -0
- package/dist/plugins/internal/agent-export/index.d.ts +24 -0
- package/dist/plugins/internal/agent-export/index.js +123 -0
- package/dist/plugins/internal/agent-export/normalize.d.ts +5 -0
- package/dist/plugins/internal/agent-export/normalize.js +73 -0
- package/dist/plugins/internal/llms-txt/dev-middleware.d.ts +6 -0
- package/dist/plugins/internal/llms-txt/dev-middleware.js +8 -3
- package/dist/plugins/internal/llms-txt/emit.js +23 -6
- package/dist/plugins/internal/llms-txt/generate.d.ts +7 -1
- package/dist/plugins/internal/llms-txt/generate.js +9 -2
- package/dist/plugins/internal/llms-txt/load.d.ts +2 -0
- package/dist/plugins/internal/llms-txt/load.js +20 -4
- package/dist/plugins/internal/llms-txt/types.d.ts +10 -0
- package/dist/plugins/routes.js +4 -0
- package/dist/preset.d.ts +19 -9
- package/dist/preset.js +20 -1
- package/dist/route-context-payload/index.js +1 -1
- package/dist/routes/404.d.ts +2 -3
- package/dist/routes/404.js +1 -1
- package/dist/routes/_chrome.d.ts +5 -5
- package/dist/routes/_chrome.js +7 -2
- package/dist/routes/_context.d.ts +4 -4
- package/dist/routes/_design-token-panel-bootstrap.d.ts +1 -4
- package/dist/routes/_design-token-panel-bootstrap.js +9 -1
- package/dist/routes/docs-slug.d.ts +2 -3
- package/dist/routes/docs-tags-index.d.ts +2 -3
- package/dist/routes/docs-tags-index.js +1 -1
- package/dist/routes/docs-tags-tag.d.ts +2 -3
- package/dist/routes/docs-tags-tag.js +1 -1
- package/dist/routes/docs-versions.d.ts +2 -3
- package/dist/routes/docs-versions.js +1 -1
- package/dist/routes/files-path.d.ts +2 -3
- package/dist/routes/files-path.js +1 -1
- package/dist/routes/index.d.ts +2 -3
- package/dist/routes/index.js +1 -1
- package/dist/routes/locale-docs-slug.d.ts +2 -3
- package/dist/routes/locale-docs-tags-index.d.ts +2 -3
- package/dist/routes/locale-docs-tags-index.js +1 -1
- package/dist/routes/locale-docs-tags-tag.d.ts +2 -3
- package/dist/routes/locale-docs-tags-tag.js +1 -1
- package/dist/routes/locale-docs-versions.d.ts +2 -3
- package/dist/routes/locale-docs-versions.js +1 -1
- package/dist/routes/locale-files-path.d.ts +2 -3
- package/dist/routes/locale-files-path.js +1 -1
- package/dist/routes/locale-index.d.ts +2 -3
- package/dist/routes/locale-index.js +1 -1
- package/dist/routes/mcp.d.ts +5 -0
- package/dist/routes/mcp.js +25 -0
- package/dist/routes/v-docs-slug.d.ts +2 -3
- package/dist/routes/v-locale-docs-slug.d.ts +2 -3
- package/dist/search-widget/index.d.ts +1 -2
- package/dist/search-widget/index.js +4 -7
- package/dist/search-widget-script/generated-script.js +12 -5
- package/dist/settings-defaults.d.ts +2 -0
- package/dist/settings-defaults.js +93 -0
- package/dist/settings.d.ts +8 -2
- package/dist/sidebar/client-data.d.ts +18 -0
- package/dist/sidebar/client-data.js +47 -0
- package/dist/sidebar/index.d.ts +3 -1
- package/dist/sidebar/index.js +3 -1
- package/dist/sidebar/sidebar.d.ts +12 -44
- package/dist/sidebar/sidebar.js +4 -3
- package/dist/sidebar/types.d.ts +14 -0
- package/dist/sidebar-prepaint/index.d.ts +1 -2
- package/dist/sidebar-prepaint/index.js +4 -6
- package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +2 -3
- package/dist/sidebar-resizer/sidebar-resizer-init.js +3 -3
- package/dist/sidebar-toggle-island/index.d.ts +8 -11
- package/dist/sidebar-toggle-island/index.js +75 -62
- package/dist/sidebar-tree/build-tree.js +5 -6
- package/dist/sidebar-tree/types.d.ts +2 -0
- package/dist/sidebar-tree-island/index.d.ts +4 -19
- package/dist/sidebar-tree-island/index.js +782 -436
- package/dist/sidebar-tree-island/scope-state.d.ts +38 -0
- package/dist/sidebar-tree-island/scope-state.js +151 -0
- package/dist/sidebar-tree-island/sidebar-scroll-preserve.js +6 -2
- package/dist/sidebar-utils/index.d.ts +17 -19
- package/dist/sidebar-utils/index.js +100 -3
- package/dist/sidebar-utils/scope.d.ts +11 -0
- package/dist/sidebar-utils/scope.js +67 -0
- package/dist/sidebar-with-defaults/index.d.ts +1 -2
- package/dist/sidebar-with-defaults/index.js +19 -18
- package/dist/site-schema/nav-tree.js +15 -15
- package/dist/site-schema/types.d.ts +1 -0
- package/dist/site-tree-nav/index.d.ts +2 -3
- package/dist/site-tree-nav/index.js +11 -12
- package/dist/site-tree-nav/normalize-island-props.d.ts +16 -0
- package/dist/site-tree-nav/normalize-island-props.js +122 -0
- package/dist/site-tree-nav-island/index.d.ts +3 -3
- package/dist/site-tree-nav-island/index.js +243 -144
- package/dist/smart-break/index.d.ts +3 -4
- package/dist/smart-break/index.js +1 -1
- package/dist/tab-item/tab-item.d.ts +3 -4
- package/dist/tab-item/tab-item.js +1 -1
- package/dist/tag-pages/index.d.ts +3 -3
- package/dist/tag-pages/index.js +10 -10
- package/dist/theme/color-scheme-provider.d.ts +3 -3
- package/dist/theme/color-scheme-provider.js +3 -3
- package/dist/theme/theme-pack-provider.d.ts +1 -1
- package/dist/theme/theme-pack-provider.js +3 -3
- package/dist/theme/theme-toggle.d.ts +2 -3
- package/dist/theme/theme-toggle.js +1 -1
- package/dist/theme-pack-dialog/index.d.ts +1 -1
- package/dist/theme-pack-dialog/index.js +69 -75
- package/dist/theme-pack-dialog/theme-pack-card.d.ts +3 -4
- package/dist/theme-pack-dialog/theme-pack-card.js +19 -17
- package/dist/theme-pack-switcher/index.d.ts +4 -5
- package/dist/theme-pack-switcher/index.js +52 -49
- package/dist/theme-packs/academia/meta.json +1 -1
- package/dist/theme-packs/academia/pack.css +1 -1
- package/dist/theme-packs/bauhaus/meta.json +1 -1
- package/dist/theme-packs/bauhaus/pack.css +2 -2
- package/dist/theme-packs/blueprint/meta.json +1 -1
- package/dist/theme-packs/blueprint/pack.css +2 -2
- package/dist/theme-packs/botanica/meta.json +1 -1
- package/dist/theme-packs/botanica/pack.css +2 -2
- package/dist/theme-packs/broadsheet/meta.json +1 -1
- package/dist/theme-packs/broadsheet/pack.css +2 -2
- package/dist/theme-packs/brutalist/meta.json +1 -1
- package/dist/theme-packs/brutalist/pack.css +2 -2
- package/dist/theme-packs/eink/meta.json +1 -1
- package/dist/theme-packs/eink/pack.css +1 -1
- package/dist/theme-packs/futura-editorial/meta.json +1 -1
- package/dist/theme-packs/futura-editorial/pack.css +2 -2
- package/dist/theme-packs/hearth/meta.json +1 -1
- package/dist/theme-packs/hearth/pack.css +2 -2
- package/dist/theme-packs/ledger/meta.json +1 -1
- package/dist/theme-packs/ledger/pack.css +1 -1
- package/dist/theme-packs/manuscript/meta.json +1 -1
- package/dist/theme-packs/manuscript/pack.css +1 -1
- package/dist/theme-packs/matcha/meta.json +1 -1
- package/dist/theme-packs/matcha/pack.css +2 -2
- package/dist/theme-packs/nocturne/meta.json +1 -1
- package/dist/theme-packs/nocturne/pack.css +2 -2
- package/dist/theme-packs/observatory/meta.json +1 -1
- package/dist/theme-packs/observatory/pack.css +2 -2
- package/dist/theme-packs/onyx/meta.json +1 -1
- package/dist/theme-packs/onyx/pack.css +2 -2
- package/dist/theme-packs/phosphor/meta.json +1 -1
- package/dist/theme-packs/phosphor/pack.css +2 -2
- package/dist/theme-packs/riso/meta.json +1 -1
- package/dist/theme-packs/riso/pack.css +2 -2
- package/dist/theme-packs/sakura/meta.json +1 -1
- package/dist/theme-packs/sakura/pack.css +2 -2
- package/dist/theme-packs/scandi/meta.json +1 -1
- package/dist/theme-packs/scandi/pack.css +1 -1
- package/dist/theme-packs/solar/meta.json +1 -1
- package/dist/theme-packs/solar/pack.css +1 -1
- package/dist/theme-packs/sumi/meta.json +1 -1
- package/dist/theme-packs/sumi/pack.css +2 -2
- package/dist/theme-packs/swissgrid/meta.json +1 -1
- package/dist/theme-packs/swissgrid/pack.css +1 -1
- package/dist/theme-packs/timberline/meta.json +1 -1
- package/dist/theme-packs/timberline/pack.css +2 -2
- package/dist/theme-packs/washi/meta.json +1 -1
- package/dist/theme-packs/washi/pack.css +2 -2
- package/dist/theme-toggle/index.d.ts +1 -1
- package/dist/theme-toggle/index.js +154 -167
- package/dist/theme.css +47 -121
- package/dist/toc/mobile-toc.d.ts +3 -5
- package/dist/toc/mobile-toc.js +29 -27
- package/dist/toc/toc.d.ts +3 -4
- package/dist/toc/toc.js +18 -18
- package/dist/toc/use-active-heading.d.ts +5 -4
- package/dist/toc/use-active-heading.js +36 -30
- package/dist/toc-prepaint/index.d.ts +1 -2
- package/dist/toc-prepaint/index.js +4 -6
- package/dist/transitions/nested-island-props-refresh.d.ts +3 -16
- package/dist/transitions/nested-island-props-refresh.js +133 -151
- package/dist/transitions/page-events.d.ts +8 -13
- package/dist/tree-nav-shared/index.d.ts +4 -5
- package/dist/tree-nav-shared/index.js +6 -7
- package/dist/use-modal-dialog/index.d.ts +9 -63
- package/dist/use-modal-dialog/index.js +41 -59
- package/dist/versions-page/index.d.ts +3 -3
- package/dist/versions-page/index.js +5 -5
- package/dist/wind/index.d.ts +5 -0
- package/dist/wind/index.js +169 -0
- package/dist/wind.json +498 -0
- package/dist/z-index-defaults/index.d.ts +4 -4
- package/dist/zdtp-loader.d.ts +7 -0
- package/dist/zdtp-loader.js +8 -0
- package/eject/asset-components/asset-card.tsx +14 -16
- package/eject/asset-components/asset-code.tsx +10 -12
- package/eject/asset-components/shared.tsx +5 -7
- package/eject/breadcrumb/breadcrumb.tsx +15 -16
- package/eject/code-group/index.tsx +4 -10
- package/eject/content-admonition/index.tsx +5 -6
- package/eject/desktop-sidebar-toggle-island/index.ts +4 -0
- package/eject/desktop-sidebar-toggle-island/island.tsx +50 -0
- package/eject/desktop-sidebar-toggle-island/storage.ts +27 -0
- package/eject/details/details.tsx +3 -5
- package/eject/doc-history/index.tsx +193 -179
- package/eject/doc-pager/index.tsx +3 -4
- package/eject/footer/footer.tsx +7 -9
- package/eject/header/header.tsx +42 -54
- package/eject/header/nav-overflow-script.ts +1 -1
- package/eject/header/types.ts +12 -13
- package/eject/image-enlarge/index.tsx +84 -69
- package/eject/image-enlarge/public.ts +2 -0
- package/eject/image-enlarge/ssr-fallback.tsx +7 -0
- package/eject/page-loading/page-loading-overlay.tsx +8 -15
- package/eject/sidebar/client-data.ts +68 -0
- package/eject/sidebar/index.ts +3 -0
- package/eject/sidebar/sidebar.tsx +16 -97
- package/eject/sidebar/types.ts +15 -0
- package/eject/sidebar-toggle-island/index.tsx +103 -102
- package/eject/sidebar-tree-island/index.tsx +827 -615
- package/eject/sidebar-tree-island/scope-state.ts +154 -0
- package/eject/sidebar-tree-island/sidebar-scroll-preserve.ts +8 -2
- package/eject/site-tree-nav-island/index.tsx +349 -222
- package/eject/tab-item/tab-item.tsx +2 -4
- package/eject/theme-toggle/hydration-pending.ts +6 -10
- package/eject/theme-toggle/index.tsx +133 -173
- package/eject/toc/mobile-toc.tsx +27 -31
- package/eject/toc/toc.tsx +21 -24
- package/eject/toc/use-active-heading.ts +43 -38
- package/package.json +40 -22
- package/routes-src/404.tsx +2 -3
- package/routes-src/_chrome.tsx +7 -2
- package/routes-src/_design-token-panel-bootstrap.tsx +1 -63
- package/routes-src/docs-slug.tsx +2 -3
- package/routes-src/docs-tags-index.tsx +2 -3
- package/routes-src/docs-tags-tag.tsx +2 -3
- package/routes-src/docs-versions.tsx +2 -3
- package/routes-src/files-path.tsx +2 -4
- package/routes-src/index.tsx +2 -3
- package/routes-src/locale-docs-slug.tsx +2 -3
- package/routes-src/locale-docs-tags-index.tsx +2 -3
- package/routes-src/locale-docs-tags-tag.tsx +2 -3
- package/routes-src/locale-docs-versions.tsx +2 -3
- package/routes-src/locale-files-path.tsx +2 -4
- package/routes-src/locale-index.tsx +2 -3
- package/routes-src/mcp.tsx +25 -0
- package/routes-src/v-docs-slug.tsx +2 -3
- package/routes-src/v-locale-docs-slug.tsx +2 -3
- package/tsconfig.base.json +1 -1
- package/dist/safelist.css +0 -2
- package/dist/theme-no-reset.css +0 -379
- package/eject/desktop-sidebar-toggle-island/index.tsx +0 -110
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The minimal project config the client re-wire needs to reproduce
|
|
3
|
+
* `getPathForLocale`'s output from the live pathname. Emitted as `data-*`
|
|
4
|
+
* attributes on the switcher container so {@link LANGUAGE_SWITCHER_INIT_SCRIPT}
|
|
5
|
+
* can read it without any serialized props.
|
|
6
|
+
*/
|
|
7
|
+
export interface LanguageSwitcherConfig {
|
|
8
|
+
/** Normalized site base with no trailing slash (`""` for a root site). */
|
|
9
|
+
base: string;
|
|
10
|
+
/** The project's default locale (rendered without a locale prefix). */
|
|
11
|
+
defaultLocale: string;
|
|
12
|
+
/** Whether the project appends trailing slashes to page URLs. */
|
|
13
|
+
trailingSlash: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Client-side re-computation of a locale-switched href from the *current*
|
|
17
|
+
* pathname. This is a self-contained port of `getPathForLocale` (+ its
|
|
18
|
+
* `stripBase` / version-prefix split / `withBase` / `applyTrailingSlash`
|
|
19
|
+
* dependencies) from `url-helpers`. It MUST stay behaviourally identical to
|
|
20
|
+
* that function — pinned by the drift-guard test in
|
|
21
|
+
* `__tests__/language-switcher.test.tsx`, which asserts equality against the
|
|
22
|
+
* real `buildLocaleLinks` output across a case table.
|
|
23
|
+
*
|
|
24
|
+
* It is deliberately self-contained (no references to module-scope helpers)
|
|
25
|
+
* because {@link LANGUAGE_SWITCHER_INIT_SCRIPT} embeds it verbatim via
|
|
26
|
+
* package-build serialization, so it must be valid as a standalone function
|
|
27
|
+
* in the browser. Downstream builds consume a frozen script string.
|
|
28
|
+
*/
|
|
29
|
+
export declare function switchLocaleHref(pathname: string, config: LanguageSwitcherConfig, currentLang: string, targetLang: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* The minimal project config the client re-wire needs to reproduce the header
|
|
32
|
+
* factory's per-page menu URLs from the live pathname. Emitted as `data-*`
|
|
33
|
+
* attributes on the switcher container so {@link VERSION_SWITCHER_REWIRE_SCRIPT}
|
|
34
|
+
* can read it without any serialized props.
|
|
35
|
+
*/
|
|
36
|
+
export interface VersionSwitcherRewireConfig {
|
|
37
|
+
/** Normalized site base with no trailing slash (`""` for a root site). */
|
|
38
|
+
base: string;
|
|
39
|
+
/** The project's default locale (rendered without a locale prefix). */
|
|
40
|
+
defaultLocale: string;
|
|
41
|
+
/** Whether the project appends trailing slashes to page URLs. */
|
|
42
|
+
trailingSlash: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The active locale code — constant within a `header-${lang}` persist window,
|
|
45
|
+
* so it can be read once from the SSR container rather than re-derived.
|
|
46
|
+
*/
|
|
47
|
+
currentLocale: string;
|
|
48
|
+
}
|
|
49
|
+
/** The re-computed per-page menu state {@link computeVersionSwitcherState} returns. */
|
|
50
|
+
export interface VersionSwitcherState {
|
|
51
|
+
/** Href for the "Latest" entry, matching the SSR `latestUrl`. */
|
|
52
|
+
latestHref: string;
|
|
53
|
+
/** version slug → href for that version of the current page (SSR `versionUrls`). */
|
|
54
|
+
versionHrefs: Record<string, string>;
|
|
55
|
+
/** Active version slug, or `null` when the current page is on "latest". */
|
|
56
|
+
activeVersion: string | null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Client-side re-computation of the version-switcher's per-page menu state from
|
|
60
|
+
* the *current* pathname. This is a self-contained port of the header factory's
|
|
61
|
+
* URL logic (`createHeaderWithDefaults`'s `latestUrl` / `versionUrls` block, in
|
|
62
|
+
* turn `docsUrl` / `versionedDocsUrl` / `withBase` from `url-helpers`). It MUST
|
|
63
|
+
* stay behaviourally identical to that SSR path — pinned by the drift-guard test
|
|
64
|
+
* in `__tests__/version-switcher.test.tsx`, which asserts equality against the
|
|
65
|
+
* real `makeUrlHelpers` output across a case table.
|
|
66
|
+
*
|
|
67
|
+
* It is deliberately self-contained (no references to module-scope helpers)
|
|
68
|
+
* because {@link VERSION_SWITCHER_REWIRE_SCRIPT} embeds it verbatim via
|
|
69
|
+
* package-build serialization, so it must be valid as a standalone function
|
|
70
|
+
* in the browser. Downstream builds consume a frozen script string.
|
|
71
|
+
*
|
|
72
|
+
* The `/docs/versions` listing is a standalone package route (`currentSlug`
|
|
73
|
+
* `undefined` on the SSR side), so — like the SSR factory — every menu href
|
|
74
|
+
* there collapses to `versionsPageUrl`; the exact-path check below mirrors that.
|
|
75
|
+
*/
|
|
76
|
+
export declare function computeVersionSwitcherState(pathname: string, config: VersionSwitcherRewireConfig, versionSlugs: string[]): VersionSwitcherState;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
function switchLocaleHref(pathname, config, currentLang, targetLang) {
|
|
2
|
+
const normalizedBase = config.base;
|
|
3
|
+
const defaultLocale = config.defaultLocale;
|
|
4
|
+
const trailingSlash = config.trailingSlash;
|
|
5
|
+
const stripBase = (path) => {
|
|
6
|
+
if (normalizedBase === "") return path;
|
|
7
|
+
if (path === normalizedBase) return "/";
|
|
8
|
+
return path.indexOf(normalizedBase + "/") === 0 ? path.slice(normalizedBase.length) : path;
|
|
9
|
+
};
|
|
10
|
+
const applyTrailingSlash = (url) => {
|
|
11
|
+
if (!trailingSlash) return url;
|
|
12
|
+
if (url.charAt(url.length - 1) === "/") return url;
|
|
13
|
+
const suffixIdx = url.search(/[?#]/);
|
|
14
|
+
const pathPart = suffixIdx >= 0 ? url.slice(0, suffixIdx) : url;
|
|
15
|
+
const suffix = suffixIdx >= 0 ? url.slice(suffixIdx) : "";
|
|
16
|
+
if (pathPart.charAt(pathPart.length - 1) === "/") return url;
|
|
17
|
+
const segments = pathPart.split("/");
|
|
18
|
+
const lastSegment = segments[segments.length - 1] || "";
|
|
19
|
+
if (/\.[a-zA-Z]\w*$/.test(lastSegment)) return url;
|
|
20
|
+
return pathPart + "/" + suffix;
|
|
21
|
+
};
|
|
22
|
+
const withBase = (path) => {
|
|
23
|
+
const raw = normalizedBase === "" ? path : normalizedBase + (path.charAt(0) === "/" ? path : "/" + path);
|
|
24
|
+
return applyTrailingSlash(raw);
|
|
25
|
+
};
|
|
26
|
+
const stripped = stripBase(pathname);
|
|
27
|
+
const versionMatch = stripped.match(/^(\/v\/[^/]+)(\/.*|$)/);
|
|
28
|
+
const versionPrefix = versionMatch ? versionMatch[1] || "" : "";
|
|
29
|
+
let relativePath = versionMatch ? versionMatch[2] || "/" : stripped;
|
|
30
|
+
if (currentLang !== defaultLocale) {
|
|
31
|
+
relativePath = relativePath.replace(
|
|
32
|
+
new RegExp("^/" + currentLang + "(?:/|$)"),
|
|
33
|
+
"/"
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
if (targetLang !== defaultLocale) {
|
|
37
|
+
relativePath = "/" + targetLang + relativePath;
|
|
38
|
+
}
|
|
39
|
+
return withBase(versionPrefix + relativePath);
|
|
40
|
+
}
|
|
41
|
+
function computeVersionSwitcherState(pathname, config, versionSlugs) {
|
|
42
|
+
const normalizedBase = config.base;
|
|
43
|
+
const defaultLocale = config.defaultLocale;
|
|
44
|
+
const currentLocale = config.currentLocale;
|
|
45
|
+
const trailingSlash = config.trailingSlash;
|
|
46
|
+
const stripBase = (path) => {
|
|
47
|
+
if (normalizedBase === "") return path;
|
|
48
|
+
if (path === normalizedBase) return "/";
|
|
49
|
+
return path.indexOf(normalizedBase + "/") === 0 ? path.slice(normalizedBase.length) : path;
|
|
50
|
+
};
|
|
51
|
+
const applyTrailingSlash = (url) => {
|
|
52
|
+
if (!trailingSlash) return url;
|
|
53
|
+
if (url.charAt(url.length - 1) === "/") return url;
|
|
54
|
+
const suffixIdx = url.search(/[?#]/);
|
|
55
|
+
const pathPart = suffixIdx >= 0 ? url.slice(0, suffixIdx) : url;
|
|
56
|
+
const suffix = suffixIdx >= 0 ? url.slice(suffixIdx) : "";
|
|
57
|
+
if (pathPart.charAt(pathPart.length - 1) === "/") return url;
|
|
58
|
+
const segments = pathPart.split("/");
|
|
59
|
+
const lastSegment = segments[segments.length - 1] || "";
|
|
60
|
+
if (/\.[a-zA-Z]\w*$/.test(lastSegment)) return url;
|
|
61
|
+
return pathPart + "/" + suffix;
|
|
62
|
+
};
|
|
63
|
+
const withBase = (path) => {
|
|
64
|
+
const raw = normalizedBase === "" ? path : normalizedBase + (path.charAt(0) === "/" ? path : "/" + path);
|
|
65
|
+
return applyTrailingSlash(raw);
|
|
66
|
+
};
|
|
67
|
+
const versionsPageUrl = withBase(
|
|
68
|
+
currentLocale === defaultLocale ? "/docs/versions" : "/" + currentLocale + "/docs/versions"
|
|
69
|
+
);
|
|
70
|
+
const stripped = stripBase(pathname);
|
|
71
|
+
const versionMatch = stripped.match(/^\/v\/([^/]+)(\/.*|$)/);
|
|
72
|
+
const rest = versionMatch ? versionMatch[2] || "/" : stripped;
|
|
73
|
+
let localeStripped = rest;
|
|
74
|
+
if (currentLocale !== defaultLocale) {
|
|
75
|
+
localeStripped = rest.replace(
|
|
76
|
+
new RegExp("^/" + currentLocale + "(?:/|$)"),
|
|
77
|
+
"/"
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const isVersionsIndex = localeStripped === "/docs/versions" || localeStripped === "/docs/versions/";
|
|
81
|
+
const isDocPage = /^\/docs(\/|$)/.test(localeStripped) && !isVersionsIndex;
|
|
82
|
+
const activeVersion = isDocPage && versionMatch ? versionMatch[1] || null : null;
|
|
83
|
+
const versionHrefs = {};
|
|
84
|
+
let latestHref;
|
|
85
|
+
if (isDocPage) {
|
|
86
|
+
latestHref = withBase(rest);
|
|
87
|
+
for (let i = 0; i < versionSlugs.length; i++) {
|
|
88
|
+
const slug = versionSlugs[i];
|
|
89
|
+
if (slug) versionHrefs[slug] = withBase("/v/" + slug + rest);
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
latestHref = versionsPageUrl;
|
|
93
|
+
for (let i = 0; i < versionSlugs.length; i++) {
|
|
94
|
+
const slug = versionSlugs[i];
|
|
95
|
+
if (slug) versionHrefs[slug] = versionsPageUrl;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { latestHref, versionHrefs, activeVersion };
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
computeVersionSwitcherState,
|
|
102
|
+
switchLocaleHref
|
|
103
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
|
-
|
|
3
|
-
import type { VNode } from "preact";
|
|
2
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
4
3
|
export interface VersionBannerLabels {
|
|
5
4
|
/** Banner body text (e.g. "You are viewing documentation for an older version."). */
|
|
6
5
|
message: string;
|
|
@@ -23,4 +22,4 @@ export interface VersionBannerProps {
|
|
|
23
22
|
* The host typically resolves `labels` via `t("version.banner.*", lang)`
|
|
24
23
|
* and `latestUrl` via the project's URL helpers.
|
|
25
24
|
*/
|
|
26
|
-
export declare function VersionBanner(props: VersionBannerProps):
|
|
25
|
+
export declare function VersionBanner(props: VersionBannerProps): Child;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
|
-
|
|
3
|
-
import type { VNode } from "preact";
|
|
2
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
4
3
|
import type { VersionEntry, VersionSwitcherLabels } from "./types.js";
|
|
5
4
|
export interface VersionSwitcherProps {
|
|
6
5
|
/**
|
|
@@ -52,52 +51,8 @@ export interface VersionSwitcherProps {
|
|
|
52
51
|
*/
|
|
53
52
|
rewireConfig?: VersionSwitcherRewireConfig;
|
|
54
53
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* factory's per-page menu URLs from the live pathname. Emitted as `data-*`
|
|
58
|
-
* attributes on the switcher container so {@link VERSION_SWITCHER_REWIRE_SCRIPT}
|
|
59
|
-
* can read it without any serialized props.
|
|
60
|
-
*/
|
|
61
|
-
export interface VersionSwitcherRewireConfig {
|
|
62
|
-
/** Normalized site base with no trailing slash (`""` for a root site). */
|
|
63
|
-
base: string;
|
|
64
|
-
/** The project's default locale (rendered without a locale prefix). */
|
|
65
|
-
defaultLocale: string;
|
|
66
|
-
/** Whether the project appends trailing slashes to page URLs. */
|
|
67
|
-
trailingSlash: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* The active locale code — constant within a `header-${lang}` persist window,
|
|
70
|
-
* so it can be read once from the SSR container rather than re-derived.
|
|
71
|
-
*/
|
|
72
|
-
currentLocale: string;
|
|
73
|
-
}
|
|
74
|
-
/** The re-computed per-page menu state {@link computeVersionSwitcherState} returns. */
|
|
75
|
-
export interface VersionSwitcherState {
|
|
76
|
-
/** Href for the "Latest" entry, matching the SSR `latestUrl`. */
|
|
77
|
-
latestHref: string;
|
|
78
|
-
/** version slug → href for that version of the current page (SSR `versionUrls`). */
|
|
79
|
-
versionHrefs: Record<string, string>;
|
|
80
|
-
/** Active version slug, or `null` when the current page is on "latest". */
|
|
81
|
-
activeVersion: string | null;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Client-side re-computation of the version-switcher's per-page menu state from
|
|
85
|
-
* the *current* pathname. This is a self-contained port of the header factory's
|
|
86
|
-
* URL logic (`createHeaderWithDefaults`'s `latestUrl` / `versionUrls` block, in
|
|
87
|
-
* turn `docsUrl` / `versionedDocsUrl` / `withBase` from `url-helpers`). It MUST
|
|
88
|
-
* stay behaviourally identical to that SSR path — pinned by the drift-guard test
|
|
89
|
-
* in `__tests__/version-switcher.test.tsx`, which asserts equality against the
|
|
90
|
-
* real `makeUrlHelpers` output across a case table.
|
|
91
|
-
*
|
|
92
|
-
* It is deliberately self-contained (no references to module-scope helpers)
|
|
93
|
-
* because {@link VERSION_SWITCHER_REWIRE_SCRIPT} embeds it verbatim via
|
|
94
|
-
* `.toString()`, so it must be valid as a standalone function in the browser.
|
|
95
|
-
*
|
|
96
|
-
* The `/docs/versions` listing is a standalone package route (`currentSlug`
|
|
97
|
-
* `undefined` on the SSR side), so — like the SSR factory — every menu href
|
|
98
|
-
* there collapses to `versionsPageUrl`; the exact-path check below mirrors that.
|
|
99
|
-
*/
|
|
100
|
-
export declare function computeVersionSwitcherState(pathname: string, config: VersionSwitcherRewireConfig, versionSlugs: string[]): VersionSwitcherState;
|
|
54
|
+
import type { VersionSwitcherRewireConfig } from "./switcher-url-state.js";
|
|
55
|
+
export { computeVersionSwitcherState, type VersionSwitcherRewireConfig, type VersionSwitcherState } from "./switcher-url-state.js";
|
|
101
56
|
/**
|
|
102
57
|
* Canonical CSS rule that backs the responsive visibility of the
|
|
103
58
|
* version-switcher's host wrapper. **The component itself does NOT
|
|
@@ -139,7 +94,7 @@ export declare const VERSION_SWITCHER_VISIBILITY_STYLE = "@media (min-width:64re
|
|
|
139
94
|
* `VERSION_SWITCHER_INIT_SCRIPT` — mount it once at body-end on any
|
|
140
95
|
* page that includes a `<VersionSwitcher>`.
|
|
141
96
|
*/
|
|
142
|
-
export declare function VersionSwitcher(props: VersionSwitcherProps):
|
|
97
|
+
export declare function VersionSwitcher(props: VersionSwitcherProps): Child;
|
|
143
98
|
/**
|
|
144
99
|
* Self-contained init script for the version-switcher's interactive
|
|
145
100
|
* behavior. Mount once per page (e.g. inside the layout's body-end
|
|
@@ -215,5 +170,5 @@ export declare const VERSION_SWITCHER_INIT_SCRIPT: string;
|
|
|
215
170
|
* `nav-overflow-script.ts` / `sidebar-tree-island` / `language-switcher.tsx`
|
|
216
171
|
* use (zudolab/zudo-doc#3398, consolidated by #3408).
|
|
217
172
|
*/
|
|
218
|
-
export
|
|
173
|
+
export { VERSION_SWITCHER_REWIRE_SCRIPT } from "./switcher-generated-scripts.js";
|
|
219
174
|
export type { VersionEntry, VersionSwitcherLabels };
|
|
@@ -1,66 +1,6 @@
|
|
|
1
|
-
import { jsx, jsxs } from "
|
|
1
|
+
import { jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
2
2
|
import { AFTER_NAVIGATE_EVENT } from "../transitions/page-events.js";
|
|
3
|
-
import {
|
|
4
|
-
import { UNAVAILABLE_VERSIONS_ATTR } from "../version-availability/index.js";
|
|
5
|
-
function computeVersionSwitcherState(pathname, config, versionSlugs) {
|
|
6
|
-
const normalizedBase = config.base;
|
|
7
|
-
const defaultLocale = config.defaultLocale;
|
|
8
|
-
const currentLocale = config.currentLocale;
|
|
9
|
-
const trailingSlash = config.trailingSlash;
|
|
10
|
-
const stripBase = (path) => {
|
|
11
|
-
if (normalizedBase === "") return path;
|
|
12
|
-
if (path === normalizedBase) return "/";
|
|
13
|
-
return path.indexOf(normalizedBase + "/") === 0 ? path.slice(normalizedBase.length) : path;
|
|
14
|
-
};
|
|
15
|
-
const applyTrailingSlash = (url) => {
|
|
16
|
-
if (!trailingSlash) return url;
|
|
17
|
-
if (url.charAt(url.length - 1) === "/") return url;
|
|
18
|
-
const suffixIdx = url.search(/[?#]/);
|
|
19
|
-
const pathPart = suffixIdx >= 0 ? url.slice(0, suffixIdx) : url;
|
|
20
|
-
const suffix = suffixIdx >= 0 ? url.slice(suffixIdx) : "";
|
|
21
|
-
if (pathPart.charAt(pathPart.length - 1) === "/") return url;
|
|
22
|
-
const segments = pathPart.split("/");
|
|
23
|
-
const lastSegment = segments[segments.length - 1] || "";
|
|
24
|
-
if (/\.[a-zA-Z]\w*$/.test(lastSegment)) return url;
|
|
25
|
-
return pathPart + "/" + suffix;
|
|
26
|
-
};
|
|
27
|
-
const withBase = (path) => {
|
|
28
|
-
const raw = normalizedBase === "" ? path : normalizedBase + (path.charAt(0) === "/" ? path : "/" + path);
|
|
29
|
-
return applyTrailingSlash(raw);
|
|
30
|
-
};
|
|
31
|
-
const versionsPageUrl = withBase(
|
|
32
|
-
currentLocale === defaultLocale ? "/docs/versions" : "/" + currentLocale + "/docs/versions"
|
|
33
|
-
);
|
|
34
|
-
const stripped = stripBase(pathname);
|
|
35
|
-
const versionMatch = stripped.match(/^\/v\/([^/]+)(\/.*|$)/);
|
|
36
|
-
const rest = versionMatch ? versionMatch[2] || "/" : stripped;
|
|
37
|
-
let localeStripped = rest;
|
|
38
|
-
if (currentLocale !== defaultLocale) {
|
|
39
|
-
localeStripped = rest.replace(
|
|
40
|
-
new RegExp("^/" + currentLocale + "(?:/|$)"),
|
|
41
|
-
"/"
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
const isVersionsIndex = localeStripped === "/docs/versions" || localeStripped === "/docs/versions/";
|
|
45
|
-
const isDocPage = /^\/docs(\/|$)/.test(localeStripped) && !isVersionsIndex;
|
|
46
|
-
const activeVersion = isDocPage && versionMatch ? versionMatch[1] || null : null;
|
|
47
|
-
const versionHrefs = {};
|
|
48
|
-
let latestHref;
|
|
49
|
-
if (isDocPage) {
|
|
50
|
-
latestHref = withBase(rest);
|
|
51
|
-
for (let i = 0; i < versionSlugs.length; i++) {
|
|
52
|
-
const slug = versionSlugs[i];
|
|
53
|
-
if (slug) versionHrefs[slug] = withBase("/v/" + slug + rest);
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
latestHref = versionsPageUrl;
|
|
57
|
-
for (let i = 0; i < versionSlugs.length; i++) {
|
|
58
|
-
const slug = versionSlugs[i];
|
|
59
|
-
if (slug) versionHrefs[slug] = versionsPageUrl;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return { latestHref, versionHrefs, activeVersion };
|
|
63
|
-
}
|
|
3
|
+
import { computeVersionSwitcherState } from "./switcher-url-state.js";
|
|
64
4
|
function cls(...parts) {
|
|
65
5
|
return parts.filter(Boolean).join(" ");
|
|
66
6
|
}
|
|
@@ -69,7 +9,6 @@ function ChevronDownIcon() {
|
|
|
69
9
|
return /* @__PURE__ */ jsx(
|
|
70
10
|
"svg",
|
|
71
11
|
{
|
|
72
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
73
12
|
class: "h-[0.875rem] w-[0.875rem]",
|
|
74
13
|
fill: "none",
|
|
75
14
|
viewBox: "0 0 24 24",
|
|
@@ -110,12 +49,12 @@ function VersionSwitcher(props) {
|
|
|
110
49
|
"data-current-locale": rewireConfig.currentLocale,
|
|
111
50
|
"data-unavailable-label": labels.unavailable
|
|
112
51
|
} : {};
|
|
113
|
-
return /* @__PURE__ */ jsxs("div", { class: "
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { class: "relative", "data-version-switcher": true, ...rewireAttrs, children: [
|
|
114
53
|
/* @__PURE__ */ jsxs(
|
|
115
54
|
"button",
|
|
116
55
|
{
|
|
117
56
|
type: "button",
|
|
118
|
-
class: "flex items-center gap-hsp-2xs border border-muted rounded px-hsp-sm py-vsp-3xs text-small text-muted hover:border-accent hover:text-accent transition-colors cursor-pointer whitespace-nowrap",
|
|
57
|
+
class: "flex items-center gap-hsp-2xs border border-muted rounded px-hsp-sm py-vsp-3xs text-small text-muted hover:border-accent hover:text-accent transition-colors duration-0 cursor-pointer whitespace-nowrap",
|
|
119
58
|
"aria-expanded": "false",
|
|
120
59
|
"aria-controls": menuId,
|
|
121
60
|
"data-version-toggle": true,
|
|
@@ -231,98 +170,7 @@ toggle.focus();
|
|
|
231
170
|
initVersionSwitcher();
|
|
232
171
|
document.addEventListener(${JSON.stringify(AFTER_NAVIGATE_EVENT)},initVersionSwitcher);
|
|
233
172
|
})();`;
|
|
234
|
-
|
|
235
|
-
var FLAG="__zdVersionSwitcherRewire";
|
|
236
|
-
if(window[FLAG])return;
|
|
237
|
-
window[FLAG]=true;
|
|
238
|
-
var ATTR=${JSON.stringify(UNAVAILABLE_VERSIONS_ATTR)};
|
|
239
|
-
${CURRENT_PATH_SCRIPT_PRELUDE}
|
|
240
|
-
var computeVersionSwitcherState=${computeVersionSwitcherState.toString()};
|
|
241
|
-
function setActive(a,active){
|
|
242
|
-
a.classList.toggle("font-bold",active);
|
|
243
|
-
a.classList.toggle("text-accent",active);
|
|
244
|
-
a.classList.toggle("text-fg",!active);
|
|
245
|
-
if(active){a.setAttribute("aria-current","page");}else{a.removeAttribute("aria-current");}
|
|
246
|
-
}
|
|
247
|
-
function setDisabled(a,disabled,unavailableLabel){
|
|
248
|
-
a.classList.toggle("hover:bg-accent/10",!disabled);
|
|
249
|
-
a.classList.toggle("hover:underline",!disabled);
|
|
250
|
-
a.classList.toggle("focus-visible:underline",!disabled);
|
|
251
|
-
a.classList.toggle("text-muted/50",disabled);
|
|
252
|
-
a.classList.toggle("cursor-not-allowed",disabled);
|
|
253
|
-
a.classList.toggle("pointer-events-none",disabled);
|
|
254
|
-
if(disabled){
|
|
255
|
-
a.setAttribute("aria-disabled","true");
|
|
256
|
-
a.setAttribute("tabindex","-1");
|
|
257
|
-
a.setAttribute("title",unavailableLabel);
|
|
258
|
-
a.classList.remove("font-bold","text-accent","text-fg");
|
|
259
|
-
a.removeAttribute("aria-current");
|
|
260
|
-
}else{
|
|
261
|
-
a.removeAttribute("aria-disabled");
|
|
262
|
-
a.removeAttribute("tabindex");
|
|
263
|
-
a.removeAttribute("title");
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function rewire(){
|
|
267
|
-
var articleEl=document.querySelector("["+ATTR+"]");
|
|
268
|
-
var hasAvailabilityData=articleEl!==null;
|
|
269
|
-
var unavailableSlugs=hasAvailabilityData?(articleEl.getAttribute(ATTR)||"").split(",").filter(Boolean):[];
|
|
270
|
-
var containers=document.querySelectorAll("[data-version-rewire]");
|
|
271
|
-
for(var i=0;i<containers.length;i++){
|
|
272
|
-
var c=containers[i];
|
|
273
|
-
var config={base:c.getAttribute("data-base")||"",defaultLocale:c.getAttribute("data-default-locale")||"",trailingSlash:c.getAttribute("data-trailing-slash")==="true",currentLocale:c.getAttribute("data-current-locale")||""};
|
|
274
|
-
var unavailableLabel=c.getAttribute("data-unavailable-label")||"";
|
|
275
|
-
var versionAnchors=c.querySelectorAll("[data-version-slug]");
|
|
276
|
-
var slugs=[];
|
|
277
|
-
for(var j=0;j<versionAnchors.length;j++){
|
|
278
|
-
var s=versionAnchors[j].getAttribute("data-version-slug");
|
|
279
|
-
if(s)slugs.push(s);
|
|
280
|
-
}
|
|
281
|
-
var state=computeVersionSwitcherState(readCurrentPath(CURRENT_PATH_DATASET_KEY),config,slugs);
|
|
282
|
-
var latest=c.querySelector("[data-version-latest]");
|
|
283
|
-
if(latest){
|
|
284
|
-
latest.setAttribute("href",state.latestHref);
|
|
285
|
-
setActive(latest,state.activeVersion===null);
|
|
286
|
-
}
|
|
287
|
-
for(var k=0;k<versionAnchors.length;k++){
|
|
288
|
-
var a=versionAnchors[k];
|
|
289
|
-
var slug=a.getAttribute("data-version-slug");
|
|
290
|
-
if(!slug)continue;
|
|
291
|
-
var href=state.versionHrefs[slug];
|
|
292
|
-
if(href!=null)a.setAttribute("href",href);
|
|
293
|
-
if(hasAvailabilityData){
|
|
294
|
-
var disabled=unavailableSlugs.indexOf(slug)!==-1;
|
|
295
|
-
setDisabled(a,disabled,unavailableLabel);
|
|
296
|
-
if(!disabled)setActive(a,state.activeVersion===slug);
|
|
297
|
-
}else{
|
|
298
|
-
var alreadyDisabled=a.getAttribute("aria-disabled")==="true";
|
|
299
|
-
if(!alreadyDisabled)setActive(a,state.activeVersion===slug);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
var label=c.querySelector("[data-version-trigger-label]");
|
|
303
|
-
if(label){
|
|
304
|
-
if(state.activeVersion===null){
|
|
305
|
-
if(latest)label.textContent=latest.textContent;
|
|
306
|
-
}else{
|
|
307
|
-
var activeLabel=null;
|
|
308
|
-
for(var m=0;m<versionAnchors.length;m++){
|
|
309
|
-
if(versionAnchors[m].getAttribute("data-version-slug")===state.activeVersion){activeLabel=versionAnchors[m].textContent;break;}
|
|
310
|
-
}
|
|
311
|
-
label.textContent=activeLabel!=null?activeLabel:state.activeVersion;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
// The initial call is deferred to DOMContentLoaded when the script (inline in
|
|
317
|
-
// <header>, which parses before <article>) would otherwise run before the
|
|
318
|
-
// article element exists. Running early would read a missing ATTR as "no
|
|
319
|
-
// unavailable slugs" and clobber the SSR-correct disabled state with
|
|
320
|
-
// everything-enabled \u2014 a first-paint variant of the bug this rewire exists
|
|
321
|
-
// to fix (see the doc comment above; SSR already rendered the right state for
|
|
322
|
-
// this page, so a brief deferral loses nothing).
|
|
323
|
-
if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",rewire);}else{rewire();}
|
|
324
|
-
document.addEventListener(${JSON.stringify(AFTER_NAVIGATE_EVENT)},rewire);
|
|
325
|
-
})();`;
|
|
173
|
+
import { VERSION_SWITCHER_REWIRE_SCRIPT } from "./switcher-generated-scripts.js";
|
|
326
174
|
export {
|
|
327
175
|
VERSION_SWITCHER_INIT_SCRIPT,
|
|
328
176
|
VERSION_SWITCHER_REWIRE_SCRIPT,
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
|
-
|
|
3
|
-
import type { VNode } from "preact";
|
|
2
|
+
import type { Child } from "@takazudo/zfb/zudo-react";
|
|
4
3
|
export interface IconProps {
|
|
5
4
|
/** CSS class string forwarded to the root `<svg>` element. */
|
|
6
|
-
|
|
5
|
+
class?: string;
|
|
7
6
|
}
|
|
8
|
-
export declare function ChevronRight({ className }: IconProps):
|
|
9
|
-
export declare function ChevronLeft({ className }: IconProps):
|
|
10
|
-
export declare function Search({ className }: IconProps):
|
|
11
|
-
export declare function History({ className }: IconProps):
|
|
12
|
-
export declare function Close({ className }: IconProps):
|
|
13
|
-
export declare function ArrowLeft({ className }: IconProps):
|
|
14
|
-
export declare function GitHub({ className }: IconProps):
|
|
15
|
-
export declare function Folder({ className }: IconProps):
|
|
16
|
-
export declare function FolderOpen({ className }: IconProps):
|
|
17
|
-
export declare function FileGeneric({ className }: IconProps):
|
|
18
|
-
export declare function FileCode({ className }: IconProps):
|
|
19
|
-
export declare function FileText({ className }: IconProps):
|
|
20
|
-
export declare function FileImage({ className }: IconProps):
|
|
21
|
-
export declare function FileVideo({ className }: IconProps):
|
|
22
|
-
export declare function FilePdf({ className }: IconProps):
|
|
23
|
-
export declare function FileArchive({ className }: IconProps):
|
|
7
|
+
export declare function ChevronRight({ class: className }: IconProps): Child;
|
|
8
|
+
export declare function ChevronLeft({ class: className }: IconProps): Child;
|
|
9
|
+
export declare function Search({ class: className }: IconProps): Child;
|
|
10
|
+
export declare function History({ class: className }: IconProps): Child;
|
|
11
|
+
export declare function Close({ class: className }: IconProps): Child;
|
|
12
|
+
export declare function ArrowLeft({ class: className }: IconProps): Child;
|
|
13
|
+
export declare function GitHub({ class: className }: IconProps): Child;
|
|
14
|
+
export declare function Folder({ class: className }: IconProps): Child;
|
|
15
|
+
export declare function FolderOpen({ class: className }: IconProps): Child;
|
|
16
|
+
export declare function FileGeneric({ class: className }: IconProps): Child;
|
|
17
|
+
export declare function FileCode({ class: className }: IconProps): Child;
|
|
18
|
+
export declare function FileText({ class: className }: IconProps): Child;
|
|
19
|
+
export declare function FileImage({ class: className }: IconProps): Child;
|
|
20
|
+
export declare function FileVideo({ class: className }: IconProps): Child;
|
|
21
|
+
export declare function FilePdf({ class: className }: IconProps): Child;
|
|
22
|
+
export declare function FileArchive({ class: className }: IconProps): Child;
|