@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
|
@@ -1,143 +1,82 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { useEffect, useMemo, useState } from
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { FunctionalComponent } from "preact";
|
|
2
|
+
import { useEffect, useMemo, useState } from "preact/hooks";
|
|
3
|
+
import {
|
|
4
|
+
createMdxHeadingComponents,
|
|
5
|
+
isActive,
|
|
6
|
+
normalizeLink,
|
|
7
|
+
slugifyHeading,
|
|
8
|
+
withBase,
|
|
9
|
+
type LayoutProps,
|
|
10
|
+
} from "@kamod-ch/preactpress/client";
|
|
11
|
+
import Logo from "./Logo.js";
|
|
12
|
+
import ThemeToggle from "./ThemeToggle.js";
|
|
13
|
+
import "./hono.css";
|
|
7
14
|
|
|
8
15
|
interface SidebarItem {
|
|
9
|
-
text: string
|
|
10
|
-
link?: string
|
|
11
|
-
items?: SidebarItem[]
|
|
16
|
+
text: string;
|
|
17
|
+
link?: string;
|
|
18
|
+
items?: SidebarItem[];
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
interface SidebarGroup {
|
|
15
|
-
text?: string
|
|
16
|
-
items: SidebarItem[]
|
|
22
|
+
text?: string;
|
|
23
|
+
items: SidebarItem[];
|
|
17
24
|
}
|
|
18
25
|
|
|
19
|
-
type SocialLink = NonNullable<LayoutProps[
|
|
26
|
+
type SocialLink = NonNullable<LayoutProps["themeConfig"]["socialLinks"]>[number];
|
|
20
27
|
|
|
21
28
|
const GITHUB_SVG =
|
|
22
|
-
'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path fill="currentColor" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.404 1.02.005 2.04.137 3 .404 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>'
|
|
23
|
-
|
|
24
|
-
function withBase(base: string, link: string): string {
|
|
25
|
-
if (/^(?:[a-z]+:)?\/\//i.test(link) || /^(?:data|mailto|tel):/i.test(link) || link.startsWith('#')) {
|
|
26
|
-
return link
|
|
27
|
-
}
|
|
28
|
-
const b = base === '/' ? '' : base.replace(/\/$/, '')
|
|
29
|
-
const l = link.startsWith('/') ? link : `/${link}`
|
|
30
|
-
return `${b}${l}`
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function normalizeLink(link: string): string {
|
|
34
|
-
const clean = link.split(/[?#]/, 1)[0] || '/'
|
|
35
|
-
const prefixed = clean.startsWith('/') ? clean : `/${clean}`
|
|
36
|
-
return prefixed.replace(/\/$/, '') || '/'
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function isActive(routePath: string, link: string | undefined): boolean {
|
|
40
|
-
if (!link || /^(?:[a-z]+:)?\/\//i.test(link)) return false
|
|
41
|
-
const route = normalizeLink(routePath)
|
|
42
|
-
const target = normalizeLink(link)
|
|
43
|
-
return route === target || (target !== '/' && route.startsWith(`${target}/`))
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function childText(children: ComponentChildren): string {
|
|
47
|
-
if (children == null || typeof children === 'boolean') return ''
|
|
48
|
-
if (typeof children === 'string' || typeof children === 'number') return String(children)
|
|
49
|
-
if (Array.isArray(children)) return children.map(childText).join('')
|
|
50
|
-
if (typeof children === 'object' && 'props' in children) {
|
|
51
|
-
return childText(children.props.children as ComponentChildren)
|
|
52
|
-
}
|
|
53
|
-
return ''
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function slugify(text: string): string {
|
|
57
|
-
const slug = text
|
|
58
|
-
.toLowerCase()
|
|
59
|
-
.trim()
|
|
60
|
-
.replace(/<[^>]+>/g, '')
|
|
61
|
-
.replace(/&[a-z0-9#]+;/gi, '')
|
|
62
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
63
|
-
.replace(/^-+|-+$/g, '')
|
|
64
|
-
return slug || 'section'
|
|
65
|
-
}
|
|
29
|
+
'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path fill="currentColor" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.404 1.02.005 2.04.137 3 .404 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>';
|
|
66
30
|
|
|
67
31
|
function tagRoute(tag: string): string {
|
|
68
|
-
return `/tags/${
|
|
32
|
+
return `/tags/${slugifyHeading(tag)}`;
|
|
69
33
|
}
|
|
70
34
|
|
|
71
35
|
function resolveSidebar(
|
|
72
|
-
sidebar: LayoutProps[
|
|
73
|
-
routePath: string
|
|
36
|
+
sidebar: LayoutProps["themeConfig"]["sidebar"],
|
|
37
|
+
routePath: string,
|
|
74
38
|
): SidebarGroup[] {
|
|
75
|
-
if (!sidebar) return []
|
|
76
|
-
if (Array.isArray(sidebar)) return sidebar
|
|
39
|
+
if (!sidebar) return [];
|
|
40
|
+
if (Array.isArray(sidebar)) return sidebar;
|
|
77
41
|
|
|
78
|
-
const route = normalizeLink(routePath)
|
|
42
|
+
const route = normalizeLink(routePath);
|
|
79
43
|
const entries = Object.entries(sidebar)
|
|
80
44
|
.map(([prefix, groups]) => ({ prefix: normalizeLink(prefix), groups }))
|
|
81
|
-
.filter(({ prefix }) => prefix !==
|
|
82
|
-
.sort((a, b) => b.prefix.length - a.prefix.length)
|
|
45
|
+
.filter(({ prefix }) => prefix !== "/")
|
|
46
|
+
.sort((a, b) => b.prefix.length - a.prefix.length);
|
|
83
47
|
|
|
84
48
|
for (const { prefix, groups } of entries) {
|
|
85
|
-
if (route === prefix || route.startsWith(`${prefix}/`)) return groups
|
|
49
|
+
if (route === prefix || route.startsWith(`${prefix}/`)) return groups;
|
|
86
50
|
}
|
|
87
51
|
|
|
88
|
-
return sidebar[
|
|
52
|
+
return sidebar["/"] ?? sidebar[""] ?? [];
|
|
89
53
|
}
|
|
90
54
|
|
|
91
55
|
function flattenItems(items: SidebarItem[]): Array<{ text: string; link: string }> {
|
|
92
|
-
const out: Array<{ text: string; link: string }> = []
|
|
56
|
+
const out: Array<{ text: string; link: string }> = [];
|
|
93
57
|
for (const item of items) {
|
|
94
|
-
if (item.link) out.push({ text: item.text, link: item.link })
|
|
95
|
-
if (item.items?.length) out.push(...flattenItems(item.items))
|
|
58
|
+
if (item.link) out.push({ text: item.text, link: item.link });
|
|
59
|
+
if (item.items?.length) out.push(...flattenItems(item.items));
|
|
96
60
|
}
|
|
97
|
-
return out
|
|
61
|
+
return out;
|
|
98
62
|
}
|
|
99
63
|
|
|
100
64
|
function flattenSidebarItems(sidebar: SidebarGroup[]): Array<{ text: string; link: string }> {
|
|
101
|
-
return sidebar.flatMap((group) => flattenItems(group.items))
|
|
65
|
+
return sidebar.flatMap((group) => flattenItems(group.items));
|
|
102
66
|
}
|
|
103
67
|
|
|
104
|
-
function socialIconSvg(icon: SocialLink[
|
|
105
|
-
if (typeof icon ===
|
|
106
|
-
return icon.toLowerCase() ===
|
|
68
|
+
function socialIconSvg(icon: SocialLink["icon"]): string | undefined {
|
|
69
|
+
if (typeof icon === "object") return icon.svg;
|
|
70
|
+
return icon.toLowerCase() === "github" ? GITHUB_SVG : undefined;
|
|
107
71
|
}
|
|
108
72
|
|
|
109
|
-
function socialLinkLabel(icon: SocialLink[
|
|
110
|
-
if (ariaLabel) return ariaLabel
|
|
111
|
-
return typeof icon ===
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function createMdxHeadingComponents() {
|
|
115
|
-
const used = new Map<string, number>()
|
|
116
|
-
const heading =
|
|
117
|
-
(Tag: 'h2' | 'h3') =>
|
|
118
|
-
({ children, ...props }: JSX.HTMLAttributes<HTMLHeadingElement>) => {
|
|
119
|
-
const base = slugify(childText(children))
|
|
120
|
-
const count = used.get(base) ?? 0
|
|
121
|
-
used.set(base, count + 1)
|
|
122
|
-
const id = count === 0 ? base : `${base}-${count + 1}`
|
|
123
|
-
return (
|
|
124
|
-
<Tag {...props} id={id} class={`hn-heading ${props.class ?? ''}`.trim()}>
|
|
125
|
-
{children}
|
|
126
|
-
<a class="hn-heading-anchor" href={`#${id}`} aria-label="Link to section">
|
|
127
|
-
#
|
|
128
|
-
</a>
|
|
129
|
-
</Tag>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
h2: heading('h2'),
|
|
135
|
-
h3: heading('h3')
|
|
136
|
-
}
|
|
73
|
+
function socialLinkLabel(icon: SocialLink["icon"], ariaLabel?: string): string {
|
|
74
|
+
if (ariaLabel) return ariaLabel;
|
|
75
|
+
return typeof icon === "string" ? icon : "Social link";
|
|
137
76
|
}
|
|
138
77
|
|
|
139
78
|
function isHomeRoute(routePath: string, prefix: string | undefined): boolean {
|
|
140
|
-
return normalizeLink(routePath) === normalizeLink(prefix ||
|
|
79
|
+
return normalizeLink(routePath) === normalizeLink(prefix || "/");
|
|
141
80
|
}
|
|
142
81
|
|
|
143
82
|
const Layout: FunctionalComponent<LayoutProps> = ({
|
|
@@ -147,75 +86,88 @@ const Layout: FunctionalComponent<LayoutProps> = ({
|
|
|
147
86
|
page,
|
|
148
87
|
locale,
|
|
149
88
|
locales = [],
|
|
150
|
-
localizeRoute
|
|
89
|
+
localizeRoute,
|
|
151
90
|
}) => {
|
|
152
|
-
const [query, setQuery] = useState(
|
|
153
|
-
const [sidebarOpen, setSidebarOpen] = useState(false)
|
|
154
|
-
const isHome = isHomeRoute(routePath, locale?.prefix)
|
|
155
|
-
const activeSidebar = resolveSidebar(themeConfig.sidebar, routePath)
|
|
156
|
-
const sidebarItems = flattenSidebarItems(activeSidebar)
|
|
157
|
-
const normalizedQuery = query.trim().toLowerCase()
|
|
91
|
+
const [query, setQuery] = useState("");
|
|
92
|
+
const [sidebarOpen, setSidebarOpen] = useState(false);
|
|
93
|
+
const isHome = isHomeRoute(routePath, locale?.prefix);
|
|
94
|
+
const activeSidebar = resolveSidebar(themeConfig.sidebar, routePath);
|
|
95
|
+
const sidebarItems = flattenSidebarItems(activeSidebar);
|
|
96
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
158
97
|
const visibleSidebar = useMemo(() => {
|
|
159
|
-
if (!normalizedQuery) return activeSidebar
|
|
98
|
+
if (!normalizedQuery) return activeSidebar;
|
|
160
99
|
return activeSidebar
|
|
161
100
|
.map((group) => ({
|
|
162
101
|
...group,
|
|
163
|
-
items: group.items.filter((item) => item.text.toLowerCase().includes(normalizedQuery))
|
|
102
|
+
items: group.items.filter((item) => item.text.toLowerCase().includes(normalizedQuery)),
|
|
164
103
|
}))
|
|
165
|
-
.filter((group) => group.items.length > 0)
|
|
166
|
-
}, [activeSidebar, normalizedQuery])
|
|
167
|
-
const activeIndex = sidebarItems.findIndex((item) => isActive(routePath, item.link))
|
|
168
|
-
const previous = activeIndex > 0 ? sidebarItems[activeIndex - 1] : undefined
|
|
104
|
+
.filter((group) => group.items.length > 0);
|
|
105
|
+
}, [activeSidebar, normalizedQuery]);
|
|
106
|
+
const activeIndex = sidebarItems.findIndex((item) => isActive(routePath, item.link));
|
|
107
|
+
const previous = activeIndex > 0 ? sidebarItems[activeIndex - 1] : undefined;
|
|
169
108
|
const next =
|
|
170
|
-
activeIndex >= 0 && activeIndex < sidebarItems.length - 1
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
|
|
109
|
+
activeIndex >= 0 && activeIndex < sidebarItems.length - 1
|
|
110
|
+
? sidebarItems[activeIndex + 1]
|
|
111
|
+
: undefined;
|
|
112
|
+
const mdxComponents = createMdxHeadingComponents({
|
|
113
|
+
headingClass: "hn-heading",
|
|
114
|
+
anchorClass: "hn-heading-anchor",
|
|
115
|
+
anchorLabel: "Link to section",
|
|
116
|
+
});
|
|
117
|
+
const MdxComponent = page?.kind === "mdx" ? page.Component : undefined;
|
|
118
|
+
const pageTags = page?.tags ?? [];
|
|
119
|
+
const showTags = themeConfig.tags !== false && pageTags.length > 0 && !page?.meta.tagIndex;
|
|
175
120
|
const editHref =
|
|
176
121
|
themeConfig.editLink && page?.relativePath
|
|
177
122
|
? themeConfig.editLink.pattern.replace(/:path/g, page.relativePath)
|
|
178
|
-
: undefined
|
|
123
|
+
: undefined;
|
|
179
124
|
const lastUpdated = page?.lastUpdated
|
|
180
|
-
? new Date(page.lastUpdated).toLocaleDateString(site.lang ||
|
|
181
|
-
year:
|
|
182
|
-
month:
|
|
183
|
-
day:
|
|
125
|
+
? new Date(page.lastUpdated).toLocaleDateString(site.lang || "en", {
|
|
126
|
+
year: "numeric",
|
|
127
|
+
month: "short",
|
|
128
|
+
day: "numeric",
|
|
184
129
|
})
|
|
185
|
-
: undefined
|
|
186
|
-
const outlineItems = themeConfig.outline === false || isHome ? [] : page?.headings ?? []
|
|
187
|
-
const contentClass = isHome ?
|
|
130
|
+
: undefined;
|
|
131
|
+
const outlineItems = themeConfig.outline === false || isHome ? [] : (page?.headings ?? []);
|
|
132
|
+
const contentClass = isHome ? "hn-home-content" : "hn-doc-content";
|
|
188
133
|
const renderedContent = MdxComponent ? (
|
|
189
134
|
<div class={contentClass}>
|
|
190
135
|
<MdxComponent components={mdxComponents} />
|
|
191
136
|
</div>
|
|
192
137
|
) : (
|
|
193
|
-
<div
|
|
194
|
-
|
|
138
|
+
<div
|
|
139
|
+
class={contentClass}
|
|
140
|
+
dangerouslySetInnerHTML={{ __html: page?.kind === "markdown" ? page.html : "" }}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
195
143
|
|
|
196
144
|
useEffect(() => {
|
|
197
|
-
setQuery(
|
|
198
|
-
if (window.matchMedia(
|
|
199
|
-
setSidebarOpen(false)
|
|
145
|
+
setQuery("");
|
|
146
|
+
if (window.matchMedia("(max-width: 820px)").matches) {
|
|
147
|
+
setSidebarOpen(false);
|
|
200
148
|
}
|
|
201
|
-
}, [routePath])
|
|
149
|
+
}, [routePath]);
|
|
202
150
|
|
|
203
151
|
useEffect(() => {
|
|
204
|
-
const media = window.matchMedia(
|
|
205
|
-
const syncSidebar = () => setSidebarOpen(!media.matches)
|
|
206
|
-
syncSidebar()
|
|
207
|
-
media.addEventListener(
|
|
208
|
-
return () => media.removeEventListener(
|
|
209
|
-
}, [])
|
|
152
|
+
const media = window.matchMedia("(max-width: 820px)");
|
|
153
|
+
const syncSidebar = () => setSidebarOpen(!media.matches);
|
|
154
|
+
syncSidebar();
|
|
155
|
+
media.addEventListener("change", syncSidebar);
|
|
156
|
+
return () => media.removeEventListener("change", syncSidebar);
|
|
157
|
+
}, []);
|
|
210
158
|
|
|
211
159
|
return (
|
|
212
|
-
<div class={`hn-site${isHome ?
|
|
160
|
+
<div class={`hn-site${isHome ? " is-home" : ""}`}>
|
|
213
161
|
<a class="hn-skip" href="#content">
|
|
214
162
|
Skip to content
|
|
215
163
|
</a>
|
|
216
164
|
<header class="hn-header">
|
|
217
165
|
<div class="hn-header-inner">
|
|
218
|
-
<a
|
|
166
|
+
<a
|
|
167
|
+
class="hn-brand"
|
|
168
|
+
href={withBase(site.base, locale?.prefix || "/")}
|
|
169
|
+
aria-label={site.title}
|
|
170
|
+
>
|
|
219
171
|
<Logo label={site.title} />
|
|
220
172
|
</a>
|
|
221
173
|
<div class="hn-header-actions">
|
|
@@ -224,47 +176,51 @@ const Layout: FunctionalComponent<LayoutProps> = ({
|
|
|
224
176
|
item.link ? (
|
|
225
177
|
<a
|
|
226
178
|
key={item.link}
|
|
227
|
-
class={isActive(routePath, item.link) ?
|
|
179
|
+
class={isActive(routePath, item.link) ? "active" : ""}
|
|
228
180
|
href={withBase(site.base, item.link)}
|
|
229
|
-
aria-current={isActive(routePath, item.link) ?
|
|
181
|
+
aria-current={isActive(routePath, item.link) ? "page" : undefined}
|
|
230
182
|
>
|
|
231
183
|
{item.text}
|
|
232
184
|
</a>
|
|
233
|
-
) : null
|
|
185
|
+
) : null,
|
|
234
186
|
)}
|
|
235
187
|
</nav>
|
|
236
188
|
{themeConfig.socialLinks?.length ? (
|
|
237
189
|
<div class="hn-social" aria-label="Social links">
|
|
238
190
|
{themeConfig.socialLinks.map((link) => {
|
|
239
|
-
const svg = socialIconSvg(link.icon)
|
|
191
|
+
const svg = socialIconSvg(link.icon);
|
|
240
192
|
return (
|
|
241
193
|
<a
|
|
242
194
|
href={withBase(site.base, link.link)}
|
|
243
195
|
aria-label={socialLinkLabel(link.icon, link.ariaLabel)}
|
|
244
196
|
key={`${socialLinkLabel(link.icon, link.ariaLabel)}:${link.link}`}
|
|
245
197
|
>
|
|
246
|
-
{svg ?
|
|
198
|
+
{svg ? (
|
|
199
|
+
<span dangerouslySetInnerHTML={{ __html: svg }} />
|
|
200
|
+
) : (
|
|
201
|
+
socialLinkLabel(link.icon, link.ariaLabel)
|
|
202
|
+
)}
|
|
247
203
|
</a>
|
|
248
|
-
)
|
|
204
|
+
);
|
|
249
205
|
})}
|
|
250
206
|
</div>
|
|
251
207
|
) : null}
|
|
252
208
|
{locales.length > 1 && localizeRoute ? (
|
|
253
209
|
<details class="hn-locale-switcher">
|
|
254
|
-
<summary>{locale?.label ??
|
|
210
|
+
<summary>{locale?.label ?? "Language"}</summary>
|
|
255
211
|
<div class="hn-locale-menu">
|
|
256
212
|
{locales.map((item) => {
|
|
257
|
-
const active = item.key === locale?.key
|
|
213
|
+
const active = item.key === locale?.key;
|
|
258
214
|
return (
|
|
259
215
|
<a
|
|
260
216
|
key={item.key}
|
|
261
217
|
href={withBase(site.base, localizeRoute(item))}
|
|
262
|
-
aria-current={active ?
|
|
263
|
-
class={active ?
|
|
218
|
+
aria-current={active ? "page" : undefined}
|
|
219
|
+
class={active ? "active" : ""}
|
|
264
220
|
>
|
|
265
221
|
{item.label}
|
|
266
222
|
</a>
|
|
267
|
-
)
|
|
223
|
+
);
|
|
268
224
|
})}
|
|
269
225
|
</div>
|
|
270
226
|
</details>
|
|
@@ -298,21 +254,21 @@ const Layout: FunctionalComponent<LayoutProps> = ({
|
|
|
298
254
|
</label>
|
|
299
255
|
) : null}
|
|
300
256
|
{visibleSidebar.map((group, groupIndex) => (
|
|
301
|
-
<div class="hn-sidebar-group" key={`${group.text ??
|
|
257
|
+
<div class="hn-sidebar-group" key={`${group.text ?? "group"}:${groupIndex}`}>
|
|
302
258
|
{group.text ? <h2>{group.text}</h2> : null}
|
|
303
259
|
<ul>
|
|
304
260
|
{group.items.map((item) =>
|
|
305
261
|
item.link ? (
|
|
306
262
|
<li key={item.link}>
|
|
307
263
|
<a
|
|
308
|
-
class={isActive(routePath, item.link) ?
|
|
264
|
+
class={isActive(routePath, item.link) ? "active" : ""}
|
|
309
265
|
href={withBase(site.base, item.link)}
|
|
310
|
-
aria-current={isActive(routePath, item.link) ?
|
|
266
|
+
aria-current={isActive(routePath, item.link) ? "page" : undefined}
|
|
311
267
|
>
|
|
312
268
|
{item.text}
|
|
313
269
|
</a>
|
|
314
270
|
</li>
|
|
315
|
-
) : null
|
|
271
|
+
) : null,
|
|
316
272
|
)}
|
|
317
273
|
</ul>
|
|
318
274
|
</div>
|
|
@@ -353,11 +309,13 @@ const Layout: FunctionalComponent<LayoutProps> = ({
|
|
|
353
309
|
) : null}
|
|
354
310
|
{themeConfig.lastUpdated || editHref ? (
|
|
355
311
|
<footer class="hn-doc-meta">
|
|
356
|
-
{themeConfig.lastUpdated && lastUpdated ?
|
|
312
|
+
{themeConfig.lastUpdated && lastUpdated ? (
|
|
313
|
+
<span>Updated {lastUpdated}</span>
|
|
314
|
+
) : null}
|
|
357
315
|
{editHref ? (
|
|
358
316
|
<span>
|
|
359
|
-
{themeConfig.lastUpdated && lastUpdated ?
|
|
360
|
-
<a href={editHref}>{themeConfig.editLink?.text ??
|
|
317
|
+
{themeConfig.lastUpdated && lastUpdated ? " · " : null}
|
|
318
|
+
<a href={editHref}>{themeConfig.editLink?.text ?? "Edit this page"}</a>
|
|
361
319
|
</span>
|
|
362
320
|
) : null}
|
|
363
321
|
</footer>
|
|
@@ -382,7 +340,7 @@ const Layout: FunctionalComponent<LayoutProps> = ({
|
|
|
382
340
|
)}
|
|
383
341
|
{themeConfig.footer ? <footer class="hn-footer">{themeConfig.footer}</footer> : null}
|
|
384
342
|
</div>
|
|
385
|
-
)
|
|
386
|
-
}
|
|
343
|
+
);
|
|
344
|
+
};
|
|
387
345
|
|
|
388
|
-
export default Layout
|
|
346
|
+
export default Layout;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { FunctionalComponent } from
|
|
1
|
+
import type { FunctionalComponent } from "preact";
|
|
2
2
|
|
|
3
3
|
interface LogoProps {
|
|
4
|
-
class?: string
|
|
5
|
-
label: string
|
|
4
|
+
class?: string;
|
|
5
|
+
label: string;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const Logo: FunctionalComponent<LogoProps> = ({ class: className, label }) => (
|
|
9
|
-
<span class={`hn-logo ${className ??
|
|
9
|
+
<span class={`hn-logo ${className ?? ""}`.trim()} aria-label={label}>
|
|
10
10
|
<svg aria-hidden="true" viewBox="0 0 36 36" width="36" height="36">
|
|
11
11
|
<rect width="36" height="36" rx="11" fill="currentColor" opacity="0.12" />
|
|
12
12
|
<path
|
|
@@ -21,6 +21,6 @@ const Logo: FunctionalComponent<LogoProps> = ({ class: className, label }) => (
|
|
|
21
21
|
</svg>
|
|
22
22
|
<span>{label}</span>
|
|
23
23
|
</span>
|
|
24
|
-
)
|
|
24
|
+
);
|
|
25
25
|
|
|
26
|
-
export default Logo
|
|
26
|
+
export default Logo;
|
|
@@ -1,72 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useEffect } from 'preact/hooks'
|
|
1
|
+
import { ThemeToggle as BaseThemeToggle } from "@kamod-ch/preactpress/client";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function readStoredTheme(): StoredTheme | null {
|
|
8
|
-
try {
|
|
9
|
-
const value = localStorage.getItem(THEME_STORAGE_KEY)
|
|
10
|
-
return value === 'light' || value === 'dark' ? value : null
|
|
11
|
-
} catch {
|
|
12
|
-
return null
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function applyTheme(theme: StoredTheme | null): void {
|
|
17
|
-
if (theme === null) document.documentElement.removeAttribute('data-theme')
|
|
18
|
-
else document.documentElement.setAttribute('data-theme', theme)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function toggleTheme(): void {
|
|
22
|
-
const stored = readStoredTheme()
|
|
23
|
-
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
24
|
-
const isDark = stored === 'dark' || (stored === null && prefersDark)
|
|
25
|
-
const next: StoredTheme = isDark ? 'light' : 'dark'
|
|
26
|
-
applyTheme(next)
|
|
27
|
-
try {
|
|
28
|
-
localStorage.setItem(THEME_STORAGE_KEY, next)
|
|
29
|
-
} catch {
|
|
30
|
-
/* Ignore private mode or storage quota failures. */
|
|
31
|
-
}
|
|
3
|
+
export default function ThemeToggle() {
|
|
4
|
+
return <BaseThemeToggle className="hn-theme-toggle" ariaLabel="Toggle theme" />;
|
|
32
5
|
}
|
|
33
|
-
|
|
34
|
-
const ThemeToggle: FunctionalComponent = () => {
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
function onStorage(event: StorageEvent): void {
|
|
37
|
-
if (event.key !== THEME_STORAGE_KEY) return
|
|
38
|
-
const value = event.newValue
|
|
39
|
-
applyTheme(value === 'light' || value === 'dark' ? value : null)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
window.addEventListener('storage', onStorage)
|
|
43
|
-
return () => window.removeEventListener('storage', onStorage)
|
|
44
|
-
}, [])
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<button type="button" class="hn-theme-toggle" onClick={toggleTheme} aria-label="Toggle theme">
|
|
48
|
-
<span class="hn-theme-toggle-moon" aria-hidden="true">
|
|
49
|
-
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor">
|
|
50
|
-
<path
|
|
51
|
-
d="M21 14.8A8.5 8.5 0 0 1 9.2 3a7 7 0 1 0 11.8 11.8Z"
|
|
52
|
-
strokeLinecap="round"
|
|
53
|
-
strokeLinejoin="round"
|
|
54
|
-
strokeWidth="1.7"
|
|
55
|
-
/>
|
|
56
|
-
</svg>
|
|
57
|
-
</span>
|
|
58
|
-
<span class="hn-theme-toggle-sun" aria-hidden="true">
|
|
59
|
-
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor">
|
|
60
|
-
<circle cx="12" cy="12" r="3.5" strokeWidth="1.7" />
|
|
61
|
-
<path
|
|
62
|
-
d="M12 2.5v2M12 19.5v2M4.6 4.6 6 6M18 18l1.4 1.4M2.5 12h2M19.5 12h2M4.6 19.4 6 18M18 6l1.4-1.4"
|
|
63
|
-
strokeLinecap="round"
|
|
64
|
-
strokeWidth="1.7"
|
|
65
|
-
/>
|
|
66
|
-
</svg>
|
|
67
|
-
</span>
|
|
68
|
-
</button>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default ThemeToggle
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
--hono-code-text: #f3f4f6;
|
|
16
16
|
--hono-radius: 1.1rem;
|
|
17
17
|
--hono-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
|
|
18
|
-
--hono-font-sans:
|
|
18
|
+
--hono-font-sans:
|
|
19
|
+
ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
19
20
|
--hono-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
20
21
|
--hono-layout-max: 1360px;
|
|
21
22
|
--hono-layout-gutter: 2rem;
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
color-scheme: dark;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
:root[data-theme=
|
|
27
|
+
:root[data-theme="light"] {
|
|
27
28
|
--hono-bg: #ffffff;
|
|
28
29
|
--hono-bg-soft: #f7f7f8;
|
|
29
30
|
--hono-panel: rgba(15, 23, 42, 0.04);
|
|
@@ -56,7 +57,11 @@ body {
|
|
|
56
57
|
margin: 0;
|
|
57
58
|
min-width: 320px;
|
|
58
59
|
background:
|
|
59
|
-
radial-gradient(
|
|
60
|
+
radial-gradient(
|
|
61
|
+
circle at 70% 0,
|
|
62
|
+
color-mix(in srgb, var(--hono-accent) 16%, transparent),
|
|
63
|
+
transparent 24rem
|
|
64
|
+
),
|
|
60
65
|
linear-gradient(180deg, var(--hono-bg-soft), var(--hono-bg) 22rem);
|
|
61
66
|
color: var(--hono-text);
|
|
62
67
|
font-family: var(--hono-font-sans);
|
|
@@ -240,8 +245,8 @@ a {
|
|
|
240
245
|
color: var(--hono-text-strong);
|
|
241
246
|
}
|
|
242
247
|
|
|
243
|
-
:root[data-theme=
|
|
244
|
-
:root:not([data-theme=
|
|
248
|
+
:root[data-theme="light"] .hn-theme-toggle-sun,
|
|
249
|
+
:root:not([data-theme="light"]) .hn-theme-toggle-moon {
|
|
245
250
|
display: none;
|
|
246
251
|
}
|
|
247
252
|
|
|
@@ -655,8 +660,8 @@ a {
|
|
|
655
660
|
min-width: 100%;
|
|
656
661
|
}
|
|
657
662
|
|
|
658
|
-
:root:not([data-theme=
|
|
659
|
-
:root:not([data-theme=
|
|
663
|
+
:root:not([data-theme="light"]) .hn-doc-content .shiki,
|
|
664
|
+
:root:not([data-theme="light"]) .hn-doc-content .shiki span {
|
|
660
665
|
color: var(--shiki-dark) !important;
|
|
661
666
|
background-color: var(--shiki-dark-bg) !important;
|
|
662
667
|
}
|
|
@@ -780,12 +785,24 @@ a {
|
|
|
780
785
|
display: none;
|
|
781
786
|
}
|
|
782
787
|
|
|
783
|
-
.hn-doc-content
|
|
784
|
-
.
|
|
785
|
-
.
|
|
786
|
-
.hn-doc-content
|
|
787
|
-
.
|
|
788
|
-
.
|
|
788
|
+
.hn-doc-content
|
|
789
|
+
.pp-code-group:has(.pp-code-group-input:nth-of-type(1):checked)
|
|
790
|
+
.pp-code-group-block:nth-child(1),
|
|
791
|
+
.hn-doc-content
|
|
792
|
+
.pp-code-group:has(.pp-code-group-input:nth-of-type(2):checked)
|
|
793
|
+
.pp-code-group-block:nth-child(2),
|
|
794
|
+
.hn-doc-content
|
|
795
|
+
.pp-code-group:has(.pp-code-group-input:nth-of-type(3):checked)
|
|
796
|
+
.pp-code-group-block:nth-child(3),
|
|
797
|
+
.hn-doc-content
|
|
798
|
+
.pp-code-group:has(.pp-code-group-input:nth-of-type(4):checked)
|
|
799
|
+
.pp-code-group-block:nth-child(4),
|
|
800
|
+
.hn-doc-content
|
|
801
|
+
.pp-code-group:has(.pp-code-group-input:nth-of-type(5):checked)
|
|
802
|
+
.pp-code-group-block:nth-child(5),
|
|
803
|
+
.hn-doc-content
|
|
804
|
+
.pp-code-group:has(.pp-code-group-input:nth-of-type(6):checked)
|
|
805
|
+
.pp-code-group-block:nth-child(6) {
|
|
789
806
|
display: block;
|
|
790
807
|
}
|
|
791
808
|
|
|
@@ -971,7 +988,7 @@ a {
|
|
|
971
988
|
}
|
|
972
989
|
|
|
973
990
|
.hn-sidebar-panel > summary::after {
|
|
974
|
-
content:
|
|
991
|
+
content: "▾";
|
|
975
992
|
color: var(--hono-muted);
|
|
976
993
|
font-size: 0.85rem;
|
|
977
994
|
transition: transform 0.15s ease;
|