@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,359 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_STORAGE_PREFIX,
|
|
3
|
+
DEFAULT_TOGGLE_EVENT,
|
|
4
|
+
EAGER_LOAD_GATE_KEY_SUFFIXES,
|
|
5
|
+
EAGER_LOAD_GATE_STATE_FAMILY,
|
|
6
|
+
resolveToggleEventName
|
|
7
|
+
} from "./design-token-panel-constants.js";
|
|
8
|
+
import {
|
|
9
|
+
BEFORE_NAVIGATE_EVENT,
|
|
10
|
+
AFTER_NAVIGATE_EVENT
|
|
11
|
+
} from "./transitions/page-events.js";
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_THEME_PACK_SLUG,
|
|
14
|
+
THEME_PACK_CHANGED_EVENT,
|
|
15
|
+
readThemePackFromDom
|
|
16
|
+
} from "./theme-pack-switcher/theme-pack-sync.js";
|
|
17
|
+
const COLOR_SCHEME_CHANGED_EVENT = "color-scheme-changed";
|
|
18
|
+
function openStateKey(instancePrefix) {
|
|
19
|
+
return `${instancePrefix}-open`;
|
|
20
|
+
}
|
|
21
|
+
function readOpenState(instancePrefix) {
|
|
22
|
+
try {
|
|
23
|
+
return localStorage.getItem(openStateKey(instancePrefix)) === "1";
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function isEmptyEnvelope(raw) {
|
|
29
|
+
if (raw === null || raw === "") return true;
|
|
30
|
+
let parsed;
|
|
31
|
+
try {
|
|
32
|
+
parsed = JSON.parse(raw);
|
|
33
|
+
} catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
if (parsed === null) return true;
|
|
37
|
+
if (Array.isArray(parsed)) return parsed.length === 0;
|
|
38
|
+
if (typeof parsed === "object") return Object.keys(parsed).length === 0;
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
function hasPersistedPanelState(config) {
|
|
42
|
+
const instancePrefix = config.storagePrefix ?? DEFAULT_STORAGE_PREFIX;
|
|
43
|
+
try {
|
|
44
|
+
for (const [suffix, gate] of Object.entries(EAGER_LOAD_GATE_KEY_SUFFIXES)) {
|
|
45
|
+
if (gate.requiredConfig !== null && config[gate.requiredConfig] === void 0) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const value = localStorage.getItem(`${instancePrefix}${suffix}`);
|
|
49
|
+
if (suffix === ":autoload" && value !== "1") continue;
|
|
50
|
+
if (gate.acceptedValues.some((accepted) => accepted === value)) return true;
|
|
51
|
+
}
|
|
52
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
53
|
+
const key = localStorage.key(i);
|
|
54
|
+
if (key === null || !EAGER_LOAD_GATE_STATE_FAMILY.matchesKey(instancePrefix, key)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (!isEmptyEnvelope(localStorage.getItem(key))) return true;
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
function readMode() {
|
|
64
|
+
return document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
|
|
65
|
+
}
|
|
66
|
+
function withPackScopedStoragePrefix(config, activePack) {
|
|
67
|
+
if (activePack === DEFAULT_THEME_PACK_SLUG) return config;
|
|
68
|
+
return { ...config, storagePrefix: `${config.storagePrefix}--${activePack}` };
|
|
69
|
+
}
|
|
70
|
+
function collectDeclaredTokenNames(config) {
|
|
71
|
+
const names = [];
|
|
72
|
+
for (const tab of config.tabs ?? []) {
|
|
73
|
+
for (const tier of tab.tiers ?? []) {
|
|
74
|
+
for (const item of tier.items ?? []) {
|
|
75
|
+
names.push(item.cssVar);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const baseRoles = tab.colorExtras?.baseRoles;
|
|
79
|
+
if (baseRoles) {
|
|
80
|
+
for (const cssVar of Object.values(baseRoles)) {
|
|
81
|
+
if (typeof cssVar === "string" && cssVar.length > 0) {
|
|
82
|
+
names.push(cssVar);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return names;
|
|
88
|
+
}
|
|
89
|
+
function clearAppliedTokenOverrides(config) {
|
|
90
|
+
const names = collectDeclaredTokenNames(config);
|
|
91
|
+
if (config.applySink) {
|
|
92
|
+
try {
|
|
93
|
+
config.applySink.clear(names);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
console.warn(
|
|
96
|
+
"[zudo-doc] applySink.clear threw during theme-pack switch; outgoing overrides may linger.",
|
|
97
|
+
err
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const style = document.documentElement.style;
|
|
103
|
+
for (const name of names) {
|
|
104
|
+
style.removeProperty(name);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function bootstrapDesignTokenPanel(buildConfig) {
|
|
108
|
+
bootstrapDesignTokenPanelForScope(buildConfig);
|
|
109
|
+
}
|
|
110
|
+
function bootstrapDesignTokenPanelForScope(buildConfig, activationSignal, onConfigured) {
|
|
111
|
+
if (activationSignal?.aborted) return;
|
|
112
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let zdtpImport = null;
|
|
116
|
+
let activationInFlight = false;
|
|
117
|
+
let configurePhase = "pending";
|
|
118
|
+
const pendingListenerCleanups = [];
|
|
119
|
+
let pendingListenersRetained = false;
|
|
120
|
+
function removePendingListeners() {
|
|
121
|
+
if (pendingListenersRetained) return;
|
|
122
|
+
pendingListenersRetained = true;
|
|
123
|
+
for (const cleanup of pendingListenerCleanups.splice(0).reverse()) cleanup();
|
|
124
|
+
activationSignal?.removeEventListener("abort", onActivationAbort);
|
|
125
|
+
}
|
|
126
|
+
function retainDocumentListeners() {
|
|
127
|
+
pendingListenersRetained = true;
|
|
128
|
+
pendingListenerCleanups.length = 0;
|
|
129
|
+
activationSignal?.removeEventListener("abort", onActivationAbort);
|
|
130
|
+
}
|
|
131
|
+
function addPendingListener(target, type, listener) {
|
|
132
|
+
target.addEventListener(type, listener);
|
|
133
|
+
pendingListenerCleanups.push(() => target.removeEventListener(type, listener));
|
|
134
|
+
}
|
|
135
|
+
function onActivationAbort() {
|
|
136
|
+
if (configurePhase !== "pending") return;
|
|
137
|
+
removePendingListeners();
|
|
138
|
+
activationInFlight = false;
|
|
139
|
+
}
|
|
140
|
+
activationSignal?.addEventListener("abort", onActivationAbort, { once: true });
|
|
141
|
+
let pendingToggles = 0;
|
|
142
|
+
function loadZdtp() {
|
|
143
|
+
if (zdtpImport === null) {
|
|
144
|
+
zdtpImport = import("@takazudo/zudo-doc/zdtp-loader").catch((err) => {
|
|
145
|
+
zdtpImport = null;
|
|
146
|
+
throw err;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return zdtpImport;
|
|
150
|
+
}
|
|
151
|
+
function configureAndWire(zdtp) {
|
|
152
|
+
const {
|
|
153
|
+
configurePanelIfActive,
|
|
154
|
+
configurePanel,
|
|
155
|
+
reapplyPersistedOverrides,
|
|
156
|
+
setLifecycleAdapter,
|
|
157
|
+
showDesignTokenPanel
|
|
158
|
+
} = zdtp;
|
|
159
|
+
let currentConfig = withPackScopedStoragePrefix(
|
|
160
|
+
buildConfig(readMode()),
|
|
161
|
+
readThemePackFromDom()
|
|
162
|
+
);
|
|
163
|
+
const initialHandle = configurePanelIfActive(
|
|
164
|
+
activationSignal,
|
|
165
|
+
currentConfig
|
|
166
|
+
);
|
|
167
|
+
if (!initialHandle) return false;
|
|
168
|
+
let handle = initialHandle;
|
|
169
|
+
if (activationSignal?.aborted) {
|
|
170
|
+
handle.destroy();
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
let pendingMode = readMode();
|
|
174
|
+
let timer = null;
|
|
175
|
+
addPendingListener(window, COLOR_SCHEME_CHANGED_EVENT, () => {
|
|
176
|
+
pendingMode = readMode();
|
|
177
|
+
if (timer !== null) return;
|
|
178
|
+
timer = setTimeout(() => {
|
|
179
|
+
timer = null;
|
|
180
|
+
const mode = pendingMode;
|
|
181
|
+
const wasOpen = readOpenState(handle.instanceId);
|
|
182
|
+
handle.destroy();
|
|
183
|
+
currentConfig = withPackScopedStoragePrefix(
|
|
184
|
+
buildConfig(mode),
|
|
185
|
+
readThemePackFromDom()
|
|
186
|
+
);
|
|
187
|
+
handle = configurePanel(currentConfig);
|
|
188
|
+
if (wasOpen) showDesignTokenPanel();
|
|
189
|
+
}, 0);
|
|
190
|
+
});
|
|
191
|
+
let pendingPack = readThemePackFromDom();
|
|
192
|
+
let packTimer = null;
|
|
193
|
+
pendingListenerCleanups.push(() => {
|
|
194
|
+
if (timer !== null) clearTimeout(timer);
|
|
195
|
+
if (packTimer !== null) clearTimeout(packTimer);
|
|
196
|
+
});
|
|
197
|
+
addPendingListener(window, THEME_PACK_CHANGED_EVENT, () => {
|
|
198
|
+
pendingPack = readThemePackFromDom();
|
|
199
|
+
if (packTimer !== null) return;
|
|
200
|
+
packTimer = setTimeout(() => {
|
|
201
|
+
packTimer = null;
|
|
202
|
+
const pack = pendingPack;
|
|
203
|
+
const wasOpen = readOpenState(handle.instanceId);
|
|
204
|
+
const outgoingConfig = currentConfig;
|
|
205
|
+
handle.destroy();
|
|
206
|
+
clearAppliedTokenOverrides(outgoingConfig);
|
|
207
|
+
currentConfig = withPackScopedStoragePrefix(buildConfig(readMode()), pack);
|
|
208
|
+
handle = configurePanel(currentConfig);
|
|
209
|
+
reapplyPersistedOverrides();
|
|
210
|
+
if (wasOpen) showDesignTokenPanel();
|
|
211
|
+
}, 0);
|
|
212
|
+
});
|
|
213
|
+
if (activationSignal?.aborted) {
|
|
214
|
+
handle.destroy();
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
reapplyPersistedOverrides();
|
|
218
|
+
const adapter = {
|
|
219
|
+
onBeforeSwap(cb) {
|
|
220
|
+
const handler = () => cb();
|
|
221
|
+
document.addEventListener(BEFORE_NAVIGATE_EVENT, handler);
|
|
222
|
+
return () => document.removeEventListener(BEFORE_NAVIGATE_EVENT, handler);
|
|
223
|
+
},
|
|
224
|
+
onPageLoad(cb) {
|
|
225
|
+
const handler = () => cb();
|
|
226
|
+
document.addEventListener(AFTER_NAVIGATE_EVENT, handler);
|
|
227
|
+
return () => document.removeEventListener(AFTER_NAVIGATE_EVENT, handler);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
if (activationSignal?.aborted) {
|
|
231
|
+
handle.destroy();
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
setLifecycleAdapter(adapter);
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
async function activate() {
|
|
238
|
+
if (activationSignal?.aborted) {
|
|
239
|
+
removePendingListeners();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (activationInFlight || configurePhase !== "pending") return;
|
|
243
|
+
activationInFlight = true;
|
|
244
|
+
let zdtp;
|
|
245
|
+
try {
|
|
246
|
+
zdtp = await loadZdtp();
|
|
247
|
+
} catch (err) {
|
|
248
|
+
activationInFlight = false;
|
|
249
|
+
if (activationSignal?.aborted) return;
|
|
250
|
+
pendingToggles = 0;
|
|
251
|
+
console.error(
|
|
252
|
+
"[zudo-doc] design-token-panel: loading @takazudo/zdtp failed; the next toggle retries.",
|
|
253
|
+
err
|
|
254
|
+
);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (activationSignal?.aborted) {
|
|
258
|
+
activationInFlight = false;
|
|
259
|
+
removePendingListeners();
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
if (!configureAndWire(zdtp)) {
|
|
264
|
+
if (activationSignal?.aborted) removePendingListeners();
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
configurePhase = "configured";
|
|
268
|
+
onConfigured?.();
|
|
269
|
+
retainDocumentListeners();
|
|
270
|
+
} catch (err) {
|
|
271
|
+
configurePhase = "failed";
|
|
272
|
+
removePendingListeners();
|
|
273
|
+
console.error(
|
|
274
|
+
"[zudo-doc] design-token-panel: configure failed; the panel is disabled until the next full page load.",
|
|
275
|
+
err
|
|
276
|
+
);
|
|
277
|
+
return;
|
|
278
|
+
} finally {
|
|
279
|
+
activationInFlight = false;
|
|
280
|
+
}
|
|
281
|
+
if (!activationSignal?.aborted && pendingToggles % 2 === 1) {
|
|
282
|
+
zdtp.showDesignTokenPanel();
|
|
283
|
+
}
|
|
284
|
+
pendingToggles = 0;
|
|
285
|
+
}
|
|
286
|
+
function readActiveConfig() {
|
|
287
|
+
return withPackScopedStoragePrefix(
|
|
288
|
+
buildConfig(readMode()),
|
|
289
|
+
readThemePackFromDom()
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
const onInterimToggle = () => {
|
|
293
|
+
if (configurePhase !== "pending") return;
|
|
294
|
+
pendingToggles += 1;
|
|
295
|
+
void activate();
|
|
296
|
+
};
|
|
297
|
+
const boundToggleChannels = /* @__PURE__ */ new Set();
|
|
298
|
+
let instanceToggleChannel = null;
|
|
299
|
+
function bindToggleChannel(name) {
|
|
300
|
+
if (boundToggleChannels.has(name)) return;
|
|
301
|
+
boundToggleChannels.add(name);
|
|
302
|
+
addPendingListener(window, name, onInterimToggle);
|
|
303
|
+
}
|
|
304
|
+
function refreshInstanceToggleChannel(config) {
|
|
305
|
+
const resolved = resolveToggleEventName(config);
|
|
306
|
+
if (resolved === instanceToggleChannel) return;
|
|
307
|
+
if (instanceToggleChannel !== null && instanceToggleChannel !== DEFAULT_TOGGLE_EVENT) {
|
|
308
|
+
window.removeEventListener(instanceToggleChannel, onInterimToggle);
|
|
309
|
+
boundToggleChannels.delete(instanceToggleChannel);
|
|
310
|
+
}
|
|
311
|
+
instanceToggleChannel = resolved;
|
|
312
|
+
bindToggleChannel(resolved);
|
|
313
|
+
}
|
|
314
|
+
const bootConfig = readActiveConfig();
|
|
315
|
+
bindToggleChannel(DEFAULT_TOGGLE_EVENT);
|
|
316
|
+
refreshInstanceToggleChannel(bootConfig);
|
|
317
|
+
window.__zdtpReadyClicks?.();
|
|
318
|
+
if (hasPersistedPanelState(bootConfig)) void activate();
|
|
319
|
+
addPendingListener(window, THEME_PACK_CHANGED_EVENT, () => {
|
|
320
|
+
if (configurePhase !== "pending") return;
|
|
321
|
+
const activeConfig = readActiveConfig();
|
|
322
|
+
refreshInstanceToggleChannel(activeConfig);
|
|
323
|
+
if (hasPersistedPanelState(activeConfig)) void activate();
|
|
324
|
+
});
|
|
325
|
+
addPendingListener(window, COLOR_SCHEME_CHANGED_EVENT, () => {
|
|
326
|
+
if (configurePhase !== "pending") return;
|
|
327
|
+
refreshInstanceToggleChannel(readActiveConfig());
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
let bootstrapWinner = null;
|
|
331
|
+
let warnedLostRace = false;
|
|
332
|
+
function warnLostBootstrapRace(winnerOrigin, loserOrigin) {
|
|
333
|
+
if (typeof window === "undefined" || warnedLostRace) return;
|
|
334
|
+
warnedLostRace = true;
|
|
335
|
+
const detail = loserOrigin === "configured" && winnerOrigin === "default" ? "The package-default island configured the panel earlier in this browser session, so `designTokenPanelConfigModule` did not apply on this page. This happens when the session first hard-loaded a page rendered by a self-contained `pages/` stub, which reaches the package default instead of the package-injected route. Thread your builder through `chromeBindings.DesignTokenPanelBootstrap` to make it apply on every page regardless of entry point." : `The ${winnerOrigin} island configured the panel first; this ${loserOrigin} island's builder was ignored. zdtp is configured once per session \u2014 mount exactly one design-token-panel bootstrap, e.g. via \`chromeBindings.DesignTokenPanelBootstrap\`.`;
|
|
336
|
+
console.warn(`[zudo-doc] design-token panel already configured. ${detail}`);
|
|
337
|
+
}
|
|
338
|
+
function runDesignTokenPanelBootstrapOnce(build, origin = "default", activationSignal) {
|
|
339
|
+
if (activationSignal?.aborted) return;
|
|
340
|
+
if (bootstrapWinner) {
|
|
341
|
+
if (bootstrapWinner.build !== build) warnLostBootstrapRace(bootstrapWinner.origin, origin);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
const winner = { origin, build, configured: false };
|
|
345
|
+
bootstrapWinner = winner;
|
|
346
|
+
const releasePendingClaim = () => {
|
|
347
|
+
if (!winner.configured && bootstrapWinner === winner) bootstrapWinner = null;
|
|
348
|
+
};
|
|
349
|
+
activationSignal?.addEventListener("abort", releasePendingClaim, { once: true });
|
|
350
|
+
bootstrapDesignTokenPanelForScope(build, activationSignal, () => {
|
|
351
|
+
winner.configured = true;
|
|
352
|
+
activationSignal?.removeEventListener("abort", releasePendingClaim);
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
export {
|
|
356
|
+
bootstrapDesignTokenPanel,
|
|
357
|
+
runDesignTokenPanelBootstrapOnce,
|
|
358
|
+
withPackScopedStoragePrefix
|
|
359
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getScope } from "@takazudo/zfb/zudo-react";
|
|
3
|
+
import { buildDesignTokenPanelConfig } from "./design-token-panel-config/index.js";
|
|
4
|
+
import { runDesignTokenPanelBootstrapOnce } from "./design-token-panel-bootstrap-controller.js";
|
|
5
|
+
function DesignTokenPanelBootstrap() {
|
|
6
|
+
const scope = getScope();
|
|
7
|
+
scope.onActivate(() => {
|
|
8
|
+
runDesignTokenPanelBootstrapOnce(
|
|
9
|
+
buildDesignTokenPanelConfig,
|
|
10
|
+
"default",
|
|
11
|
+
scope.abortSignal
|
|
12
|
+
);
|
|
13
|
+
});
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
DesignTokenPanelBootstrap.displayName = "DesignTokenPanelBootstrap";
|
|
17
|
+
export {
|
|
18
|
+
DesignTokenPanelBootstrap
|
|
19
|
+
};
|
|
@@ -1,197 +1,7 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* whatsoever. It used to eagerly import the side-effect-free `/constants` leaf;
|
|
8
|
-
* since #4018 those constants come from the in-package mirror
|
|
9
|
-
* `./design-token-panel-constants.js`, because that one static edge made an
|
|
10
|
-
* OPTIONAL peer a hard build-time requirement for every chrome consumer
|
|
11
|
-
* (#4009 — see that module's header).
|
|
12
|
-
* The root package is `import()`ed on the first dispatch on either resolved
|
|
13
|
-
* toggle channel (the shared `toggle-design-token-panel`, or this instance's own —
|
|
14
|
-
* see the public 0.5 {@link resolveToggleEventName}), or eagerly when the
|
|
15
|
-
* persisted-state probe finds saved tweaks / a previously-open panel, so zdtp's bundle stays
|
|
16
|
-
* out of the initial page load.
|
|
17
|
-
*
|
|
18
|
-
* `bootstrapDesignTokenPanel` is a callable that configures zdtp's panel and
|
|
19
|
-
* wires its lifecycle hooks to zfb's navigation events via
|
|
20
|
-
* `setLifecycleAdapter()`. It receives a mode-scoped PanelConfig builder —
|
|
21
|
-
* either a project override or the package default from
|
|
22
|
-
* `@takazudo/zudo-doc/design-token-panel-config`. The builder module is
|
|
23
|
-
* zdtp-runtime-free (type-only zdtp imports), which is what lets it stay a
|
|
24
|
-
* STATIC import here without defeating the lazy load — and lets the probe
|
|
25
|
-
* compute the exact active storage prefix before zdtp exists.
|
|
26
|
-
*
|
|
27
|
-
* The current call shape is a mode-scoped builder. It rebuilds the panel per
|
|
28
|
-
* light/dark mode on every `color-scheme-changed` toggle:
|
|
29
|
-
*
|
|
30
|
-
* import { bootstrapDesignTokenPanel } from "@takazudo/zudo-doc/design-token-panel-bootstrap";
|
|
31
|
-
* import { buildDesignTokenPanelConfig } from "@/config/design-token-panel-config";
|
|
32
|
-
* bootstrapDesignTokenPanel(buildDesignTokenPanelConfig);
|
|
33
|
-
*
|
|
34
|
-
* `DesignTokenPanelBootstrap` (below) is the PACKAGE-OWNED island component
|
|
35
|
-
* that wires the mode-scoped builder for every `createChrome` consumer with no
|
|
36
|
-
* host config file — the #2658 "Approach (a)" package default. Since #3396 it
|
|
37
|
-
* binds the package-default builder DIRECTLY
|
|
38
|
-
* (`./design-token-panel-config/index.js`), not the routes plugin's
|
|
39
|
-
* `virtual:zudo-doc-design-token-panel-config` module.
|
|
40
|
-
* `packages/zudo-doc/src/chrome/derive.tsx` statically imports it so zfb's
|
|
41
|
-
* island scanner walks route → chrome → derive → here (mirrors the DocHistory
|
|
42
|
-
* #2480 static-import contract). A host that ejects entirely can call
|
|
43
|
-
* `bootstrapDesignTokenPanel` with its own builder. Package-owned INJECTED
|
|
44
|
-
* routes do not render this component — they render the configured wrapper
|
|
45
|
-
* described below — but every other `createChrome` caller does.
|
|
46
|
-
*
|
|
47
|
-
* COUPLING REMOVED (#3396, epic #3394): this module no longer imports any
|
|
48
|
-
* `virtual:` specifier, so `@takazudo/zudo-doc/chrome` (which reaches here via
|
|
49
|
-
* `chrome/derive.tsx`) bundles OUTSIDE a zfb build with zero shims, and a
|
|
50
|
-
* `packageOwnedRoutes: false` host needs no alias for the config specifier.
|
|
51
|
-
*
|
|
52
|
-
* WHERE THE HOST OVERRIDE ENTERS NOW: `settings.designTokenPanelConfigModule`
|
|
53
|
-
* still travels through `virtual:zudo-doc-design-token-panel-config`, but the
|
|
54
|
-
* ONLY module that imports that specifier is the routes-only wrapper
|
|
55
|
-
* `routes/_design-token-panel-bootstrap.tsx`. It calls
|
|
56
|
-
* {@link runDesignTokenPanelBootstrapOnce} with the resolved builder and is
|
|
57
|
-
* threaded into `hostBindings.DesignTokenPanelBootstrap` by `routes/_chrome.tsx`,
|
|
58
|
-
* so `deriveBodyEndIslands` renders it instead of the package default on
|
|
59
|
-
* injected routes. The wrapper is a component-level seam INSIDE the client
|
|
60
|
-
* island bundle — deliberately NOT a module-level setter: the route/SSR graph
|
|
61
|
-
* and the hydrated island bundle are separate module graphs, so a setter called
|
|
62
|
-
* during route evaluation would configure only the server instance while the
|
|
63
|
-
* client re-evaluated this module and kept the default.
|
|
64
|
-
*
|
|
65
|
-
* SELF-CONTAINED `pages/` STUBS (was a KNOWN GAP in #3396; closed by #3414).
|
|
66
|
-
* A host that renders docs through a self-contained `pages/` stub (the
|
|
67
|
-
* locked-manifest shape, #2653 — it calls `createChrome` directly rather than
|
|
68
|
-
* going through `routes/_chrome.tsx`) reaches the package default here, so
|
|
69
|
-
* `designTokenPanelConfigModule` does not apply to those pages. Because
|
|
70
|
-
* {@link runDesignTokenPanelBootstrapOnce}'s latch is per SESSION, not per
|
|
71
|
-
* page, that used to make the whole SPA session's panel config depend on which
|
|
72
|
-
* page was hard-loaded first (#3406). Two things now bound it:
|
|
73
|
-
*
|
|
74
|
-
* - `chrome/derive.tsx` SKIPS this package default as the slot default when
|
|
75
|
-
* `settings.designTokenPanelConfigModule` is set and the host supplied no
|
|
76
|
-
* explicit `chromeBindings.DesignTokenPanelBootstrap` (and
|
|
77
|
-
* `packageOwnedRoutes` is on). Stub-rendered pages then mount NO panel island
|
|
78
|
-
* at all, so they can no longer win the latch with the wrong builder — the
|
|
79
|
-
* configured island is the genuine first caller whatever the entry page. The
|
|
80
|
-
* absence on stub pages is deliberate; such a host threads its own builder
|
|
81
|
-
* via `chromeBindings.DesignTokenPanelBootstrap` to get a panel there too.
|
|
82
|
-
* - Any residual default-then-configured race that skip does not close warns at
|
|
83
|
-
* runtime, naming both the setting and that workaround — see
|
|
84
|
-
* {@link runDesignTokenPanelBootstrapOnce}.
|
|
85
|
-
*
|
|
86
|
-
* Package-first wiring landed in S9a zudolab/zudo-doc#2333; mode-scoped rebuild
|
|
87
|
-
* wiring was added in zudolab/zudo-doc#2610 and the package-default island in
|
|
88
|
-
* #2658.
|
|
89
|
-
*
|
|
90
|
-
* CSS is pulled via `@import "@takazudo/zdtp/styles.css"` in the project's
|
|
91
|
-
* `src/styles/global.css` so the panel chrome lands in the main page CSS
|
|
92
|
-
* bundle (not a deferred chunk). Vite library mode strips the source CSS
|
|
93
|
-
* import from the emitted JS, so the explicit CSS-side import is the
|
|
94
|
-
* required pull point. See @takazudo/zdtp PORTABLE-CONTRACT.md §7.
|
|
2
|
+
* Public facade for the design-token-panel bootstrap subpath. Callable setup
|
|
3
|
+
* helpers live in the ordinary controller module; the sole island marker is
|
|
4
|
+
* defined in its own `use client` entry.
|
|
95
5
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/** Active color-scheme mode, read from `<html data-theme>`. */
|
|
99
|
-
type ColorSchemeMode = "light" | "dark";
|
|
100
|
-
/**
|
|
101
|
-
* A per-mode PanelConfig factory. The package default and host overrides use
|
|
102
|
-
* this same shape so panel defaults follow the live light/dark mode.
|
|
103
|
-
*/
|
|
104
|
-
export type PanelConfigBuilder = (mode: ColorSchemeMode) => PanelConfig;
|
|
105
|
-
/**
|
|
106
|
-
* Theme-pack storage-prefix rule (ADR theme-packs.md Decision 4), enforced
|
|
107
|
-
* CENTRALLY here — never per-builder, so host builders supplied via
|
|
108
|
-
* `designTokenPanelConfigModule` cannot cross-contaminate namespaces even if
|
|
109
|
-
* unaware of packs:
|
|
110
|
-
*
|
|
111
|
-
* - active pack `default` → the builder's `storagePrefix` stays BYTE-UNCHANGED
|
|
112
|
-
* (the existing-user carry-over guarantee: `zudo-doc-tweak` keys keep
|
|
113
|
-
* working on the stock look).
|
|
114
|
-
* - any other pack → `${storagePrefix}--<slug>` (double hyphen avoids
|
|
115
|
-
* colliding with zdtp's own `-open`/version suffixes). zdtp derives every
|
|
116
|
-
* key — including the `${prefix}-open` open-state mirror — from the prefix,
|
|
117
|
-
* so tweaks saved under pack A are invisible under pack B and restored
|
|
118
|
-
* verbatim on switch-back.
|
|
119
|
-
*
|
|
120
|
-
* The `PanelConfigBuilder` signature stays `(mode) => PanelConfig` — this is a
|
|
121
|
-
* post-process of the RETURNED config, not a builder-contract change.
|
|
122
|
-
*/
|
|
123
|
-
export declare function withPackScopedStoragePrefix(config: PanelConfig, activePack: string): PanelConfig;
|
|
124
|
-
/**
|
|
125
|
-
* Bootstrap zdtp for a project — LAZILY (#3282). At mount this registers the
|
|
126
|
-
* interim toggle listener on both resolved channels (#3315), drains the
|
|
127
|
-
* pre-hydration click queue, and probes localStorage for persisted panel
|
|
128
|
-
* state; the actual
|
|
129
|
-
* `import("@takazudo/zudo-doc/zdtp-loader")` (zdtp's package-owned
|
|
130
|
-
* re-export, #4201) + configure happen on the first toggle (or
|
|
131
|
-
* immediately on a probe hit). The configure body then wires everything the
|
|
132
|
-
* pre-lazy version wired eagerly: `configurePanel` with the pack-scoped
|
|
133
|
-
* mode-config, the `color-scheme-changed` / `theme-pack-changed` rebuild
|
|
134
|
-
* listeners, `reapplyPersistedOverrides`, and the zfb lifecycle adapter via
|
|
135
|
-
* `setLifecycleAdapter`.
|
|
136
|
-
*
|
|
137
|
-
* @param buildConfig - The project's `(mode) => PanelConfig` builder for
|
|
138
|
-
* mode-scoped rebuilds.
|
|
139
|
-
*/
|
|
140
|
-
export declare function bootstrapDesignTokenPanel(buildConfig: PanelConfigBuilder): void;
|
|
141
|
-
/**
|
|
142
|
-
* Which island won the once-latch below (#3414).
|
|
143
|
-
*
|
|
144
|
-
* - `"default"` — the package-default {@link DesignTokenPanelBootstrap}, bound
|
|
145
|
-
* to the package-default builder.
|
|
146
|
-
* - `"configured"` — the routes-only wrapper
|
|
147
|
-
* (`routes/_design-token-panel-bootstrap.tsx`), bound to whatever
|
|
148
|
-
* `virtual:zudo-doc-design-token-panel-config` resolved to (a host's
|
|
149
|
-
* `settings.designTokenPanelConfigModule` when set, the package default
|
|
150
|
-
* otherwise).
|
|
151
|
-
*/
|
|
152
|
-
export type DesignTokenPanelBootstrapOrigin = "default" | "configured";
|
|
153
|
-
/**
|
|
154
|
-
* Run {@link bootstrapDesignTokenPanel} at most once per module instance, with
|
|
155
|
-
* whichever mode-scoped builder the caller supplies.
|
|
156
|
-
*
|
|
157
|
-
* Exists so the routes-only configured wrapper
|
|
158
|
-
* (`routes/_design-token-panel-bootstrap.tsx`, #3396) gets the same one-shot
|
|
159
|
-
* semantics as {@link DesignTokenPanelBootstrap} while supplying the
|
|
160
|
-
* host-overridable builder from `virtual:zudo-doc-design-token-panel-config`.
|
|
161
|
-
* The guard is deliberately shared across both callers: `deriveBodyEndIslands`
|
|
162
|
-
* renders exactly ONE of them, and if a host ever mounted both, configuring the
|
|
163
|
-
* panel twice would re-mount it rather than layer the two configs.
|
|
164
|
-
*
|
|
165
|
-
* `origin` tags WHICH island is calling (#3414). It is optional, defaulting to
|
|
166
|
-
* `"default"`, because this function is reachable from the frozen
|
|
167
|
-
* `./design-token-panel-bootstrap` subpath (API.md) — an added required
|
|
168
|
-
* parameter would break an ejected host that calls it. Both in-package callers
|
|
169
|
-
* pass it explicitly.
|
|
170
|
-
*
|
|
171
|
-
* This is a CALL, not a module-level setter — the builder is passed in at
|
|
172
|
-
* render time inside whichever bundle the island actually hydrates in, so it
|
|
173
|
-
* never has to cross the route-graph → island-bundle boundary.
|
|
174
|
-
*/
|
|
175
|
-
export declare function runDesignTokenPanelBootstrapOnce(build: PanelConfigBuilder, origin?: DesignTokenPanelBootstrapOrigin): void;
|
|
176
|
-
/**
|
|
177
|
-
* The package-default `<DesignTokenPanelBootstrap/>` island: mounted (via
|
|
178
|
-
* `Island({ when: "load" })`, no `ssrFallback` — it renders nothing on either
|
|
179
|
-
* side) by `../doc-body-end-islands/index.tsx` when `settings.designTokenPanel`
|
|
180
|
-
* is on, gated the same way `AiChatModal`/`ImageEnlarge`/`MermaidEnlarge` are.
|
|
181
|
-
* On first render, calls `bootstrapDesignTokenPanel` with the PACKAGE-DEFAULT
|
|
182
|
-
* mode-scoped `buildDesignTokenPanelConfig` builder. A host's
|
|
183
|
-
* `designTokenPanelConfigModule` override does not reach this component — it
|
|
184
|
-
* arrives through the routes-only wrapper described in the module docblock.
|
|
185
|
-
*
|
|
186
|
-
* `displayName` pinned explicitly (belt-and-braces, matching
|
|
187
|
-
* `AiChatModal`/`ImageEnlarge`/`MermaidEnlarge`/`DocHistory`) so zfb's
|
|
188
|
-
* `captureComponentName` emits a stable `data-zfb-island="DesignTokenPanelBootstrap"`
|
|
189
|
-
* marker independent of minification. It MUST keep matching the exported
|
|
190
|
-
* binding identifier — zfb's island scanner registers by the scanner-visible
|
|
191
|
-
* export name and warns when a `displayName` diverges from it.
|
|
192
|
-
*/
|
|
193
|
-
export declare function DesignTokenPanelBootstrap(): JSX.Element | null;
|
|
194
|
-
export declare namespace DesignTokenPanelBootstrap {
|
|
195
|
-
var displayName: string;
|
|
196
|
-
}
|
|
197
|
-
export {};
|
|
6
|
+
export * from "./design-token-panel-bootstrap-controller.js";
|
|
7
|
+
export { DesignTokenPanelBootstrap } from "./design-token-panel-bootstrap-island.js";
|