@takazudo/zudo-doc 5.28.2 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -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/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 +28 -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 +2933 -2943
- 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 +70 -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 +1 -2
- package/dist/header-with-defaults/index.js +18 -8
- 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/index.d.ts +1 -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-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/index.ts +1 -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
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Fragment, jsx, jsxs } from "
|
|
3
|
-
import {
|
|
2
|
+
import { Fragment, jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
3
|
+
import { computed, For, getScope, Show, signal } from "@takazudo/zfb/zudo-react";
|
|
4
4
|
import { SmartBreak } from "../smart-break/index.js";
|
|
5
5
|
import { History, Close, ArrowLeft } from "../icons/index.js";
|
|
6
6
|
import { AFTER_NAVIGATE_EVENT } from "../transitions/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { modalDialog } from "../use-modal-dialog/index.js";
|
|
8
8
|
import { formatDate } from "../format-date/index.js";
|
|
9
9
|
function Spinner() {
|
|
10
|
-
return /* @__PURE__ */ jsx("div", {
|
|
10
|
+
return /* @__PURE__ */ jsx("div", { class: "flex items-center justify-center py-vsp-xl", children: /* @__PURE__ */ jsx(
|
|
11
11
|
"span",
|
|
12
12
|
{
|
|
13
|
-
|
|
13
|
+
class: "inline-block box-border rounded-full page-loading-spinner",
|
|
14
14
|
style: {
|
|
15
|
-
width:
|
|
16
|
-
height:
|
|
15
|
+
width: "48px",
|
|
16
|
+
height: "48px",
|
|
17
17
|
border: "5px solid var(--color-fg, #fff)",
|
|
18
|
-
|
|
18
|
+
"border-bottom-color": "transparent"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
) });
|
|
@@ -87,7 +87,7 @@ function buildSideBySideRows(changes) {
|
|
|
87
87
|
}
|
|
88
88
|
const DIFF_CACHE_LIMIT = 32;
|
|
89
89
|
const diffCache = /* @__PURE__ */ new Map();
|
|
90
|
-
async function getCachedDiff(olderHash, newerHash, olderContent, newerContent) {
|
|
90
|
+
async function getCachedDiff(olderHash, newerHash, olderContent, newerContent, isCurrent) {
|
|
91
91
|
const key = `${olderHash}::${newerHash}`;
|
|
92
92
|
const hit = diffCache.get(key);
|
|
93
93
|
if (hit) {
|
|
@@ -101,6 +101,7 @@ async function getCachedDiff(olderHash, newerHash, olderContent, newerContent) {
|
|
|
101
101
|
throw new Error('Compare requires the optional peer "diff": install it to use docHistory');
|
|
102
102
|
}
|
|
103
103
|
);
|
|
104
|
+
if (!isCurrent()) throw new Error("Comparison cancelled");
|
|
104
105
|
const changes = diffLines(olderContent, newerContent);
|
|
105
106
|
diffCache.set(key, changes);
|
|
106
107
|
if (diffCache.size > DIFF_CACHE_LIMIT) {
|
|
@@ -114,70 +115,72 @@ function DiffViewer({
|
|
|
114
115
|
onBack,
|
|
115
116
|
showBackButton
|
|
116
117
|
}) {
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const scope = getScope();
|
|
119
|
+
const changes = signal(null);
|
|
120
|
+
const diffError = signal(null);
|
|
121
|
+
const tableRevision = signal(0);
|
|
122
|
+
scope.onActivate(() => {
|
|
120
123
|
let cancelled = false;
|
|
121
|
-
setDiffError(null);
|
|
122
124
|
getCachedDiff(
|
|
123
125
|
selection.older.hash,
|
|
124
126
|
selection.newer.hash,
|
|
125
127
|
selection.older.content,
|
|
126
|
-
selection.newer.content
|
|
128
|
+
selection.newer.content,
|
|
129
|
+
() => !cancelled && !scope.abortSignal.aborted
|
|
127
130
|
).then((result) => {
|
|
128
|
-
if (!cancelled)
|
|
131
|
+
if (!cancelled && !scope.abortSignal.aborted) {
|
|
132
|
+
changes.value = result;
|
|
133
|
+
tableRevision.value++;
|
|
134
|
+
}
|
|
129
135
|
}).catch((e) => {
|
|
130
|
-
if (!cancelled) {
|
|
131
|
-
|
|
136
|
+
if (!cancelled && !scope.abortSignal.aborted) {
|
|
137
|
+
diffError.value = e instanceof Error ? e.message : "Failed to compute diff";
|
|
132
138
|
}
|
|
133
139
|
});
|
|
134
140
|
return () => {
|
|
135
141
|
cancelled = true;
|
|
136
142
|
};
|
|
137
|
-
}
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
[
|
|
141
|
-
);
|
|
142
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
|
|
143
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-hsp-sm px-hsp-lg py-vsp-xs border-b border-muted", children: [
|
|
143
|
+
});
|
|
144
|
+
const tableSnapshots = computed(() => changes.value ? [{ revision: tableRevision.value, rows: buildSideBySideRows(changes.value) }] : []);
|
|
145
|
+
return /* @__PURE__ */ jsxs("div", { class: "flex flex-col h-full", children: [
|
|
146
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-center gap-hsp-sm px-hsp-lg py-vsp-xs border-b border-muted", children: [
|
|
144
147
|
showBackButton && /* @__PURE__ */ jsx(
|
|
145
148
|
"button",
|
|
146
149
|
{
|
|
147
150
|
type: "button",
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
"on:click": onBack,
|
|
152
|
+
class: "text-muted hover:text-fg lg:hidden",
|
|
150
153
|
"aria-label": "Back to revisions",
|
|
151
|
-
children: /* @__PURE__ */ jsx(ArrowLeft, {
|
|
154
|
+
children: /* @__PURE__ */ jsx(ArrowLeft, { class: "h-icon-sm w-icon-sm" })
|
|
152
155
|
}
|
|
153
156
|
),
|
|
154
|
-
/* @__PURE__ */ jsxs("div", {
|
|
155
|
-
/* @__PURE__ */ jsx("div", {
|
|
156
|
-
/* @__PURE__ */ jsx("div", {
|
|
157
|
+
/* @__PURE__ */ jsxs("div", { class: "flex-1 min-w-0 flex", children: [
|
|
158
|
+
/* @__PURE__ */ jsx("div", { class: "w-1/2 text-small text-muted font-mono truncate pr-hsp-sm", children: selection.older.hash.slice(0, 7) }),
|
|
159
|
+
/* @__PURE__ */ jsx("div", { class: "w-1/2 text-small text-muted font-mono truncate pl-hsp-sm", children: selection.newer.hash.slice(0, 7) })
|
|
157
160
|
] })
|
|
158
161
|
] }),
|
|
159
|
-
diffError
|
|
160
|
-
!changes && !diffError
|
|
161
|
-
/* @__PURE__ */ jsx("div", {
|
|
162
|
+
/* @__PURE__ */ jsx(Show, { when: computed(() => diffError.value !== null), children: () => /* @__PURE__ */ jsx("div", { class: "px-hsp-lg py-vsp-lg text-danger text-small", children: diffError }) }),
|
|
163
|
+
/* @__PURE__ */ jsx(Show, { when: computed(() => !changes.value && !diffError.value), children: () => /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
164
|
+
/* @__PURE__ */ jsx("div", { class: computed(() => `flex-1 overflow-auto${!changes.value ? " hidden" : ""}`), children: /* @__PURE__ */ jsx(For, { each: tableSnapshots, by: (snapshot) => snapshot.revision, children: (snapshot) => /* @__PURE__ */ jsxs("table", { class: "w-full border-collapse", style: { "table-layout": "fixed" }, children: [
|
|
162
165
|
/* @__PURE__ */ jsxs("colgroup", { children: [
|
|
163
166
|
/* @__PURE__ */ jsx("col", { style: { width: "2.5rem" } }),
|
|
164
167
|
/* @__PURE__ */ jsx("col", {}),
|
|
165
168
|
/* @__PURE__ */ jsx("col", { style: { width: "2.5rem" } }),
|
|
166
169
|
/* @__PURE__ */ jsx("col", {})
|
|
167
170
|
] }),
|
|
168
|
-
/* @__PURE__ */ jsx("tbody", { children: rows.map((row
|
|
171
|
+
/* @__PURE__ */ jsx("tbody", { children: snapshot.value.rows.map((row) => {
|
|
169
172
|
const leftBg = row.type === "removed" || row.type === "changed" ? "diff-line-removed" : "";
|
|
170
173
|
const rightBg = row.type === "added" || row.type === "changed" ? "diff-line-added" : "";
|
|
171
174
|
const leftEmpty = row.leftLine === null;
|
|
172
175
|
const rightEmpty = row.rightLine === null;
|
|
173
|
-
return /* @__PURE__ */ jsxs("tr", {
|
|
174
|
-
/* @__PURE__ */ jsx("td", {
|
|
175
|
-
/* @__PURE__ */ jsx("td", {
|
|
176
|
-
/* @__PURE__ */ jsx("td", {
|
|
177
|
-
/* @__PURE__ */ jsx("td", {
|
|
178
|
-
] }
|
|
176
|
+
return /* @__PURE__ */ jsxs("tr", { class: "diff-row", children: [
|
|
177
|
+
/* @__PURE__ */ jsx("td", { class: `diff-line-num ${leftBg}`, children: row.leftNum ?? "" }),
|
|
178
|
+
/* @__PURE__ */ jsx("td", { class: `diff-line-content ${leftBg}${leftEmpty ? " diff-line-empty" : ""}`, children: row.leftLine ?? "" }),
|
|
179
|
+
/* @__PURE__ */ jsx("td", { class: `diff-line-num ${rightBg}`, children: row.rightNum ?? "" }),
|
|
180
|
+
/* @__PURE__ */ jsx("td", { class: `diff-line-content ${rightBg}${rightEmpty ? " diff-line-empty" : ""}`, children: row.rightLine ?? "" })
|
|
181
|
+
] });
|
|
179
182
|
}) })
|
|
180
|
-
] }) })
|
|
183
|
+
] }) }) })
|
|
181
184
|
] });
|
|
182
185
|
}
|
|
183
186
|
function RevisionList({
|
|
@@ -186,16 +189,17 @@ function RevisionList({
|
|
|
186
189
|
displayLocale,
|
|
187
190
|
dateFormats
|
|
188
191
|
}) {
|
|
189
|
-
const
|
|
190
|
-
const
|
|
192
|
+
const revisionEntries = signal(entries);
|
|
193
|
+
const selectedA = signal(1);
|
|
194
|
+
const selectedB = signal(0);
|
|
191
195
|
if (entries.length === 0) {
|
|
192
|
-
return /* @__PURE__ */ jsx("div", {
|
|
196
|
+
return /* @__PURE__ */ jsx("div", { class: "px-hsp-lg py-vsp-lg text-muted text-small", children: "No revision history available." });
|
|
193
197
|
}
|
|
194
|
-
const canCompare = selectedA !== selectedB && selectedA >= 0 && selectedB >= 0 && selectedA < entries.length && selectedB < entries.length;
|
|
198
|
+
const canCompare = computed(() => selectedA.value !== selectedB.value && selectedA.value >= 0 && selectedB.value >= 0 && selectedA.value < entries.length && selectedB.value < entries.length);
|
|
195
199
|
function handleCompare() {
|
|
196
|
-
if (!canCompare) return;
|
|
197
|
-
const idxOlder = Math.max(selectedA, selectedB);
|
|
198
|
-
const idxNewer = Math.min(selectedA, selectedB);
|
|
200
|
+
if (!canCompare.value) return;
|
|
201
|
+
const idxOlder = Math.max(selectedA.value, selectedB.value);
|
|
202
|
+
const idxNewer = Math.min(selectedA.value, selectedB.value);
|
|
199
203
|
const olderEntry = entries[idxOlder];
|
|
200
204
|
const newerEntry = entries[idxNewer];
|
|
201
205
|
if (!olderEntry || !newerEntry) return;
|
|
@@ -204,41 +208,49 @@ function RevisionList({
|
|
|
204
208
|
newer: newerEntry
|
|
205
209
|
});
|
|
206
210
|
}
|
|
207
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
208
|
-
entries.length >= 2 && /* @__PURE__ */ jsxs("div", {
|
|
211
|
+
return /* @__PURE__ */ jsxs("div", { class: "flex flex-col h-full", children: [
|
|
212
|
+
entries.length >= 2 && /* @__PURE__ */ jsxs("div", { class: "px-hsp-lg py-vsp-xs border-b border-muted flex items-center gap-hsp-sm", children: [
|
|
209
213
|
/* @__PURE__ */ jsx(
|
|
210
214
|
"button",
|
|
211
215
|
{
|
|
212
216
|
type: "button",
|
|
213
|
-
disabled: !canCompare,
|
|
214
|
-
|
|
215
|
-
|
|
217
|
+
disabled: computed(() => !canCompare.value),
|
|
218
|
+
"on:click": handleCompare,
|
|
219
|
+
class: computed(
|
|
220
|
+
() => canCompare.value ? "px-hsp-md py-vsp-2xs text-small rounded bg-accent text-bg hover:bg-accent-hover" : "px-hsp-md py-vsp-2xs text-small rounded bg-surface text-muted cursor-not-allowed"
|
|
221
|
+
),
|
|
216
222
|
children: "Compare"
|
|
217
223
|
}
|
|
218
224
|
),
|
|
219
|
-
/* @__PURE__ */ jsx("span", {
|
|
225
|
+
/* @__PURE__ */ jsx("span", { class: "text-caption text-muted", children: "Select two revisions (A / B)" })
|
|
220
226
|
] }),
|
|
221
|
-
/* @__PURE__ */ jsx("div", {
|
|
222
|
-
const isA = selectedA === idx;
|
|
223
|
-
const isB = selectedB === idx;
|
|
227
|
+
/* @__PURE__ */ jsx("div", { class: "flex-1 overflow-auto", children: /* @__PURE__ */ jsx(For, { each: revisionEntries, by: (entry) => entry.hash, children: (entry, idx) => {
|
|
228
|
+
const isA = computed(() => selectedA.value === idx.value);
|
|
229
|
+
const isB = computed(() => selectedB.value === idx.value);
|
|
224
230
|
const dateStr = formatDate(
|
|
225
|
-
entry.date,
|
|
231
|
+
entry.value.date,
|
|
226
232
|
displayLocale ?? "en",
|
|
227
233
|
dateFormats?.full
|
|
228
234
|
);
|
|
229
235
|
return /* @__PURE__ */ jsx(
|
|
230
236
|
"div",
|
|
231
237
|
{
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
238
|
+
class: computed(
|
|
239
|
+
() => isA.value || isB.value ? "px-hsp-lg py-vsp-xs border-b border-muted bg-surface" : "px-hsp-lg py-vsp-xs border-b border-muted hover:bg-surface"
|
|
240
|
+
),
|
|
241
|
+
children: /* @__PURE__ */ jsxs("div", { class: "flex items-start gap-hsp-sm", children: [
|
|
242
|
+
entries.length >= 2 && /* @__PURE__ */ jsxs("div", { class: "flex flex-col gap-vsp-2xs pt-[2px] shrink-0", children: [
|
|
235
243
|
/* @__PURE__ */ jsx(
|
|
236
244
|
"button",
|
|
237
245
|
{
|
|
238
246
|
type: "button",
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
247
|
+
"on:click": () => {
|
|
248
|
+
selectedA.value = idx.value;
|
|
249
|
+
},
|
|
250
|
+
class: computed(
|
|
251
|
+
() => isA.value ? "w-[1.5rem] h-[1.25rem] text-caption rounded flex items-center justify-center bg-accent text-bg" : "w-[1.5rem] h-[1.25rem] text-caption rounded flex items-center justify-center border border-muted text-muted hover:border-fg hover:text-fg"
|
|
252
|
+
),
|
|
253
|
+
"aria-label": `Select revision ${entry.value.hash.slice(0, 7)} as A`,
|
|
242
254
|
children: "A"
|
|
243
255
|
}
|
|
244
256
|
),
|
|
@@ -246,26 +258,29 @@ function RevisionList({
|
|
|
246
258
|
"button",
|
|
247
259
|
{
|
|
248
260
|
type: "button",
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
261
|
+
"on:click": () => {
|
|
262
|
+
selectedB.value = idx.value;
|
|
263
|
+
},
|
|
264
|
+
class: computed(
|
|
265
|
+
() => isB.value ? "w-[1.5rem] h-[1.25rem] text-caption rounded flex items-center justify-center bg-accent text-bg" : "w-[1.5rem] h-[1.25rem] text-caption rounded flex items-center justify-center border border-muted text-muted hover:border-fg hover:text-fg"
|
|
266
|
+
),
|
|
267
|
+
"aria-label": `Select revision ${entry.value.hash.slice(0, 7)} as B`,
|
|
252
268
|
children: "B"
|
|
253
269
|
}
|
|
254
270
|
)
|
|
255
271
|
] }),
|
|
256
|
-
/* @__PURE__ */ jsxs("div", {
|
|
257
|
-
/* @__PURE__ */ jsxs("div", {
|
|
258
|
-
/* @__PURE__ */ jsx("code", {
|
|
259
|
-
/* @__PURE__ */ jsx("span", {
|
|
272
|
+
/* @__PURE__ */ jsxs("div", { class: "min-w-0 flex-1", children: [
|
|
273
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-baseline gap-hsp-sm", children: [
|
|
274
|
+
/* @__PURE__ */ jsx("code", { class: "text-caption text-accent font-mono", children: entry.value.hash.slice(0, 7) }),
|
|
275
|
+
/* @__PURE__ */ jsx("span", { class: "text-caption text-muted", children: dateStr })
|
|
260
276
|
] }),
|
|
261
|
-
/* @__PURE__ */ jsx("div", {
|
|
262
|
-
/* @__PURE__ */ jsx("div", {
|
|
277
|
+
/* @__PURE__ */ jsx("div", { class: "text-small text-fg mt-vsp-2xs truncate", children: /* @__PURE__ */ jsx(SmartBreak, { children: entry.value.message }) }),
|
|
278
|
+
/* @__PURE__ */ jsx("div", { class: "text-caption text-muted", children: entry.value.author })
|
|
263
279
|
] })
|
|
264
280
|
] })
|
|
265
|
-
}
|
|
266
|
-
entry.hash
|
|
281
|
+
}
|
|
267
282
|
);
|
|
268
|
-
}) })
|
|
283
|
+
} }) })
|
|
269
284
|
] });
|
|
270
285
|
}
|
|
271
286
|
function DocHistory({
|
|
@@ -275,67 +290,81 @@ function DocHistory({
|
|
|
275
290
|
displayLocale,
|
|
276
291
|
dateFormats
|
|
277
292
|
}) {
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
const
|
|
281
|
-
const
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const returnFocusRef = useRef(null);
|
|
293
|
+
const scope = getScope();
|
|
294
|
+
const view = signal("closed");
|
|
295
|
+
const data = signal(null);
|
|
296
|
+
const loading = signal(false);
|
|
297
|
+
const error = signal(null);
|
|
298
|
+
const diffSelection = signal(null);
|
|
299
|
+
const returnFocusRef = { current: null };
|
|
286
300
|
const base = basePath.replace(/\/+$/, "");
|
|
287
301
|
const historySlug = slug === "" ? "index" : slug;
|
|
288
302
|
const fetchPath = locale ? `${base}/doc-history/${locale}/${historySlug}.json` : `${base}/doc-history/${historySlug}.json`;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
303
|
+
let fetchController = null;
|
|
304
|
+
let fetchRun = 0;
|
|
305
|
+
const fetchHistory = async () => {
|
|
306
|
+
if (data.value || loading.value) return;
|
|
307
|
+
fetchController?.abort();
|
|
308
|
+
const controller = new AbortController();
|
|
309
|
+
fetchController = controller;
|
|
310
|
+
const run = ++fetchRun;
|
|
311
|
+
loading.value = true;
|
|
312
|
+
error.value = null;
|
|
293
313
|
try {
|
|
294
|
-
const res = await fetch(fetchPath);
|
|
314
|
+
const res = await fetch(fetchPath, { signal: controller.signal });
|
|
315
|
+
if (controller.signal.aborted || scope.abortSignal.aborted || run !== fetchRun) return;
|
|
295
316
|
if (!res.ok) {
|
|
296
317
|
throw new Error(`Failed to load history (${res.status})`);
|
|
297
318
|
}
|
|
298
319
|
const json = await res.json();
|
|
320
|
+
if (controller.signal.aborted || scope.abortSignal.aborted || run !== fetchRun) return;
|
|
299
321
|
if (!json || !Array.isArray(json.entries)) {
|
|
300
322
|
throw new Error("Malformed history response");
|
|
301
323
|
}
|
|
302
|
-
|
|
324
|
+
data.value = json;
|
|
303
325
|
} catch (e) {
|
|
304
|
-
|
|
326
|
+
if (!controller.signal.aborted && !scope.abortSignal.aborted && run === fetchRun)
|
|
327
|
+
error.value = e instanceof Error ? e.message : "Failed to load history";
|
|
305
328
|
} finally {
|
|
306
|
-
|
|
329
|
+
if (!scope.abortSignal.aborted && run === fetchRun) loading.value = false;
|
|
307
330
|
}
|
|
308
|
-
}
|
|
331
|
+
};
|
|
332
|
+
scope.onActivate(() => () => {
|
|
333
|
+
fetchController?.abort();
|
|
334
|
+
fetchRun++;
|
|
335
|
+
});
|
|
309
336
|
function handleOpen(e) {
|
|
310
337
|
returnFocusRef.current = e.currentTarget;
|
|
311
|
-
|
|
312
|
-
fetchHistory();
|
|
338
|
+
view.value = "revisions";
|
|
339
|
+
void fetchHistory();
|
|
313
340
|
}
|
|
314
|
-
const handleClose =
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
341
|
+
const handleClose = () => {
|
|
342
|
+
view.value = "closed";
|
|
343
|
+
diffSelection.value = null;
|
|
344
|
+
fetchController?.abort();
|
|
345
|
+
fetchRun++;
|
|
346
|
+
loading.value = false;
|
|
347
|
+
};
|
|
318
348
|
function handleSelectDiff(selection) {
|
|
319
|
-
|
|
320
|
-
|
|
349
|
+
diffSelection.value = selection;
|
|
350
|
+
view.value = "diff";
|
|
321
351
|
}
|
|
322
352
|
function handleBackToRevisions() {
|
|
323
|
-
|
|
324
|
-
|
|
353
|
+
diffSelection.value = null;
|
|
354
|
+
view.value = "revisions";
|
|
325
355
|
}
|
|
326
|
-
|
|
327
|
-
if (view
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
document.body.style.overflow = "";
|
|
331
|
-
}
|
|
356
|
+
scope.effect(() => {
|
|
357
|
+
if (view.value === "closed") return;
|
|
358
|
+
const previousOverflow = document.body.style.overflow;
|
|
359
|
+
document.body.style.overflow = "hidden";
|
|
332
360
|
return () => {
|
|
333
|
-
document.body.style.overflow =
|
|
361
|
+
document.body.style.overflow = previousOverflow;
|
|
334
362
|
};
|
|
335
|
-
}
|
|
336
|
-
const isOpen = view !== "closed";
|
|
337
|
-
const hasDiff = view === "diff" && diffSelection;
|
|
338
|
-
const {
|
|
363
|
+
});
|
|
364
|
+
const isOpen = computed(() => view.value !== "closed");
|
|
365
|
+
const hasDiff = computed(() => view.value === "diff" && diffSelection.value !== null);
|
|
366
|
+
const diffPairs = computed(() => diffSelection.value && view.value === "diff" ? [{ key: `${diffSelection.value.older.hash}:${diffSelection.value.newer.hash}`, selection: diffSelection.value }] : []);
|
|
367
|
+
const { dialogRef } = modalDialog(scope, {
|
|
339
368
|
isOpen,
|
|
340
369
|
onClose: handleClose,
|
|
341
370
|
navigateEvent: AFTER_NAVIGATE_EVENT,
|
|
@@ -343,16 +372,17 @@ function DocHistory({
|
|
|
343
372
|
returnFocusRef
|
|
344
373
|
});
|
|
345
374
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
346
|
-
/* @__PURE__ */ jsx("div", {
|
|
375
|
+
/* @__PURE__ */ jsx("div", { class: "flex justify-end mt-vsp-xl", children: /* @__PURE__ */ jsxs(
|
|
347
376
|
"button",
|
|
348
377
|
{
|
|
349
378
|
type: "button",
|
|
350
|
-
|
|
351
|
-
|
|
379
|
+
"on:click": handleOpen,
|
|
380
|
+
"data-doc-history-trigger": "",
|
|
381
|
+
class: "flex items-center gap-hsp-xs px-hsp-md py-vsp-xs rounded-lg bg-surface border border-muted text-muted hover:text-accent hover:border-accent focus-visible:text-accent focus-visible:border-accent transition-colors duration-0",
|
|
352
382
|
"aria-label": "View document history",
|
|
353
383
|
children: [
|
|
354
|
-
/* @__PURE__ */ jsx(History, {
|
|
355
|
-
/* @__PURE__ */ jsx("span", {
|
|
384
|
+
/* @__PURE__ */ jsx(History, { class: "h-icon-md w-icon-md" }),
|
|
385
|
+
/* @__PURE__ */ jsx("span", { class: "text-small", children: "History" })
|
|
356
386
|
]
|
|
357
387
|
}
|
|
358
388
|
) }),
|
|
@@ -361,34 +391,37 @@ function DocHistory({
|
|
|
361
391
|
{
|
|
362
392
|
ref: dialogRef,
|
|
363
393
|
"aria-label": "Document revision history",
|
|
364
|
-
|
|
394
|
+
"data-doc-history-panel": "",
|
|
395
|
+
class: "z-modal fixed inset-0 m-0 h-full w-full max-h-full max-w-full bg-bg border-none p-0 backdrop:z-modal-backdrop backdrop:bg-bg/30",
|
|
365
396
|
style: { color: "var(--color-fg)" },
|
|
366
397
|
children: [
|
|
367
|
-
/* @__PURE__ */ jsxs("div", {
|
|
368
|
-
/* @__PURE__ */ jsx("h2", {
|
|
398
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-center justify-between px-hsp-lg py-vsp-xs border-b border-muted", children: [
|
|
399
|
+
/* @__PURE__ */ jsx("h2", { class: "text-body font-semibold text-fg", children: computed(() => view.value === "diff" ? "Diff" : "Revision History") }),
|
|
369
400
|
/* @__PURE__ */ jsx(
|
|
370
401
|
"button",
|
|
371
402
|
{
|
|
372
403
|
type: "button",
|
|
373
|
-
|
|
374
|
-
|
|
404
|
+
"on:click": handleClose,
|
|
405
|
+
class: "text-muted hover:text-fg",
|
|
375
406
|
"aria-label": "Close history panel",
|
|
376
|
-
children: /* @__PURE__ */ jsx(Close, {
|
|
407
|
+
children: /* @__PURE__ */ jsx(Close, { class: "h-icon-md w-icon-md" })
|
|
377
408
|
}
|
|
378
409
|
)
|
|
379
410
|
] }),
|
|
380
|
-
/* @__PURE__ */ jsxs("div", {
|
|
381
|
-
loading
|
|
382
|
-
error
|
|
383
|
-
!loading && !error && data
|
|
411
|
+
/* @__PURE__ */ jsxs("div", { class: "h-[calc(100%_-_3rem)] overflow-hidden", children: [
|
|
412
|
+
/* @__PURE__ */ jsx(Show, { when: loading, children: () => /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
413
|
+
/* @__PURE__ */ jsx(Show, { when: computed(() => error.value !== null), children: () => /* @__PURE__ */ jsx("div", { class: "px-hsp-lg py-vsp-lg text-danger text-small", children: error }) }),
|
|
414
|
+
/* @__PURE__ */ jsx(Show, { when: computed(() => !loading.value && !error.value && data.value !== null), children: () => /* @__PURE__ */ jsxs("div", { class: "flex h-full", children: [
|
|
384
415
|
/* @__PURE__ */ jsx(
|
|
385
416
|
"div",
|
|
386
417
|
{
|
|
387
|
-
|
|
418
|
+
class: computed(
|
|
419
|
+
() => hasDiff.value ? "hidden lg:flex lg:flex-col lg:w-[clamp(16rem,25%,22rem)] shrink-0 border-r border-muted h-full" : "flex flex-col w-full h-full"
|
|
420
|
+
),
|
|
388
421
|
children: /* @__PURE__ */ jsx(
|
|
389
422
|
RevisionList,
|
|
390
423
|
{
|
|
391
|
-
entries: data.entries,
|
|
424
|
+
entries: data.value.entries,
|
|
392
425
|
onSelectDiff: handleSelectDiff,
|
|
393
426
|
displayLocale,
|
|
394
427
|
dateFormats
|
|
@@ -396,16 +429,8 @@ function DocHistory({
|
|
|
396
429
|
)
|
|
397
430
|
}
|
|
398
431
|
),
|
|
399
|
-
hasDiff
|
|
400
|
-
|
|
401
|
-
{
|
|
402
|
-
selection: diffSelection,
|
|
403
|
-
onBack: handleBackToRevisions,
|
|
404
|
-
showBackButton: true
|
|
405
|
-
},
|
|
406
|
-
`${diffSelection.older.hash}:${diffSelection.newer.hash}`
|
|
407
|
-
) })
|
|
408
|
-
] })
|
|
432
|
+
/* @__PURE__ */ jsx(Show, { when: hasDiff, children: () => /* @__PURE__ */ jsx("div", { class: "flex-1 min-w-0 h-full", children: /* @__PURE__ */ jsx(For, { each: diffPairs, by: (pair) => pair.key, children: (pair) => /* @__PURE__ */ jsx(DiffViewer, { selection: pair.value.selection, onBack: handleBackToRevisions, showBackButton: true }) }) }) })
|
|
433
|
+
] }) })
|
|
409
434
|
] })
|
|
410
435
|
]
|
|
411
436
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
|
-
|
|
3
|
-
import type { VNode } from "preact";
|
|
2
|
+
import type { Child, Description } from "@takazudo/zfb/zudo-react";
|
|
4
3
|
import type { ChromeContext } from "../factory-context/index.js";
|
|
5
4
|
import type { ResolvedDateFormats, Settings } from "../settings.js";
|
|
6
5
|
/** Per-entry metadata shape from the doc-history manifest. */
|
|
@@ -27,12 +26,13 @@ export interface DocHistoryAreaSettings {
|
|
|
27
26
|
* Must match the interface of `@takazudo/zudo-doc/doc-history`'s DocHistory.
|
|
28
27
|
*/
|
|
29
28
|
export type DocHistoryComponent = (props: {
|
|
29
|
+
ssrFallback?: Child;
|
|
30
30
|
slug: string;
|
|
31
31
|
locale?: string;
|
|
32
32
|
basePath?: string;
|
|
33
33
|
displayLocale?: string;
|
|
34
34
|
dateFormats?: ResolvedDateFormats;
|
|
35
|
-
}) =>
|
|
35
|
+
}) => Description;
|
|
36
36
|
export interface DocHistoryAreaProps {
|
|
37
37
|
/** Page slug, e.g. "getting-started/intro". */
|
|
38
38
|
slug: string;
|
|
@@ -77,4 +77,6 @@ export interface DocHistoryAreaProps {
|
|
|
77
77
|
* DocHistory island is a HOST-bound slot (`ctx.hostBindings.DocHistory`,
|
|
78
78
|
* default: a no-op stub rendering an empty fragment).
|
|
79
79
|
*/
|
|
80
|
-
export declare function createDocHistoryArea<S extends Settings = Settings>(ctx: ChromeContext<S>): (props: DocHistoryAreaProps) =>
|
|
80
|
+
export declare function createDocHistoryArea<S extends Settings = Settings>(ctx: ChromeContext<S>): (props: DocHistoryAreaProps) => Child;
|
|
81
|
+
/** Server-only fixed-target boundary. The fallback never crosses island JSON props. */
|
|
82
|
+
export declare function DocHistoryBoundary({ ssrFallback, ...props }: Parameters<DocHistoryComponent>[0]): Description;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx, jsxs } from "
|
|
1
|
+
import { Fragment, jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
2
2
|
import { Island } from "@takazudo/zfb";
|
|
3
|
+
import { DocHistory as DocHistoryClient } from "../doc-history/index.js";
|
|
3
4
|
import { compileExclude } from "../doc-history-exclude/index.js";
|
|
4
5
|
import { BodyFootUtilArea } from "../body-foot-util/index.js";
|
|
5
6
|
import { toHistorySlug } from "../slug/index.js";
|
|
@@ -20,7 +21,6 @@ function createDocHistoryArea(ctx) {
|
|
|
20
21
|
);
|
|
21
22
|
const DocHistory = deriveDocHistorySlot(ctx);
|
|
22
23
|
const dateFormatsFor = deriveDateFormats(ctx);
|
|
23
|
-
DocHistory.displayName = "DocHistory";
|
|
24
24
|
function DocHistoryArea({
|
|
25
25
|
slug,
|
|
26
26
|
locale,
|
|
@@ -57,20 +57,17 @@ function createDocHistoryArea(ctx) {
|
|
|
57
57
|
updatedDate ? `: ${updatedDate}` : ""
|
|
58
58
|
] })
|
|
59
59
|
] });
|
|
60
|
-
const docHistoryIsland = showDocHistoryUi ?
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
}) : null;
|
|
60
|
+
const docHistoryIsland = showDocHistoryUi ? /* @__PURE__ */ jsx(
|
|
61
|
+
DocHistory,
|
|
62
|
+
{
|
|
63
|
+
ssrFallback: fallback,
|
|
64
|
+
slug: historySlug,
|
|
65
|
+
...docHistoryLocale !== void 0 ? { locale: docHistoryLocale } : {},
|
|
66
|
+
basePath: docHistoryBasePath,
|
|
67
|
+
displayLocale: docHistoryDisplayLocale,
|
|
68
|
+
dateFormats: docHistoryDateFormats
|
|
69
|
+
}
|
|
70
|
+
) : null;
|
|
74
71
|
void historyLabel;
|
|
75
72
|
const utilSettings = settings.bodyFootUtilArea;
|
|
76
73
|
const sourceExt = meta ? meta.ext : sourceFileExt;
|
|
@@ -87,6 +84,10 @@ function createDocHistoryArea(ctx) {
|
|
|
87
84
|
}
|
|
88
85
|
return DocHistoryArea;
|
|
89
86
|
}
|
|
87
|
+
function DocHistoryBoundary({ ssrFallback, ...props }) {
|
|
88
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Island, { when: "idle", ssrFallback, children: /* @__PURE__ */ jsx(DocHistoryClient, { ...props }) }) });
|
|
89
|
+
}
|
|
90
90
|
export {
|
|
91
|
+
DocHistoryBoundary,
|
|
91
92
|
createDocHistoryArea
|
|
92
93
|
};
|
|
@@ -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 { ChromeContext } from "../factory-context/index.js";
|
|
5
4
|
import type { Settings } from "../settings.js";
|
|
6
5
|
/** Per-entry metadata shape from the doc-history manifest. */
|
|
@@ -40,4 +39,4 @@ export interface DocMetainfoAreaProps {
|
|
|
40
39
|
* package slug helper; the per-page git-history manifest is a HOST-bound slot
|
|
41
40
|
* (`ctx.hostBindings.docHistoryMeta`, default `{}` → no Created/Updated block).
|
|
42
41
|
*/
|
|
43
|
-
export declare function createDocMetainfoArea<S extends Settings = Settings>(ctx: ChromeContext<S>): (props: DocMetainfoAreaProps) =>
|
|
42
|
+
export declare function createDocMetainfoArea<S extends Settings = Settings>(ctx: ChromeContext<S>): (props: DocMetainfoAreaProps) => Child;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
2
2
|
import { DocMetainfo } from "../metainfo/index.js";
|
|
3
3
|
import { toHistorySlug } from "../slug/index.js";
|
|
4
4
|
import { assertChromeContext } from "../chrome/assert-chrome-context.js";
|