@kamod-ch/preactpress 1.0.0 → 1.0.2
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/README.md +87 -49
- package/bin/preactpress.mjs +5 -5
- package/dist/client/app.d.ts +1 -1
- package/dist/client/app.d.ts.map +1 -1
- package/dist/client/app.js +34 -38
- package/dist/client/app.js.map +1 -1
- package/dist/client/entry-client.js +11 -12
- package/dist/client/entry-client.js.map +1 -1
- package/dist/client/entry-ssr.d.ts +2 -2
- package/dist/client/entry-ssr.d.ts.map +1 -1
- package/dist/client/entry-ssr.js +16 -16
- package/dist/client/entry-ssr.js.map +1 -1
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/loadPage.d.ts +1 -1
- package/dist/client/loadPage.d.ts.map +1 -1
- package/dist/client/loadPage.js +12 -12
- package/dist/client/loadPage.js.map +1 -1
- package/dist/client/prefetchLinks.js +4 -4
- package/dist/client/prefetchLinks.js.map +1 -1
- package/dist/client/theme-default/AlgoliaSearch.d.ts +3 -3
- package/dist/client/theme-default/AlgoliaSearch.d.ts.map +1 -1
- package/dist/client/theme-default/AlgoliaSearch.js +15 -15
- package/dist/client/theme-default/AlgoliaSearch.js.map +1 -1
- package/dist/client/theme-default/Features.d.ts +2 -2
- package/dist/client/theme-default/Features.d.ts.map +1 -1
- package/dist/client/theme-default/Features.js +10 -8
- package/dist/client/theme-default/Features.js.map +1 -1
- package/dist/client/theme-default/Hero.d.ts +2 -2
- package/dist/client/theme-default/Hero.d.ts.map +1 -1
- package/dist/client/theme-default/Hero.js +9 -7
- package/dist/client/theme-default/Hero.js.map +1 -1
- package/dist/client/theme-default/Layout.d.ts +3 -3
- package/dist/client/theme-default/Layout.d.ts.map +1 -1
- package/dist/client/theme-default/Layout.js +56 -99
- package/dist/client/theme-default/Layout.js.map +1 -1
- package/dist/client/theme-default/Logo.d.ts +2 -2
- package/dist/client/theme-default/Logo.d.ts.map +1 -1
- package/dist/client/theme-default/Logo.js +8 -8
- package/dist/client/theme-default/Logo.js.map +1 -1
- package/dist/client/theme-default/NavLinks.d.ts +2 -2
- package/dist/client/theme-default/NavLinks.d.ts.map +1 -1
- package/dist/client/theme-default/NavLinks.js +3 -3
- package/dist/client/theme-default/NavLinks.js.map +1 -1
- package/dist/client/theme-default/SidebarNav.d.ts +2 -2
- package/dist/client/theme-default/SidebarNav.d.ts.map +1 -1
- package/dist/client/theme-default/SidebarNav.js +3 -3
- package/dist/client/theme-default/SidebarNav.js.map +1 -1
- package/dist/client/theme-default/SocialLinks.d.ts +2 -2
- package/dist/client/theme-default/SocialLinks.d.ts.map +1 -1
- package/dist/client/theme-default/SocialLinks.js +1 -1
- package/dist/client/theme-default/SocialLinks.js.map +1 -1
- package/dist/client/theme-default/ThemeToggle.d.ts +2 -3
- package/dist/client/theme-default/ThemeToggle.d.ts.map +1 -1
- package/dist/client/theme-default/ThemeToggle.js +2 -30
- package/dist/client/theme-default/ThemeToggle.js.map +1 -1
- package/dist/client/theme-default/index.d.ts +1 -1
- package/dist/client/theme-default/index.d.ts.map +1 -1
- package/dist/client/theme-default/index.js +1 -1
- package/dist/client/theme-default/index.js.map +1 -1
- package/dist/client/theme-utils.d.ts +24 -0
- package/dist/client/theme-utils.d.ts.map +1 -0
- package/dist/client/theme-utils.js +107 -0
- package/dist/client/theme-utils.js.map +1 -0
- package/dist/client/types.d.ts +5 -5
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/usePageHead.d.ts +2 -2
- package/dist/client/usePageHead.d.ts.map +1 -1
- package/dist/client/usePageHead.js +61 -56
- package/dist/client/usePageHead.js.map +1 -1
- package/dist/client/useSiteSearch.d.ts.map +1 -1
- package/dist/client/useSiteSearch.js +8 -8
- package/dist/client/useSiteSearch.js.map +1 -1
- package/dist/node/build.d.ts +1 -1
- package/dist/node/build.d.ts.map +1 -1
- package/dist/node/build.js +105 -96
- package/dist/node/build.js.map +1 -1
- package/dist/node/buildCache.d.ts.map +1 -1
- package/dist/node/buildCache.js +7 -7
- package/dist/node/buildCache.js.map +1 -1
- package/dist/node/check.d.ts +1 -1
- package/dist/node/check.d.ts.map +1 -1
- package/dist/node/check.js +52 -52
- package/dist/node/check.js.map +1 -1
- package/dist/node/cli.js +61 -64
- package/dist/node/cli.js.map +1 -1
- package/dist/node/config-helpers.d.ts +4 -4
- package/dist/node/config-helpers.d.ts.map +1 -1
- package/dist/node/config-helpers.js +1 -1
- package/dist/node/config-helpers.js.map +1 -1
- package/dist/node/config.d.ts +4 -4
- package/dist/node/config.d.ts.map +1 -1
- package/dist/node/config.js +37 -40
- package/dist/node/config.js.map +1 -1
- package/dist/node/content.d.ts +4 -4
- package/dist/node/content.d.ts.map +1 -1
- package/dist/node/content.js +28 -28
- package/dist/node/content.js.map +1 -1
- package/dist/node/createContentLoader.d.ts +1 -1
- package/dist/node/createContentLoader.d.ts.map +1 -1
- package/dist/node/createContentLoader.js +3 -3
- package/dist/node/createContentLoader.js.map +1 -1
- package/dist/node/devCss.d.ts +1 -1
- package/dist/node/devCss.d.ts.map +1 -1
- package/dist/node/devCss.js +5 -6
- package/dist/node/devCss.js.map +1 -1
- package/dist/node/devSsr.d.ts +3 -3
- package/dist/node/devSsr.d.ts.map +1 -1
- package/dist/node/devSsr.js +32 -32
- package/dist/node/devSsr.js.map +1 -1
- package/dist/node/dynamicRoutes.d.ts +2 -2
- package/dist/node/dynamicRoutes.d.ts.map +1 -1
- package/dist/node/dynamicRoutes.js +24 -24
- package/dist/node/dynamicRoutes.js.map +1 -1
- package/dist/node/favicon.d.ts +2 -2
- package/dist/node/favicon.d.ts.map +1 -1
- package/dist/node/favicon.js +26 -24
- package/dist/node/favicon.js.map +1 -1
- package/dist/node/feed.d.ts +2 -2
- package/dist/node/feed.d.ts.map +1 -1
- package/dist/node/feed.js +18 -16
- package/dist/node/feed.js.map +1 -1
- package/dist/node/hooks.d.ts +2 -2
- package/dist/node/hooks.d.ts.map +1 -1
- package/dist/node/hooks.js +1 -1
- package/dist/node/hooks.js.map +1 -1
- package/dist/node/html.d.ts +8 -8
- package/dist/node/html.d.ts.map +1 -1
- package/dist/node/html.js +75 -64
- package/dist/node/html.js.map +1 -1
- package/dist/node/index.d.ts +11 -11
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +8 -8
- package/dist/node/index.js.map +1 -1
- package/dist/node/init.d.ts +2 -0
- package/dist/node/init.d.ts.map +1 -1
- package/dist/node/init.js +59 -27
- package/dist/node/init.js.map +1 -1
- package/dist/node/lastUpdated.d.ts +2 -2
- package/dist/node/lastUpdated.d.ts.map +1 -1
- package/dist/node/lastUpdated.js +7 -4
- package/dist/node/lastUpdated.js.map +1 -1
- package/dist/node/loadSiteModule.js +2 -2
- package/dist/node/loadSiteModule.js.map +1 -1
- package/dist/node/markdown.d.ts +2 -2
- package/dist/node/markdown.d.ts.map +1 -1
- package/dist/node/markdown.js +110 -110
- package/dist/node/markdown.js.map +1 -1
- package/dist/node/markdownHeadings.d.ts +1 -1
- package/dist/node/markdownHeadings.d.ts.map +1 -1
- package/dist/node/markdownHeadings.js +11 -11
- package/dist/node/markdownHeadings.js.map +1 -1
- package/dist/node/markdownInclude.d.ts.map +1 -1
- package/dist/node/markdownInclude.js +11 -11
- package/dist/node/markdownInclude.js.map +1 -1
- package/dist/node/markdownSnippets.d.ts.map +1 -1
- package/dist/node/markdownSnippets.js +34 -34
- package/dist/node/markdownSnippets.js.map +1 -1
- package/dist/node/mdx.d.ts +1 -1
- package/dist/node/mdx.d.ts.map +1 -1
- package/dist/node/mdx.js +4 -4
- package/dist/node/mdx.js.map +1 -1
- package/dist/node/packageRoot.d.ts.map +1 -1
- package/dist/node/packageRoot.js +4 -4
- package/dist/node/packageRoot.js.map +1 -1
- package/dist/node/pageDataLoaders.d.ts +2 -2
- package/dist/node/pageDataLoaders.d.ts.map +1 -1
- package/dist/node/pageDataLoaders.js +24 -20
- package/dist/node/pageDataLoaders.js.map +1 -1
- package/dist/node/paths.d.ts.map +1 -1
- package/dist/node/paths.js +4 -4
- package/dist/node/paths.js.map +1 -1
- package/dist/node/plugin.d.ts +3 -3
- package/dist/node/plugin.d.ts.map +1 -1
- package/dist/node/plugin.js +66 -66
- package/dist/node/plugin.js.map +1 -1
- package/dist/node/resolveDeps.js +10 -10
- package/dist/node/resolveDeps.js.map +1 -1
- package/dist/node/serve.d.ts.map +1 -1
- package/dist/node/serve.js +13 -15
- package/dist/node/serve.js.map +1 -1
- package/dist/node/server.d.ts +3 -3
- package/dist/node/server.d.ts.map +1 -1
- package/dist/node/server.js +28 -25
- package/dist/node/server.js.map +1 -1
- package/dist/node/siteConfig.d.ts +12 -12
- package/dist/node/siteConfig.d.ts.map +1 -1
- package/dist/node/tagIndex.d.ts +5 -5
- package/dist/node/tagIndex.d.ts.map +1 -1
- package/dist/node/tagIndex.js +10 -10
- package/dist/node/tagIndex.js.map +1 -1
- package/dist/shared/contentChunk.d.ts.map +1 -1
- package/dist/shared/contentChunk.js +6 -6
- package/dist/shared/contentChunk.js.map +1 -1
- package/dist/shared/contentSchema.d.ts.map +1 -1
- package/dist/shared/contentSchema.js +11 -11
- package/dist/shared/contentSchema.js.map +1 -1
- package/dist/shared/deadLinks.d.ts.map +1 -1
- package/dist/shared/deadLinks.js +6 -6
- package/dist/shared/deadLinks.js.map +1 -1
- package/dist/shared/escapeHtml.js +4 -4
- package/dist/shared/escapeHtml.js.map +1 -1
- package/dist/shared/index.d.ts +14 -14
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +14 -14
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/locale.d.ts +1 -1
- package/dist/shared/locale.d.ts.map +1 -1
- package/dist/shared/locale.js +10 -10
- package/dist/shared/locale.js.map +1 -1
- package/dist/shared/pageChrome.d.ts +4 -4
- package/dist/shared/pageChrome.d.ts.map +1 -1
- package/dist/shared/pageChrome.js +21 -21
- package/dist/shared/pageChrome.js.map +1 -1
- package/dist/shared/pageHead.d.ts +1 -1
- package/dist/shared/pageHead.d.ts.map +1 -1
- package/dist/shared/pageHead.js +4 -4
- package/dist/shared/pageHead.js.map +1 -1
- package/dist/shared/pageMeta.d.ts +5 -5
- package/dist/shared/pageMeta.d.ts.map +1 -1
- package/dist/shared/pageMeta.js +15 -17
- package/dist/shared/pageMeta.js.map +1 -1
- package/dist/shared/rewrites.d.ts +1 -1
- package/dist/shared/rewrites.d.ts.map +1 -1
- package/dist/shared/rewrites.js +2 -2
- package/dist/shared/rewrites.js.map +1 -1
- package/dist/shared/route.js +5 -5
- package/dist/shared/route.js.map +1 -1
- package/dist/shared/search.d.ts +3 -3
- package/dist/shared/search.d.ts.map +1 -1
- package/dist/shared/search.js +14 -14
- package/dist/shared/search.js.map +1 -1
- package/dist/shared/sidebar.d.ts +1 -1
- package/dist/shared/sidebar.d.ts.map +1 -1
- package/dist/shared/sidebar.js +4 -4
- package/dist/shared/sidebar.js.map +1 -1
- package/dist/shared/slug.d.ts +1 -1
- package/dist/shared/slug.d.ts.map +1 -1
- package/dist/shared/slug.js +5 -5
- package/dist/shared/slug.js.map +1 -1
- package/dist/shared/socialIcons.d.ts.map +1 -1
- package/dist/shared/socialIcons.js +4 -4
- package/dist/shared/socialIcons.js.map +1 -1
- package/dist/shared/tags.js +8 -8
- package/dist/shared/tags.js.map +1 -1
- package/dist/shared/theme.d.ts +1 -1
- package/dist/shared/theme.d.ts.map +1 -1
- package/dist/shared/theme.js +16 -10
- package/dist/shared/theme.js.map +1 -1
- package/dist/shared/themeLabels.d.ts +1 -1
- package/dist/shared/themeLabels.d.ts.map +1 -1
- package/dist/shared/themeLabels.js +26 -26
- package/dist/shared/themeLabels.js.map +1 -1
- package/dist/shared/url.d.ts.map +1 -1
- package/dist/shared/url.js +3 -3
- package/dist/shared/url.js.map +1 -1
- package/package.json +33 -9
- package/src/client/app.tsx +89 -92
- package/src/client/entry-client.tsx +17 -19
- package/src/client/entry-ssr.tsx +33 -33
- package/src/client/index.ts +16 -2
- package/src/client/loadPage.ts +37 -38
- package/src/client/prefetchLinks.ts +30 -30
- package/src/client/theme-default/AlgoliaSearch.tsx +46 -46
- package/src/client/theme-default/Features.tsx +27 -21
- package/src/client/theme-default/Hero.tsx +22 -18
- package/src/client/theme-default/Layout.tsx +189 -244
- package/src/client/theme-default/Logo.tsx +30 -40
- package/src/client/theme-default/NavLinks.tsx +21 -21
- package/src/client/theme-default/SidebarNav.tsx +29 -29
- package/src/client/theme-default/SocialLinks.tsx +11 -11
- package/src/client/theme-default/ThemeToggle.tsx +2 -78
- package/src/client/theme-default/index.ts +1 -1
- package/src/client/theme-default/styles.css +30 -21
- package/src/client/theme-utils.tsx +184 -0
- package/src/client/types.ts +30 -24
- package/src/client/usePageHead.ts +128 -128
- package/src/client/useSiteSearch.ts +34 -34
- package/src/client/virtual.d.ts +76 -76
- package/src/shared/contentChunk.ts +6 -6
- package/src/shared/contentSchema.ts +52 -49
- package/src/shared/deadLinks.ts +16 -16
- package/src/shared/escapeHtml.ts +5 -5
- package/src/shared/index.ts +21 -25
- package/src/shared/locale.ts +46 -46
- package/src/shared/pageChrome.ts +123 -123
- package/src/shared/pageHead.ts +16 -16
- package/src/shared/pageMeta.ts +79 -79
- package/src/shared/rewrites.ts +14 -16
- package/src/shared/route.ts +7 -7
- package/src/shared/search.ts +52 -52
- package/src/shared/sidebar.ts +28 -28
- package/src/shared/slug.ts +13 -13
- package/src/shared/socialIcons.ts +12 -14
- package/src/shared/tags.ts +20 -20
- package/src/shared/theme.ts +22 -13
- package/src/shared/themeLabels.ts +45 -45
- package/src/shared/url.ts +6 -10
- package/templates/default/.preactpress/config.ts +17 -17
- package/templates/default/README.md +16 -16
- package/templates/default/guide/first-five-minutes.md +21 -21
- package/templates/default/index.html +1 -1
- package/templates/default/index.md +9 -9
- package/templates/default/package.json +1 -1
- package/templates/default/pnpm-lock.yaml +5 -5
- package/templates/docs/.preactpress/config.ts +76 -56
- package/templates/docs/README.md +6 -6
- package/templates/docs/components/BenefitsGrid.tsx +45 -0
- package/templates/docs/components/CliBlock.tsx +38 -0
- package/templates/docs/components/ComparisonTable.tsx +60 -0
- package/templates/docs/components/CopyableCommand.tsx +86 -0
- package/templates/docs/components/Counter.tsx +7 -5
- package/templates/docs/components/MarketingHero.tsx +63 -0
- package/templates/docs/components/MdxDemo.tsx +96 -0
- package/templates/docs/components/References.tsx +62 -0
- package/templates/docs/components/TemplateGallery.tsx +46 -0
- package/templates/docs/components/marketing.css +992 -0
- package/templates/docs/examples/algolia-docsearch.md +33 -0
- package/templates/docs/examples/content-loader.data.ts +11 -0
- package/templates/docs/examples/content-loader.md +29 -0
- package/templates/docs/examples/dynamic-routes.md +16 -0
- package/templates/docs/examples/static-assets.md +13 -0
- package/templates/docs/guide/advanced.md +4 -4
- package/templates/docs/guide/commands.md +10 -10
- package/templates/docs/guide/configuration.md +43 -43
- package/templates/docs/guide/creating-pages.md +60 -39
- package/templates/docs/guide/custom-themes.md +9 -9
- package/templates/docs/guide/deploy.md +29 -29
- package/templates/docs/guide/first-five-minutes.md +22 -22
- package/templates/docs/guide/getting-started.md +29 -31
- package/templates/docs/guide/markdown-and-mdx.md +1 -1
- package/templates/docs/guide/routing.md +40 -40
- package/templates/docs/guide/what-is-preactpress.md +18 -18
- package/templates/docs/index.html +1 -1
- package/templates/docs/index.mdx +25 -0
- package/templates/docs/interactive.mdx +1 -1
- package/templates/docs/markdown-examples.md +73 -21
- package/templates/docs/package.json +1 -1
- package/templates/docs/packages/[pkg].md +15 -0
- package/templates/docs/packages/[pkg].paths.ts +20 -0
- package/templates/docs/parts/include-body.md +1 -0
- package/templates/docs/pnpm-lock.yaml +5 -5
- package/templates/docs/public/preactpress-example.txt +1 -0
- package/templates/docs/snippets/greet.ts +1 -1
- package/templates/hono/.preactpress/config.ts +65 -65
- package/templates/hono/.preactpress/theme/CodeSnippet.tsx +15 -15
- package/templates/hono/.preactpress/theme/FeatureGrid.tsx +7 -7
- package/templates/hono/.preactpress/theme/Hero.tsx +13 -13
- package/templates/hono/.preactpress/theme/Layout.tsx +122 -164
- package/templates/hono/.preactpress/theme/Logo.tsx +6 -6
- package/templates/hono/.preactpress/theme/ThemeToggle.tsx +3 -70
- package/templates/hono/.preactpress/theme/hono.css +31 -14
- package/templates/hono/README.md +17 -15
- package/templates/hono/components/Counter.tsx +7 -5
- package/templates/hono/de/guide/configuration.md +18 -20
- package/templates/hono/de/guide/deploy.md +29 -29
- package/templates/hono/de/guide/first-five-minutes.md +21 -21
- package/templates/hono/de/guide/getting-started.md +29 -29
- package/templates/hono/de/guide/routing.md +26 -25
- package/templates/hono/de/guide/seiten-erstellen.md +39 -39
- package/templates/hono/de/guide/what-is-preactpress.md +18 -18
- package/templates/hono/de/index.mdx +20 -17
- package/templates/hono/de/interactive.mdx +1 -1
- package/templates/hono/de/markdown-examples.md +6 -6
- package/templates/hono/de/parts/include-body.md +1 -0
- package/templates/hono/de/snippets/greet.ts +1 -1
- package/templates/hono/guide/configuration.md +25 -25
- package/templates/hono/guide/creating-pages.md +39 -39
- package/templates/hono/guide/deploy.md +29 -29
- package/templates/hono/guide/first-five-minutes.md +21 -21
- package/templates/hono/guide/getting-started.md +29 -29
- package/templates/hono/guide/routing.md +40 -40
- package/templates/hono/guide/what-is-preactpress.md +18 -18
- package/templates/hono/index.html +1 -1
- package/templates/hono/index.mdx +21 -17
- package/templates/hono/interactive.mdx +1 -1
- package/templates/hono/markdown-examples.md +6 -6
- package/templates/hono/package.json +1 -1
- package/templates/hono/parts/include-body.md +1 -0
- package/templates/hono/pnpm-lock.yaml +5 -5
- package/templates/hono/snippets/greet.ts +1 -1
- package/templates/magazine/.preactpress/config.ts +19 -19
- package/templates/magazine/.preactpress/theme/Layout.tsx +69 -172
- package/templates/magazine/.preactpress/theme/TeaserGrid.tsx +14 -14
- package/templates/magazine/.preactpress/theme/ThemeToggle.tsx +4 -70
- package/templates/magazine/.preactpress/theme/magazine.css +13 -8
- package/templates/magazine/README.md +30 -0
- package/templates/magazine/article-markets.md +2 -2
- package/templates/magazine/article-tech.mdx +10 -10
- package/templates/magazine/index.data.ts +9 -9
- package/templates/magazine/index.html +5 -1
- package/templates/magazine/index.mdx +1 -1
- package/templates/magazine/package.json +1 -1
- package/templates/magazine/pnpm-lock.yaml +2917 -0
- package/templates/docs/about.md +0 -10
- package/templates/docs/dist/404.html +0 -29
- package/templates/docs/dist/about/index.html +0 -32
- package/templates/docs/dist/assets/esm-DzlBxN5p.js +0 -110
- package/templates/docs/dist/assets/interactive-64o6YwrR.js +0 -9
- package/templates/docs/dist/assets/interactive-BedCloEw.js +0 -9
- package/templates/docs/dist/assets/main-BVLeh8GO.js +0 -1
- package/templates/docs/dist/assets/main-CreUBb3N.js +0 -1
- package/templates/docs/dist/assets/main-oodK-zZy.css +0 -2
- package/templates/docs/dist/de/guide/getting-started/index.html +0 -36
- package/templates/docs/dist/de/guide/what-is-preactpress/index.html +0 -38
- package/templates/docs/dist/de/index.html +0 -29
- package/templates/docs/dist/favicon-32.png +0 -0
- package/templates/docs/dist/favicon.png +0 -0
- package/templates/docs/dist/favicon.svg +0 -28
- package/templates/docs/dist/guide/advanced/index.html +0 -53
- package/templates/docs/dist/guide/commands/index.html +0 -89
- package/templates/docs/dist/guide/configuration/index.html +0 -196
- package/templates/docs/dist/guide/creating-pages/index.html +0 -234
- package/templates/docs/dist/guide/custom-themes/index.html +0 -52
- package/templates/docs/dist/guide/default-theme/index.html +0 -53
- package/templates/docs/dist/guide/deploy/index.html +0 -195
- package/templates/docs/dist/guide/first-five-minutes/index.html +0 -99
- package/templates/docs/dist/guide/getting-started/index.html +0 -173
- package/templates/docs/dist/guide/markdown-and-mdx/index.html +0 -59
- package/templates/docs/dist/guide/routing/index.html +0 -192
- package/templates/docs/dist/guide/what-is-preactpress/index.html +0 -141
- package/templates/docs/dist/index.html +0 -30
- package/templates/docs/dist/interactive/index.html +0 -37
- package/templates/docs/dist/markdown-examples/index.html +0 -231
- package/templates/docs/dist/preactpress-content/404.json +0 -8
- package/templates/docs/dist/preactpress-content/_index.json +0 -50
- package/templates/docs/dist/preactpress-content/about.json +0 -15
- package/templates/docs/dist/preactpress-content/de.json +0 -45
- package/templates/docs/dist/preactpress-content/de__guide__getting-started.json +0 -26
- package/templates/docs/dist/preactpress-content/de__guide__what-is-preactpress.json +0 -21
- package/templates/docs/dist/preactpress-content/guide__advanced.json +0 -46
- package/templates/docs/dist/preactpress-content/guide__commands.json +0 -26
- package/templates/docs/dist/preactpress-content/guide__configuration.json +0 -51
- package/templates/docs/dist/preactpress-content/guide__creating-pages.json +0 -71
- package/templates/docs/dist/preactpress-content/guide__custom-themes.json +0 -15
- package/templates/docs/dist/preactpress-content/guide__default-theme.json +0 -36
- package/templates/docs/dist/preactpress-content/guide__deploy.json +0 -56
- package/templates/docs/dist/preactpress-content/guide__first-five-minutes.json +0 -36
- package/templates/docs/dist/preactpress-content/guide__getting-started.json +0 -51
- package/templates/docs/dist/preactpress-content/guide__markdown-and-mdx.json +0 -31
- package/templates/docs/dist/preactpress-content/guide__routing.json +0 -71
- package/templates/docs/dist/preactpress-content/guide__what-is-preactpress.json +0 -51
- package/templates/docs/dist/preactpress-content/markdown-examples.json +0 -71
- package/templates/docs/dist/preactpress-content/tags__markdown.json +0 -16
- package/templates/docs/dist/preactpress-search.json +0 -166
- package/templates/docs/dist/preactpress-theme.js +0 -1
- package/templates/docs/dist/tags/markdown/index.html +0 -32
- package/templates/docs/index.md +0 -28
- package/templates/hono/dist/404.html +0 -29
- package/templates/hono/dist/README/index.html +0 -104
- package/templates/hono/dist/about/index.html +0 -32
- package/templates/hono/dist/assets/Counter-CCEByS-J.js +0 -1
- package/templates/hono/dist/assets/Hero--o6WMNvm.js +0 -2
- package/templates/hono/dist/assets/de-D5r6Ye70.js +0 -10
- package/templates/hono/dist/assets/hono-BXWYYdyv.js +0 -10
- package/templates/hono/dist/assets/interactive-Bxo-WBpC.js +0 -9
- package/templates/hono/dist/assets/interactive-BznI4IQ3.js +0 -9
- package/templates/hono/dist/assets/main-Bqi-VFEk.js +0 -2
- package/templates/hono/dist/assets/main-DIIN7FO0.css +0 -1
- package/templates/hono/dist/de/about/index.html +0 -32
- package/templates/hono/dist/de/guide/commands/index.html +0 -41
- package/templates/hono/dist/de/guide/configuration/index.html +0 -105
- package/templates/hono/dist/de/guide/deploy/index.html +0 -195
- package/templates/hono/dist/de/guide/first-five-minutes/index.html +0 -99
- package/templates/hono/dist/de/guide/getting-started/index.html +0 -173
- package/templates/hono/dist/de/guide/routing/index.html +0 -165
- package/templates/hono/dist/de/guide/seiten-erstellen/index.html +0 -234
- package/templates/hono/dist/de/guide/what-is-preactpress/index.html +0 -141
- package/templates/hono/dist/de/index.html +0 -30
- package/templates/hono/dist/de/interactive/index.html +0 -37
- package/templates/hono/dist/de/markdown-examples/index.html +0 -97
- package/templates/hono/dist/de/parts/include-body/index.html +0 -36
- package/templates/hono/dist/de/tags/markdown/index.html +0 -32
- package/templates/hono/dist/favicon-32.png +0 -0
- package/templates/hono/dist/favicon.png +0 -0
- package/templates/hono/dist/favicon.svg +0 -28
- package/templates/hono/dist/guide/commands/index.html +0 -41
- package/templates/hono/dist/guide/configuration/index.html +0 -158
- package/templates/hono/dist/guide/creating-pages/index.html +0 -234
- package/templates/hono/dist/guide/deploy/index.html +0 -195
- package/templates/hono/dist/guide/first-five-minutes/index.html +0 -99
- package/templates/hono/dist/guide/getting-started/index.html +0 -173
- package/templates/hono/dist/guide/routing/index.html +0 -165
- package/templates/hono/dist/guide/what-is-preactpress/index.html +0 -141
- package/templates/hono/dist/index.html +0 -30
- package/templates/hono/dist/interactive/index.html +0 -37
- package/templates/hono/dist/markdown-examples/index.html +0 -105
- package/templates/hono/dist/partials/shared-note/index.html +0 -30
- package/templates/hono/dist/parts/include-body/index.html +0 -36
- package/templates/hono/dist/preactpress-content/404.json +0 -8
- package/templates/hono/dist/preactpress-content/README.json +0 -26
- package/templates/hono/dist/preactpress-content/about.json +0 -15
- package/templates/hono/dist/preactpress-content/de__about.json +0 -15
- package/templates/hono/dist/preactpress-content/de__guide__commands.json +0 -36
- package/templates/hono/dist/preactpress-content/de__guide__configuration.json +0 -41
- package/templates/hono/dist/preactpress-content/de__guide__deploy.json +0 -56
- package/templates/hono/dist/preactpress-content/de__guide__first-five-minutes.json +0 -36
- package/templates/hono/dist/preactpress-content/de__guide__getting-started.json +0 -51
- package/templates/hono/dist/preactpress-content/de__guide__routing.json +0 -61
- package/templates/hono/dist/preactpress-content/de__guide__seiten-erstellen.json +0 -71
- package/templates/hono/dist/preactpress-content/de__guide__what-is-preactpress.json +0 -51
- package/templates/hono/dist/preactpress-content/de__markdown-examples.json +0 -131
- package/templates/hono/dist/preactpress-content/de__parts__include-body.json +0 -16
- package/templates/hono/dist/preactpress-content/de__tags__markdown.json +0 -16
- package/templates/hono/dist/preactpress-content/guide__commands.json +0 -36
- package/templates/hono/dist/preactpress-content/guide__configuration.json +0 -51
- package/templates/hono/dist/preactpress-content/guide__creating-pages.json +0 -71
- package/templates/hono/dist/preactpress-content/guide__deploy.json +0 -56
- package/templates/hono/dist/preactpress-content/guide__first-five-minutes.json +0 -36
- package/templates/hono/dist/preactpress-content/guide__getting-started.json +0 -51
- package/templates/hono/dist/preactpress-content/guide__routing.json +0 -61
- package/templates/hono/dist/preactpress-content/guide__what-is-preactpress.json +0 -51
- package/templates/hono/dist/preactpress-content/markdown-examples.json +0 -141
- package/templates/hono/dist/preactpress-content/partials__shared-note.json +0 -10
- package/templates/hono/dist/preactpress-content/parts__include-body.json +0 -16
- package/templates/hono/dist/preactpress-content/tags__markdown.json +0 -16
- package/templates/hono/dist/preactpress-search.json +0 -242
- package/templates/hono/dist/preactpress-theme.js +0 -1
- package/templates/hono/dist/tags/markdown/index.html +0 -32
package/src/shared/locale.ts
CHANGED
|
@@ -3,29 +3,29 @@ import type {
|
|
|
3
3
|
ResolvedI18n,
|
|
4
4
|
ResolvedLocale,
|
|
5
5
|
SiteData,
|
|
6
|
-
ThemeConfig
|
|
7
|
-
} from
|
|
8
|
-
import { normalizeRoute } from
|
|
6
|
+
ThemeConfig,
|
|
7
|
+
} from "../node/siteConfig.js";
|
|
8
|
+
import { normalizeRoute } from "./route.js";
|
|
9
9
|
|
|
10
10
|
export function resolveLocales(
|
|
11
11
|
userLocales: Record<string, LocaleConfig> | undefined,
|
|
12
12
|
site: SiteData,
|
|
13
|
-
themeConfig: ThemeConfig
|
|
13
|
+
themeConfig: ThemeConfig,
|
|
14
14
|
): ResolvedI18n | undefined {
|
|
15
|
-
const entries = Object.entries(userLocales ?? {})
|
|
16
|
-
if (entries.length === 0) return undefined
|
|
15
|
+
const entries = Object.entries(userLocales ?? {});
|
|
16
|
+
if (entries.length === 0) return undefined;
|
|
17
17
|
|
|
18
|
-
const defaultLocaleKey = userLocales?.root ?
|
|
18
|
+
const defaultLocaleKey = userLocales?.root ? "root" : entries[0][0];
|
|
19
19
|
const locales = entries.map(([key, locale]) => {
|
|
20
|
-
const prefix = localePrefixForKey(key)
|
|
21
|
-
const link = locale.link ?? `${prefix ||
|
|
22
|
-
const lang = locale.lang ?? (key ===
|
|
20
|
+
const prefix = localePrefixForKey(key);
|
|
21
|
+
const link = locale.link ?? `${prefix || ""}/`;
|
|
22
|
+
const lang = locale.lang ?? (key === "root" ? site.lang : key);
|
|
23
23
|
const localeSite = {
|
|
24
24
|
...site,
|
|
25
25
|
title: locale.title ?? site.title,
|
|
26
26
|
description: locale.description ?? site.description,
|
|
27
|
-
lang
|
|
28
|
-
}
|
|
27
|
+
lang,
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
return {
|
|
31
31
|
key,
|
|
@@ -36,81 +36,81 @@ export function resolveLocales(
|
|
|
36
36
|
site: localeSite,
|
|
37
37
|
themeConfig: {
|
|
38
38
|
...themeConfig,
|
|
39
|
-
...
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
})
|
|
39
|
+
...locale.themeConfig,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
43
|
|
|
44
|
-
return { defaultLocaleKey, locales }
|
|
44
|
+
return { defaultLocaleKey, locales };
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export function localePrefixForKey(key: string): string {
|
|
48
|
-
return key ===
|
|
48
|
+
return key === "root" ? "" : normalizeRoute(`/${key}`);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export function localeFromRoute(
|
|
52
52
|
route: string,
|
|
53
|
-
i18n: ResolvedI18n | undefined
|
|
53
|
+
i18n: ResolvedI18n | undefined,
|
|
54
54
|
): ResolvedLocale | undefined {
|
|
55
|
-
if (!i18n) return undefined
|
|
56
|
-
const normalized = normalizeRoute(route)
|
|
55
|
+
if (!i18n) return undefined;
|
|
56
|
+
const normalized = normalizeRoute(route);
|
|
57
57
|
const prefixed = [...i18n.locales]
|
|
58
58
|
.filter((locale) => locale.prefix)
|
|
59
|
-
.sort((a, b) => b.prefix.length - a.prefix.length)
|
|
59
|
+
.sort((a, b) => b.prefix.length - a.prefix.length);
|
|
60
60
|
const match = prefixed.find(
|
|
61
|
-
(locale) => normalized === locale.prefix || normalized.startsWith(`${locale.prefix}/`)
|
|
62
|
-
)
|
|
63
|
-
if (match) return match
|
|
64
|
-
return i18n.locales.find((locale) => locale.key === i18n.defaultLocaleKey) ?? i18n.locales[0]
|
|
61
|
+
(locale) => normalized === locale.prefix || normalized.startsWith(`${locale.prefix}/`),
|
|
62
|
+
);
|
|
63
|
+
if (match) return match;
|
|
64
|
+
return i18n.locales.find((locale) => locale.key === i18n.defaultLocaleKey) ?? i18n.locales[0];
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export function stripLocalePrefix(route: string, locale: ResolvedLocale | undefined): string {
|
|
68
|
-
const normalized = normalizeRoute(route)
|
|
69
|
-
if (!locale?.prefix) return normalized
|
|
70
|
-
if (normalized === locale.prefix) return
|
|
68
|
+
const normalized = normalizeRoute(route);
|
|
69
|
+
if (!locale?.prefix) return normalized;
|
|
70
|
+
if (normalized === locale.prefix) return "/";
|
|
71
71
|
if (normalized.startsWith(`${locale.prefix}/`)) {
|
|
72
|
-
return normalizeRoute(normalized.slice(locale.prefix.length))
|
|
72
|
+
return normalizeRoute(normalized.slice(locale.prefix.length));
|
|
73
73
|
}
|
|
74
|
-
return normalized
|
|
74
|
+
return normalized;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export function routePathKey(route: string, i18n: ResolvedI18n | undefined): string {
|
|
78
|
-
return stripLocalePrefix(route, localeFromRoute(route, i18n))
|
|
78
|
+
return stripLocalePrefix(route, localeFromRoute(route, i18n));
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export function localizeRoute(pathKey: string, locale: ResolvedLocale): string {
|
|
82
|
-
const normalized = normalizeRoute(pathKey)
|
|
83
|
-
if (!locale.prefix) return normalized
|
|
84
|
-
return normalized ===
|
|
82
|
+
const normalized = normalizeRoute(pathKey);
|
|
83
|
+
if (!locale.prefix) return normalized;
|
|
84
|
+
return normalized === "/" ? locale.prefix : normalizeRoute(`${locale.prefix}${normalized}`);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
export function localizedRouteForLocale(
|
|
88
88
|
route: string,
|
|
89
89
|
targetLocale: ResolvedLocale,
|
|
90
90
|
i18n: ResolvedI18n | undefined,
|
|
91
|
-
availableRoutes?: ReadonlySet<string
|
|
91
|
+
availableRoutes?: ReadonlySet<string>,
|
|
92
92
|
): string {
|
|
93
|
-
const pathKey = routePathKey(route, i18n)
|
|
94
|
-
const localized = localizeRoute(pathKey, targetLocale)
|
|
95
|
-
if (!availableRoutes || availableRoutes.has(localized)) return localized
|
|
96
|
-
return normalizeRoute(targetLocale.link)
|
|
93
|
+
const pathKey = routePathKey(route, i18n);
|
|
94
|
+
const localized = localizeRoute(pathKey, targetLocale);
|
|
95
|
+
if (!availableRoutes || availableRoutes.has(localized)) return localized;
|
|
96
|
+
return normalizeRoute(targetLocale.link);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export function siteForRoute(
|
|
100
100
|
site: SiteData,
|
|
101
101
|
route: string,
|
|
102
|
-
i18n: ResolvedI18n | undefined
|
|
102
|
+
i18n: ResolvedI18n | undefined,
|
|
103
103
|
): SiteData {
|
|
104
|
-
const localeSite = localeFromRoute(route, i18n)?.site
|
|
105
|
-
if (!localeSite) return site
|
|
104
|
+
const localeSite = localeFromRoute(route, i18n)?.site;
|
|
105
|
+
if (!localeSite) return site;
|
|
106
106
|
// `base` is a deployment setting; locale copies are resolved before CLI overrides.
|
|
107
|
-
return { ...localeSite, base: site.base }
|
|
107
|
+
return { ...localeSite, base: site.base };
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export function themeConfigForRoute(
|
|
111
111
|
themeConfig: ThemeConfig,
|
|
112
112
|
route: string,
|
|
113
|
-
i18n: ResolvedI18n | undefined
|
|
113
|
+
i18n: ResolvedI18n | undefined,
|
|
114
114
|
): ThemeConfig {
|
|
115
|
-
return localeFromRoute(route, i18n)?.themeConfig ?? themeConfig
|
|
115
|
+
return localeFromRoute(route, i18n)?.themeConfig ?? themeConfig;
|
|
116
116
|
}
|
package/src/shared/pageChrome.ts
CHANGED
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
import { pageLayoutFromMeta, type PageLayout } from
|
|
1
|
+
import { pageLayoutFromMeta, type PageLayout } from "./pageMeta.js";
|
|
2
2
|
|
|
3
|
-
export type PageAside = boolean |
|
|
4
|
-
export type PageOutlineConfig = number | [number, number] |
|
|
5
|
-
export type PageOutlineLevels = [number, number] | false
|
|
3
|
+
export type PageAside = boolean | "left";
|
|
4
|
+
export type PageOutlineConfig = number | [number, number] | "deep" | false;
|
|
5
|
+
export type PageOutlineLevels = [number, number] | false;
|
|
6
6
|
|
|
7
7
|
export type ThemeableImage =
|
|
8
8
|
| string
|
|
9
9
|
| { src: string; alt?: string }
|
|
10
|
-
| { light: string; dark: string; alt?: string }
|
|
10
|
+
| { light: string; dark: string; alt?: string };
|
|
11
11
|
|
|
12
12
|
export interface HeroAction {
|
|
13
|
-
theme:
|
|
14
|
-
text: string
|
|
15
|
-
link: string
|
|
16
|
-
target?: string
|
|
17
|
-
rel?: string
|
|
13
|
+
theme: "brand" | "alt";
|
|
14
|
+
text: string;
|
|
15
|
+
link: string;
|
|
16
|
+
target?: string;
|
|
17
|
+
rel?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface Hero {
|
|
21
|
-
name?: string
|
|
22
|
-
text?: string
|
|
23
|
-
tagline?: string
|
|
24
|
-
image?: ThemeableImage
|
|
25
|
-
actions: HeroAction[]
|
|
21
|
+
name?: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
tagline?: string;
|
|
24
|
+
image?: ThemeableImage;
|
|
25
|
+
actions: HeroAction[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export type FeatureIcon =
|
|
29
29
|
| string
|
|
30
30
|
| { src: string; alt?: string; width?: string; height?: string }
|
|
31
|
-
| { light: string; dark: string; alt?: string; width?: string; height?: string }
|
|
31
|
+
| { light: string; dark: string; alt?: string; width?: string; height?: string };
|
|
32
32
|
|
|
33
33
|
export interface Feature {
|
|
34
|
-
icon?: FeatureIcon
|
|
35
|
-
title: string
|
|
36
|
-
details: string
|
|
37
|
-
link?: string
|
|
38
|
-
linkText?: string
|
|
39
|
-
rel?: string
|
|
40
|
-
target?: string
|
|
34
|
+
icon?: FeatureIcon;
|
|
35
|
+
title: string;
|
|
36
|
+
details: string;
|
|
37
|
+
link?: string;
|
|
38
|
+
linkText?: string;
|
|
39
|
+
rel?: string;
|
|
40
|
+
target?: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export interface PageChromeThemeConfig {
|
|
44
|
-
outline?: boolean | PageOutlineConfig
|
|
45
|
-
footer?: string
|
|
46
|
-
editLink?: unknown
|
|
47
|
-
lastUpdated?: boolean
|
|
44
|
+
outline?: boolean | PageOutlineConfig;
|
|
45
|
+
footer?: string;
|
|
46
|
+
editLink?: unknown;
|
|
47
|
+
lastUpdated?: boolean;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export interface ResolvedPageChrome {
|
|
51
|
-
layout: PageLayout
|
|
52
|
-
isHome: boolean
|
|
53
|
-
showNavbar: boolean
|
|
54
|
-
showSidebar: boolean
|
|
55
|
-
aside: PageAside
|
|
56
|
-
showAside: boolean
|
|
57
|
-
outlineLevels: PageOutlineLevels
|
|
58
|
-
showPager: boolean
|
|
59
|
-
showFooter: boolean
|
|
60
|
-
showEditLink: boolean
|
|
61
|
-
showLastUpdated: boolean
|
|
62
|
-
pageClass?: string
|
|
63
|
-
markdownStyles: boolean
|
|
64
|
-
hero?: Hero
|
|
65
|
-
features: Feature[]
|
|
51
|
+
layout: PageLayout;
|
|
52
|
+
isHome: boolean;
|
|
53
|
+
showNavbar: boolean;
|
|
54
|
+
showSidebar: boolean;
|
|
55
|
+
aside: PageAside;
|
|
56
|
+
showAside: boolean;
|
|
57
|
+
outlineLevels: PageOutlineLevels;
|
|
58
|
+
showPager: boolean;
|
|
59
|
+
showFooter: boolean;
|
|
60
|
+
showEditLink: boolean;
|
|
61
|
+
showLastUpdated: boolean;
|
|
62
|
+
pageClass?: string;
|
|
63
|
+
markdownStyles: boolean;
|
|
64
|
+
hero?: Hero;
|
|
65
|
+
features: Feature[];
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export interface OutlineHeading {
|
|
69
|
-
id: string
|
|
70
|
-
text: string
|
|
71
|
-
level: number
|
|
69
|
+
id: string;
|
|
70
|
+
text: string;
|
|
71
|
+
level: number;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export function resolvePageChrome(
|
|
75
75
|
meta: Record<string, unknown> | undefined,
|
|
76
|
-
themeConfig: PageChromeThemeConfig = {}
|
|
76
|
+
themeConfig: PageChromeThemeConfig = {},
|
|
77
77
|
): ResolvedPageChrome {
|
|
78
|
-
const layout = pageLayoutFromMeta(meta)
|
|
79
|
-
const isHome = layout ===
|
|
80
|
-
const aside = resolveAside(meta?.aside, layout ===
|
|
81
|
-
const outlineLevels = resolveOutlineLevels(meta?.outline, themeConfig.outline)
|
|
82
|
-
const showAside = aside !== false && outlineLevels !== false
|
|
78
|
+
const layout = pageLayoutFromMeta(meta);
|
|
79
|
+
const isHome = layout === "home" || meta?.isHome === true;
|
|
80
|
+
const aside = resolveAside(meta?.aside, layout === "doc");
|
|
81
|
+
const outlineLevels = resolveOutlineLevels(meta?.outline, themeConfig.outline);
|
|
82
|
+
const showAside = aside !== false && outlineLevels !== false;
|
|
83
83
|
|
|
84
84
|
return {
|
|
85
85
|
layout,
|
|
86
86
|
isHome,
|
|
87
87
|
showNavbar: resolveBoolean(meta?.navbar, true),
|
|
88
|
-
showSidebar: resolveBoolean(meta?.sidebar, layout ===
|
|
88
|
+
showSidebar: resolveBoolean(meta?.sidebar, layout === "doc"),
|
|
89
89
|
aside,
|
|
90
90
|
showAside,
|
|
91
91
|
outlineLevels,
|
|
92
|
-
showPager: layout ===
|
|
92
|
+
showPager: layout === "doc",
|
|
93
93
|
showFooter: Boolean(themeConfig.footer) && resolveBoolean(meta?.footer, true),
|
|
94
94
|
showEditLink: Boolean(themeConfig.editLink) && resolveBoolean(meta?.editLink, true),
|
|
95
95
|
showLastUpdated: Boolean(themeConfig.lastUpdated) && resolveBoolean(meta?.lastUpdated, true),
|
|
96
96
|
pageClass: resolveString(meta?.pageClass),
|
|
97
|
-
markdownStyles: layout !==
|
|
97
|
+
markdownStyles: layout !== "page" && meta?.markdownStyles !== false,
|
|
98
98
|
hero: parseHero(meta?.hero),
|
|
99
|
-
features: parseFeatures(meta?.features)
|
|
100
|
-
}
|
|
99
|
+
features: parseFeatures(meta?.features),
|
|
100
|
+
};
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export function filterHeadingsForOutline<T extends OutlineHeading>(
|
|
104
104
|
headings: T[],
|
|
105
|
-
levels: PageOutlineLevels
|
|
105
|
+
levels: PageOutlineLevels,
|
|
106
106
|
): T[] {
|
|
107
|
-
if (levels === false) return []
|
|
108
|
-
const [min, max] = levels
|
|
109
|
-
return headings.filter((heading) => heading.level >= min && heading.level <= max)
|
|
107
|
+
if (levels === false) return [];
|
|
108
|
+
const [min, max] = levels;
|
|
109
|
+
return headings.filter((heading) => heading.level >= min && heading.level <= max);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
export function parseHero(value: unknown): Hero | undefined {
|
|
113
|
-
if (!isRecord(value)) return undefined
|
|
113
|
+
if (!isRecord(value)) return undefined;
|
|
114
114
|
|
|
115
|
-
const name = resolveString(value.name)
|
|
116
|
-
const text = resolveString(value.text)
|
|
117
|
-
const tagline = resolveString(value.tagline)
|
|
118
|
-
const image = parseThemeableImage(value.image)
|
|
115
|
+
const name = resolveString(value.name);
|
|
116
|
+
const text = resolveString(value.text);
|
|
117
|
+
const tagline = resolveString(value.tagline);
|
|
118
|
+
const image = parseThemeableImage(value.image);
|
|
119
119
|
const actions = Array.isArray(value.actions)
|
|
120
120
|
? value.actions.map(parseHeroAction).filter((action): action is HeroAction => Boolean(action))
|
|
121
|
-
: []
|
|
121
|
+
: [];
|
|
122
122
|
|
|
123
|
-
if (!name && !text && !tagline && !image && actions.length === 0) return undefined
|
|
123
|
+
if (!name && !text && !tagline && !image && actions.length === 0) return undefined;
|
|
124
124
|
|
|
125
|
-
return { name, text, tagline, image, actions }
|
|
125
|
+
return { name, text, tagline, image, actions };
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export function parseFeatures(value: unknown): Feature[] {
|
|
129
|
-
if (!Array.isArray(value)) return []
|
|
130
|
-
return value.map(parseFeature).filter((feature): feature is Feature => Boolean(feature))
|
|
129
|
+
if (!Array.isArray(value)) return [];
|
|
130
|
+
return value.map(parseFeature).filter((feature): feature is Feature => Boolean(feature));
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
function parseHeroAction(value: unknown): HeroAction | undefined {
|
|
134
|
-
if (!isRecord(value)) return undefined
|
|
135
|
-
const text = resolveString(value.text)
|
|
136
|
-
const link = resolveString(value.link)
|
|
137
|
-
if (!text || !link) return undefined
|
|
134
|
+
if (!isRecord(value)) return undefined;
|
|
135
|
+
const text = resolveString(value.text);
|
|
136
|
+
const link = resolveString(value.link);
|
|
137
|
+
if (!text || !link) return undefined;
|
|
138
138
|
|
|
139
139
|
return {
|
|
140
|
-
theme: value.theme ===
|
|
140
|
+
theme: value.theme === "alt" ? "alt" : "brand",
|
|
141
141
|
text,
|
|
142
142
|
link,
|
|
143
143
|
target: resolveString(value.target),
|
|
144
|
-
rel: resolveString(value.rel)
|
|
145
|
-
}
|
|
144
|
+
rel: resolveString(value.rel),
|
|
145
|
+
};
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
function parseFeature(value: unknown): Feature | undefined {
|
|
149
|
-
if (!isRecord(value)) return undefined
|
|
150
|
-
const title = resolveString(value.title)
|
|
151
|
-
const details = resolveString(value.details)
|
|
152
|
-
if (!title || !details) return undefined
|
|
149
|
+
if (!isRecord(value)) return undefined;
|
|
150
|
+
const title = resolveString(value.title);
|
|
151
|
+
const details = resolveString(value.details);
|
|
152
|
+
if (!title || !details) return undefined;
|
|
153
153
|
|
|
154
154
|
return {
|
|
155
155
|
icon: parseFeatureIcon(value.icon),
|
|
@@ -158,87 +158,87 @@ function parseFeature(value: unknown): Feature | undefined {
|
|
|
158
158
|
link: resolveString(value.link),
|
|
159
159
|
linkText: resolveString(value.linkText),
|
|
160
160
|
rel: resolveString(value.rel),
|
|
161
|
-
target: resolveString(value.target)
|
|
162
|
-
}
|
|
161
|
+
target: resolveString(value.target),
|
|
162
|
+
};
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
function parseThemeableImage(value: unknown): ThemeableImage | undefined {
|
|
166
|
-
if (typeof value ===
|
|
167
|
-
if (!isRecord(value)) return undefined
|
|
166
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
167
|
+
if (!isRecord(value)) return undefined;
|
|
168
168
|
|
|
169
|
-
const src = resolveString(value.src)
|
|
170
|
-
if (src) return { src, alt: resolveString(value.alt) }
|
|
169
|
+
const src = resolveString(value.src);
|
|
170
|
+
if (src) return { src, alt: resolveString(value.alt) };
|
|
171
171
|
|
|
172
|
-
const light = resolveString(value.light)
|
|
173
|
-
const dark = resolveString(value.dark)
|
|
174
|
-
if (light && dark) return { light, dark, alt: resolveString(value.alt) }
|
|
172
|
+
const light = resolveString(value.light);
|
|
173
|
+
const dark = resolveString(value.dark);
|
|
174
|
+
if (light && dark) return { light, dark, alt: resolveString(value.alt) };
|
|
175
175
|
|
|
176
|
-
return undefined
|
|
176
|
+
return undefined;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
function parseFeatureIcon(value: unknown): FeatureIcon | undefined {
|
|
180
|
-
if (typeof value ===
|
|
181
|
-
if (!isRecord(value)) return undefined
|
|
180
|
+
if (typeof value === "string" && value.trim()) return value.trim();
|
|
181
|
+
if (!isRecord(value)) return undefined;
|
|
182
182
|
|
|
183
|
-
const width = resolveString(value.width)
|
|
184
|
-
const height = resolveString(value.height)
|
|
185
|
-
const src = resolveString(value.src)
|
|
186
|
-
if (src) return { src, alt: resolveString(value.alt), width, height }
|
|
183
|
+
const width = resolveString(value.width);
|
|
184
|
+
const height = resolveString(value.height);
|
|
185
|
+
const src = resolveString(value.src);
|
|
186
|
+
if (src) return { src, alt: resolveString(value.alt), width, height };
|
|
187
187
|
|
|
188
|
-
const light = resolveString(value.light)
|
|
189
|
-
const dark = resolveString(value.dark)
|
|
188
|
+
const light = resolveString(value.light);
|
|
189
|
+
const dark = resolveString(value.dark);
|
|
190
190
|
if (light && dark) {
|
|
191
|
-
return { light, dark, alt: resolveString(value.alt), width, height }
|
|
191
|
+
return { light, dark, alt: resolveString(value.alt), width, height };
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
return undefined
|
|
194
|
+
return undefined;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
function resolveAside(value: unknown, defaultValue: boolean): PageAside {
|
|
198
|
-
if (value ===
|
|
199
|
-
if (typeof value ===
|
|
200
|
-
return defaultValue
|
|
198
|
+
if (value === "left") return "left";
|
|
199
|
+
if (typeof value === "boolean") return value;
|
|
200
|
+
return defaultValue;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
function resolveOutlineLevels(
|
|
204
204
|
pageValue: unknown,
|
|
205
|
-
siteValue: PageChromeThemeConfig[
|
|
205
|
+
siteValue: PageChromeThemeConfig["outline"],
|
|
206
206
|
): PageOutlineLevels {
|
|
207
|
-
const pageLevels = parseOutlineLevels(pageValue)
|
|
208
|
-
if (pageLevels !== undefined) return pageLevels
|
|
207
|
+
const pageLevels = parseOutlineLevels(pageValue);
|
|
208
|
+
if (pageLevels !== undefined) return pageLevels;
|
|
209
209
|
|
|
210
|
-
if (siteValue === false) return false
|
|
211
|
-
return parseOutlineLevels(siteValue) ?? [2, 3]
|
|
210
|
+
if (siteValue === false) return false;
|
|
211
|
+
return parseOutlineLevels(siteValue) ?? [2, 3];
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
function parseOutlineLevels(value: unknown): PageOutlineLevels | undefined {
|
|
215
|
-
if (value === false) return false
|
|
216
|
-
if (value ===
|
|
217
|
-
if (typeof value ===
|
|
215
|
+
if (value === false) return false;
|
|
216
|
+
if (value === "deep") return [2, 6];
|
|
217
|
+
if (typeof value === "number") return normalizeOutlineRange(value, value);
|
|
218
218
|
if (Array.isArray(value) && value.length === 2) {
|
|
219
|
-
const [min, max] = value
|
|
220
|
-
if (typeof min ===
|
|
221
|
-
return normalizeOutlineRange(min, max)
|
|
219
|
+
const [min, max] = value;
|
|
220
|
+
if (typeof min === "number" && typeof max === "number") {
|
|
221
|
+
return normalizeOutlineRange(min, max);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
return undefined
|
|
224
|
+
return undefined;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
function normalizeOutlineRange(min: number, max: number): PageOutlineLevels | undefined {
|
|
228
|
-
if (!Number.isFinite(min) || !Number.isFinite(max)) return undefined
|
|
229
|
-
const start = Math.max(1, Math.min(6, Math.trunc(min)))
|
|
230
|
-
const end = Math.max(1, Math.min(6, Math.trunc(max)))
|
|
231
|
-
return start <= end ? [start, end] : [end, start]
|
|
228
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return undefined;
|
|
229
|
+
const start = Math.max(1, Math.min(6, Math.trunc(min)));
|
|
230
|
+
const end = Math.max(1, Math.min(6, Math.trunc(max)));
|
|
231
|
+
return start <= end ? [start, end] : [end, start];
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
function resolveBoolean(value: unknown, defaultValue: boolean): boolean {
|
|
235
|
-
return typeof value ===
|
|
235
|
+
return typeof value === "boolean" ? value : defaultValue;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
function resolveString(value: unknown): string | undefined {
|
|
239
|
-
return typeof value ===
|
|
239
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
243
|
-
return Boolean(value) && typeof value ===
|
|
243
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
244
244
|
}
|
package/src/shared/pageHead.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import type { HeadTag } from
|
|
1
|
+
import type { HeadTag } from "../node/siteConfig.js";
|
|
2
2
|
|
|
3
3
|
export function headTagsFromMeta(meta: Record<string, unknown> | undefined): HeadTag[] {
|
|
4
|
-
const raw = meta?.head
|
|
5
|
-
if (!Array.isArray(raw)) return []
|
|
4
|
+
const raw = meta?.head;
|
|
5
|
+
if (!Array.isArray(raw)) return [];
|
|
6
6
|
|
|
7
|
-
const tags: HeadTag[] = []
|
|
7
|
+
const tags: HeadTag[] = [];
|
|
8
8
|
for (const entry of raw) {
|
|
9
|
-
const tag = parseHeadTag(entry)
|
|
10
|
-
if (tag) tags.push(tag)
|
|
9
|
+
const tag = parseHeadTag(entry);
|
|
10
|
+
if (tag) tags.push(tag);
|
|
11
11
|
}
|
|
12
|
-
return tags
|
|
12
|
+
return tags;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function parseHeadTag(entry: unknown): HeadTag | undefined {
|
|
16
|
-
if (!Array.isArray(entry) || entry.length < 2) return undefined
|
|
17
|
-
const name = entry[0]
|
|
18
|
-
const attrs = entry[1]
|
|
19
|
-
if (name !==
|
|
20
|
-
if (!attrs || typeof attrs !==
|
|
21
|
-
const record = attrs as Record<string, string | boolean | undefined
|
|
22
|
-
if (entry.length >= 3 && name ===
|
|
23
|
-
return [
|
|
16
|
+
if (!Array.isArray(entry) || entry.length < 2) return undefined;
|
|
17
|
+
const name = entry[0];
|
|
18
|
+
const attrs = entry[1];
|
|
19
|
+
if (name !== "meta" && name !== "link" && name !== "script") return undefined;
|
|
20
|
+
if (!attrs || typeof attrs !== "object") return undefined;
|
|
21
|
+
const record = attrs as Record<string, string | boolean | undefined>;
|
|
22
|
+
if (entry.length >= 3 && name === "script") {
|
|
23
|
+
return ["script", record, typeof entry[2] === "string" ? entry[2] : ""];
|
|
24
24
|
}
|
|
25
|
-
return [name, record]
|
|
25
|
+
return [name, record];
|
|
26
26
|
}
|