@takazudo/zudo-doc 0.2.21 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/gen-z-index.mjs +164 -0
- package/bin/tags-audit-runner.ts +126 -0
- package/bin/tags-audit.mjs +64 -0
- package/bin/zudo-doc.mjs +83 -0
- package/dist/ai-chat-modal/index.d.ts +8 -0
- package/dist/ai-chat-modal/index.js +243 -0
- package/dist/body-foot-util/body-foot-util-area.d.ts +4 -8
- package/dist/body-foot-util/edit-link.d.ts +4 -8
- package/dist/body-foot-util/index.d.ts +4 -3
- package/dist/breadcrumb/breadcrumb.d.ts +5 -9
- package/dist/breadcrumb/find-path.d.ts +2 -5
- package/dist/breadcrumb/index.d.ts +4 -4
- package/dist/breadcrumb/types.d.ts +3 -5
- package/dist/category-nav/index.d.ts +86 -0
- package/dist/category-nav/index.js +44 -0
- package/dist/category-tree-nav/index.d.ts +65 -0
- package/dist/category-tree-nav/index.js +24 -0
- package/dist/code-group/index.d.ts +10 -0
- package/dist/code-group/index.js +37 -0
- package/dist/code-syntax/code-block-enhancer-script.d.ts +1 -3
- package/dist/code-syntax/code-block-enhancer.d.ts +3 -6
- package/dist/code-syntax/index.d.ts +9 -8
- package/dist/code-syntax/mermaid-init-script.d.ts +3 -5
- package/dist/code-syntax/mermaid-init.d.ts +4 -7
- package/dist/code-syntax/tabs-init-script.d.ts +1 -3
- package/dist/code-syntax/tabs-init.d.ts +3 -6
- package/dist/code-syntax/tabs.d.ts +4 -7
- package/dist/color-scheme-utils.d.ts +125 -0
- package/dist/color-scheme-utils.js +151 -0
- package/dist/compose-meta-title/index.d.ts +7 -0
- package/dist/compose-meta-title/index.js +10 -0
- package/dist/content/component-map.d.ts +13 -17
- package/dist/content/content-blockquote.d.ts +3 -6
- package/dist/content/content-code.d.ts +3 -6
- package/dist/content/content-code.js +1 -1
- package/dist/content/content-link.d.ts +3 -6
- package/dist/content/content-link.js +1 -1
- package/dist/content/content-ol.d.ts +3 -6
- package/dist/content/content-paragraph.d.ts +3 -6
- package/dist/content/content-strong.d.ts +3 -6
- package/dist/content/content-table.d.ts +3 -6
- package/dist/content/content-ul.d.ts +3 -6
- package/dist/content/heading-h2.d.ts +3 -6
- package/dist/content/heading-h3.d.ts +3 -6
- package/dist/content/heading-h4.d.ts +3 -6
- package/dist/content/index.d.ts +29 -13
- package/dist/content-admonition/index.d.ts +15 -0
- package/dist/content-admonition/index.js +14 -0
- package/dist/design-token-panel-bootstrap.d.ts +38 -0
- package/dist/design-token-panel-bootstrap.js +29 -0
- package/dist/desktop-sidebar-toggle-island/index.d.ts +5 -0
- package/dist/desktop-sidebar-toggle-island/index.js +62 -0
- package/dist/details/details.d.ts +3 -7
- package/dist/details/index.d.ts +2 -2
- package/dist/doc-body-end/index.d.ts +21 -0
- package/dist/doc-body-end/index.js +15 -0
- package/dist/doc-content-header/index.d.ts +69 -0
- package/dist/doc-content-header/index.js +49 -0
- package/dist/doc-history/index.d.ts +10 -0
- package/dist/doc-history/index.js +407 -0
- package/dist/doc-history-area/index.d.ts +84 -0
- package/dist/doc-history-area/index.js +76 -0
- package/dist/doc-metainfo-area/index.d.ts +46 -0
- package/dist/doc-metainfo-area/index.js +41 -0
- package/dist/doc-page-props/index.d.ts +93 -0
- package/dist/doc-page-props/index.js +0 -0
- package/dist/doc-page-renderer/index.d.ts +128 -0
- package/dist/doc-page-renderer/index.js +103 -0
- package/dist/doc-page-shell/index.d.ts +136 -0
- package/dist/doc-page-shell/index.js +127 -0
- package/dist/doc-pager/index.d.ts +25 -0
- package/dist/doc-pager/index.js +41 -0
- package/dist/doc-route-entries/index.d.ts +125 -0
- package/dist/doc-route-entries/index.js +76 -0
- package/dist/doc-route-paths/index.d.ts +54 -0
- package/dist/doc-route-paths/index.js +61 -0
- package/dist/doc-tags-area/index.d.ts +38 -0
- package/dist/doc-tags-area/index.js +30 -0
- package/dist/doclayout/anchors.d.ts +7 -9
- package/dist/doclayout/doc-layout-with-defaults.d.ts +16 -12
- package/dist/doclayout/doc-layout.d.ts +5 -9
- package/dist/doclayout/index.d.ts +6 -6
- package/dist/eject/index.d.ts +33 -0
- package/dist/eject/index.js +229 -0
- package/dist/extract-headings/index.d.ts +43 -0
- package/dist/extract-headings/index.js +111 -0
- package/dist/factory-context/index.d.ts +80 -0
- package/dist/factory-context/index.js +0 -0
- package/dist/features.css +882 -0
- package/dist/footer/footer.d.ts +4 -8
- package/dist/footer/index.d.ts +13 -3
- package/dist/footer/types.d.ts +4 -6
- package/dist/footer-with-defaults/index.d.ts +63 -0
- package/dist/footer-with-defaults/index.js +128 -0
- package/dist/frontmatter-preview-data/index.d.ts +26 -0
- package/dist/frontmatter-preview-data/index.js +23 -0
- package/dist/github-helpers/index.d.ts +17 -0
- package/dist/github-helpers/index.js +16 -0
- package/dist/head/doc-head.d.ts +3 -6
- package/dist/head/index.d.ts +9 -5
- package/dist/head/og-tags.d.ts +4 -7
- package/dist/head/twitter-card.d.ts +3 -6
- package/dist/head/types.d.ts +1 -3
- package/dist/head-with-defaults/index.d.ts +49 -0
- package/dist/head-with-defaults/index.js +62 -0
- package/dist/header/header.d.ts +6 -10
- package/dist/header/index.d.ts +16 -6
- package/dist/header/nav-active.d.ts +5 -7
- package/dist/header/nav-overflow-script.d.ts +1 -3
- package/dist/header/right-items.d.ts +3 -6
- package/dist/header/types.d.ts +10 -12
- package/dist/header-with-defaults/index.d.ts +77 -0
- package/dist/header-with-defaults/index.js +163 -0
- package/dist/html-preview-wrapper/dedent.d.ts +1 -3
- package/dist/html-preview-wrapper/highlighted-code.d.ts +3 -7
- package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +6 -10
- package/dist/html-preview-wrapper/html-preview.d.ts +5 -9
- package/dist/html-preview-wrapper/index.d.ts +8 -5
- package/dist/html-preview-wrapper/preflight.d.ts +1 -3
- package/dist/html-preview-wrapper/preview-base.d.ts +4 -8
- package/dist/i18n-version/index.d.ts +7 -5
- package/dist/i18n-version/language-switcher.d.ts +5 -8
- package/dist/i18n-version/types.d.ts +3 -5
- package/dist/i18n-version/version-banner.d.ts +4 -8
- package/dist/i18n-version/version-switcher.d.ts +7 -10
- package/dist/icons/index.d.ts +9 -13
- package/dist/image-enlarge/index.d.ts +13 -0
- package/dist/image-enlarge/index.js +176 -0
- package/dist/index.d.ts +26 -2
- package/dist/inline-version-switcher/index.d.ts +31 -0
- package/dist/inline-version-switcher/index.js +44 -0
- package/dist/integrations/claude-resources/escape-for-mdx.d.ts +1 -3
- package/dist/integrations/claude-resources/generate.d.ts +2 -4
- package/dist/integrations/claude-resources/index.d.ts +7 -10
- package/dist/integrations/doc-history/index.d.ts +21 -24
- package/dist/integrations/doc-history/pre-build.d.ts +7 -9
- package/dist/integrations/llms-txt/dev-middleware.d.ts +7 -11
- package/dist/integrations/llms-txt/emit.d.ts +2 -7
- package/dist/integrations/llms-txt/generate.d.ts +3 -8
- package/dist/integrations/llms-txt/index.d.ts +33 -8
- package/dist/integrations/llms-txt/load.d.ts +3 -7
- package/dist/integrations/llms-txt/strip.d.ts +2 -6
- package/dist/integrations/llms-txt/types.d.ts +9 -13
- package/dist/integrations/search-index/build-emitter.d.ts +4 -7
- package/dist/integrations/search-index/collect.d.ts +2 -5
- package/dist/integrations/search-index/dev-middleware.d.ts +5 -8
- package/dist/integrations/search-index/index.d.ts +7 -5
- package/dist/integrations/search-index/types.d.ts +5 -7
- package/dist/island-types/index.d.ts +44 -0
- package/dist/island-types/index.js +12 -0
- package/dist/locale-merge/index.d.ts +114 -0
- package/dist/locale-merge/index.js +27 -0
- package/dist/math-block/index.d.ts +18 -0
- package/dist/math-block/index.js +29 -0
- package/dist/md-utils/index.d.ts +6 -8
- package/dist/md-utils/index.js +2 -1
- package/dist/mdx-components/index.d.ts +46 -0
- package/dist/mdx-components/index.js +161 -0
- package/dist/mermaid-enlarge/index.d.ts +11 -0
- package/dist/mermaid-enlarge/index.js +290 -0
- package/dist/metainfo/doc-metainfo.d.ts +5 -9
- package/dist/metainfo/doc-tags.d.ts +7 -11
- package/dist/metainfo/frontmatter-preview.d.ts +8 -12
- package/dist/metainfo/index.d.ts +6 -4
- package/dist/nav-data-prep/index.d.ts +72 -0
- package/dist/nav-data-prep/index.js +34 -0
- package/dist/nav-indexing/category-nav.d.ts +4 -8
- package/dist/nav-indexing/category-tree-nav.d.ts +4 -8
- package/dist/nav-indexing/doc-card-grid.d.ts +4 -8
- package/dist/nav-indexing/docs-sitemap.d.ts +4 -8
- package/dist/nav-indexing/index.d.ts +37 -10
- package/dist/nav-indexing/nav-card-grid.d.ts +4 -8
- package/dist/nav-indexing/site-tree-nav-demo.d.ts +4 -8
- package/dist/nav-indexing/tag-nav.d.ts +6 -10
- package/dist/nav-indexing/types.d.ts +6 -8
- package/dist/nav-indexing/versions-page-content.d.ts +4 -8
- package/dist/nav-scope/index.d.ts +41 -0
- package/dist/nav-scope/index.js +41 -0
- package/dist/nav-source-cache/index.d.ts +13 -0
- package/dist/nav-source-cache/index.js +28 -0
- package/dist/nav-source-docs/index.d.ts +169 -0
- package/dist/nav-source-docs/index.js +123 -0
- package/dist/page-loading/index.d.ts +1 -2
- package/dist/page-loading/page-loading-overlay.d.ts +4 -8
- package/dist/plugins/claude-resources.d.ts +3 -0
- package/dist/plugins/claude-resources.js +27 -0
- package/dist/plugins/connect-adapter.d.ts +31 -0
- package/dist/plugins/connect-adapter.js +78 -0
- package/dist/plugins/doc-history.d.ts +3 -0
- package/dist/plugins/doc-history.js +54 -0
- package/dist/plugins/llms-txt.d.ts +3 -0
- package/dist/plugins/llms-txt.js +48 -0
- package/dist/plugins/plugin-utils.d.ts +17 -0
- package/dist/plugins/plugin-utils.js +11 -0
- package/dist/plugins/routes.d.ts +2 -0
- package/dist/plugins/routes.js +100 -0
- package/dist/plugins/search-index.d.ts +3 -0
- package/dist/plugins/search-index.js +24 -0
- package/dist/preset.d.ts +198 -0
- package/dist/preset.js +185 -0
- package/dist/render-markdown/index.d.ts +5 -0
- package/dist/render-markdown/index.js +115 -0
- package/dist/robots.d.ts +36 -0
- package/dist/robots.js +17 -0
- package/dist/route-enumerators/index.d.ts +204 -0
- package/dist/route-enumerators/index.js +156 -0
- package/dist/routes/404.d.ts +7 -0
- package/dist/routes/404.js +47 -0
- package/dist/routes/_chrome.d.ts +32 -0
- package/dist/routes/_chrome.js +365 -0
- package/dist/routes/_context.d.ts +56 -0
- package/dist/routes/_context.js +222 -0
- package/dist/routes/_docs-helpers.d.ts +43 -0
- package/dist/routes/_docs-helpers.js +173 -0
- package/dist/routes/_virtual.d.js +0 -0
- package/dist/routes/api-ai-chat.d.ts +5 -0
- package/dist/routes/api-ai-chat.js +24 -0
- package/dist/routes/docs-slug.d.ts +21 -0
- package/dist/routes/docs-slug.js +26 -0
- package/dist/routes/docs-tags-index.d.ts +7 -0
- package/dist/routes/docs-tags-index.js +11 -0
- package/dist/routes/docs-tags-tag.d.ts +23 -0
- package/dist/routes/docs-tags-tag.js +19 -0
- package/dist/routes/docs-versions.d.ts +7 -0
- package/dist/routes/docs-versions.js +11 -0
- package/dist/routes/index.d.ts +7 -0
- package/dist/routes/index.js +117 -0
- package/dist/routes/locale-docs-slug.d.ts +27 -0
- package/dist/routes/locale-docs-slug.js +40 -0
- package/dist/routes/locale-docs-tags-index.d.ts +18 -0
- package/dist/routes/locale-docs-tags-index.js +15 -0
- package/dist/routes/locale-docs-tags-tag.d.ts +25 -0
- package/dist/routes/locale-docs-tags-tag.js +22 -0
- package/dist/routes/locale-docs-versions.d.ts +18 -0
- package/dist/routes/locale-docs-versions.js +15 -0
- package/dist/routes/locale-index.d.ts +24 -0
- package/dist/routes/locale-index.js +132 -0
- package/dist/routes/robots.txt.d.ts +3 -0
- package/dist/routes/robots.txt.js +8 -0
- package/dist/routes/sitemap.xml.d.ts +5 -0
- package/dist/routes/sitemap.xml.js +31 -0
- package/dist/routes/v-docs-slug.d.ts +27 -0
- package/dist/routes/v-docs-slug.js +34 -0
- package/dist/routes/v-locale-docs-slug.d.ts +31 -0
- package/dist/routes/v-locale-docs-slug.js +50 -0
- package/dist/safelist.css +1 -1
- package/dist/search-widget/index.d.ts +38 -0
- package/dist/search-widget/index.js +169 -0
- package/dist/search-widget-script/index.d.ts +18 -0
- package/dist/search-widget-script/index.js +465 -0
- package/dist/settings.d.ts +270 -0
- package/dist/settings.js +0 -0
- package/dist/sidebar/index.d.ts +21 -3
- package/dist/sidebar/sidebar.d.ts +5 -9
- package/dist/sidebar/types.d.ts +4 -6
- package/dist/sidebar-prepaint/index.d.ts +21 -0
- package/dist/sidebar-prepaint/index.js +23 -0
- package/dist/sidebar-resizer/index.d.ts +2 -6
- package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +6 -10
- package/dist/sidebar-toggle-island/index.d.ts +13 -0
- package/dist/sidebar-toggle-island/index.js +122 -0
- package/dist/sidebar-tree/build-tree.d.ts +4 -8
- package/dist/sidebar-tree/category-meta.d.ts +3 -6
- package/dist/sidebar-tree/index.d.ts +18 -3
- package/dist/sidebar-tree/types.d.ts +6 -8
- package/dist/sidebar-tree-island/index.d.ts +13 -0
- package/dist/sidebar-tree-island/index.js +454 -0
- package/dist/sidebar-utils/index.d.ts +64 -0
- package/dist/sidebar-utils/index.js +88 -0
- package/dist/sidebar-with-defaults/index.d.ts +38 -0
- package/dist/sidebar-with-defaults/index.js +45 -0
- package/dist/site-tree-nav/index.d.ts +71 -0
- package/dist/site-tree-nav/index.js +36 -0
- package/dist/site-tree-nav-island/index.d.ts +11 -0
- package/dist/site-tree-nav-island/index.js +176 -0
- package/dist/slug/index.d.ts +4 -0
- package/dist/slug/index.js +19 -0
- package/dist/smart-break/index.d.ts +55 -0
- package/dist/{toc/smart-break.js → smart-break/index.js} +30 -3
- package/dist/tab-item/index.d.ts +2 -2
- package/dist/tab-item/tab-item.d.ts +6 -7
- package/dist/tag-helpers/index.d.ts +40 -0
- package/dist/tag-helpers/index.js +54 -0
- package/dist/tag-pages/index.d.ts +114 -0
- package/dist/tag-pages/index.js +146 -0
- package/dist/tags-audit.d.ts +107 -0
- package/dist/tags-audit.js +321 -0
- package/dist/theme/color-scheme-provider.d.ts +4 -8
- package/dist/theme/color-tweak-export-modal.d.ts +4 -7
- package/dist/theme/design-token-serde.d.ts +14 -17
- package/dist/theme/design-token-types.d.ts +4 -6
- package/dist/theme/iframe-bridge.d.ts +12 -14
- package/dist/theme/index.d.ts +7 -9
- package/dist/theme/theme-toggle.d.ts +3 -8
- package/dist/theme-toggle/color-scheme-sync.d.ts +5 -7
- package/dist/theme-toggle/index.d.ts +4 -8
- package/dist/toc/cx.d.ts +2 -3
- package/dist/toc/index.d.ts +8 -6
- package/dist/toc/mobile-toc.d.ts +5 -9
- package/dist/toc/mobile-toc.js +1 -1
- package/dist/toc/toc-title.d.ts +1 -3
- package/dist/toc/toc.d.ts +5 -9
- package/dist/toc/toc.js +1 -1
- package/dist/toc/types.d.ts +1 -3
- package/dist/toc/use-active-heading.d.ts +4 -7
- package/dist/transitions/index.d.ts +1 -1
- package/dist/transitions/page-events.d.ts +4 -6
- package/dist/tree-nav-shared/index.d.ts +22 -0
- package/dist/tree-nav-shared/index.js +66 -0
- package/dist/url-helpers/index.d.ts +37 -0
- package/dist/url-helpers/index.js +106 -0
- package/dist/url-normalizer/index.d.ts +39 -1
- package/dist/url-normalizer/normalize.d.ts +3 -5
- package/dist/use-modal-dialog/index.d.ts +70 -0
- package/dist/use-modal-dialog/index.js +73 -0
- package/dist/versions-page/index.d.ts +55 -0
- package/dist/versions-page/index.js +73 -0
- package/eject/breadcrumb/breadcrumb.tsx +194 -0
- package/eject/breadcrumb/find-path.ts +26 -0
- package/eject/breadcrumb/index.ts +4 -0
- package/eject/breadcrumb/types.ts +32 -0
- package/eject/code-group/index.tsx +78 -0
- package/eject/content-admonition/index.tsx +50 -0
- package/eject/details/details.tsx +34 -0
- package/eject/details/index.ts +4 -0
- package/eject/doc-pager/index.tsx +91 -0
- package/eject/footer/footer.tsx +167 -0
- package/eject/footer/index.ts +19 -0
- package/eject/footer/types.ts +60 -0
- package/eject/header/header.tsx +725 -0
- package/eject/header/index.ts +36 -0
- package/eject/header/nav-active.ts +122 -0
- package/eject/header/nav-overflow-script.ts +302 -0
- package/eject/header/right-items.ts +78 -0
- package/eject/header/types.ts +69 -0
- package/eject/page-loading/index.ts +10 -0
- package/eject/page-loading/page-loading-overlay.tsx +103 -0
- package/eject/sidebar/index.ts +27 -0
- package/eject/sidebar/sidebar.tsx +137 -0
- package/eject/sidebar/types.ts +73 -0
- package/eject/tab-item/index.ts +7 -0
- package/eject/tab-item/tab-item.tsx +70 -0
- package/eject/theme-toggle/color-scheme-sync.ts +73 -0
- package/eject/theme-toggle/index.tsx +120 -0
- package/eject/toc/cx.ts +38 -0
- package/eject/toc/index.ts +11 -0
- package/eject/toc/mobile-toc.tsx +133 -0
- package/eject/toc/toc-title.ts +33 -0
- package/eject/toc/toc.tsx +119 -0
- package/eject/toc/types.ts +14 -0
- package/eject/toc/use-active-heading.ts +162 -0
- package/package.json +371 -11
- package/routes-src/404.tsx +49 -0
- package/routes-src/_chrome.tsx +470 -0
- package/routes-src/_context.ts +314 -0
- package/routes-src/_docs-helpers.ts +284 -0
- package/routes-src/_virtual.d.ts +15 -0
- package/routes-src/api-ai-chat.tsx +46 -0
- package/routes-src/docs-slug.tsx +43 -0
- package/routes-src/docs-tags-index.tsx +14 -0
- package/routes-src/docs-tags-tag.tsx +29 -0
- package/routes-src/docs-versions.tsx +15 -0
- package/routes-src/index.tsx +134 -0
- package/routes-src/locale-docs-slug.tsx +69 -0
- package/routes-src/locale-docs-tags-index.tsx +23 -0
- package/routes-src/locale-docs-tags-tag.tsx +39 -0
- package/routes-src/locale-docs-versions.tsx +23 -0
- package/routes-src/locale-index.tsx +150 -0
- package/routes-src/robots.txt.tsx +13 -0
- package/routes-src/sitemap.xml.tsx +48 -0
- package/routes-src/v-docs-slug.tsx +64 -0
- package/routes-src/v-locale-docs-slug.tsx +85 -0
- package/dist/toc/smart-break.d.ts +0 -27
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ComponentChildren } from 'preact';
|
|
3
|
-
|
|
1
|
+
import type { ComponentChildren } from "preact";
|
|
4
2
|
/**
|
|
5
3
|
* Subset of the host's `ColorModeConfig` that the v2 provider actually
|
|
6
4
|
* consumes. Kept locally so the v2 package does not need to import a host
|
|
7
5
|
* type module — the caller maps its own settings into this shape (or
|
|
8
6
|
* passes `null` for the persisted-tweak / no-light-dark path).
|
|
9
7
|
*/
|
|
10
|
-
interface ColorSchemeProviderColorMode {
|
|
8
|
+
export interface ColorSchemeProviderColorMode {
|
|
11
9
|
defaultMode: "light" | "dark";
|
|
12
10
|
respectPrefersColorScheme: boolean;
|
|
13
11
|
}
|
|
14
|
-
interface ColorSchemeProviderProps {
|
|
12
|
+
export interface ColorSchemeProviderProps {
|
|
15
13
|
/**
|
|
16
14
|
* Pre-computed `:root { --zd-* }` CSS string. The caller resolves the
|
|
17
15
|
* active color scheme (or the configured light+dark pair) and renders
|
|
@@ -27,6 +25,4 @@ interface ColorSchemeProviderProps {
|
|
|
27
25
|
/** Optional children; preserved for forward compatibility. */
|
|
28
26
|
children?: ComponentChildren;
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export { type ColorSchemeProviderColorMode, type ColorSchemeProviderProps, ColorSchemeProvider as default };
|
|
28
|
+
export default function ColorSchemeProvider({ cssText, colorMode, }: ColorSchemeProviderProps): import("preact").JSX.Element;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { TweakState, ColorTweakState } from './design-token-types.js';
|
|
4
|
-
|
|
1
|
+
import { type DesignTokenManifest } from "./design-token-serde.js";
|
|
2
|
+
import { type ColorTweakState, type TweakState } from "./design-token-types.js";
|
|
5
3
|
interface DesignTokenExportModalProps {
|
|
6
4
|
onClose: () => void;
|
|
7
5
|
/** Full unified tweak state — the modal serializes all four categories. */
|
|
@@ -14,6 +12,5 @@ interface DesignTokenExportModalProps {
|
|
|
14
12
|
* access (tests) can omit and we'll treat the entire color block as changed. */
|
|
15
13
|
colorDefaults?: ColorTweakState;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export { ColorTweakExportModal as default };
|
|
15
|
+
export default function ColorTweakExportModal({ onClose, state, manifest, colorDefaults, }: DesignTokenExportModalProps): import("preact").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ColorTweakState, TweakState } from './design-token-types.js';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Design-token SerDe — unified JSON export / import for the design-token panel.
|
|
5
3
|
*
|
|
@@ -44,11 +42,11 @@ interface TokenDef {
|
|
|
44
42
|
/** Read-only tokens are displayed but not editable. */
|
|
45
43
|
readonly?: true;
|
|
46
44
|
}
|
|
47
|
-
|
|
48
|
-
declare const DESIGN_TOKEN_SCHEMA: "zudo-doc-design-tokens/v1";
|
|
45
|
+
import { type ColorTweakState, type TweakState } from "./design-token-types.js";
|
|
46
|
+
export declare const DESIGN_TOKEN_SCHEMA: "zudo-doc-design-tokens/v1";
|
|
49
47
|
/** External JSON value for a base-color / semantic-color entry. */
|
|
50
48
|
type ColorSlotValue = number | "bg" | "fg";
|
|
51
|
-
interface DesignTokenJsonColorBase {
|
|
49
|
+
export interface DesignTokenJsonColorBase {
|
|
52
50
|
bg?: number;
|
|
53
51
|
fg?: number;
|
|
54
52
|
cursor?: number;
|
|
@@ -56,15 +54,15 @@ interface DesignTokenJsonColorBase {
|
|
|
56
54
|
"sel-bg"?: number;
|
|
57
55
|
"sel-fg"?: number;
|
|
58
56
|
}
|
|
59
|
-
interface DesignTokenJsonColor {
|
|
57
|
+
export interface DesignTokenJsonColor {
|
|
60
58
|
palette?: string[];
|
|
61
59
|
base?: DesignTokenJsonColorBase;
|
|
62
60
|
/** Palette-index (or "bg"/"fg") mappings, same keys as `SEMANTIC_DEFAULTS`. */
|
|
63
61
|
semantic?: Record<string, ColorSlotValue>;
|
|
64
62
|
}
|
|
65
63
|
/** External token map keyed by CSS var name. */
|
|
66
|
-
type DesignTokenJsonOverrides = Record<string, string>;
|
|
67
|
-
interface DesignTokenJson {
|
|
64
|
+
export type DesignTokenJsonOverrides = Record<string, string>;
|
|
65
|
+
export interface DesignTokenJson {
|
|
68
66
|
$schema: typeof DESIGN_TOKEN_SCHEMA;
|
|
69
67
|
exportedAt: string;
|
|
70
68
|
color?: DesignTokenJsonColor;
|
|
@@ -78,12 +76,12 @@ interface DesignTokenJson {
|
|
|
78
76
|
* doesn't ship its own manifest; this is intentionally a caller concern
|
|
79
77
|
* so each consumer keeps full control over the editable token set.
|
|
80
78
|
*/
|
|
81
|
-
interface DesignTokenManifest {
|
|
79
|
+
export interface DesignTokenManifest {
|
|
82
80
|
spacing: readonly TokenDef[];
|
|
83
81
|
font: readonly TokenDef[];
|
|
84
82
|
size: readonly TokenDef[];
|
|
85
83
|
}
|
|
86
|
-
interface SerializeOptions {
|
|
84
|
+
export interface SerializeOptions {
|
|
87
85
|
/** Token manifest (spacing / font / size arrays) used to compute
|
|
88
86
|
* diff-only output and resolve CSS-var names. Required. */
|
|
89
87
|
manifest: DesignTokenManifest;
|
|
@@ -98,7 +96,7 @@ interface SerializeOptions {
|
|
|
98
96
|
/** Override the `exportedAt` stamp (test-only). */
|
|
99
97
|
now?: () => Date;
|
|
100
98
|
}
|
|
101
|
-
interface DeserializeResult {
|
|
99
|
+
export interface DeserializeResult {
|
|
102
100
|
/** The reconstructed tweak state, with unknown-token values dropped. */
|
|
103
101
|
state: TweakState;
|
|
104
102
|
/** CSS var names present in the payload that don't match any known token. */
|
|
@@ -107,7 +105,7 @@ interface DeserializeResult {
|
|
|
107
105
|
* (e.g. "semantic mapping dropped because value isn't a number"). */
|
|
108
106
|
warnings: string[];
|
|
109
107
|
}
|
|
110
|
-
interface DeserializeOptions {
|
|
108
|
+
export interface DeserializeOptions {
|
|
111
109
|
/** Token manifest (spacing / font / size arrays) used to resolve CSS-var
|
|
112
110
|
* names back to internal token ids. Required. */
|
|
113
111
|
manifest: DesignTokenManifest;
|
|
@@ -118,7 +116,7 @@ interface DeserializeOptions {
|
|
|
118
116
|
}
|
|
119
117
|
/** Thrown when the payload is not a v1 schema object. The error `.reason`
|
|
120
118
|
* helps the UI render a precise inline message. */
|
|
121
|
-
declare class DesignTokenSchemaError extends Error {
|
|
119
|
+
export declare class DesignTokenSchemaError extends Error {
|
|
122
120
|
readonly reason: "not-object" | "schema-missing" | "schema-mismatch";
|
|
123
121
|
readonly actualSchema?: unknown;
|
|
124
122
|
constructor(reason: "not-object" | "schema-missing" | "schema-mismatch", message: string, actualSchema?: unknown);
|
|
@@ -129,7 +127,7 @@ declare class DesignTokenSchemaError extends Error {
|
|
|
129
127
|
* By default this is diff-only against `opts.colorDefaults` + manifest
|
|
130
128
|
* defaults; set `opts.includeDefaults = true` to dump everything.
|
|
131
129
|
*/
|
|
132
|
-
declare function serialize(state: TweakState, opts: SerializeOptions): DesignTokenJson;
|
|
130
|
+
export declare function serialize(state: TweakState, opts: SerializeOptions): DesignTokenJson;
|
|
133
131
|
/**
|
|
134
132
|
* Parse a design-token JSON document and lift it back into a tweak state.
|
|
135
133
|
*
|
|
@@ -140,6 +138,5 @@ declare function serialize(state: TweakState, opts: SerializeOptions): DesignTok
|
|
|
140
138
|
* Missing fields fall back to `opts.colorDefaults` (or, absent that, a
|
|
141
139
|
* minimal neutral default) so the result is always a valid `TweakState`.
|
|
142
140
|
*/
|
|
143
|
-
declare function deserialize(input: unknown, opts: DeserializeOptions): DeserializeResult;
|
|
144
|
-
|
|
145
|
-
export { DESIGN_TOKEN_SCHEMA, type DeserializeOptions, type DeserializeResult, type DesignTokenJson, type DesignTokenJsonColor, type DesignTokenJsonColorBase, type DesignTokenJsonOverrides, type DesignTokenManifest, DesignTokenSchemaError, type SerializeOptions, deserialize, serialize };
|
|
141
|
+
export declare function deserialize(input: unknown, opts: DeserializeOptions): DeserializeResult;
|
|
142
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface ColorTweakState {
|
|
1
|
+
export interface ColorTweakState {
|
|
2
2
|
palette: string[];
|
|
3
3
|
background: number;
|
|
4
4
|
foreground: number;
|
|
@@ -7,13 +7,11 @@ interface ColorTweakState {
|
|
|
7
7
|
selectionFg: number;
|
|
8
8
|
semanticMappings: Record<string, number | "bg" | "fg">;
|
|
9
9
|
}
|
|
10
|
-
type TokenOverrides = Record<string, string>;
|
|
11
|
-
interface TweakState {
|
|
10
|
+
export type TokenOverrides = Record<string, string>;
|
|
11
|
+
export interface TweakState {
|
|
12
12
|
color: ColorTweakState;
|
|
13
13
|
spacing: TokenOverrides;
|
|
14
14
|
font: TokenOverrides;
|
|
15
15
|
size: TokenOverrides;
|
|
16
16
|
}
|
|
17
|
-
declare function emptyOverrides(): TokenOverrides;
|
|
18
|
-
|
|
19
|
-
export { type ColorTweakState, type TokenOverrides, type TweakState, emptyOverrides };
|
|
17
|
+
export declare function emptyOverrides(): TokenOverrides;
|
|
@@ -1,44 +1,42 @@
|
|
|
1
|
-
declare const BRIDGE_SOURCE: "zudo-doc-theme-bridge";
|
|
2
|
-
type CssVarPair = readonly [name: string, value: string];
|
|
3
|
-
interface ApplyCssVarsMessage {
|
|
1
|
+
export declare const BRIDGE_SOURCE: "zudo-doc-theme-bridge";
|
|
2
|
+
export type CssVarPair = readonly [name: string, value: string];
|
|
3
|
+
export interface ApplyCssVarsMessage {
|
|
4
4
|
source: typeof BRIDGE_SOURCE;
|
|
5
5
|
type: "apply-css-vars";
|
|
6
6
|
vars: ReadonlyArray<CssVarPair>;
|
|
7
7
|
}
|
|
8
|
-
interface ClearCssVarsMessage {
|
|
8
|
+
export interface ClearCssVarsMessage {
|
|
9
9
|
source: typeof BRIDGE_SOURCE;
|
|
10
10
|
type: "clear-css-vars";
|
|
11
11
|
names: ReadonlyArray<string>;
|
|
12
12
|
}
|
|
13
|
-
interface ReadyMessage {
|
|
13
|
+
export interface ReadyMessage {
|
|
14
14
|
source: typeof BRIDGE_SOURCE;
|
|
15
15
|
type: "ready";
|
|
16
16
|
}
|
|
17
|
-
interface ErrorMessage {
|
|
17
|
+
export interface ErrorMessage {
|
|
18
18
|
source: typeof BRIDGE_SOURCE;
|
|
19
19
|
type: "error";
|
|
20
20
|
reason: string;
|
|
21
21
|
}
|
|
22
|
-
type BridgeMessage = ApplyCssVarsMessage | ClearCssVarsMessage | ReadyMessage | ErrorMessage;
|
|
22
|
+
export type BridgeMessage = ApplyCssVarsMessage | ClearCssVarsMessage | ReadyMessage | ErrorMessage;
|
|
23
23
|
/**
|
|
24
24
|
* Type guard. Accepts any postMessage payload and confirms it is a bridge
|
|
25
25
|
* envelope. Foreign messages are ignored silently.
|
|
26
26
|
*/
|
|
27
|
-
declare function isBridgeMessage(value: unknown): value is BridgeMessage;
|
|
27
|
+
export declare function isBridgeMessage(value: unknown): value is BridgeMessage;
|
|
28
28
|
/** Send `apply-css-vars` to the iframe. No-op when the iframe has not loaded. */
|
|
29
|
-
declare function sendApplyCssVars(iframe: HTMLIFrameElement | null, vars: ReadonlyArray<CssVarPair>): void;
|
|
29
|
+
export declare function sendApplyCssVars(iframe: HTMLIFrameElement | null, vars: ReadonlyArray<CssVarPair>): void;
|
|
30
30
|
/** Send `clear-css-vars` to the iframe so it removes inline overrides. */
|
|
31
|
-
declare function sendClearCssVars(iframe: HTMLIFrameElement | null, names: ReadonlyArray<string>): void;
|
|
31
|
+
export declare function sendClearCssVars(iframe: HTMLIFrameElement | null, names: ReadonlyArray<string>): void;
|
|
32
32
|
/**
|
|
33
33
|
* Install a message listener inside the preview iframe document that applies
|
|
34
34
|
* any incoming CSS-var batches onto `documentElement.style`. Returns a
|
|
35
35
|
* teardown function. Intended to be called once at iframe boot.
|
|
36
36
|
*/
|
|
37
|
-
declare function installIframeReceiver(target?: Window): () => void;
|
|
37
|
+
export declare function installIframeReceiver(target?: Window): () => void;
|
|
38
38
|
/**
|
|
39
39
|
* Install a `ready` listener on the panel side so callers can defer the
|
|
40
40
|
* initial CSS-var sync until the iframe document has booted.
|
|
41
41
|
*/
|
|
42
|
-
declare function onIframeReady(expectedSource: Window | null, callback: () => void): () => void;
|
|
43
|
-
|
|
44
|
-
export { type ApplyCssVarsMessage, BRIDGE_SOURCE, type BridgeMessage, type ClearCssVarsMessage, type CssVarPair, type ErrorMessage, type ReadyMessage, installIframeReceiver, isBridgeMessage, onIframeReady, sendApplyCssVars, sendClearCssVars };
|
|
42
|
+
export declare function onIframeReady(expectedSource: Window | null, callback: () => void): () => void;
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
export { default as ThemeToggle } from
|
|
2
|
-
export { default as ColorSchemeProvider
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
import '../theme-toggle/index.js';
|
|
9
|
-
import '../theme-toggle/color-scheme-sync.js';
|
|
1
|
+
export { default as ThemeToggle } from "./theme-toggle.js";
|
|
2
|
+
export { default as ColorSchemeProvider } from "./color-scheme-provider.js";
|
|
3
|
+
export type { ColorSchemeProviderProps, ColorSchemeProviderColorMode, } from "./color-scheme-provider.js";
|
|
4
|
+
export { default as ColorTweakExportModal } from "./color-tweak-export-modal.js";
|
|
5
|
+
export { DESIGN_TOKEN_SCHEMA, DesignTokenSchemaError, deserialize, serialize, type DesignTokenJson, type DesignTokenJsonColor, type DesignTokenJsonColorBase, type DesignTokenJsonOverrides, type DesignTokenManifest, type DeserializeOptions, type DeserializeResult, type SerializeOptions, } from "./design-token-serde.js";
|
|
6
|
+
export { emptyOverrides, type ColorTweakState, type TokenOverrides, type TweakState, } from "./design-token-types.js";
|
|
7
|
+
export { BRIDGE_SOURCE, isBridgeMessage, installIframeReceiver, onIframeReady, sendApplyCssVars, sendClearCssVars, type BridgeMessage, type ApplyCssVarsMessage, type ClearCssVarsMessage, type ReadyMessage, type ErrorMessage, type CssVarPair, } from "./iframe-bridge.js";
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { VNode } from 'preact';
|
|
2
|
-
import { ThemeToggleProps } from '../theme-toggle/index.js';
|
|
3
|
-
import '../theme-toggle/color-scheme-sync.js';
|
|
4
|
-
|
|
5
1
|
/** @jsxRuntime automatic */
|
|
6
2
|
/** @jsxImportSource preact */
|
|
7
|
-
|
|
3
|
+
import type { VNode } from "preact";
|
|
4
|
+
import { type ThemeToggleProps } from "../theme-toggle/index.js";
|
|
8
5
|
/**
|
|
9
6
|
* Default-export click-toggle for color scheme. Wraps the bare
|
|
10
7
|
* `<ThemeToggle>` in `<Island when="load">` so the SSG renderer emits a
|
|
@@ -13,6 +10,4 @@ import '../theme-toggle/color-scheme-sync.js';
|
|
|
13
10
|
* want to control hydration timing themselves) should import the bare
|
|
14
11
|
* component from `@takazudo/zudo-doc/theme-toggle` instead.
|
|
15
12
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export { ThemeToggle as default };
|
|
13
|
+
export default function ThemeToggle(props?: ThemeToggleProps): VNode;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
type ColorSchemeMode = "light" | "dark";
|
|
2
|
-
declare const COLOR_SCHEME_CHANGED_EVENT = "color-scheme-changed";
|
|
1
|
+
export type ColorSchemeMode = "light" | "dark";
|
|
2
|
+
export declare const COLOR_SCHEME_CHANGED_EVENT = "color-scheme-changed";
|
|
3
3
|
/**
|
|
4
4
|
* Read the active color scheme from `<html data-theme>`. Falls back to
|
|
5
5
|
* `defaultMode` when the attribute is missing or holds an unexpected
|
|
6
6
|
* value (e.g. before the ColorSchemeProvider bootstrap script ran).
|
|
7
7
|
*/
|
|
8
|
-
declare function readColorSchemeFromDom(defaultMode: ColorSchemeMode): ColorSchemeMode;
|
|
8
|
+
export declare function readColorSchemeFromDom(defaultMode: ColorSchemeMode): ColorSchemeMode;
|
|
9
9
|
/**
|
|
10
10
|
* Apply `next` as the active color scheme: mutate the DOM, persist the
|
|
11
11
|
* preference, and notify every subscriber (including other mounted
|
|
@@ -28,11 +28,9 @@ declare function readColorSchemeFromDom(defaultMode: ColorSchemeMode): ColorSche
|
|
|
28
28
|
* round-trip keeps them) is a zdtp design question tracked upstream at
|
|
29
29
|
* Takazudo/zudo-design-token-panel#343. See zudo-doc#2037.
|
|
30
30
|
*/
|
|
31
|
-
declare function applyColorScheme(next: ColorSchemeMode): void;
|
|
31
|
+
export declare function applyColorScheme(next: ColorSchemeMode): void;
|
|
32
32
|
/**
|
|
33
33
|
* Subscribe to color-scheme changes. Returns an unsubscribe function
|
|
34
34
|
* (suitable as a `useEffect` cleanup).
|
|
35
35
|
*/
|
|
36
|
-
declare function subscribeColorSchemeChanged(listener: () => void): () => void;
|
|
37
|
-
|
|
38
|
-
export { COLOR_SCHEME_CHANGED_EVENT, type ColorSchemeMode, applyColorScheme, readColorSchemeFromDom, subscribeColorSchemeChanged };
|
|
36
|
+
export declare function subscribeColorSchemeChanged(listener: () => void): () => void;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface ThemeToggleProps {
|
|
1
|
+
import { type ColorSchemeMode } from "./color-scheme-sync.js";
|
|
2
|
+
export interface ThemeToggleProps {
|
|
5
3
|
defaultMode?: ColorSchemeMode;
|
|
6
4
|
}
|
|
7
|
-
declare function ThemeToggle({ defaultMode, }: ThemeToggleProps): preact.JSX.Element;
|
|
8
|
-
declare namespace ThemeToggle {
|
|
5
|
+
export declare function ThemeToggle({ defaultMode, }: ThemeToggleProps): import("preact").JSX.Element;
|
|
6
|
+
export declare namespace ThemeToggle {
|
|
9
7
|
var displayName: string;
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
export { ThemeToggle, type ThemeToggleProps };
|
package/dist/toc/cx.d.ts
CHANGED
|
@@ -10,6 +10,5 @@
|
|
|
10
10
|
type ClassValue = string | number | bigint | boolean | null | undefined | ClassValue[] | {
|
|
11
11
|
[key: string]: unknown;
|
|
12
12
|
};
|
|
13
|
-
declare function cx(...args: ClassValue[]): string;
|
|
14
|
-
|
|
15
|
-
export { cx };
|
|
13
|
+
export declare function cx(...args: ClassValue[]): string;
|
|
14
|
+
export {};
|
package/dist/toc/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export { Toc
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
|
|
1
|
+
export { Toc } from "./toc.js";
|
|
2
|
+
export type { TocProps } from "./toc.js";
|
|
3
|
+
export { MobileToc } from "./mobile-toc.js";
|
|
4
|
+
export type { MobileTocProps } from "./mobile-toc.js";
|
|
5
|
+
export { useActiveHeading, getActiveHeadingId } from "./use-active-heading.js";
|
|
6
|
+
export type { UseActiveHeadingResult } from "./use-active-heading.js";
|
|
7
|
+
export type { HeadingItem } from "./types.js";
|
|
8
|
+
export { getTocTitle } from "./toc-title.js";
|
package/dist/toc/mobile-toc.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { VNode } from 'preact';
|
|
2
|
-
import { HeadingItem } from './types.js';
|
|
3
|
-
|
|
4
1
|
/** @jsxRuntime automatic */
|
|
5
2
|
/** @jsxImportSource preact */
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import type { VNode } from "preact";
|
|
4
|
+
import type { HeadingItem } from "./types.js";
|
|
5
|
+
export interface MobileTocProps {
|
|
8
6
|
headings: readonly HeadingItem[];
|
|
9
7
|
title?: string;
|
|
10
8
|
}
|
|
@@ -38,9 +36,7 @@ interface MobileTocProps {
|
|
|
38
36
|
* crawlers can still find the locale label in the static markup. When
|
|
39
37
|
* headings are present the full interactive toggle UI is rendered.
|
|
40
38
|
*/
|
|
41
|
-
declare function MobileToc({ headings, title, }: MobileTocProps): VNode;
|
|
42
|
-
declare namespace MobileToc {
|
|
39
|
+
export declare function MobileToc({ headings, title, }: MobileTocProps): VNode;
|
|
40
|
+
export declare namespace MobileToc {
|
|
43
41
|
var displayName: string;
|
|
44
42
|
}
|
|
45
|
-
|
|
46
|
-
export { MobileToc, type MobileTocProps };
|
package/dist/toc/mobile-toc.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
3
3
|
import { useMemo, useState } from "preact/hooks";
|
|
4
|
-
import { SmartBreak } from "
|
|
4
|
+
import { SmartBreak } from "../smart-break/index.js";
|
|
5
5
|
import { cx } from "./cx.js";
|
|
6
6
|
function MobileToc({
|
|
7
7
|
headings,
|
package/dist/toc/toc-title.d.ts
CHANGED
|
@@ -5,6 +5,4 @@
|
|
|
5
5
|
* first, then falls back to the full tag, then falls back to the English
|
|
6
6
|
* default so callers always receive a non-empty string.
|
|
7
7
|
*/
|
|
8
|
-
declare function getTocTitle(lang?: string): string;
|
|
9
|
-
|
|
10
|
-
export { getTocTitle };
|
|
8
|
+
export declare function getTocTitle(lang?: string): string;
|
package/dist/toc/toc.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { VNode } from 'preact';
|
|
2
|
-
import { HeadingItem } from './types.js';
|
|
3
|
-
|
|
4
1
|
/** @jsxRuntime automatic */
|
|
5
2
|
/** @jsxImportSource preact */
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import type { VNode } from "preact";
|
|
4
|
+
import type { HeadingItem } from "./types.js";
|
|
5
|
+
export interface TocProps {
|
|
8
6
|
headings: readonly HeadingItem[];
|
|
9
7
|
/**
|
|
10
8
|
* Section label used by MobileToc. The desktop Toc no longer renders
|
|
@@ -52,9 +50,7 @@ interface TocProps {
|
|
|
52
50
|
* `<nav aria-label="Table of contents">` landmark provides the section
|
|
53
51
|
* semantics for screen readers. Issue #1655 / T1.
|
|
54
52
|
*/
|
|
55
|
-
declare function Toc({ headings, title }: TocProps): VNode;
|
|
56
|
-
declare namespace Toc {
|
|
53
|
+
export declare function Toc({ headings, title }: TocProps): VNode;
|
|
54
|
+
export declare namespace Toc {
|
|
57
55
|
var displayName: string;
|
|
58
56
|
}
|
|
59
|
-
|
|
60
|
-
export { Toc, type TocProps };
|
package/dist/toc/toc.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx } from "preact/jsx-runtime";
|
|
3
3
|
import { useMemo } from "preact/hooks";
|
|
4
4
|
import { useActiveHeading } from "./use-active-heading.js";
|
|
5
|
-
import { SmartBreak } from "
|
|
5
|
+
import { SmartBreak } from "../smart-break/index.js";
|
|
6
6
|
import { cx } from "./cx.js";
|
|
7
7
|
function Toc({ headings, title = "On this page" }) {
|
|
8
8
|
const filtered = useMemo(
|
package/dist/toc/types.d.ts
CHANGED
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
* types byte-aligned with the engine so a page module's `headings`
|
|
8
8
|
* export drops in directly.
|
|
9
9
|
*/
|
|
10
|
-
interface HeadingItem {
|
|
10
|
+
export interface HeadingItem {
|
|
11
11
|
readonly depth: number;
|
|
12
12
|
readonly slug: string;
|
|
13
13
|
readonly text: string;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
export type { HeadingItem };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { HeadingItem } from
|
|
2
|
-
|
|
1
|
+
import type { HeadingItem } from "./types.js";
|
|
3
2
|
/**
|
|
4
3
|
* Pure helper that picks the active heading id given the heading slug
|
|
5
4
|
* order and a slug→element map. Extracted from the hook so it is unit-
|
|
@@ -12,8 +11,8 @@ import { HeadingItem } from './types.js';
|
|
|
12
11
|
* midline, treat it as already active. Otherwise activate the
|
|
13
12
|
* predecessor of the first visible heading.
|
|
14
13
|
*/
|
|
15
|
-
declare function getActiveHeadingId(headingIds: readonly string[], elementMap: ReadonlyMap<string, HTMLElement>, viewportHeight: number): string | null;
|
|
16
|
-
interface UseActiveHeadingResult {
|
|
14
|
+
export declare function getActiveHeadingId(headingIds: readonly string[], elementMap: ReadonlyMap<string, HTMLElement>, viewportHeight: number): string | null;
|
|
15
|
+
export interface UseActiveHeadingResult {
|
|
17
16
|
activeId: string | null;
|
|
18
17
|
activate: (id: string) => void;
|
|
19
18
|
}
|
|
@@ -25,6 +24,4 @@ interface UseActiveHeadingResult {
|
|
|
25
24
|
* the smooth-scroll completes (`scrollend`, with a timeout fallback
|
|
26
25
|
* for older Safari).
|
|
27
26
|
*/
|
|
28
|
-
declare function useActiveHeading(headings: readonly HeadingItem[]): UseActiveHeadingResult;
|
|
29
|
-
|
|
30
|
-
export { type UseActiveHeadingResult, getActiveHeadingId, useActiveHeading };
|
|
27
|
+
export declare function useActiveHeading(headings: readonly HeadingItem[]): UseActiveHeadingResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AFTER_NAVIGATE_EVENT,
|
|
1
|
+
export { BEFORE_NAVIGATE_EVENT, AFTER_NAVIGATE_EVENT, onBeforeNavigate, onAfterNavigate, } from "./page-events.js";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* to "page-loading-begin" / Astro's `astro:before-preparation` in
|
|
7
7
|
* the v2 vocabulary.
|
|
8
8
|
*/
|
|
9
|
-
declare const BEFORE_NAVIGATE_EVENT = "zfb:before-preparation";
|
|
9
|
+
export declare const BEFORE_NAVIGATE_EVENT = "zfb:before-preparation";
|
|
10
10
|
/**
|
|
11
11
|
* Event name fired once the new page's `<body>` has been swapped in.
|
|
12
12
|
* Today resolves to `"zfb:after-swap"` — dispatched by zfb's
|
|
@@ -15,7 +15,7 @@ declare const BEFORE_NAVIGATE_EVENT = "zfb:before-preparation";
|
|
|
15
15
|
* both first-paint and post-swap behavior). Direct successor to
|
|
16
16
|
* Astro's `astro:page-load`.
|
|
17
17
|
*/
|
|
18
|
-
declare const AFTER_NAVIGATE_EVENT = "zfb:after-swap";
|
|
18
|
+
export declare const AFTER_NAVIGATE_EVENT = "zfb:after-swap";
|
|
19
19
|
/**
|
|
20
20
|
* Subscribe to "navigation start" — runs `handler` each time the user
|
|
21
21
|
* navigates away from the current page. zfb's `<ClientRouter />`
|
|
@@ -26,7 +26,7 @@ declare const AFTER_NAVIGATE_EVENT = "zfb:after-swap";
|
|
|
26
26
|
* Returns an unsubscribe function. SSR-safe: if `document` is undefined
|
|
27
27
|
* (server / non-browser host) returns a no-op unsubscribe.
|
|
28
28
|
*/
|
|
29
|
-
declare function onBeforeNavigate(handler: () => void): () => void;
|
|
29
|
+
export declare function onBeforeNavigate(handler: () => void): () => void;
|
|
30
30
|
/**
|
|
31
31
|
* Subscribe to "navigation end" — runs `handler` after each page-body
|
|
32
32
|
* swap. Mirrors Astro's `astro:page-load`: fires once on first load,
|
|
@@ -36,6 +36,4 @@ declare function onBeforeNavigate(handler: () => void): () => void;
|
|
|
36
36
|
* Returns an unsubscribe function. SSR-safe: returns a no-op when
|
|
37
37
|
* called outside a browser.
|
|
38
38
|
*/
|
|
39
|
-
declare function onAfterNavigate(handler: () => void): () => void;
|
|
40
|
-
|
|
41
|
-
export { AFTER_NAVIGATE_EVENT, BEFORE_NAVIGATE_EVENT, onAfterNavigate, onBeforeNavigate };
|
|
39
|
+
export declare function onAfterNavigate(handler: () => void): () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
export declare const INDENT = "clamp(0.8rem, 1.2vw, 1.625rem)";
|
|
4
|
+
export declare const CONNECTOR_OFFSET = "clamp(0.2rem, 0.3vw, 0.5rem)";
|
|
5
|
+
export declare const CONNECTOR_WIDTH = "clamp(0.4rem, 0.6vw, 1rem)";
|
|
6
|
+
export declare const BASE_PAD = "clamp(0.4rem, 0.8vw, 1.3rem)";
|
|
7
|
+
export declare function connectorLeft(depth: number): string;
|
|
8
|
+
export declare function CategoryLinkIcon({ className }: {
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("preact").JSX.Element;
|
|
11
|
+
export declare function ConnectorLines({ depth, isLast, widthScale, topPad, }: {
|
|
12
|
+
depth: number;
|
|
13
|
+
isLast: boolean;
|
|
14
|
+
widthScale?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Padding-top of the inner content row that holds the link text. The horizontal
|
|
17
|
+
* connector and (when `isLast`) the vertical clip both anchor to the first-line
|
|
18
|
+
* midpoint computed as `topPad + 0.5lh`, so multi-line labels keep the connector
|
|
19
|
+
* aligned with the first line instead of the row's vertical center.
|
|
20
|
+
*/
|
|
21
|
+
topPad?: string;
|
|
22
|
+
}): import("preact").JSX.Element | null;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
const INDENT = "clamp(0.8rem, 1.2vw, 1.625rem)";
|
|
3
|
+
const CONNECTOR_OFFSET = "clamp(0.2rem, 0.3vw, 0.5rem)";
|
|
4
|
+
const CONNECTOR_WIDTH = "clamp(0.4rem, 0.6vw, 1rem)";
|
|
5
|
+
const BASE_PAD = "clamp(0.4rem, 0.8vw, 1.3rem)";
|
|
6
|
+
function connectorLeft(depth) {
|
|
7
|
+
return `calc(${depth} * ${INDENT} + ${CONNECTOR_OFFSET})`;
|
|
8
|
+
}
|
|
9
|
+
const CATEGORY_LINK_PATH = "M5.746 5.74 0 11.49l20.987 20.96C34.126 45.572 41.963 53.45 41.948 53.523c-.012.062-9.456 9.544-20.986 21.07L0 95.55l5.714 5.715c3.142 3.143 5.748 5.715 5.79 5.715s2.63-2.563 5.75-5.696l17.939-18.001c21.867-21.94 29.443-29.599 29.443-29.768 0-.114-.665-.804-5.084-5.275C51.872 40.47 11.71.125 11.565.036 11.525.01 8.906 2.578 5.746 5.74m38.345-.066c-3.132 3.13-5.696 5.71-5.696 5.732-.001.022 2.16 2.185 4.8 4.807 2.641 2.623 8.382 8.338 12.758 12.702 15.38 15.337 23.763 23.641 24.314 24.086.19.153.346.336.346.405 0 .07-1.738 1.847-3.887 3.976a17515 17515 0 0 0-20.35 20.264 19555 19555 0 0 1-17.223 17.158c-.416.409-.757.77-.757.8 0 .083 11.415 11.485 11.457 11.445.235-.22 53.542-53.528 53.542-53.543C103.395 53.472 49.891.02 49.837 0c-.028-.01-2.613 2.543-5.746 5.674";
|
|
10
|
+
function CategoryLinkIcon({ className }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
fill: "currentColor",
|
|
16
|
+
viewBox: "0 0 103.395 107.049",
|
|
17
|
+
"aria-hidden": "true",
|
|
18
|
+
className: `shrink-0 ${className ?? ""}`,
|
|
19
|
+
children: /* @__PURE__ */ jsx("path", { d: CATEGORY_LINK_PATH })
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
function ConnectorLines({
|
|
24
|
+
depth,
|
|
25
|
+
isLast,
|
|
26
|
+
widthScale = 1,
|
|
27
|
+
topPad = "0px"
|
|
28
|
+
}) {
|
|
29
|
+
if (depth === 0) return null;
|
|
30
|
+
const left = connectorLeft(depth);
|
|
31
|
+
const width = widthScale === 1 ? CONNECTOR_WIDTH : `calc(${CONNECTOR_WIDTH} * ${widthScale})`;
|
|
32
|
+
const firstLineMid = `calc(${topPad} + 0.5lh)`;
|
|
33
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: "absolute border-l border-dashed border-muted",
|
|
38
|
+
style: {
|
|
39
|
+
left,
|
|
40
|
+
top: 0,
|
|
41
|
+
bottom: isLast ? `calc(100% - ${firstLineMid})` : 0
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
),
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: "absolute border-t border-dashed border-muted",
|
|
49
|
+
style: {
|
|
50
|
+
left,
|
|
51
|
+
width,
|
|
52
|
+
top: firstLineMid
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
BASE_PAD,
|
|
60
|
+
CONNECTOR_OFFSET,
|
|
61
|
+
CONNECTOR_WIDTH,
|
|
62
|
+
CategoryLinkIcon,
|
|
63
|
+
ConnectorLines,
|
|
64
|
+
INDENT,
|
|
65
|
+
connectorLeft
|
|
66
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Settings } from "../settings.js";
|
|
2
|
+
import type { FactoryI18n } from "../factory-context/index.js";
|
|
3
|
+
/** Represents a locale switcher link (mirrors the host `LocaleLink`). */
|
|
4
|
+
export interface LocaleLink {
|
|
5
|
+
code: string;
|
|
6
|
+
label: string;
|
|
7
|
+
href: string;
|
|
8
|
+
active: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** The settings fields the URL helpers read. */
|
|
11
|
+
export type UrlHelperSettings = Pick<Settings, "base" | "trailingSlash" | "siteUrl" | "defaultLocaleOnlyPrefixes">;
|
|
12
|
+
/** The full set of URL helpers built from `(settings, i18n)`. */
|
|
13
|
+
export interface UrlHelpers {
|
|
14
|
+
/** Normalized base path with no trailing slash (empty string when "/"). */
|
|
15
|
+
normalizedBase: string;
|
|
16
|
+
applyTrailingSlash(url: string): string;
|
|
17
|
+
withBase(path: string): string;
|
|
18
|
+
stripBase(path: string): string;
|
|
19
|
+
absoluteUrl(pageUrl: string): string | undefined;
|
|
20
|
+
docsUrl(slug: string, lang?: string): string;
|
|
21
|
+
isExternal(href: string): boolean;
|
|
22
|
+
resolveHref(href: string): string;
|
|
23
|
+
navHref(path: string, lang: string | undefined, currentVersion: string | undefined): string;
|
|
24
|
+
getPathForLocale(path: string, currentLang: string, targetLang: string): string;
|
|
25
|
+
buildLocaleLinks(currentPath: string, currentLang: string): LocaleLink[];
|
|
26
|
+
isDefaultLocaleOnlyPath(path: string): boolean;
|
|
27
|
+
versionedDocsUrl(slug: string, versionSlug: string, lang?: string): string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build the URL helper set from the host's settings + i18n surface.
|
|
31
|
+
*
|
|
32
|
+
* Equivalent to the legacy `src/utils/base.ts` module functions, but with the
|
|
33
|
+
* project singletons injected rather than imported — so the same logic ships
|
|
34
|
+
* from the package. The host stub calls this once with its concrete settings and
|
|
35
|
+
* i18n and re-exports the result.
|
|
36
|
+
*/
|
|
37
|
+
export declare function makeUrlHelpers(settings: UrlHelperSettings, i18n: FactoryI18n): UrlHelpers;
|