@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
package/dist/home-page/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "
|
|
2
|
-
import { Fragment as Fragment2 } from "preact";
|
|
1
|
+
import { Fragment, jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
3
2
|
import { Island } from "@takazudo/zfb";
|
|
4
3
|
import { AutoLogo } from "../auto-logo/index.js";
|
|
5
4
|
import { DocLayoutWithDefaults } from "../doclayout/index.js";
|
|
@@ -23,7 +22,7 @@ function HomeMetaLink({ href, children }) {
|
|
|
23
22
|
href,
|
|
24
23
|
class: "group inline-flex items-center gap-hsp-xs text-small text-fg hover:text-accent hover:underline focus-visible:text-accent focus-visible:underline",
|
|
25
24
|
children: [
|
|
26
|
-
/* @__PURE__ */ jsx(CategoryLinkIcon, {
|
|
25
|
+
/* @__PURE__ */ jsx(CategoryLinkIcon, { class: "w-icon-sm text-muted group-hover:text-accent group-focus-visible:text-accent" }),
|
|
27
26
|
/* @__PURE__ */ jsx("span", { children })
|
|
28
27
|
]
|
|
29
28
|
}
|
|
@@ -52,6 +51,10 @@ function selectSecondaryNodes(tree, secondary, categoryIgnore) {
|
|
|
52
51
|
function cssUrl(url) {
|
|
53
52
|
return `url("${url.replace(/[\\"]/g, "\\$&")}")`;
|
|
54
53
|
}
|
|
54
|
+
function logoMaskStyle(url) {
|
|
55
|
+
const mask = `${cssUrl(url)} center/contain no-repeat`;
|
|
56
|
+
return { "-webkit-mask": mask, mask };
|
|
57
|
+
}
|
|
55
58
|
function createHomePageView(ctx) {
|
|
56
59
|
assertChromeContext(ctx, "createHomePageView");
|
|
57
60
|
const settings = ctx.settings;
|
|
@@ -131,6 +134,11 @@ function createHomePageView(ctx) {
|
|
|
131
134
|
if (hasExtras) {
|
|
132
135
|
rowItems.push(resolvedExtras);
|
|
133
136
|
}
|
|
137
|
+
const rowContent = [];
|
|
138
|
+
rowItems.forEach((item, index) => {
|
|
139
|
+
if (index > 0) rowContent.push(/* @__PURE__ */ jsx("span", { class: "text-muted", children: "/" }));
|
|
140
|
+
rowContent.push(item);
|
|
141
|
+
});
|
|
134
142
|
return /* @__PURE__ */ jsxs(
|
|
135
143
|
DocLayoutWithDefaults,
|
|
136
144
|
{
|
|
@@ -149,7 +157,7 @@ function createHomePageView(ctx) {
|
|
|
149
157
|
bodyEndComponents: /* @__PURE__ */ jsx(BodyEndIslands, { basePath: settings.base ?? "/" }),
|
|
150
158
|
enableClientRouter: settings.dynamicPageTransition,
|
|
151
159
|
children: [
|
|
152
|
-
/* @__PURE__ */ jsx("div", {
|
|
160
|
+
/* @__PURE__ */ jsx("div", { "data-zd-home-hero": true, class: "mb-vsp-xl", children: /* @__PURE__ */ jsxs("div", { class: "zd-home-inner flex flex-col items-center justify-center text-center gap-hsp-md lg:flex-row lg:text-left lg:gap-hsp-xl", children: [
|
|
153
161
|
logoSetting === "auto" ? /* @__PURE__ */ jsx(
|
|
154
162
|
AutoLogo,
|
|
155
163
|
{
|
|
@@ -160,28 +168,22 @@ function createHomePageView(ctx) {
|
|
|
160
168
|
"div",
|
|
161
169
|
{
|
|
162
170
|
class: "w-[320px] max-w-full aspect-[1200/630] bg-fg shrink-0",
|
|
163
|
-
style:
|
|
164
|
-
WebkitMask: `${cssUrl(withBase(logoSetting))} center/contain no-repeat`,
|
|
165
|
-
mask: `${cssUrl(withBase(logoSetting))} center/contain no-repeat`
|
|
166
|
-
},
|
|
171
|
+
style: logoMaskStyle(withBase(logoSetting)),
|
|
167
172
|
"aria-hidden": "true"
|
|
168
173
|
}
|
|
169
174
|
) : null,
|
|
170
175
|
/* @__PURE__ */ jsxs("div", { class: "zd-home-copy min-w-0 lg:flex-1", children: [
|
|
171
|
-
/* @__PURE__ */ jsx("h1", { class: "text-heading font-bold mb-vsp-2xs wrap-anywhere", children: settings.siteName }),
|
|
176
|
+
/* @__PURE__ */ jsx("h1", { class: "text-heading font-bold mb-vsp-2xs zd-wrap-anywhere", children: settings.siteName }),
|
|
172
177
|
/* @__PURE__ */ jsx("p", { class: "text-muted text-small mb-vsp-sm", children: rawDescription }),
|
|
173
|
-
/* @__PURE__ */ jsx("div", { class: "zd-home-links flex flex-wrap items-center justify-center lg:justify-start gap-hsp-md text-small", children:
|
|
174
|
-
index > 0 && /* @__PURE__ */ jsx("span", { class: "text-muted", children: "/" }),
|
|
175
|
-
item
|
|
176
|
-
] }, index)) })
|
|
178
|
+
/* @__PURE__ */ jsx("div", { class: "zd-home-links flex flex-wrap items-center justify-center lg:justify-start gap-hsp-md text-small", children: rowContent })
|
|
177
179
|
] })
|
|
178
180
|
] }) }),
|
|
179
181
|
hasIntro && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
180
182
|
/* @__PURE__ */ jsx("hr", { class: "zd-home-rule", "data-home-rule": "upper" }),
|
|
181
|
-
/* @__PURE__ */ jsx("div", {
|
|
183
|
+
/* @__PURE__ */ jsx("div", { "data-zd-home-intro": true, children: /* @__PURE__ */ jsx("div", { class: "zd-home-inner", children: /* @__PURE__ */ jsx(CompactProse, { intro }) }) })
|
|
182
184
|
] }),
|
|
183
185
|
/* @__PURE__ */ jsx("hr", { class: "zd-home-rule", "data-home-rule": "lower" }),
|
|
184
|
-
/* @__PURE__ */ jsxs("section", {
|
|
186
|
+
/* @__PURE__ */ jsxs("section", { "data-zd-home-sitemap": true, children: [
|
|
185
187
|
/* @__PURE__ */ jsx(HomeSectionHeading, { children: sitemapHeading }),
|
|
186
188
|
Island({
|
|
187
189
|
when: "idle",
|
|
@@ -191,7 +193,7 @@ function createHomePageView(ctx) {
|
|
|
191
193
|
tree,
|
|
192
194
|
categoryOrder,
|
|
193
195
|
categoryIgnore: [...categoryIgnore, ...movedNodes.map((n) => n.slug)],
|
|
194
|
-
initiallyCollapsedCategorySlugs,
|
|
196
|
+
...initiallyCollapsedCategorySlugs !== void 0 ? { initiallyCollapsedCategorySlugs } : {},
|
|
195
197
|
locale,
|
|
196
198
|
updatedLabel: t("doc.updated", locale),
|
|
197
199
|
dateFormats: dateFormatsFor(locale)
|
|
@@ -210,7 +212,7 @@ function createHomePageView(ctx) {
|
|
|
210
212
|
] }),
|
|
211
213
|
settings.docTags && tagCount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
212
214
|
/* @__PURE__ */ jsx("hr", { class: "zd-home-rule", "data-home-rule": "tags" }),
|
|
213
|
-
/* @__PURE__ */ jsx("section", {
|
|
215
|
+
/* @__PURE__ */ jsx("section", { "data-zd-home-tags": true, children: tags && tags.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
214
216
|
/* @__PURE__ */ jsx(HomeSectionHeading, { children: t("doc.tags", locale) }),
|
|
215
217
|
/* @__PURE__ */ jsx(
|
|
216
218
|
TagNav,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
|
-
|
|
3
|
-
import type { VNode } from "preact";
|
|
2
|
+
import { type Child } from "@takazudo/zfb/zudo-react";
|
|
4
3
|
export interface HighlightedCodeProps {
|
|
5
4
|
code: string;
|
|
6
5
|
language: string;
|
|
@@ -10,6 +9,6 @@ export interface HighlightedCodeProps {
|
|
|
10
9
|
* Falls back to a plain `<pre><code>` block while the runtime is loading or
|
|
11
10
|
* when the current request cannot produce safe markup.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
12
|
+
* The runtime request is scoped to the current source panel mount.
|
|
14
13
|
*/
|
|
15
|
-
export declare function HighlightedCode({ code, language, }: HighlightedCodeProps):
|
|
14
|
+
export declare function HighlightedCode({ code, language, }: HighlightedCodeProps): Child;
|
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
import { jsx } from "
|
|
2
|
-
import {
|
|
1
|
+
import { jsx } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
getScope,
|
|
5
|
+
signal,
|
|
6
|
+
Show
|
|
7
|
+
} from "@takazudo/zfb/zudo-react";
|
|
3
8
|
import { startHighlightRequest } from "./highlight-runtime.js";
|
|
4
9
|
function HighlightedCode({
|
|
5
10
|
code,
|
|
6
11
|
language
|
|
7
12
|
}) {
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
const scope = getScope();
|
|
14
|
+
const highlighted = signal(null);
|
|
15
|
+
scope.onActivate(
|
|
16
|
+
() => startHighlightRequest({
|
|
12
17
|
code,
|
|
13
18
|
language,
|
|
14
19
|
onSettled(nextHtml) {
|
|
15
|
-
|
|
16
|
-
nextHtml == null ? null : { code, language, html: nextHtml }
|
|
17
|
-
);
|
|
20
|
+
highlighted.value = nextHtml;
|
|
18
21
|
}
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return /* @__PURE__ */ jsx("pre", { class: "m-0 p-hsp-md bg-code-bg text-caption leading-relaxed overflow-x-auto", children: /* @__PURE__ */ jsx("code", { class: "font-mono whitespace-pre", children: code }) });
|
|
23
|
-
}
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
const html = computed(() => highlighted.value);
|
|
24
25
|
return /* @__PURE__ */ jsx(
|
|
25
|
-
|
|
26
|
+
Show,
|
|
26
27
|
{
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
when: computed(() => html.value != null),
|
|
29
|
+
fallback: () => /* @__PURE__ */ jsx("pre", { class: "m-0 p-hsp-md bg-code-bg text-caption leading-relaxed overflow-x-auto", children: /* @__PURE__ */ jsx("code", { class: "font-mono whitespace-pre", children: code }) }),
|
|
30
|
+
children: () => /* @__PURE__ */ jsx("div", { class: "zd-html-preview-code", rawHtml: html })
|
|
29
31
|
}
|
|
30
32
|
);
|
|
31
33
|
}
|
|
@@ -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 HtmlPreviewLabels } from "./html-preview.js";
|
|
5
4
|
/**
|
|
6
5
|
* Global HTML preview configuration. Mirrors the `settings.htmlPreview`
|
|
@@ -19,7 +18,7 @@ export interface HtmlPreviewWrapperProps {
|
|
|
19
18
|
/**
|
|
20
19
|
* Controls when the preview subtree is rendered.
|
|
21
20
|
*
|
|
22
|
-
* `"eager"` (and omission) preserves the server-rendered
|
|
21
|
+
* `"eager"` (and omission) preserves the server-rendered preview host and
|
|
23
22
|
* hydrates it when visible. `"visible"` emits only an inert height
|
|
24
23
|
* reservation during SSR and renders the preview on the client through
|
|
25
24
|
* zfb's skip-SSR island path.
|
|
@@ -130,7 +129,7 @@ type HtmlPreviewWrapperInnerProps = Omit<HtmlPreviewWrapperProps, "loading">;
|
|
|
130
129
|
* Merges global (`settings.htmlPreview`) config with per-usage props and
|
|
131
130
|
* forwards everything to `<HtmlPreview>`. Renders the preview tree
|
|
132
131
|
* **directly**: it does NOT wrap itself in `<Island>`. `HtmlPreviewWrapper`
|
|
133
|
-
*
|
|
132
|
+
* in `wrapper.tsx` applies the `<Island when="visible">` wrapper around it.
|
|
134
133
|
*
|
|
135
134
|
* ## Island invariant (read before touching the displayName / Island wiring)
|
|
136
135
|
*
|
|
@@ -151,28 +150,8 @@ type HtmlPreviewWrapperInnerProps = Omit<HtmlPreviewWrapperProps, "loading">;
|
|
|
151
150
|
* (`HtmlPreviewWrapperInner`) and is exported, so the marker resolves to
|
|
152
151
|
* THIS bare component and the bundle hydrates it in-place.
|
|
153
152
|
*/
|
|
154
|
-
export declare function HtmlPreviewWrapperInner(props: HtmlPreviewWrapperInnerProps):
|
|
153
|
+
export declare function HtmlPreviewWrapperInner(props: HtmlPreviewWrapperInnerProps): Child;
|
|
155
154
|
export declare namespace HtmlPreviewWrapperInner {
|
|
156
155
|
var displayName: string;
|
|
157
156
|
}
|
|
158
|
-
/**
|
|
159
|
-
* HTML preview wrapper component — the public MDX-registered binding
|
|
160
|
-
* (`HtmlPreview: HtmlPreviewWrapper`).
|
|
161
|
-
*
|
|
162
|
-
* Eager mode wraps the bare `HtmlPreviewWrapperInner` in
|
|
163
|
-
* `<Island when="visible">`, mirroring the legacy `client:visible` hydration
|
|
164
|
-
* timing while preserving the complete server-rendered preview. Visible mode
|
|
165
|
-
* uses zfb's skip-SSR fallback path: static output contains only an inert
|
|
166
|
-
* nonzero reservation, while the real serializable inner props remain on the
|
|
167
|
-
* island marker for the client mount. zfb intentionally mounts skip-SSR
|
|
168
|
-
* islands immediately, so the bare inner target keeps that reservation in
|
|
169
|
-
* place and applies its own one-shot IntersectionObserver gate before it
|
|
170
|
-
* instantiates the preview subtree; missing observer support fails open.
|
|
171
|
-
*
|
|
172
|
-
* The public export name and signature are unchanged from before the
|
|
173
|
-
* zudolab/zudo-doc#1925 fix, so existing consumers that register
|
|
174
|
-
* `HtmlPreview: HtmlPreviewWrapper` keep working (and now hydrate correctly)
|
|
175
|
-
* with no call-site change.
|
|
176
|
-
*/
|
|
177
|
-
export declare function HtmlPreviewWrapper(props: HtmlPreviewWrapperProps): VNode;
|
|
178
157
|
export {};
|
|
@@ -1,63 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "
|
|
3
|
-
import { useEffect, useRef, useState } from "preact/hooks";
|
|
4
|
-
import { Island } from "@takazudo/zfb";
|
|
2
|
+
import { jsx } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
5
3
|
import { HtmlPreview } from "./html-preview.js";
|
|
6
|
-
const VISIBLE_MOUNT_PROP = "__zudoDocVisibleMount";
|
|
7
|
-
function reservationHeight(height) {
|
|
8
|
-
return height != null && height > 0 ? height : 200;
|
|
9
|
-
}
|
|
10
|
-
function HtmlPreviewReservation({
|
|
11
|
-
height,
|
|
12
|
-
reservationRef
|
|
13
|
-
}) {
|
|
14
|
-
return /* @__PURE__ */ jsx(
|
|
15
|
-
"div",
|
|
16
|
-
{
|
|
17
|
-
ref: reservationRef,
|
|
18
|
-
"aria-hidden": "true",
|
|
19
|
-
"data-zd-html-preview-reservation": true,
|
|
20
|
-
style: { height: reservationHeight(height) }
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
4
|
function HtmlPreviewWrapperInner(props) {
|
|
25
|
-
const runtimeProps = props;
|
|
26
|
-
const deferUntilVisible = runtimeProps[VISIBLE_MOUNT_PROP] === true;
|
|
27
|
-
const reservationRef = useRef(null);
|
|
28
|
-
const [shouldRenderPreview, setShouldRenderPreview] = useState(
|
|
29
|
-
!deferUntilVisible || typeof globalThis.IntersectionObserver !== "function"
|
|
30
|
-
);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (shouldRenderPreview) return;
|
|
33
|
-
if (!deferUntilVisible) {
|
|
34
|
-
setShouldRenderPreview(true);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const target = reservationRef.current;
|
|
38
|
-
const Observer = globalThis.IntersectionObserver;
|
|
39
|
-
if (!target || typeof Observer !== "function") {
|
|
40
|
-
setShouldRenderPreview(true);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
let fired = false;
|
|
44
|
-
const observer = new Observer(
|
|
45
|
-
(entries) => {
|
|
46
|
-
if (fired || !entries.some((entry) => entry.isIntersecting)) return;
|
|
47
|
-
fired = true;
|
|
48
|
-
observer.disconnect();
|
|
49
|
-
setShouldRenderPreview(true);
|
|
50
|
-
},
|
|
51
|
-
{ threshold: 0 }
|
|
52
|
-
);
|
|
53
|
-
observer.observe(target);
|
|
54
|
-
return () => {
|
|
55
|
-
fired = true;
|
|
56
|
-
observer.disconnect();
|
|
57
|
-
};
|
|
58
|
-
}, [deferUntilVisible, shouldRenderPreview]);
|
|
59
5
|
const {
|
|
60
|
-
[VISIBLE_MOUNT_PROP]: _visibleMount,
|
|
61
6
|
globalConfig,
|
|
62
7
|
html,
|
|
63
8
|
css,
|
|
@@ -76,16 +21,7 @@ function HtmlPreviewWrapperInner(props) {
|
|
|
76
21
|
externalScripts,
|
|
77
22
|
preflight,
|
|
78
23
|
showResources
|
|
79
|
-
} =
|
|
80
|
-
if (!shouldRenderPreview) {
|
|
81
|
-
return /* @__PURE__ */ jsx(
|
|
82
|
-
HtmlPreviewReservation,
|
|
83
|
-
{
|
|
84
|
-
height,
|
|
85
|
-
reservationRef
|
|
86
|
-
}
|
|
87
|
-
);
|
|
88
|
-
}
|
|
24
|
+
} = props;
|
|
89
25
|
const mergedHead = [globalConfig?.head, head].filter(Boolean).join("\n") || void 0;
|
|
90
26
|
const mergedCss = [globalConfig?.css, css].filter(Boolean).join("\n") || void 0;
|
|
91
27
|
const mergedJs = [globalConfig?.js, js].filter(Boolean).join("\n") || void 0;
|
|
@@ -116,27 +52,6 @@ function HtmlPreviewWrapperInner(props) {
|
|
|
116
52
|
);
|
|
117
53
|
}
|
|
118
54
|
HtmlPreviewWrapperInner.displayName = "HtmlPreviewWrapperInner";
|
|
119
|
-
function HtmlPreviewWrapper(props) {
|
|
120
|
-
const { loading = "eager", ...innerProps } = props;
|
|
121
|
-
if (loading === "visible") {
|
|
122
|
-
const visibleInnerProps = {
|
|
123
|
-
...innerProps,
|
|
124
|
-
[VISIBLE_MOUNT_PROP]: true
|
|
125
|
-
};
|
|
126
|
-
const rendered2 = Island({
|
|
127
|
-
when: "visible",
|
|
128
|
-
ssrFallback: /* @__PURE__ */ jsx(HtmlPreviewReservation, { height: innerProps.height }),
|
|
129
|
-
children: /* @__PURE__ */ jsx(HtmlPreviewWrapperInner, { ...visibleInnerProps })
|
|
130
|
-
});
|
|
131
|
-
return rendered2;
|
|
132
|
-
}
|
|
133
|
-
const rendered = Island({
|
|
134
|
-
when: "visible",
|
|
135
|
-
children: /* @__PURE__ */ jsx(HtmlPreviewWrapperInner, { ...innerProps })
|
|
136
|
-
});
|
|
137
|
-
return rendered;
|
|
138
|
-
}
|
|
139
55
|
export {
|
|
140
|
-
HtmlPreviewWrapper,
|
|
141
56
|
HtmlPreviewWrapperInner
|
|
142
57
|
};
|
|
@@ -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 HtmlPreviewLabels } from "./preview-base.js";
|
|
5
4
|
export type { HtmlPreviewLabels } from "./preview-base.js";
|
|
6
5
|
export interface HtmlPreviewProps {
|
|
@@ -151,12 +150,6 @@ export declare function buildSrcdoc(html: string, css?: string, head?: string, j
|
|
|
151
150
|
* HTML preview widget — renders an isolated iframe with viewport
|
|
152
151
|
* controls and a collapsible code section.
|
|
153
152
|
*
|
|
154
|
-
*
|
|
155
|
-
* React → Preact hook imports.
|
|
156
|
-
*
|
|
157
|
-
* Requires client-side JS (iframe load events, height sync, code
|
|
158
|
-
* toggle). Mount as an island via `<HtmlPreview client:visible />` in
|
|
159
|
-
* Astro, or wire up the SSR-skip placeholder pattern for non-Astro
|
|
160
|
-
* consumers.
|
|
153
|
+
* Pure setup for the preview island; iframe lifecycle belongs to PreviewBase.
|
|
161
154
|
*/
|
|
162
|
-
export declare function HtmlPreview({ html, css, head, js, title, lang, height, defaultOpen, labels, showSource, showViewportControls, fullHeight, sandbox, componentCss, componentHead, componentJs, externalStyles, externalScripts, preflight, showResources, }: HtmlPreviewProps):
|
|
155
|
+
export declare function HtmlPreview({ html, css, head, js, title, lang, height, defaultOpen, labels, showSource, showViewportControls, fullHeight, sandbox, componentCss, componentHead, componentJs, externalStyles, externalScripts, preflight, showResources, }: HtmlPreviewProps): Child;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { jsx } from "
|
|
2
|
-
import { useMemo } from "preact/hooks";
|
|
1
|
+
import { jsx } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
3
2
|
import {
|
|
4
3
|
PreviewBase
|
|
5
4
|
} from "./preview-base.js";
|
|
@@ -92,37 +91,22 @@ function HtmlPreview({
|
|
|
92
91
|
preflight,
|
|
93
92
|
showResources
|
|
94
93
|
}) {
|
|
95
|
-
const srcdoc =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{ lang, title, previewLabel: labels?.preview }
|
|
106
|
-
),
|
|
107
|
-
[
|
|
108
|
-
html,
|
|
109
|
-
css,
|
|
110
|
-
head,
|
|
111
|
-
js,
|
|
112
|
-
fullHeight,
|
|
113
|
-
externalStyles,
|
|
114
|
-
externalScripts,
|
|
115
|
-
preflight,
|
|
116
|
-
lang,
|
|
117
|
-
title,
|
|
118
|
-
labels?.preview
|
|
119
|
-
]
|
|
94
|
+
const srcdoc = buildSrcdoc(
|
|
95
|
+
html,
|
|
96
|
+
css,
|
|
97
|
+
head,
|
|
98
|
+
js,
|
|
99
|
+
fullHeight,
|
|
100
|
+
externalStyles,
|
|
101
|
+
externalScripts,
|
|
102
|
+
preflight,
|
|
103
|
+
{ lang, title, previewLabel: labels?.preview }
|
|
120
104
|
);
|
|
121
105
|
const hasScripts = containsScript(head, js, externalScripts);
|
|
122
106
|
const syncDelay = hasScripts ? 300 : 0;
|
|
123
107
|
const sandboxValue = resolveSandbox(sandbox, hasScripts);
|
|
124
108
|
const sandboxAttributeValue = sandboxValue === "" ? " " : sandboxValue;
|
|
125
|
-
const codeBlocks =
|
|
109
|
+
const codeBlocks = (() => {
|
|
126
110
|
const resourceLines = showResources ? [
|
|
127
111
|
...(externalStyles ?? []).map(
|
|
128
112
|
(href) => `<link rel="stylesheet" href="${href}">`
|
|
@@ -146,15 +130,7 @@ ${dedent(html)}` : dedent(html);
|
|
|
146
130
|
}
|
|
147
131
|
] : []
|
|
148
132
|
];
|
|
149
|
-
}
|
|
150
|
-
html,
|
|
151
|
-
componentCss,
|
|
152
|
-
componentHead,
|
|
153
|
-
componentJs,
|
|
154
|
-
showResources,
|
|
155
|
-
externalStyles,
|
|
156
|
-
externalScripts
|
|
157
|
-
]);
|
|
133
|
+
})();
|
|
158
134
|
return /* @__PURE__ */ jsx(
|
|
159
135
|
PreviewBase,
|
|
160
136
|
{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { HtmlPreviewWrapperInner, } from "./html-preview-wrapper.js";
|
|
2
|
+
export { HtmlPreviewWrapper } from "./wrapper.js";
|
|
2
3
|
export type { HtmlPreviewWrapperProps, HtmlPreviewGlobalConfig, } from "./html-preview-wrapper.js";
|
|
3
4
|
export { HtmlPreview } from "./html-preview.js";
|
|
4
5
|
export type { HtmlPreviewProps } from "./html-preview.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
HtmlPreviewWrapper,
|
|
3
2
|
HtmlPreviewWrapperInner
|
|
4
3
|
} from "./html-preview-wrapper.js";
|
|
4
|
+
import { HtmlPreviewWrapper } from "./wrapper.js";
|
|
5
5
|
import { HtmlPreview } from "./html-preview.js";
|
|
6
6
|
import { PreviewBase } from "./preview-base.js";
|
|
7
7
|
import { HighlightedCode } from "./highlighted-code.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
|
-
|
|
3
|
-
import type { VNode } from "preact";
|
|
2
|
+
import { type Child } from "@takazudo/zfb/zudo-react";
|
|
4
3
|
export interface CodeBlockData {
|
|
5
4
|
language: string;
|
|
6
5
|
title: string;
|
|
@@ -39,7 +38,6 @@ export interface PreviewBaseProps {
|
|
|
39
38
|
* Interactive preview base: iframe viewport switcher + collapsible code
|
|
40
39
|
* section.
|
|
41
40
|
*
|
|
42
|
-
*
|
|
43
|
-
* React → Preact hook imports and `className` → `class` attribute.
|
|
41
|
+
* The native iframe is rendered during SSR and hydrated by zudo-react.
|
|
44
42
|
*/
|
|
45
|
-
export declare function PreviewBase({ title, height, srcdoc, sandbox, syncDelay, codeBlocks, defaultOpen, labels, showSource, showViewportControls, autoHeight, }: PreviewBaseProps):
|
|
43
|
+
export declare function PreviewBase({ title, height, srcdoc, sandbox, syncDelay, codeBlocks, defaultOpen, labels, showSource, showViewportControls, autoHeight, }: PreviewBaseProps): Child;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { jsx, jsxs } from "
|
|
2
|
-
import { useEffect, useRef, useState } from "preact/hooks";
|
|
3
|
-
import { HighlightedCode } from "./highlighted-code.js";
|
|
1
|
+
import { jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
|
|
4
2
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
computed,
|
|
4
|
+
getScope,
|
|
5
|
+
signal,
|
|
6
|
+
Show
|
|
7
|
+
} from "@takazudo/zfb/zudo-react";
|
|
8
|
+
import { HighlightedCode } from "./highlighted-code.js";
|
|
9
|
+
import { createPreviewAutoHeightController } from "./preview-auto-height.js";
|
|
7
10
|
const DEFAULT_LABELS = {
|
|
8
11
|
mobile: "Mobile",
|
|
9
12
|
tablet: "Tablet",
|
|
@@ -49,52 +52,44 @@ function PreviewBase({
|
|
|
49
52
|
const sourceVisible = showSource ?? true;
|
|
50
53
|
const viewportControlsVisible = showViewportControls ?? true;
|
|
51
54
|
const viewports = viewportControlsVisible ? buildViewports(resolvedLabels) : DEFAULT_VIEWPORTS;
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
);
|
|
56
|
-
const
|
|
57
|
-
const iframeRef = useRef(null);
|
|
58
|
-
const iframeHeightRef = useRef(iframeHeight);
|
|
59
|
-
const autoHeightControllerRef = useRef(
|
|
60
|
-
null
|
|
61
|
-
);
|
|
62
|
-
iframeHeightRef.current = iframeHeight;
|
|
55
|
+
const scope = getScope();
|
|
56
|
+
const activeViewport = signal(2);
|
|
57
|
+
const codeOpen = signal(sourceVisible && (defaultOpen ?? false));
|
|
58
|
+
const iframeHeight = signal(height ?? 200);
|
|
59
|
+
const iframeRef = { current: null };
|
|
63
60
|
const autoHeightEnabled = (autoHeight ?? true) && height == null;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
let controller = null;
|
|
62
|
+
scope.onActivate(() => {
|
|
63
|
+
const frame = iframeRef.current;
|
|
64
|
+
if (!frame || !autoHeightEnabled) return;
|
|
65
|
+
const nextController = createPreviewAutoHeightController({
|
|
66
|
+
iframe: frame,
|
|
69
67
|
syncDelay,
|
|
70
|
-
getCurrentHeight: () =>
|
|
68
|
+
getCurrentHeight: () => iframeHeight.value,
|
|
71
69
|
setHeight: (nextHeight) => {
|
|
72
|
-
|
|
73
|
-
setIframeHeight(nextHeight);
|
|
70
|
+
iframeHeight.value = nextHeight;
|
|
74
71
|
}
|
|
75
72
|
});
|
|
76
|
-
|
|
77
|
-
const onLoad = () =>
|
|
78
|
-
|
|
73
|
+
controller = nextController;
|
|
74
|
+
const onLoad = () => nextController.handleLoad();
|
|
75
|
+
frame.addEventListener("load", onLoad);
|
|
79
76
|
try {
|
|
80
|
-
if (
|
|
81
|
-
controller.handleLoad();
|
|
82
|
-
}
|
|
77
|
+
if (frame.contentDocument?.readyState === "complete") nextController.handleLoad();
|
|
83
78
|
} catch {
|
|
84
79
|
}
|
|
85
80
|
return () => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
autoHeightControllerRef.current = null;
|
|
90
|
-
}
|
|
81
|
+
frame.removeEventListener("load", onLoad);
|
|
82
|
+
nextController.destroy();
|
|
83
|
+
controller = null;
|
|
91
84
|
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
const containerWidth =
|
|
85
|
+
});
|
|
86
|
+
scope.effect(() => {
|
|
87
|
+
activeViewport.value;
|
|
88
|
+
if (autoHeightEnabled) controller?.schedule();
|
|
89
|
+
});
|
|
90
|
+
const containerWidth = computed(
|
|
91
|
+
() => viewportControlsVisible ? viewports[activeViewport.value]?.width ?? "100%" : "100%"
|
|
92
|
+
);
|
|
98
93
|
return /* @__PURE__ */ jsxs("div", { class: "border border-muted rounded-lg overflow-hidden my-vsp-md", children: [
|
|
99
94
|
(viewportControlsVisible || title) && /* @__PURE__ */ jsxs("div", { class: "flex items-center justify-between px-hsp-md py-hsp-sm bg-surface border-b border-muted gap-hsp-sm flex-wrap", children: [
|
|
100
95
|
title && /* @__PURE__ */ jsx("span", { class: "text-caption font-semibold text-fg", children: title }),
|
|
@@ -108,12 +103,13 @@ function PreviewBase({
|
|
|
108
103
|
"button",
|
|
109
104
|
{
|
|
110
105
|
type: "button",
|
|
111
|
-
class: `min-h-[44px] min-w-[44px] px-hsp-sm py-hsp-2xs text-caption border rounded-full cursor-pointer transition-[background,color,border-color] duration-150 leading-snug ${i === activeViewport ? "bg-accent text-bg border-accent hover:bg-accent-hover hover:border-accent-hover" : "bg-transparent text-muted border-muted hover:bg-[color-mix(in_srgb,var(--color-surface)_80%,var(--color-fg)_20%)]"}
|
|
112
|
-
"aria-pressed": i === activeViewport,
|
|
113
|
-
|
|
106
|
+
class: computed(() => `min-h-[44px] min-w-[44px] px-hsp-sm py-hsp-2xs text-caption border rounded-full cursor-pointer transition-[background,color,border-color] duration-150 leading-snug ${i === activeViewport.value ? "bg-accent text-bg border-accent hover:bg-accent-hover hover:border-accent-hover" : "bg-transparent text-muted border-muted hover:bg-[color-mix(in_srgb,var(--color-surface)_80%,var(--color-fg)_20%)]"}`),
|
|
107
|
+
"aria-pressed": computed(() => i === activeViewport.value),
|
|
108
|
+
"on:click": () => {
|
|
109
|
+
activeViewport.value = i;
|
|
110
|
+
},
|
|
114
111
|
children: vp.label
|
|
115
|
-
}
|
|
116
|
-
vp.label
|
|
112
|
+
}
|
|
117
113
|
))
|
|
118
114
|
}
|
|
119
115
|
)
|
|
@@ -122,16 +118,16 @@ function PreviewBase({
|
|
|
122
118
|
"div",
|
|
123
119
|
{
|
|
124
120
|
class: "resize-x overflow-auto max-w-full mx-auto",
|
|
125
|
-
style: { width: containerWidth },
|
|
121
|
+
style: computed(() => ({ width: containerWidth.value })),
|
|
126
122
|
children: /* @__PURE__ */ jsx(
|
|
127
123
|
"iframe",
|
|
128
124
|
{
|
|
129
125
|
ref: iframeRef,
|
|
130
|
-
class: "block w-full border-none bg-[#fff] rounded
|
|
131
|
-
|
|
132
|
-
sandbox,
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
class: "block w-full border-none bg-[#fff] rounded zd-preview-shadow",
|
|
127
|
+
title: title ?? resolvedLabels.preview,
|
|
128
|
+
...sandbox !== void 0 ? { sandbox } : {},
|
|
129
|
+
srcdoc,
|
|
130
|
+
style: computed(() => ({ height: `${iframeHeight.value}px` }))
|
|
135
131
|
}
|
|
136
132
|
)
|
|
137
133
|
}
|
|
@@ -142,22 +138,24 @@ function PreviewBase({
|
|
|
142
138
|
{
|
|
143
139
|
type: "button",
|
|
144
140
|
class: "flex min-h-[44px] min-w-[44px] items-center w-full px-hsp-md py-hsp-sm text-caption font-medium text-muted bg-surface border-none cursor-pointer gap-hsp-xs hover:bg-[color-mix(in_srgb,var(--color-surface)_80%,var(--color-fg)_20%)]",
|
|
145
|
-
|
|
141
|
+
"on:click": () => {
|
|
142
|
+
codeOpen.value = !codeOpen.value;
|
|
143
|
+
},
|
|
146
144
|
"aria-expanded": codeOpen,
|
|
147
145
|
children: [
|
|
148
146
|
/* @__PURE__ */ jsx(
|
|
149
147
|
"span",
|
|
150
148
|
{
|
|
151
|
-
class: `text-caption transition-transform duration-200 ${codeOpen ? "rotate-90" : ""}
|
|
149
|
+
class: computed(() => `text-caption transition-transform duration-200 ${codeOpen.value ? "rotate-90" : ""}`),
|
|
152
150
|
"aria-hidden": "true",
|
|
153
151
|
children: "\u25B6"
|
|
154
152
|
}
|
|
155
153
|
),
|
|
156
|
-
codeOpen ? resolvedLabels.hideCode : resolvedLabels.showCode
|
|
154
|
+
computed(() => codeOpen.value ? resolvedLabels.hideCode : resolvedLabels.showCode)
|
|
157
155
|
]
|
|
158
156
|
}
|
|
159
157
|
),
|
|
160
|
-
codeOpen
|
|
158
|
+
/* @__PURE__ */ jsx(Show, { when: codeOpen, children: () => /* @__PURE__ */ jsx("div", { children: codeBlocks.map((block, idx) => /* @__PURE__ */ jsxs(
|
|
161
159
|
"div",
|
|
162
160
|
{
|
|
163
161
|
class: `overflow-x-auto ${idx > 0 ? "border-t border-muted" : ""}`,
|
|
@@ -165,9 +163,8 @@ function PreviewBase({
|
|
|
165
163
|
/* @__PURE__ */ jsx("span", { class: "block px-hsp-md py-hsp-xs text-caption font-semibold text-muted bg-surface border-b border-muted uppercase tracking-wider", children: block.title }),
|
|
166
164
|
/* @__PURE__ */ jsx(HighlightedCode, { code: block.code, language: block.language })
|
|
167
165
|
]
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
)) })
|
|
166
|
+
}
|
|
167
|
+
)) }) })
|
|
171
168
|
] })
|
|
172
169
|
] });
|
|
173
170
|
}
|