@takazudo/zudo-doc 3.2.0 → 4.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 +61 -0
- package/README.md +2 -2
- package/bin/tag-cli-config.ts +126 -0
- package/bin/tags-audit-runner.ts +60 -76
- package/bin/tags-audit.mjs +17 -36
- package/bin/tags-suggest-runner.ts +429 -0
- package/bin/tags-suggest.mjs +30 -0
- package/bin/zudo-doc.mjs +78 -25
- package/dist/breadcrumb/breadcrumb.d.ts +4 -4
- package/dist/breadcrumb/find-path.d.ts +2 -2
- package/dist/breadcrumb/index.d.ts +1 -1
- package/dist/breadcrumb/types.d.ts +0 -5
- package/dist/chrome/derive.d.ts +16 -4
- package/dist/chrome/derive.js +64 -4
- package/dist/chrome/index.d.ts +13 -10
- package/dist/chrome/index.js +12 -6
- package/dist/chrome/primary-slots.d.ts +21 -0
- package/dist/chrome/primary-slots.js +59 -0
- package/dist/chrome-bindings.d.ts +227 -0
- package/dist/chrome-bindings.js +6 -0
- package/dist/code-syntax/code-block-enhancer-script.d.ts +4 -0
- package/dist/code-syntax/code-block-enhancer-script.js +7 -4
- package/dist/code-syntax/code-block-enhancer.d.ts +2 -2
- package/dist/code-syntax/code-block-enhancer.js +1 -3
- package/dist/code-syntax/index.d.ts +5 -5
- package/dist/code-syntax/index.js +4 -13
- package/dist/code-syntax/mermaid-init-script.d.ts +1 -22
- package/dist/code-syntax/mermaid-init-script.js +0 -2
- package/dist/code-syntax/mermaid-init.d.ts +0 -1
- package/dist/code-syntax/mermaid-init.js +3 -4
- package/dist/code-syntax/tabs-init.d.ts +0 -1
- package/dist/code-syntax/tabs-init.js +1 -3
- package/dist/code-syntax/tabs.d.ts +0 -1
- package/dist/code-syntax/tabs.js +1 -3
- package/dist/color-scheme-utils.d.ts +72 -4
- package/dist/color-scheme-utils.js +137 -0
- package/dist/color-schemes-defaults/index.d.ts +23 -0
- package/dist/color-schemes-defaults/index.js +134 -0
- package/dist/config.d.ts +459 -0
- package/dist/config.js +125 -0
- package/dist/content/component-map.d.ts +0 -16
- package/dist/content/component-map.js +2 -4
- package/dist/content/index.d.ts +1 -1
- package/dist/content/index.js +2 -3
- package/dist/content.css +1 -1
- package/dist/design-token-panel-bootstrap.d.ts +82 -27
- package/dist/design-token-panel-bootstrap.js +110 -21
- package/dist/design-token-panel-config/index.d.ts +49 -0
- package/dist/design-token-panel-config/index.js +211 -0
- package/dist/design-token-panel-config/manifest.d.ts +46 -0
- package/dist/design-token-panel-config/manifest.js +105 -0
- package/dist/directive-vocabulary-defaults/index.d.ts +16 -0
- package/dist/directive-vocabulary-defaults/index.js +12 -0
- package/dist/doc-body-end-islands/design-token-panel-island.d.ts +15 -0
- package/dist/doc-body-end-islands/design-token-panel-island.js +31 -0
- package/dist/doc-body-end-islands/index.d.ts +52 -7
- package/dist/doc-body-end-islands/index.js +19 -0
- package/dist/doc-body-end-islands/theme-pack-switcher-island.d.ts +37 -0
- package/dist/doc-body-end-islands/theme-pack-switcher-island.js +18 -0
- package/dist/doc-content-header/index.js +1 -1
- package/dist/doc-history-area/index.d.ts +10 -4
- package/dist/doc-history-area/index.js +3 -2
- package/dist/doc-metainfo-area/index.d.ts +1 -0
- package/dist/doc-page-props/index.d.ts +7 -23
- package/dist/doc-page-renderer/index.d.ts +1 -0
- package/dist/doc-page-renderer/index.js +1 -0
- package/dist/doc-page-shell/index.js +19 -12
- package/dist/doc-pager/index.js +1 -1
- package/dist/doc-route-entries/index.d.ts +2 -2
- package/dist/doclayout/doc-layout-with-defaults.js +4 -4
- package/dist/doclayout/doc-layout.d.ts +8 -0
- package/dist/doclayout/doc-layout.js +10 -1
- package/dist/docs-schema/index.d.ts +67 -0
- package/dist/docs-schema/index.js +43 -0
- package/dist/eject/index.d.ts +16 -0
- package/dist/eject/index.js +122 -28
- package/dist/extract-headings/index.d.ts +5 -8
- package/dist/extract-headings/index.js +2 -9
- package/dist/factory-context/index.d.ts +56 -4
- package/dist/features.css +65 -43
- package/dist/find-in-page/find-bar.d.ts +9 -0
- package/dist/find-in-page/find-bar.js +114 -0
- package/dist/find-in-page/find-in-page.d.ts +17 -0
- package/dist/find-in-page/find-in-page.js +131 -0
- package/dist/find-in-page/index.d.ts +11 -0
- package/dist/find-in-page/index.js +49 -0
- package/dist/footer/footer.js +1 -0
- package/dist/frontmatter-preview-defaults/index.d.ts +16 -0
- package/dist/frontmatter-preview-defaults/index.js +25 -0
- package/dist/head-with-defaults/index.d.ts +2 -0
- package/dist/head-with-defaults/index.js +16 -0
- package/dist/header/header.d.ts +10 -5
- package/dist/header/header.js +45 -5
- package/dist/header/index.d.ts +1 -1
- package/dist/header/types.d.ts +30 -1
- package/dist/header-with-defaults/index.js +1 -0
- package/dist/home-page/index.d.ts +2 -0
- package/dist/home-page/index.js +11 -5
- package/dist/home-page/prepare-home-data.js +1 -1
- package/dist/i18n-defaults/index.d.ts +22 -0
- package/dist/i18n-defaults/index.js +167 -0
- package/dist/locale-merge/index.d.ts +9 -14
- package/dist/locale-merge/index.js +6 -4
- package/dist/mdx-components/index.js +4 -4
- package/dist/plugins/claude-resources.d.ts +1 -0
- package/dist/plugins/claude-resources.js +4 -2
- package/dist/plugins/doc-history.js +1 -1
- package/dist/{integrations → plugins/internal}/claude-resources/index.d.ts +1 -16
- package/dist/{integrations → plugins/internal}/claude-resources/index.js +0 -9
- package/dist/{integrations → plugins/internal}/doc-history/index.d.ts +0 -17
- package/dist/{integrations → plugins/internal}/doc-history/index.js +0 -4
- package/dist/{integrations → plugins/internal}/doc-history/pre-build.d.ts +2 -4
- package/dist/plugins/internal/llms-txt/index.d.ts +7 -0
- package/dist/{integrations → plugins/internal}/llms-txt/load.d.ts +1 -1
- package/dist/{integrations → plugins/internal}/llms-txt/load.js +2 -2
- package/dist/{integrations → plugins/internal}/llms-txt/strip.d.ts +2 -3
- package/dist/{integrations → plugins/internal}/llms-txt/strip.js +1 -1
- package/dist/{integrations → plugins/internal}/llms-txt/types.d.ts +13 -22
- package/dist/{integrations → plugins/internal}/search-index/collect.js +1 -1
- package/dist/plugins/internal/theme-packs/copy.d.ts +32 -0
- package/dist/plugins/internal/theme-packs/copy.js +45 -0
- package/dist/plugins/internal/theme-packs/dev-middleware.d.ts +22 -0
- package/dist/plugins/internal/theme-packs/dev-middleware.js +80 -0
- package/dist/plugins/internal/theme-packs/index.d.ts +6 -0
- package/dist/plugins/internal/theme-packs/index.js +9 -0
- package/dist/plugins/internal/theme-packs/resolve.d.ts +17 -0
- package/dist/plugins/internal/theme-packs/resolve.js +17 -0
- package/dist/plugins/internal/theme-packs/types.d.ts +22 -0
- package/dist/plugins/internal/theme-packs/types.js +0 -0
- package/dist/plugins/llms-txt.js +1 -1
- package/dist/plugins/routes.js +55 -21
- package/dist/plugins/search-index.js +1 -1
- package/dist/plugins/theme-packs.d.ts +3 -0
- package/dist/plugins/theme-packs.js +40 -0
- package/dist/preset.d.ts +28 -14
- package/dist/preset.js +24 -9
- package/dist/route-context/index.js +4 -6
- package/dist/route-enumerators/index.d.ts +6 -18
- package/dist/route-enumerators/index.js +8 -6
- package/dist/routes/404.js +3 -1
- package/dist/routes/_chrome.js +3 -2
- package/dist/routes/_context.d.ts +7 -3
- package/dist/routes/_context.js +2 -0
- package/dist/routes/_docs-helpers.js +9 -21
- package/dist/safelist.css +1 -1
- package/dist/settings.d.ts +64 -12
- package/dist/sidebar-tree/build-tree.d.ts +3 -4
- package/dist/sidebar-tree/build-tree.js +4 -3
- package/dist/sidebar-tree/index.d.ts +2 -2
- package/dist/sidebar-tree/types.d.ts +6 -17
- package/dist/site-tree-nav-island/index.d.ts +3 -1
- package/dist/site-tree-nav-island/index.js +17 -5
- package/dist/site-tree-nav-island/state.d.ts +4 -0
- package/dist/site-tree-nav-island/state.js +10 -0
- package/dist/tag-helpers/index.d.ts +6 -13
- package/dist/tag-helpers/index.js +5 -23
- package/dist/tag-pages/index.d.ts +8 -21
- package/dist/tag-pages/index.js +14 -10
- package/dist/tags-audit.d.ts +16 -44
- package/dist/tags-audit.js +9 -172
- package/dist/theme/color-scheme-provider.d.ts +2 -3
- package/dist/theme/color-scheme-provider.js +2 -10
- package/dist/theme/index.d.ts +1 -4
- package/dist/theme/index.js +2 -30
- package/dist/theme/theme-pack-provider.d.ts +42 -0
- package/dist/theme/theme-pack-provider.js +75 -0
- package/dist/theme-cli/apply.d.ts +16 -0
- package/dist/theme-cli/apply.js +61 -0
- package/dist/theme-cli/config-io.d.ts +15 -0
- package/dist/theme-cli/config-io.js +51 -0
- package/dist/theme-cli/config-rewriter.d.ts +21 -0
- package/dist/theme-cli/config-rewriter.js +141 -0
- package/dist/theme-cli/config-scanner.d.ts +63 -0
- package/dist/theme-cli/config-scanner.js +288 -0
- package/dist/theme-cli/index.d.ts +7 -0
- package/dist/theme-cli/index.js +38 -0
- package/dist/theme-cli/list.d.ts +27 -0
- package/dist/theme-cli/list.js +64 -0
- package/dist/theme-cli/provenance.d.ts +17 -0
- package/dist/theme-cli/provenance.js +35 -0
- package/dist/theme-cli/registry.d.ts +14 -0
- package/dist/theme-cli/registry.js +13 -0
- package/dist/theme-pack-dialog/dialog-state.d.ts +25 -0
- package/dist/theme-pack-dialog/dialog-state.js +40 -0
- package/dist/theme-pack-dialog/index.d.ts +5 -0
- package/dist/theme-pack-dialog/index.js +152 -0
- package/dist/theme-pack-dialog/theme-pack-card.d.ts +25 -0
- package/dist/theme-pack-dialog/theme-pack-card.js +72 -0
- package/dist/theme-pack-switcher/index.d.ts +49 -0
- package/dist/theme-pack-switcher/index.js +205 -0
- package/dist/theme-pack-switcher/switcher-state.d.ts +56 -0
- package/dist/theme-pack-switcher/switcher-state.js +43 -0
- package/dist/theme-pack-switcher/theme-pack-sync.d.ts +85 -0
- package/dist/theme-pack-switcher/theme-pack-sync.js +121 -0
- package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegible-400-latin.woff2 +0 -0
- package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegible-700-latin.woff2 +0 -0
- package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegible-italic-400-latin.woff2 +0 -0
- package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegible-italic-700-latin.woff2 +0 -0
- package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegibleMono-italic-latin.woff2 +0 -0
- package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegibleMono-latin.woff2 +0 -0
- package/dist/theme-packs/beacon/fonts/OFL.txt +94 -0
- package/dist/theme-packs/beacon/meta.json +37 -0
- package/dist/theme-packs/beacon/pack.css +442 -0
- package/dist/theme-packs/broadsheet/fonts/CourierPrime-400-latin.woff2 +0 -0
- package/dist/theme-packs/broadsheet/fonts/CourierPrime-700-latin.woff2 +0 -0
- package/dist/theme-packs/broadsheet/fonts/OFL.txt +95 -0
- package/dist/theme-packs/broadsheet/fonts/PlayfairDisplay-italic-latin.woff2 +0 -0
- package/dist/theme-packs/broadsheet/fonts/PlayfairDisplay-latin.woff2 +0 -0
- package/dist/theme-packs/broadsheet/fonts/SourceSerif4-italic-latin.woff2 +0 -0
- package/dist/theme-packs/broadsheet/fonts/SourceSerif4-latin.woff2 +0 -0
- package/dist/theme-packs/broadsheet/meta.json +38 -0
- package/dist/theme-packs/broadsheet/pack.css +448 -0
- package/dist/theme-packs/brutalist/fonts/ArchivoBlack-latin.woff2 +0 -0
- package/dist/theme-packs/brutalist/fonts/IBMPlexMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/brutalist/fonts/IBMPlexMono-500-latin.woff2 +0 -0
- package/dist/theme-packs/brutalist/fonts/IBMPlexMono-700-latin.woff2 +0 -0
- package/dist/theme-packs/brutalist/fonts/OFL.txt +95 -0
- package/dist/theme-packs/brutalist/fonts/SpaceGrotesk-latin.woff2 +0 -0
- package/dist/theme-packs/brutalist/meta.json +38 -0
- package/dist/theme-packs/brutalist/pack.css +546 -0
- package/dist/theme-packs/default/meta.json +37 -0
- package/dist/theme-packs/drift/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
- package/dist/theme-packs/drift/fonts/IBMPlexMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/drift/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
- package/dist/theme-packs/drift/fonts/IBMPlexMono-500-latin.woff2 +0 -0
- package/dist/theme-packs/drift/fonts/IBMPlexSans-italic-latin.woff2 +0 -0
- package/dist/theme-packs/drift/fonts/IBMPlexSans-latin-ext.woff2 +0 -0
- package/dist/theme-packs/drift/fonts/IBMPlexSans-latin.woff2 +0 -0
- package/dist/theme-packs/drift/fonts/OFL.txt +93 -0
- package/dist/theme-packs/drift/meta.json +37 -0
- package/dist/theme-packs/drift/pack.css +478 -0
- package/dist/theme-packs/fjord/fonts/Inter-latin-ext.woff2 +0 -0
- package/dist/theme-packs/fjord/fonts/Inter-latin.woff2 +0 -0
- package/dist/theme-packs/fjord/fonts/JetBrainsMono-latin-ext.woff2 +0 -0
- package/dist/theme-packs/fjord/fonts/JetBrainsMono-latin.woff2 +0 -0
- package/dist/theme-packs/fjord/fonts/OFL.txt +94 -0
- package/dist/theme-packs/fjord/meta.json +37 -0
- package/dist/theme-packs/fjord/pack.css +375 -0
- package/dist/theme-packs/foundry/fonts/Inter-latin-ext.woff2 +0 -0
- package/dist/theme-packs/foundry/fonts/Inter-latin.woff2 +0 -0
- package/dist/theme-packs/foundry/fonts/OFL.txt +93 -0
- package/dist/theme-packs/foundry/meta.json +37 -0
- package/dist/theme-packs/foundry/pack.css +202 -0
- package/dist/theme-packs/futura-editorial/fonts/Jost-latin.woff2 +0 -0
- package/dist/theme-packs/futura-editorial/fonts/NotoSans-italic-latin.woff2 +0 -0
- package/dist/theme-packs/futura-editorial/fonts/NotoSans-latin.woff2 +0 -0
- package/dist/theme-packs/futura-editorial/fonts/OFL.txt +95 -0
- package/dist/theme-packs/futura-editorial/fonts/SpaceMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/futura-editorial/fonts/SpaceMono-700-latin.woff2 +0 -0
- package/dist/theme-packs/futura-editorial/meta.json +38 -0
- package/dist/theme-packs/futura-editorial/pack.css +313 -0
- package/dist/theme-packs/hearth/fonts/Fraunces-italic-latin.woff2 +0 -0
- package/dist/theme-packs/hearth/fonts/Fraunces-latin.woff2 +0 -0
- package/dist/theme-packs/hearth/fonts/Nunito-latin.woff2 +0 -0
- package/dist/theme-packs/hearth/fonts/OFL.txt +95 -0
- package/dist/theme-packs/hearth/fonts/SplineSansMono-latin.woff2 +0 -0
- package/dist/theme-packs/hearth/meta.json +38 -0
- package/dist/theme-packs/hearth/pack.css +385 -0
- package/dist/theme-packs/hollow/fonts/OFL.txt +94 -0
- package/dist/theme-packs/hollow/fonts/SpaceGrotesk-latin.woff2 +0 -0
- package/dist/theme-packs/hollow/fonts/SpaceMono-400-italic-latin.woff2 +0 -0
- package/dist/theme-packs/hollow/fonts/SpaceMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/hollow/fonts/SpaceMono-700-latin.woff2 +0 -0
- package/dist/theme-packs/hollow/meta.json +37 -0
- package/dist/theme-packs/hollow/pack.css +428 -0
- package/dist/theme-packs/ledger/fonts/CrimsonPro-latin-ext-italic.woff2 +0 -0
- package/dist/theme-packs/ledger/fonts/CrimsonPro-latin-ext.woff2 +0 -0
- package/dist/theme-packs/ledger/fonts/CrimsonPro-latin-italic.woff2 +0 -0
- package/dist/theme-packs/ledger/fonts/CrimsonPro-latin.woff2 +0 -0
- package/dist/theme-packs/ledger/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
- package/dist/theme-packs/ledger/fonts/IBMPlexMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/ledger/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
- package/dist/theme-packs/ledger/fonts/IBMPlexMono-500-latin.woff2 +0 -0
- package/dist/theme-packs/ledger/fonts/OFL.txt +94 -0
- package/dist/theme-packs/ledger/meta.json +37 -0
- package/dist/theme-packs/ledger/pack.css +463 -0
- package/dist/theme-packs/manuscript/fonts/CourierPrime-400-latin-ext.woff2 +0 -0
- package/dist/theme-packs/manuscript/fonts/CourierPrime-400-latin.woff2 +0 -0
- package/dist/theme-packs/manuscript/fonts/CourierPrime-700-latin-ext.woff2 +0 -0
- package/dist/theme-packs/manuscript/fonts/CourierPrime-700-latin.woff2 +0 -0
- package/dist/theme-packs/manuscript/fonts/EBGaramond-latin-italic.woff2 +0 -0
- package/dist/theme-packs/manuscript/fonts/EBGaramond-latin.woff2 +0 -0
- package/dist/theme-packs/manuscript/fonts/OFL.txt +94 -0
- package/dist/theme-packs/manuscript/meta.json +37 -0
- package/dist/theme-packs/manuscript/pack.css +376 -0
- package/dist/theme-packs/matcha/fonts/MPLUS1Code-latin.woff2 +0 -0
- package/dist/theme-packs/matcha/fonts/OFL.txt +95 -0
- package/dist/theme-packs/matcha/fonts/ShipporiMincho-500-latin.woff2 +0 -0
- package/dist/theme-packs/matcha/fonts/ShipporiMincho-700-latin.woff2 +0 -0
- package/dist/theme-packs/matcha/fonts/ZenKakuGothicNew-400-latin.woff2 +0 -0
- package/dist/theme-packs/matcha/fonts/ZenKakuGothicNew-500-latin.woff2 +0 -0
- package/dist/theme-packs/matcha/meta.json +38 -0
- package/dist/theme-packs/matcha/pack.css +409 -0
- package/dist/theme-packs/nocturne/fonts/CormorantGaramond-italic-latin.woff2 +0 -0
- package/dist/theme-packs/nocturne/fonts/CormorantGaramond-latin.woff2 +0 -0
- package/dist/theme-packs/nocturne/fonts/IBMPlexMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/nocturne/fonts/IBMPlexMono-500-latin.woff2 +0 -0
- package/dist/theme-packs/nocturne/fonts/IBMPlexMono-italic-latin.woff2 +0 -0
- package/dist/theme-packs/nocturne/fonts/Manrope-latin.woff2 +0 -0
- package/dist/theme-packs/nocturne/fonts/OFL.txt +95 -0
- package/dist/theme-packs/nocturne/meta.json +38 -0
- package/dist/theme-packs/nocturne/pack.css +502 -0
- package/dist/theme-packs/observatory/fonts/JosefinSans-latin.woff2 +0 -0
- package/dist/theme-packs/observatory/fonts/Jost-italic-latin.woff2 +0 -0
- package/dist/theme-packs/observatory/fonts/Jost-latin.woff2 +0 -0
- package/dist/theme-packs/observatory/fonts/OFL.txt +95 -0
- package/dist/theme-packs/observatory/fonts/SpaceMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/observatory/fonts/SpaceMono-700-latin.woff2 +0 -0
- package/dist/theme-packs/observatory/fonts/SpaceMono-italic-latin.woff2 +0 -0
- package/dist/theme-packs/observatory/meta.json +38 -0
- package/dist/theme-packs/observatory/pack.css +728 -0
- package/dist/theme-packs/onyx/fonts/CormorantGaramond-italic-latin.woff2 +0 -0
- package/dist/theme-packs/onyx/fonts/CormorantGaramond-latin.woff2 +0 -0
- package/dist/theme-packs/onyx/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
- package/dist/theme-packs/onyx/fonts/IBMPlexMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/onyx/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
- package/dist/theme-packs/onyx/fonts/IBMPlexMono-500-latin.woff2 +0 -0
- package/dist/theme-packs/onyx/fonts/Jost-latin.woff2 +0 -0
- package/dist/theme-packs/onyx/fonts/OFL.txt +95 -0
- package/dist/theme-packs/onyx/meta.json +38 -0
- package/dist/theme-packs/onyx/pack.css +497 -0
- package/dist/theme-packs/phosphor/fonts/JetBrainsMono-latin-ext.woff2 +0 -0
- package/dist/theme-packs/phosphor/fonts/JetBrainsMono-latin.woff2 +0 -0
- package/dist/theme-packs/phosphor/fonts/OFL.txt +94 -0
- package/dist/theme-packs/phosphor/fonts/VT323-latin-ext.woff2 +0 -0
- package/dist/theme-packs/phosphor/fonts/VT323-latin.woff2 +0 -0
- package/dist/theme-packs/phosphor/meta.json +38 -0
- package/dist/theme-packs/phosphor/pack.css +493 -0
- package/dist/theme-packs/solar/fonts/OFL.txt +94 -0
- package/dist/theme-packs/solar/fonts/SourceCodePro-italic-latin.woff2 +0 -0
- package/dist/theme-packs/solar/fonts/SourceCodePro-latin.woff2 +0 -0
- package/dist/theme-packs/solar/fonts/SourceSans3-italic-latin.woff2 +0 -0
- package/dist/theme-packs/solar/fonts/SourceSans3-latin.woff2 +0 -0
- package/dist/theme-packs/solar/meta.json +37 -0
- package/dist/theme-packs/solar/pack.css +380 -0
- package/dist/theme-packs/sumi/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
- package/dist/theme-packs/sumi/fonts/IBMPlexMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/sumi/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
- package/dist/theme-packs/sumi/fonts/IBMPlexMono-500-latin.woff2 +0 -0
- package/dist/theme-packs/sumi/fonts/OFL.txt +95 -0
- package/dist/theme-packs/sumi/fonts/ShipporiMinchoB1-600-latin.woff2 +0 -0
- package/dist/theme-packs/sumi/fonts/ShipporiMinchoB1-700-latin.woff2 +0 -0
- package/dist/theme-packs/sumi/fonts/ShipporiMinchoB1-800-latin.woff2 +0 -0
- package/dist/theme-packs/sumi/fonts/ZenKakuGothicNew-400-latin.woff2 +0 -0
- package/dist/theme-packs/sumi/fonts/ZenKakuGothicNew-500-latin.woff2 +0 -0
- package/dist/theme-packs/sumi/meta.json +38 -0
- package/dist/theme-packs/sumi/pack.css +502 -0
- package/dist/theme-packs/swissgrid/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
- package/dist/theme-packs/swissgrid/fonts/IBMPlexMono-400-latin.woff2 +0 -0
- package/dist/theme-packs/swissgrid/fonts/IBMPlexMono-600-latin.woff2 +0 -0
- package/dist/theme-packs/swissgrid/fonts/Inter-latin-ext.woff2 +0 -0
- package/dist/theme-packs/swissgrid/fonts/Inter-latin.woff2 +0 -0
- package/dist/theme-packs/swissgrid/fonts/InterTight-latin.woff2 +0 -0
- package/dist/theme-packs/swissgrid/fonts/OFL.txt +95 -0
- package/dist/theme-packs/swissgrid/meta.json +38 -0
- package/dist/theme-packs/swissgrid/pack.css +518 -0
- package/dist/theme-packs/washi/fonts/MPlus1Code-400-latin.woff2 +0 -0
- package/dist/theme-packs/washi/fonts/MPlus1Code-500-latin.woff2 +0 -0
- package/dist/theme-packs/washi/fonts/OFL.txt +95 -0
- package/dist/theme-packs/washi/fonts/ShipporiMincho-500-latin.woff2 +0 -0
- package/dist/theme-packs/washi/fonts/ShipporiMincho-600-latin.woff2 +0 -0
- package/dist/theme-packs/washi/fonts/ShipporiMincho-700-latin.woff2 +0 -0
- package/dist/theme-packs/washi/fonts/ZenKakuGothicNew-400-latin.woff2 +0 -0
- package/dist/theme-packs/washi/fonts/ZenKakuGothicNew-500-latin.woff2 +0 -0
- package/dist/theme-packs/washi/fonts/ZenKakuGothicNew-700-latin.woff2 +0 -0
- package/dist/theme-packs/washi/meta.json +38 -0
- package/dist/theme-packs/washi/pack.css +479 -0
- package/dist/theme-packs-registry/index.d.ts +5 -0
- package/dist/theme-packs-registry/index.js +30 -0
- package/dist/theme-packs-registry/load-registry.d.ts +23 -0
- package/dist/theme-packs-registry/load-registry.js +64 -0
- package/dist/theme-packs-registry/meta-schema.d.ts +70 -0
- package/dist/theme-packs-registry/meta-schema.js +38 -0
- package/dist/theme-packs-registry/resolve-enabled-packs.d.ts +25 -0
- package/dist/theme-packs-registry/resolve-enabled-packs.js +43 -0
- package/dist/theme-packs-registry/token-manifest.d.ts +19 -0
- package/dist/theme-packs-registry/token-manifest.js +57 -0
- package/dist/theme-packs-registry/validator.d.ts +35 -0
- package/dist/theme-packs-registry/validator.js +284 -0
- package/dist/theme-toggle/color-scheme-sync.d.ts +2 -4
- package/dist/theme.css +319 -0
- package/dist/versions-page/index.d.ts +2 -2
- package/dist/versions-page/index.js +8 -8
- package/dist/z-index-defaults/index.d.ts +45 -0
- package/dist/z-index-defaults/index.js +34 -0
- package/eject/breadcrumb/breadcrumb.tsx +4 -4
- package/eject/breadcrumb/find-path.ts +2 -2
- package/eject/breadcrumb/index.ts +1 -1
- package/eject/breadcrumb/types.ts +0 -6
- package/eject/code-group/index.tsx +2 -2
- package/eject/doc-history/index.tsx +1 -1
- package/eject/doc-pager/index.tsx +1 -1
- package/eject/footer/footer.tsx +1 -0
- package/eject/header/header.tsx +86 -21
- package/eject/header/index.ts +3 -0
- package/eject/header/types.ts +39 -1
- package/eject/site-tree-nav-island/index.tsx +15 -3
- package/eject/site-tree-nav-island/state.ts +9 -0
- package/eject/theme-toggle/color-scheme-sync.ts +2 -4
- package/package.json +82 -29
- package/routes-src/404.tsx +4 -1
- package/routes-src/_chrome.tsx +31 -8
- package/routes-src/_context.ts +4 -0
- package/routes-src/_docs-helpers.ts +9 -29
- package/routes-src/_virtual.d.ts +38 -2
- package/tsconfig.base.json +29 -0
- package/virtual-modules.d.ts +83 -0
- package/zfb-config-shim.d.ts +210 -0
- package/dist/integrations/llms-txt/index.d.ts +0 -33
- package/dist/theme/color-tweak-export-modal.d.ts +0 -16
- package/dist/theme/color-tweak-export-modal.js +0 -138
- package/dist/theme/design-token-serde.d.ts +0 -183
- package/dist/theme/design-token-serde.js +0 -346
- package/dist/theme/design-token-types.d.ts +0 -13
- package/dist/theme/design-token-types.js +0 -6
- package/dist/theme/iframe-bridge.d.ts +0 -42
- package/dist/theme/iframe-bridge.js +0 -72
- /package/dist/{integrations → plugins/internal}/claude-resources/escape-for-mdx.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/claude-resources/escape-for-mdx.js +0 -0
- /package/dist/{integrations → plugins/internal}/claude-resources/generate.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/claude-resources/generate.js +0 -0
- /package/dist/{integrations → plugins/internal}/doc-history/pre-build.js +0 -0
- /package/dist/{integrations → plugins/internal}/llms-txt/dev-middleware.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/llms-txt/dev-middleware.js +0 -0
- /package/dist/{integrations → plugins/internal}/llms-txt/emit.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/llms-txt/emit.js +0 -0
- /package/dist/{integrations → plugins/internal}/llms-txt/generate.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/llms-txt/generate.js +0 -0
- /package/dist/{integrations → plugins/internal}/llms-txt/index.js +0 -0
- /package/dist/{integrations → plugins/internal}/llms-txt/types.js +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/build-emitter.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/build-emitter.js +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/collect.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/dev-middleware.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/dev-middleware.js +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/index.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/index.js +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/types.d.ts +0 -0
- /package/dist/{integrations → plugins/internal}/search-index/types.js +0 -0
package/dist/tags-audit.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { readFile, readdir
|
|
1
|
+
import { readFile, readdir } from "node:fs/promises";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { join, relative } from "node:path";
|
|
4
4
|
import matter from "gray-matter";
|
|
5
5
|
function buildIndex(vocab) {
|
|
6
6
|
const byId = /* @__PURE__ */ new Map();
|
|
7
|
-
const byAlias = /* @__PURE__ */ new Map();
|
|
8
|
-
const aliasToId = /* @__PURE__ */ new Map();
|
|
9
7
|
for (const entry of vocab) {
|
|
10
8
|
byId.set(entry.id, entry);
|
|
11
|
-
for (const alias of entry.aliases ?? []) {
|
|
12
|
-
byAlias.set(alias, entry);
|
|
13
|
-
aliasToId.set(alias, entry.id);
|
|
14
|
-
}
|
|
15
9
|
}
|
|
16
|
-
return { byId
|
|
10
|
+
return { byId };
|
|
17
11
|
}
|
|
18
12
|
async function collectMdxFiles(dir) {
|
|
19
13
|
const out = [];
|
|
@@ -69,8 +63,6 @@ function findNearDuplicates(tags, helpers) {
|
|
|
69
63
|
async function audit(opts) {
|
|
70
64
|
const index = buildIndex(opts.vocabulary);
|
|
71
65
|
const unknowns = [];
|
|
72
|
-
const deprecated = [];
|
|
73
|
-
const aliases = [];
|
|
74
66
|
const frequency = {};
|
|
75
67
|
const canonicalsUsed = /* @__PURE__ */ new Set();
|
|
76
68
|
const rawTagsUsed = /* @__PURE__ */ new Set();
|
|
@@ -86,39 +78,19 @@ async function audit(opts) {
|
|
|
86
78
|
const rel = relative(opts.rootDir, file);
|
|
87
79
|
for (const tag of tags) {
|
|
88
80
|
rawTagsUsed.add(tag);
|
|
89
|
-
const idEntry = index.byId.get(tag);
|
|
90
|
-
const aliasEntry = index.byAlias.get(tag);
|
|
91
81
|
if (!opts.vocabularyActive) {
|
|
92
82
|
frequency[tag] = (frequency[tag] ?? 0) + 1;
|
|
93
83
|
canonicalsUsed.add(tag);
|
|
94
84
|
continue;
|
|
95
85
|
}
|
|
96
|
-
if (!
|
|
86
|
+
if (!index.byId.has(tag)) {
|
|
97
87
|
unknowns.push({ file: rel, raw: tag });
|
|
98
88
|
frequency[tag] = (frequency[tag] ?? 0) + 1;
|
|
99
89
|
canonicalsUsed.add(tag);
|
|
100
90
|
continue;
|
|
101
91
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const dep = entry.deprecated;
|
|
105
|
-
if (dep) {
|
|
106
|
-
if (typeof dep === "object" && dep.redirect) {
|
|
107
|
-
const target = index.byId.get(dep.redirect);
|
|
108
|
-
if (target) {
|
|
109
|
-
deprecated.push({ file: rel, raw: tag, canonical: entry.id, redirect: target.id });
|
|
110
|
-
canonical = target.id;
|
|
111
|
-
} else {
|
|
112
|
-
deprecated.push({ file: rel, raw: tag, canonical: entry.id });
|
|
113
|
-
}
|
|
114
|
-
} else {
|
|
115
|
-
deprecated.push({ file: rel, raw: tag, canonical: entry.id });
|
|
116
|
-
}
|
|
117
|
-
} else if (aliasEntry && tag !== entry.id) {
|
|
118
|
-
aliases.push({ file: rel, raw: tag, canonical: entry.id });
|
|
119
|
-
}
|
|
120
|
-
frequency[canonical] = (frequency[canonical] ?? 0) + 1;
|
|
121
|
-
canonicalsUsed.add(canonical);
|
|
92
|
+
frequency[tag] = (frequency[tag] ?? 0) + 1;
|
|
93
|
+
canonicalsUsed.add(tag);
|
|
122
94
|
}
|
|
123
95
|
}
|
|
124
96
|
}
|
|
@@ -127,18 +99,9 @@ async function audit(opts) {
|
|
|
127
99
|
const nearDupSource = opts.vocabularyActive ? Array.from(canonicalsUsed) : Array.from(rawTagsUsed);
|
|
128
100
|
nearDuplicates.push(...findNearDuplicates(nearDupSource, opts.nearDupHelpers));
|
|
129
101
|
}
|
|
130
|
-
const orphans = opts.vocabularyActive ? opts.vocabulary.filter((entry) =>
|
|
131
|
-
if (entry.deprecated) return false;
|
|
132
|
-
if (canonicalsUsed.has(entry.id)) return false;
|
|
133
|
-
for (const alias of entry.aliases ?? []) {
|
|
134
|
-
if (rawTagsUsed.has(alias)) return false;
|
|
135
|
-
}
|
|
136
|
-
return true;
|
|
137
|
-
}).map((entry) => entry.id) : [];
|
|
102
|
+
const orphans = opts.vocabularyActive ? opts.vocabulary.filter((entry) => !canonicalsUsed.has(entry.id)).map((entry) => entry.id) : [];
|
|
138
103
|
return {
|
|
139
104
|
unknowns,
|
|
140
|
-
deprecated,
|
|
141
|
-
aliases,
|
|
142
105
|
nearDuplicates,
|
|
143
106
|
orphans,
|
|
144
107
|
filesScanned,
|
|
@@ -146,114 +109,7 @@ async function audit(opts) {
|
|
|
146
109
|
};
|
|
147
110
|
}
|
|
148
111
|
function hasHardIssues(report) {
|
|
149
|
-
return report.unknowns.length > 0
|
|
150
|
-
}
|
|
151
|
-
function computeRewrites(vocabulary) {
|
|
152
|
-
const rewrites = /* @__PURE__ */ new Map();
|
|
153
|
-
const { byId } = buildIndex(vocabulary);
|
|
154
|
-
for (const entry of vocabulary) {
|
|
155
|
-
for (const alias of entry.aliases ?? []) {
|
|
156
|
-
if (alias === entry.id) continue;
|
|
157
|
-
const dep2 = entry.deprecated;
|
|
158
|
-
if (dep2 && typeof dep2 === "object" && dep2.redirect) {
|
|
159
|
-
const target = byId.get(dep2.redirect);
|
|
160
|
-
rewrites.set(alias, target ? target.id : entry.id);
|
|
161
|
-
} else {
|
|
162
|
-
rewrites.set(alias, entry.id);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const dep = entry.deprecated;
|
|
166
|
-
if (dep && typeof dep === "object" && dep.redirect) {
|
|
167
|
-
const target = byId.get(dep.redirect);
|
|
168
|
-
if (target) rewrites.set(entry.id, target.id);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return rewrites;
|
|
172
|
-
}
|
|
173
|
-
async function applyFixes(contentDirs, rewrites, rootDir) {
|
|
174
|
-
const touched = [];
|
|
175
|
-
for (const dir of contentDirs) {
|
|
176
|
-
if (!existsSync(dir)) continue;
|
|
177
|
-
const files = await collectMdxFiles(dir);
|
|
178
|
-
for (const file of files) {
|
|
179
|
-
const original = await readFile(file, "utf-8");
|
|
180
|
-
const { content, changed } = rewriteAliasesByteStable(original, rewrites);
|
|
181
|
-
if (changed) {
|
|
182
|
-
await writeFile(file, content, "utf-8");
|
|
183
|
-
touched.push(relative(rootDir, file));
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return touched;
|
|
188
|
-
}
|
|
189
|
-
function rewriteAliasesByteStable(content, rewrites) {
|
|
190
|
-
if (rewrites.size === 0) return { content, changed: false };
|
|
191
|
-
const fmMatch = content.match(/^(---\r?\n)([\s\S]*?)(\r?\n---(?:\r?\n|$))/);
|
|
192
|
-
if (!fmMatch) return { content, changed: false };
|
|
193
|
-
const whole = fmMatch[0] ?? "";
|
|
194
|
-
const open = fmMatch[1] ?? "";
|
|
195
|
-
const fmBody = fmMatch[2] ?? "";
|
|
196
|
-
const close = fmMatch[3] ?? "";
|
|
197
|
-
let changed = false;
|
|
198
|
-
let newBody = fmBody;
|
|
199
|
-
newBody = newBody.replace(
|
|
200
|
-
/^(tags[ \t]*:[ \t]*\[)([^\]\n]*)(\])/m,
|
|
201
|
-
(_full, pre, inner, post) => {
|
|
202
|
-
const rewritten = inner.replace(
|
|
203
|
-
/(^|,)([ \t]*)(?:(")([^"]*)(")|(')([^']*)(')|([^,\s"'][^,]*?))([ \t]*)(?=,|$)/g,
|
|
204
|
-
(_m, lead, leadWs, dq1, dqVal, dq2, sq1, sqVal, sq2, bareVal, trailWs) => {
|
|
205
|
-
const val = dqVal ?? sqVal ?? bareVal ?? "";
|
|
206
|
-
const target = rewrites.get(val.trim());
|
|
207
|
-
if (!target || target === val) return _m;
|
|
208
|
-
changed = true;
|
|
209
|
-
if (dq1) return `${lead}${leadWs}"${target}"${trailWs}`;
|
|
210
|
-
if (sq1) return `${lead}${leadWs}'${target}'${trailWs}`;
|
|
211
|
-
return `${lead}${leadWs}${target}${trailWs}`;
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
return pre + rewritten + post;
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
newBody = newBody.replace(
|
|
218
|
-
/^(tags[ \t]*:[ \t]*\r?\n)((?:[ \t]+-[^\n]*\r?\n?)+)/m,
|
|
219
|
-
(_full, pre, items) => {
|
|
220
|
-
const rewritten = items.replace(
|
|
221
|
-
/^([ \t]+-[ \t]+)(?:(")([^"]*)(")|(')([^']*)('))?([^\n]*)$/gm,
|
|
222
|
-
(line, dash, dq1, dqVal, dq2, sq1, sqVal, sq2, bare) => {
|
|
223
|
-
if (dq1) {
|
|
224
|
-
const target2 = rewrites.get(dqVal);
|
|
225
|
-
if (target2 && target2 !== dqVal) {
|
|
226
|
-
changed = true;
|
|
227
|
-
return `${dash}"${target2}"${bare}`;
|
|
228
|
-
}
|
|
229
|
-
return line;
|
|
230
|
-
}
|
|
231
|
-
if (sq1) {
|
|
232
|
-
const target2 = rewrites.get(sqVal);
|
|
233
|
-
if (target2 && target2 !== sqVal) {
|
|
234
|
-
changed = true;
|
|
235
|
-
return `${dash}'${target2}'${bare}`;
|
|
236
|
-
}
|
|
237
|
-
return line;
|
|
238
|
-
}
|
|
239
|
-
const trimmed = bare.replace(/[ \t\r]+$/, "");
|
|
240
|
-
const trailing = bare.slice(trimmed.length);
|
|
241
|
-
const target = rewrites.get(trimmed);
|
|
242
|
-
if (target && target !== trimmed) {
|
|
243
|
-
changed = true;
|
|
244
|
-
return `${dash}${target}${trailing}`;
|
|
245
|
-
}
|
|
246
|
-
return line;
|
|
247
|
-
}
|
|
248
|
-
);
|
|
249
|
-
return pre + rewritten;
|
|
250
|
-
}
|
|
251
|
-
);
|
|
252
|
-
if (!changed) return { content, changed: false };
|
|
253
|
-
return {
|
|
254
|
-
content: open + newBody + close + content.slice(whole.length),
|
|
255
|
-
changed: true
|
|
256
|
-
};
|
|
112
|
+
return report.unknowns.length > 0;
|
|
257
113
|
}
|
|
258
114
|
function formatTextReport(report, governance, vocabularyActive, pc) {
|
|
259
115
|
const lines = [];
|
|
@@ -271,22 +127,6 @@ function formatTextReport(report, governance, vocabularyActive, pc) {
|
|
|
271
127
|
}
|
|
272
128
|
lines.push("");
|
|
273
129
|
}
|
|
274
|
-
if (report.deprecated.length > 0) {
|
|
275
|
-
lines.push(pc.bold(pc.yellow(`\u26A0 Deprecated tags (${report.deprecated.length})`)));
|
|
276
|
-
for (const { file, raw, redirect } of report.deprecated) {
|
|
277
|
-
const suffix = redirect ? pc.dim(` \u2192 ${redirect}`) : pc.dim(" (dropped)");
|
|
278
|
-
lines.push(` ${pc.yellow("\u2022")} ${file} ${raw}${suffix}`);
|
|
279
|
-
}
|
|
280
|
-
lines.push("");
|
|
281
|
-
}
|
|
282
|
-
if (report.aliases.length > 0) {
|
|
283
|
-
lines.push(pc.bold(pc.blue(`\u2139 Alias usage (${report.aliases.length})`)));
|
|
284
|
-
for (const { file, raw, canonical } of report.aliases) {
|
|
285
|
-
lines.push(` ${pc.blue("\u2022")} ${file} ${raw} ${pc.dim(`\u2192 ${canonical}`)}`);
|
|
286
|
-
}
|
|
287
|
-
lines.push(pc.dim(` (run with --fix to rewrite these in place)`));
|
|
288
|
-
lines.push("");
|
|
289
|
-
}
|
|
290
130
|
if (report.nearDuplicates.length > 0) {
|
|
291
131
|
lines.push(pc.bold(pc.yellow(`\u26A0 Near-duplicate tags (${report.nearDuplicates.length})`)));
|
|
292
132
|
for (const pair of report.nearDuplicates) {
|
|
@@ -302,20 +142,17 @@ function formatTextReport(report, governance, vocabularyActive, pc) {
|
|
|
302
142
|
}
|
|
303
143
|
lines.push("");
|
|
304
144
|
}
|
|
305
|
-
if (report.unknowns.length === 0 && report.
|
|
145
|
+
if (report.unknowns.length === 0 && report.nearDuplicates.length === 0 && report.orphans.length === 0) {
|
|
306
146
|
lines.push(pc.green("\u2713 No tag issues found"));
|
|
307
147
|
}
|
|
308
148
|
return lines.join("\n");
|
|
309
149
|
}
|
|
310
150
|
export {
|
|
311
|
-
applyFixes,
|
|
312
151
|
audit,
|
|
313
152
|
buildIndex,
|
|
314
153
|
collectMdxFiles,
|
|
315
|
-
computeRewrites,
|
|
316
154
|
findNearDuplicates,
|
|
317
155
|
formatTextReport,
|
|
318
156
|
hasHardIssues,
|
|
319
|
-
normalizeTags
|
|
320
|
-
rewriteAliasesByteStable
|
|
157
|
+
normalizeTags
|
|
321
158
|
};
|
|
@@ -17,9 +17,8 @@ export interface ColorSchemeProviderProps {
|
|
|
17
17
|
*/
|
|
18
18
|
cssText: string;
|
|
19
19
|
/**
|
|
20
|
-
* Active light/dark mode config, or `null` for
|
|
21
|
-
*
|
|
22
|
-
* custom CSS vars from localStorage instead).
|
|
20
|
+
* Active light/dark mode config, or `null` for a single fixed scheme. The
|
|
21
|
+
* external design-token panel owns applying any persisted token overrides.
|
|
23
22
|
*/
|
|
24
23
|
colorMode: ColorSchemeProviderColorMode | null;
|
|
25
24
|
/** Optional children; preserved for forward compatibility. */
|
|
@@ -17,14 +17,6 @@ document.addEventListener(${afterNav},function(){var s=null;try{s=localStorage.g
|
|
|
17
17
|
if(respectPrefersColorScheme){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){var s=null;try{s=localStorage.getItem(STORAGE_KEY);}catch(e){}if(!s)applyTheme(getSystemMode());});}
|
|
18
18
|
})();`;
|
|
19
19
|
}
|
|
20
|
-
function buildPersistedTweakBootstrap() {
|
|
21
|
-
const afterNav = JSON.stringify(AFTER_NAVIGATE_EVENT);
|
|
22
|
-
return `(function(){
|
|
23
|
-
function applyStoredScheme(){var css=localStorage.getItem("zudo-doc-color-scheme-css");if(!css)return;try{var pairs=JSON.parse(css);var root=document.documentElement;for(var i=0;i<pairs.length;i++){root.style.setProperty(pairs[i][0],pairs[i][1]);}}catch(e){localStorage.removeItem("zudo-doc-color-scheme-css");}}
|
|
24
|
-
applyStoredScheme();
|
|
25
|
-
document.addEventListener(${afterNav},applyStoredScheme);
|
|
26
|
-
})();`;
|
|
27
|
-
}
|
|
28
20
|
function ColorSchemeProvider({
|
|
29
21
|
cssText,
|
|
30
22
|
colorMode
|
|
@@ -32,10 +24,10 @@ function ColorSchemeProvider({
|
|
|
32
24
|
const bootstrap = colorMode ? buildColorModeBootstrap(
|
|
33
25
|
colorMode.defaultMode,
|
|
34
26
|
Boolean(colorMode.respectPrefersColorScheme)
|
|
35
|
-
) :
|
|
27
|
+
) : null;
|
|
36
28
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
29
|
/* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: { __html: cssText } }),
|
|
38
|
-
/* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: bootstrap } })
|
|
30
|
+
bootstrap !== null && /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: bootstrap } })
|
|
39
31
|
] });
|
|
40
32
|
}
|
|
41
33
|
export {
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export { default as ThemeToggle } from "./theme-toggle.js";
|
|
2
2
|
export { default as ColorSchemeProvider } from "./color-scheme-provider.js";
|
|
3
3
|
export type { ColorSchemeProviderProps, ColorSchemeProviderColorMode, } from "./color-scheme-provider.js";
|
|
4
|
-
export {
|
|
5
|
-
export { DESIGN_TOKEN_SCHEMA, DesignTokenSchemaError, deserialize, serialize, type DesignTokenJson, type DesignTokenJsonColor, 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";
|
|
4
|
+
export { resolveThemePackSsrSlug } from "./theme-pack-provider.js";
|
package/dist/theme/index.js
CHANGED
|
@@ -1,36 +1,8 @@
|
|
|
1
1
|
import { default as default2 } from "./theme-toggle.js";
|
|
2
2
|
import { default as default3 } from "./color-scheme-provider.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
DESIGN_TOKEN_SCHEMA,
|
|
6
|
-
DesignTokenSchemaError,
|
|
7
|
-
deserialize,
|
|
8
|
-
serialize
|
|
9
|
-
} from "./design-token-serde.js";
|
|
10
|
-
import {
|
|
11
|
-
emptyOverrides
|
|
12
|
-
} from "./design-token-types.js";
|
|
13
|
-
import {
|
|
14
|
-
BRIDGE_SOURCE,
|
|
15
|
-
isBridgeMessage,
|
|
16
|
-
installIframeReceiver,
|
|
17
|
-
onIframeReady,
|
|
18
|
-
sendApplyCssVars,
|
|
19
|
-
sendClearCssVars
|
|
20
|
-
} from "./iframe-bridge.js";
|
|
3
|
+
import { resolveThemePackSsrSlug } from "./theme-pack-provider.js";
|
|
21
4
|
export {
|
|
22
|
-
BRIDGE_SOURCE,
|
|
23
5
|
default3 as ColorSchemeProvider,
|
|
24
|
-
default4 as ColorTweakExportModal,
|
|
25
|
-
DESIGN_TOKEN_SCHEMA,
|
|
26
|
-
DesignTokenSchemaError,
|
|
27
6
|
default2 as ThemeToggle,
|
|
28
|
-
|
|
29
|
-
emptyOverrides,
|
|
30
|
-
installIframeReceiver,
|
|
31
|
-
isBridgeMessage,
|
|
32
|
-
onIframeReady,
|
|
33
|
-
sendApplyCssVars,
|
|
34
|
-
sendClearCssVars,
|
|
35
|
-
serialize
|
|
7
|
+
resolveThemePackSsrSlug
|
|
36
8
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
import type { ThemePackRegistry } from "../theme-packs-registry/index.js";
|
|
3
|
+
export interface ThemePackProviderProps {
|
|
4
|
+
/** The build-configured pack slug (`settings.themePack`, default `"default"`). */
|
|
5
|
+
configuredSlug: string;
|
|
6
|
+
/**
|
|
7
|
+
* Ordered `{ slug → meta.version }` map of the ENABLED packs — build with
|
|
8
|
+
* {@link themePackVersionMap} from `ctx.themePackRegistry`. Order carries
|
|
9
|
+
* the switcher order; versions drive the `?v=` cache-busting query.
|
|
10
|
+
*/
|
|
11
|
+
enabled: Record<string, string>;
|
|
12
|
+
/** Resolved base prefix WITH trailing slash (`ctx.withBase("/")`). */
|
|
13
|
+
base: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Build the ordered `{ slug → version }` map the bootstrap inlines from the
|
|
17
|
+
* resolved, enabled, ordered registry (`ctx.themePackRegistry`).
|
|
18
|
+
*/
|
|
19
|
+
export declare function themePackVersionMap(registry: ThemePackRegistry): Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* The `data-theme-pack` value a page's `<html>` element must carry in SSR
|
|
22
|
+
* output: the CONFIGURED pack slug (build-static, unlike the
|
|
23
|
+
* user-preference-only `data-theme`) — this is what the no-JS path needs.
|
|
24
|
+
* Returns `undefined` (attribute omitted, feature inert) when the registry
|
|
25
|
+
* was not threaded (`themePackRegistry: null`, e.g. a
|
|
26
|
+
* `packageOwnedRoutes: false` host that builds its own payload).
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveThemePackSsrSlug(registry: ThemePackRegistry | null, settings: {
|
|
29
|
+
themePack?: string;
|
|
30
|
+
}): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Bootstrap script for the theme-pack layer. Values are inlined as JSON
|
|
33
|
+
* literals so the script body is fully self-contained (the
|
|
34
|
+
* `buildColorModeBootstrap` pattern).
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildThemePackBootstrap(configuredSlug: string, enabled: Record<string, string>, base: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Server-rendered head fragment: the pre-paint bootstrap `<script>` plus the
|
|
39
|
+
* `<noscript>` configured-pack fallback. No hydration — like
|
|
40
|
+
* `ColorSchemeProvider` it just emits markup the engine streams into `<head>`.
|
|
41
|
+
*/
|
|
42
|
+
export default function ThemePackProvider({ configuredSlug, enabled, base, }: ThemePackProviderProps): JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { AFTER_NAVIGATE_EVENT } from "../transitions/page-events.js";
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_THEME_PACK_SLUG,
|
|
5
|
+
THEME_PACK_ATTR,
|
|
6
|
+
THEME_PACK_LINK_ATTR,
|
|
7
|
+
THEME_PACK_RUNTIME_GLOBAL,
|
|
8
|
+
THEME_PACK_STORAGE_KEY,
|
|
9
|
+
buildPackCssUrl
|
|
10
|
+
} from "../theme-pack-switcher/theme-pack-sync.js";
|
|
11
|
+
function themePackVersionMap(registry) {
|
|
12
|
+
const map = {};
|
|
13
|
+
for (const entry of registry) {
|
|
14
|
+
map[entry.slug] = entry.meta.version;
|
|
15
|
+
}
|
|
16
|
+
return map;
|
|
17
|
+
}
|
|
18
|
+
function resolveThemePackSsrSlug(registry, settings) {
|
|
19
|
+
if (registry === null) return void 0;
|
|
20
|
+
return settings.themePack ?? DEFAULT_THEME_PACK_SLUG;
|
|
21
|
+
}
|
|
22
|
+
function buildThemePackBootstrap(configuredSlug, enabled, base) {
|
|
23
|
+
const configured = JSON.stringify(configuredSlug);
|
|
24
|
+
const packs = JSON.stringify(enabled);
|
|
25
|
+
const b = JSON.stringify(base);
|
|
26
|
+
const key = JSON.stringify(THEME_PACK_STORAGE_KEY);
|
|
27
|
+
const attr = JSON.stringify(THEME_PACK_ATTR);
|
|
28
|
+
const linkAttr = JSON.stringify(THEME_PACK_LINK_ATTR);
|
|
29
|
+
const defaultSlug = JSON.stringify(DEFAULT_THEME_PACK_SLUG);
|
|
30
|
+
const runtimeGlobal = JSON.stringify(THEME_PACK_RUNTIME_GLOBAL);
|
|
31
|
+
const afterNav = JSON.stringify(AFTER_NAVIGATE_EVENT);
|
|
32
|
+
return `(function(){
|
|
33
|
+
var configured=${configured};
|
|
34
|
+
var packs=${packs};
|
|
35
|
+
var base=${b};
|
|
36
|
+
var KEY=${key};
|
|
37
|
+
var ATTR=${attr};
|
|
38
|
+
var LINK_ATTR=${linkAttr};
|
|
39
|
+
var DEFAULT_SLUG=${defaultSlug};
|
|
40
|
+
function resolveSlug(){var stored=null;try{stored=localStorage.getItem(KEY);}catch(e){}if(stored&&Object.prototype.hasOwnProperty.call(packs,stored))return stored;var live=document.documentElement.getAttribute(ATTR);if(live&&Object.prototype.hasOwnProperty.call(packs,live))return live;return configured;}
|
|
41
|
+
function packHref(slug){return base+"theme-packs/"+slug+"/pack.css?v="+packs[slug];}
|
|
42
|
+
var slug=resolveSlug();
|
|
43
|
+
document.documentElement.setAttribute(ATTR,slug);
|
|
44
|
+
if(slug!==DEFAULT_SLUG){document.write('<link rel="stylesheet" '+LINK_ATTR+' href="'+packHref(slug)+'">');}
|
|
45
|
+
window[${runtimeGlobal}]={base:base,packs:packs,configured:configured};
|
|
46
|
+
document.addEventListener(${afterNav},function(){
|
|
47
|
+
var s=resolveSlug();
|
|
48
|
+
document.documentElement.setAttribute(ATTR,s);
|
|
49
|
+
var links=document.querySelectorAll("link["+LINK_ATTR+"]");
|
|
50
|
+
var want=s===DEFAULT_SLUG?null:packHref(s);
|
|
51
|
+
var found=false;
|
|
52
|
+
for(var i=0;i<links.length;i++){var l=links[i];if(want!==null&&!found&&l.getAttribute("href")===want){found=true;}else if(l.parentNode){l.parentNode.removeChild(l);}}
|
|
53
|
+
if(want!==null&&!found){var nl=document.createElement("link");nl.setAttribute("rel","stylesheet");nl.setAttribute(LINK_ATTR,"");nl.setAttribute("href",want);document.head.appendChild(nl);}
|
|
54
|
+
});
|
|
55
|
+
})();`;
|
|
56
|
+
}
|
|
57
|
+
function ThemePackProvider({
|
|
58
|
+
configuredSlug,
|
|
59
|
+
enabled,
|
|
60
|
+
base
|
|
61
|
+
}) {
|
|
62
|
+
const bootstrap = buildThemePackBootstrap(configuredSlug, enabled, base);
|
|
63
|
+
const configuredVersion = enabled[configuredSlug];
|
|
64
|
+
const noscriptHref = configuredSlug !== DEFAULT_THEME_PACK_SLUG && configuredVersion !== void 0 ? buildPackCssUrl(base, configuredSlug, configuredVersion) : null;
|
|
65
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
66
|
+
/* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: bootstrap } }),
|
|
67
|
+
noscriptHref !== null && /* @__PURE__ */ jsx("noscript", { children: /* @__PURE__ */ jsx("link", { rel: "stylesheet", href: noscriptHref }) })
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
buildThemePackBootstrap,
|
|
72
|
+
ThemePackProvider as default,
|
|
73
|
+
resolveThemePackSsrSlug,
|
|
74
|
+
themePackVersionMap
|
|
75
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type LoadInstalledThemePackCatalogOptions } from "./registry.js";
|
|
2
|
+
export interface ApplyThemePackOptions extends LoadInstalledThemePackCatalogOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
/** Injectable clock for tests — defaults to `() => new Date()`. */
|
|
5
|
+
now?: () => Date;
|
|
6
|
+
}
|
|
7
|
+
export interface ApplyThemePackResult {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
/** Human-readable outcome message (success confirmation, or a refusal
|
|
10
|
+
* explaining WHY + the manual one-liner to add by hand). */
|
|
11
|
+
message: string;
|
|
12
|
+
/** Whether zfb.config.ts's bytes actually changed (false = idempotent
|
|
13
|
+
* re-apply of the slug already configured). Only meaningful when `ok`. */
|
|
14
|
+
changed?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function applyThemePack(slug: string, options?: ApplyThemePackOptions): Promise<ApplyThemePackResult>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import { applyThemePackToConfigSource } from "./config-rewriter.js";
|
|
3
|
+
import { resolveZfbConfigPath } from "./config-io.js";
|
|
4
|
+
import { writeThemePackProvenance } from "./provenance.js";
|
|
5
|
+
import {
|
|
6
|
+
loadInstalledThemePackCatalog
|
|
7
|
+
} from "./registry.js";
|
|
8
|
+
async function applyThemePack(slug, options = {}) {
|
|
9
|
+
const cwd = options.cwd ?? process.cwd();
|
|
10
|
+
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
11
|
+
let catalog;
|
|
12
|
+
try {
|
|
13
|
+
catalog = loadInstalledThemePackCatalog(options);
|
|
14
|
+
} catch (err) {
|
|
15
|
+
return {
|
|
16
|
+
ok: false,
|
|
17
|
+
message: `Could not load the installed theme pack catalog: ${err.message}`
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const entry = catalog.find((e) => e.slug === slug);
|
|
21
|
+
if (!entry) {
|
|
22
|
+
const available = catalog.map((e) => e.slug).sort().join(", ");
|
|
23
|
+
return {
|
|
24
|
+
ok: false,
|
|
25
|
+
message: `Unknown theme pack "${slug}".
|
|
26
|
+
Available theme packs: ${available}`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const configPath = resolveZfbConfigPath(cwd);
|
|
30
|
+
if (!await fs.pathExists(configPath)) {
|
|
31
|
+
return {
|
|
32
|
+
ok: false,
|
|
33
|
+
message: `zfb.config.ts not found at ${configPath}.
|
|
34
|
+
Run this command from your project root.`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const source = await fs.readFile(configPath, "utf8");
|
|
38
|
+
const result = applyThemePackToConfigSource(source, slug);
|
|
39
|
+
if (!result.ok) {
|
|
40
|
+
return { ok: false, message: `Refusing to modify zfb.config.ts: ${result.reason}` };
|
|
41
|
+
}
|
|
42
|
+
if (result.changed) {
|
|
43
|
+
await fs.writeFile(configPath, result.source, "utf8");
|
|
44
|
+
}
|
|
45
|
+
await writeThemePackProvenance(cwd, {
|
|
46
|
+
schemaVersion: 1,
|
|
47
|
+
slug,
|
|
48
|
+
packVersion: entry.meta.version,
|
|
49
|
+
appliedAt: now().toISOString()
|
|
50
|
+
});
|
|
51
|
+
const verb = result.changed ? "Applied" : "Already applied";
|
|
52
|
+
return {
|
|
53
|
+
ok: true,
|
|
54
|
+
changed: result.changed,
|
|
55
|
+
message: `${verb} theme pack "${slug}" (${entry.meta.name}) to ${configPath}.
|
|
56
|
+
Provenance recorded in .zudo-doc.json.`
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
applyThemePack
|
|
61
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const ZFB_CONFIG_FILENAME = "zfb.config.ts";
|
|
2
|
+
export declare function resolveZfbConfigPath(cwd: string): string;
|
|
3
|
+
export interface DetectActiveThemePackResult {
|
|
4
|
+
slug: string;
|
|
5
|
+
/** `false` when zfb.config.ts is missing, unreadable, or not in a shape
|
|
6
|
+
* this scanner can confidently read — `slug` is then the documented
|
|
7
|
+
* default, not a confirmed reading of the project's real config. */
|
|
8
|
+
detected: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Best-effort read of the project's configured `themePack` slug. Never
|
|
12
|
+
* throws — any parse trouble degrades to the documented default with
|
|
13
|
+
* `detected: false`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function detectActiveThemePack(cwd: string): Promise<DetectActiveThemePackResult>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { DEFAULT_THEME_PACK_SLUG } from "../theme-packs-registry/index.js";
|
|
4
|
+
import {
|
|
5
|
+
ConfigSyntaxError,
|
|
6
|
+
findMatchingBrace,
|
|
7
|
+
findZudoDocCallParens,
|
|
8
|
+
isPlainStringLiteralSpan,
|
|
9
|
+
skipWhitespaceAndComments,
|
|
10
|
+
splitTopLevelMembers,
|
|
11
|
+
unquoteStringLiteralSpan
|
|
12
|
+
} from "./config-scanner.js";
|
|
13
|
+
const ZFB_CONFIG_FILENAME = "zfb.config.ts";
|
|
14
|
+
function resolveZfbConfigPath(cwd) {
|
|
15
|
+
return path.join(cwd, ZFB_CONFIG_FILENAME);
|
|
16
|
+
}
|
|
17
|
+
async function detectActiveThemePack(cwd) {
|
|
18
|
+
const configPath = resolveZfbConfigPath(cwd);
|
|
19
|
+
const fallback = { slug: DEFAULT_THEME_PACK_SLUG, detected: false };
|
|
20
|
+
if (!await fs.pathExists(configPath)) return fallback;
|
|
21
|
+
let source;
|
|
22
|
+
try {
|
|
23
|
+
source = await fs.readFile(configPath, "utf8");
|
|
24
|
+
} catch {
|
|
25
|
+
return fallback;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const calls = findZudoDocCallParens(source);
|
|
29
|
+
if (calls.length !== 1) return fallback;
|
|
30
|
+
const braceOpenIdx = skipWhitespaceAndComments(source, calls[0] + 1);
|
|
31
|
+
if (source[braceOpenIdx] !== "{") return fallback;
|
|
32
|
+
const braceCloseIdx = findMatchingBrace(source, braceOpenIdx);
|
|
33
|
+
const members = splitTopLevelMembers(source, braceOpenIdx + 1, braceCloseIdx);
|
|
34
|
+
if (members.some((m) => m.isSpread)) return fallback;
|
|
35
|
+
const themePackMember = members.find((m) => m.key === "themePack");
|
|
36
|
+
if (!themePackMember) return { slug: DEFAULT_THEME_PACK_SLUG, detected: true };
|
|
37
|
+
if (themePackMember.valueStart === null || themePackMember.valueEnd === null || !isPlainStringLiteralSpan(source, themePackMember.valueStart, themePackMember.valueEnd)) {
|
|
38
|
+
return fallback;
|
|
39
|
+
}
|
|
40
|
+
const slug = unquoteStringLiteralSpan(source, themePackMember.valueStart, themePackMember.valueEnd);
|
|
41
|
+
return { slug, detected: true };
|
|
42
|
+
} catch (err) {
|
|
43
|
+
if (err instanceof ConfigSyntaxError) return fallback;
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
ZFB_CONFIG_FILENAME,
|
|
49
|
+
detectActiveThemePack,
|
|
50
|
+
resolveZfbConfigPath
|
|
51
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ApplyThemePackToSourceOk {
|
|
2
|
+
ok: true;
|
|
3
|
+
/** The full rewritten file contents. Identical to the input when
|
|
4
|
+
* `changed` is false (idempotent re-apply of the already-active slug). */
|
|
5
|
+
source: string;
|
|
6
|
+
changed: boolean;
|
|
7
|
+
mode: "replaced" | "inserted-after-color-mode" | "inserted-after-color-scheme" | "inserted-first";
|
|
8
|
+
}
|
|
9
|
+
export interface ApplyThemePackToSourceRefusal {
|
|
10
|
+
ok: false;
|
|
11
|
+
/** Human-readable WHY, ending with the manual one-liner to add by hand.
|
|
12
|
+
* The input source is never touched when this is returned. */
|
|
13
|
+
reason: string;
|
|
14
|
+
}
|
|
15
|
+
export type ApplyThemePackToSourceResult = ApplyThemePackToSourceOk | ApplyThemePackToSourceRefusal;
|
|
16
|
+
/**
|
|
17
|
+
* Apply `themePack: "<slug>"` to a `zfb.config.ts` source string. Pure and
|
|
18
|
+
* filesystem-free — callers own reading/writing the actual file (see
|
|
19
|
+
* `apply.ts`).
|
|
20
|
+
*/
|
|
21
|
+
export declare function applyThemePackToConfigSource(source: string, slug: string): ApplyThemePackToSourceResult;
|