@kamod-ch/preactpress 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +165 -0
- package/assets/favicon-32.png +0 -0
- package/assets/favicon.png +0 -0
- package/assets/favicon.svg +28 -0
- package/assets/logo-dark.svg +5 -0
- package/assets/logo-light.svg +5 -0
- package/assets/logo.svg +5 -0
- package/bin/preactpress.mjs +13 -0
- package/dist/client/app.d.ts +6 -0
- package/dist/client/app.d.ts.map +1 -0
- package/dist/client/app.js +168 -0
- package/dist/client/app.js.map +1 -0
- package/dist/client/entry-client.d.ts +2 -0
- package/dist/client/entry-client.d.ts.map +1 -0
- package/dist/client/entry-client.js +27 -0
- package/dist/client/entry-client.js.map +1 -0
- package/dist/client/entry-ssr.d.ts +14 -0
- package/dist/client/entry-ssr.d.ts.map +1 -0
- package/dist/client/entry-ssr.js +59 -0
- package/dist/client/entry-ssr.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/loadPage.d.ts +5 -0
- package/dist/client/loadPage.d.ts.map +1 -0
- package/dist/client/loadPage.js +62 -0
- package/dist/client/loadPage.js.map +1 -0
- package/dist/client/prefetchLinks.d.ts +2 -0
- package/dist/client/prefetchLinks.d.ts.map +1 -0
- package/dist/client/prefetchLinks.js +55 -0
- package/dist/client/prefetchLinks.js.map +1 -0
- package/dist/client/theme-default/AlgoliaSearch.d.ts +12 -0
- package/dist/client/theme-default/AlgoliaSearch.d.ts.map +1 -0
- package/dist/client/theme-default/AlgoliaSearch.js +66 -0
- package/dist/client/theme-default/AlgoliaSearch.js.map +1 -0
- package/dist/client/theme-default/Features.d.ts +9 -0
- package/dist/client/theme-default/Features.d.ts.map +1 -0
- package/dist/client/theme-default/Features.js +25 -0
- package/dist/client/theme-default/Features.js.map +1 -0
- package/dist/client/theme-default/Hero.d.ts +9 -0
- package/dist/client/theme-default/Hero.d.ts.map +1 -0
- package/dist/client/theme-default/Hero.js +23 -0
- package/dist/client/theme-default/Hero.js.map +1 -0
- package/dist/client/theme-default/Layout.d.ts +6 -0
- package/dist/client/theme-default/Layout.d.ts.map +1 -0
- package/dist/client/theme-default/Layout.js +224 -0
- package/dist/client/theme-default/Layout.js.map +1 -0
- package/dist/client/theme-default/Logo.d.ts +16 -0
- package/dist/client/theme-default/Logo.d.ts.map +1 -0
- package/dist/client/theme-default/Logo.js +30 -0
- package/dist/client/theme-default/Logo.js.map +1 -0
- package/dist/client/theme-default/NavLinks.d.ts +12 -0
- package/dist/client/theme-default/NavLinks.d.ts.map +1 -0
- package/dist/client/theme-default/NavLinks.js +18 -0
- package/dist/client/theme-default/NavLinks.js.map +1 -0
- package/dist/client/theme-default/SidebarNav.d.ts +12 -0
- package/dist/client/theme-default/SidebarNav.d.ts.map +1 -0
- package/dist/client/theme-default/SidebarNav.js +21 -0
- package/dist/client/theme-default/SidebarNav.js.map +1 -0
- package/dist/client/theme-default/SocialLinks.d.ts +8 -0
- package/dist/client/theme-default/SocialLinks.d.ts.map +1 -0
- package/dist/client/theme-default/SocialLinks.js +13 -0
- package/dist/client/theme-default/SocialLinks.js.map +1 -0
- package/dist/client/theme-default/ThemeToggle.d.ts +4 -0
- package/dist/client/theme-default/ThemeToggle.d.ts.map +1 -0
- package/dist/client/theme-default/ThemeToggle.js +31 -0
- package/dist/client/theme-default/ThemeToggle.js.map +1 -0
- package/dist/client/theme-default/index.d.ts +2 -0
- package/dist/client/theme-default/index.d.ts.map +1 -0
- package/dist/client/theme-default/index.js +2 -0
- package/dist/client/theme-default/index.js.map +1 -0
- package/dist/client/types.d.ts +36 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/client/usePageHead.d.ts +10 -0
- package/dist/client/usePageHead.d.ts.map +1 -0
- package/dist/client/usePageHead.js +182 -0
- package/dist/client/usePageHead.js.map +1 -0
- package/dist/client/useSiteSearch.d.ts +10 -0
- package/dist/client/useSiteSearch.d.ts.map +1 -0
- package/dist/client/useSiteSearch.js +54 -0
- package/dist/client/useSiteSearch.js.map +1 -0
- package/dist/node/build.d.ts +15 -0
- package/dist/node/build.d.ts.map +1 -0
- package/dist/node/build.js +310 -0
- package/dist/node/build.js.map +1 -0
- package/dist/node/buildCache.d.ts +15 -0
- package/dist/node/buildCache.d.ts.map +1 -0
- package/dist/node/buildCache.js +41 -0
- package/dist/node/buildCache.js.map +1 -0
- package/dist/node/check.d.ts +11 -0
- package/dist/node/check.d.ts.map +1 -0
- package/dist/node/check.js +228 -0
- package/dist/node/check.js.map +1 -0
- package/dist/node/cli.d.ts +2 -0
- package/dist/node/cli.d.ts.map +1 -0
- package/dist/node/cli.js +157 -0
- package/dist/node/cli.js.map +1 -0
- package/dist/node/config-helpers.d.ts +8 -0
- package/dist/node/config-helpers.d.ts.map +1 -0
- package/dist/node/config-helpers.js +5 -0
- package/dist/node/config-helpers.js.map +1 -0
- package/dist/node/config.d.ts +13 -0
- package/dist/node/config.d.ts.map +1 -0
- package/dist/node/config.js +167 -0
- package/dist/node/config.js.map +1 -0
- package/dist/node/content.d.ts +16 -0
- package/dist/node/content.d.ts.map +1 -0
- package/dist/node/content.js +72 -0
- package/dist/node/content.js.map +1 -0
- package/dist/node/createContentLoader.d.ts +19 -0
- package/dist/node/createContentLoader.d.ts.map +1 -0
- package/dist/node/createContentLoader.js +11 -0
- package/dist/node/createContentLoader.js.map +1 -0
- package/dist/node/devCss.d.ts +7 -0
- package/dist/node/devCss.d.ts.map +1 -0
- package/dist/node/devCss.js +70 -0
- package/dist/node/devCss.js.map +1 -0
- package/dist/node/devSsr.d.ts +6 -0
- package/dist/node/devSsr.d.ts.map +1 -0
- package/dist/node/devSsr.js +112 -0
- package/dist/node/devSsr.js.map +1 -0
- package/dist/node/dynamicRoutes.d.ts +21 -0
- package/dist/node/dynamicRoutes.d.ts.map +1 -0
- package/dist/node/dynamicRoutes.js +120 -0
- package/dist/node/dynamicRoutes.js.map +1 -0
- package/dist/node/favicon.d.ts +9 -0
- package/dist/node/favicon.d.ts.map +1 -0
- package/dist/node/favicon.js +71 -0
- package/dist/node/favicon.js.map +1 -0
- package/dist/node/feed.d.ts +7 -0
- package/dist/node/feed.d.ts.map +1 -0
- package/dist/node/feed.js +37 -0
- package/dist/node/feed.js.map +1 -0
- package/dist/node/hooks.d.ts +9 -0
- package/dist/node/hooks.d.ts.map +1 -0
- package/dist/node/hooks.js +20 -0
- package/dist/node/hooks.js.map +1 -0
- package/dist/node/html.d.ts +56 -0
- package/dist/node/html.d.ts.map +1 -0
- package/dist/node/html.js +222 -0
- package/dist/node/html.js.map +1 -0
- package/dist/node/index.d.ts +12 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +9 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/init.d.ts +12 -0
- package/dist/node/init.d.ts.map +1 -0
- package/dist/node/init.js +93 -0
- package/dist/node/init.js.map +1 -0
- package/dist/node/lastUpdated.d.ts +3 -0
- package/dist/node/lastUpdated.d.ts.map +1 -0
- package/dist/node/lastUpdated.js +24 -0
- package/dist/node/lastUpdated.js.map +1 -0
- package/dist/node/loadSiteModule.d.ts +2 -0
- package/dist/node/loadSiteModule.d.ts.map +1 -0
- package/dist/node/loadSiteModule.js +10 -0
- package/dist/node/loadSiteModule.js.map +1 -0
- package/dist/node/markdown.d.ts +31 -0
- package/dist/node/markdown.d.ts.map +1 -0
- package/dist/node/markdown.js +508 -0
- package/dist/node/markdown.js.map +1 -0
- package/dist/node/markdownHeadings.d.ts +12 -0
- package/dist/node/markdownHeadings.d.ts.map +1 -0
- package/dist/node/markdownHeadings.js +70 -0
- package/dist/node/markdownHeadings.js.map +1 -0
- package/dist/node/markdownInclude.d.ts +6 -0
- package/dist/node/markdownInclude.d.ts.map +1 -0
- package/dist/node/markdownInclude.js +74 -0
- package/dist/node/markdownInclude.js.map +1 -0
- package/dist/node/markdownSnippets.d.ts +32 -0
- package/dist/node/markdownSnippets.d.ts.map +1 -0
- package/dist/node/markdownSnippets.js +172 -0
- package/dist/node/markdownSnippets.js.map +1 -0
- package/dist/node/mdx.d.ts +3 -0
- package/dist/node/mdx.d.ts.map +1 -0
- package/dist/node/mdx.js +9 -0
- package/dist/node/mdx.js.map +1 -0
- package/dist/node/packageRoot.d.ts +4 -0
- package/dist/node/packageRoot.d.ts.map +1 -0
- package/dist/node/packageRoot.js +7 -0
- package/dist/node/packageRoot.js.map +1 -0
- package/dist/node/pageDataLoaders.d.ts +6 -0
- package/dist/node/pageDataLoaders.d.ts.map +1 -0
- package/dist/node/pageDataLoaders.js +68 -0
- package/dist/node/pageDataLoaders.js.map +1 -0
- package/dist/node/paths.d.ts +5 -0
- package/dist/node/paths.d.ts.map +1 -0
- package/dist/node/paths.js +12 -0
- package/dist/node/paths.js.map +1 -0
- package/dist/node/plugin.d.ts +7 -0
- package/dist/node/plugin.d.ts.map +1 -0
- package/dist/node/plugin.js +282 -0
- package/dist/node/plugin.js.map +1 -0
- package/dist/node/resolveDeps.d.ts +5 -0
- package/dist/node/resolveDeps.d.ts.map +1 -0
- package/dist/node/resolveDeps.js +25 -0
- package/dist/node/resolveDeps.js.map +1 -0
- package/dist/node/serve.d.ts +6 -0
- package/dist/node/serve.d.ts.map +1 -0
- package/dist/node/serve.js +41 -0
- package/dist/node/serve.js.map +1 -0
- package/dist/node/server.d.ts +7 -0
- package/dist/node/server.d.ts.map +1 -0
- package/dist/node/server.js +55 -0
- package/dist/node/server.js.map +1 -0
- package/dist/node/siteConfig.d.ts +206 -0
- package/dist/node/siteConfig.d.ts.map +1 -0
- package/dist/node/siteConfig.js +2 -0
- package/dist/node/siteConfig.js.map +1 -0
- package/dist/node/tagIndex.d.ts +27 -0
- package/dist/node/tagIndex.d.ts.map +1 -0
- package/dist/node/tagIndex.js +84 -0
- package/dist/node/tagIndex.js.map +1 -0
- package/dist/shared/contentChunk.d.ts +4 -0
- package/dist/shared/contentChunk.d.ts.map +1 -0
- package/dist/shared/contentChunk.js +14 -0
- package/dist/shared/contentChunk.js.map +1 -0
- package/dist/shared/contentSchema.d.ts +43 -0
- package/dist/shared/contentSchema.d.ts.map +1 -0
- package/dist/shared/contentSchema.js +44 -0
- package/dist/shared/contentSchema.js.map +1 -0
- package/dist/shared/deadLinks.d.ts +9 -0
- package/dist/shared/deadLinks.d.ts.map +1 -0
- package/dist/shared/deadLinks.js +27 -0
- package/dist/shared/deadLinks.js.map +1 -0
- package/dist/shared/escapeHtml.d.ts +3 -0
- package/dist/shared/escapeHtml.d.ts.map +1 -0
- package/dist/shared/escapeHtml.js +11 -0
- package/dist/shared/escapeHtml.js.map +1 -0
- package/dist/shared/index.d.ts +15 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +15 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/locale.d.ts +11 -0
- package/dist/shared/locale.d.ts.map +1 -0
- package/dist/shared/locale.js +84 -0
- package/dist/shared/locale.js.map +1 -0
- package/dist/shared/pageChrome.d.ts +80 -0
- package/dist/shared/pageChrome.d.ts.map +1 -0
- package/dist/shared/pageChrome.js +160 -0
- package/dist/shared/pageChrome.js.map +1 -0
- package/dist/shared/pageHead.d.ts +3 -0
- package/dist/shared/pageHead.d.ts.map +1 -0
- package/dist/shared/pageHead.js +28 -0
- package/dist/shared/pageHead.js.map +1 -0
- package/dist/shared/pageMeta.d.ts +60 -0
- package/dist/shared/pageMeta.d.ts.map +1 -0
- package/dist/shared/pageMeta.js +72 -0
- package/dist/shared/pageMeta.js.map +1 -0
- package/dist/shared/rewrites.d.ts +5 -0
- package/dist/shared/rewrites.d.ts.map +1 -0
- package/dist/shared/rewrites.js +23 -0
- package/dist/shared/rewrites.js.map +1 -0
- package/dist/shared/route.d.ts +5 -0
- package/dist/shared/route.d.ts.map +1 -0
- package/dist/shared/route.js +15 -0
- package/dist/shared/route.js.map +1 -0
- package/dist/shared/search.d.ts +39 -0
- package/dist/shared/search.d.ts.map +1 -0
- package/dist/shared/search.js +63 -0
- package/dist/shared/search.js.map +1 -0
- package/dist/shared/sidebar.d.ts +18 -0
- package/dist/shared/sidebar.d.ts.map +1 -0
- package/dist/shared/sidebar.js +51 -0
- package/dist/shared/sidebar.js.map +1 -0
- package/dist/shared/slug.d.ts +4 -0
- package/dist/shared/slug.d.ts.map +1 -0
- package/dist/shared/slug.js +21 -0
- package/dist/shared/slug.js.map +1 -0
- package/dist/shared/socialIcons.d.ts +13 -0
- package/dist/shared/socialIcons.d.ts.map +1 -0
- package/dist/shared/socialIcons.js +27 -0
- package/dist/shared/socialIcons.js.map +1 -0
- package/dist/shared/tags.d.ts +6 -0
- package/dist/shared/tags.d.ts.map +1 -0
- package/dist/shared/tags.js +39 -0
- package/dist/shared/tags.js.map +1 -0
- package/dist/shared/theme.d.ts +8 -0
- package/dist/shared/theme.d.ts.map +1 -0
- package/dist/shared/theme.js +25 -0
- package/dist/shared/theme.js.map +1 -0
- package/dist/shared/themeLabels.d.ts +18 -0
- package/dist/shared/themeLabels.d.ts.map +1 -0
- package/dist/shared/themeLabels.js +51 -0
- package/dist/shared/themeLabels.js.map +1 -0
- package/dist/shared/url.d.ts +7 -0
- package/dist/shared/url.d.ts.map +1 -0
- package/dist/shared/url.js +10 -0
- package/dist/shared/url.js.map +1 -0
- package/package.json +108 -0
- package/src/client/app.tsx +194 -0
- package/src/client/entry-client.tsx +27 -0
- package/src/client/entry-ssr.tsx +77 -0
- package/src/client/index.ts +2 -0
- package/src/client/loadPage.ts +68 -0
- package/src/client/prefetchLinks.ts +60 -0
- package/src/client/theme-default/AlgoliaSearch.tsx +89 -0
- package/src/client/theme-default/Features.tsx +75 -0
- package/src/client/theme-default/Hero.tsx +60 -0
- package/src/client/theme-default/Layout.tsx +525 -0
- package/src/client/theme-default/Logo.tsx +104 -0
- package/src/client/theme-default/NavLinks.tsx +65 -0
- package/src/client/theme-default/SidebarNav.tsx +103 -0
- package/src/client/theme-default/SocialLinks.tsx +41 -0
- package/src/client/theme-default/ThemeToggle.tsx +79 -0
- package/src/client/theme-default/index.ts +1 -0
- package/src/client/theme-default/styles.css +1450 -0
- package/src/client/types.ts +37 -0
- package/src/client/usePageHead.ts +212 -0
- package/src/client/useSiteSearch.ts +57 -0
- package/src/client/virtual.d.ts +103 -0
- package/src/shared/contentChunk.ts +14 -0
- package/src/shared/contentSchema.ts +85 -0
- package/src/shared/deadLinks.ts +33 -0
- package/src/shared/escapeHtml.ts +11 -0
- package/src/shared/index.ts +83 -0
- package/src/shared/locale.ts +116 -0
- package/src/shared/pageChrome.ts +244 -0
- package/src/shared/pageHead.ts +26 -0
- package/src/shared/pageMeta.ts +136 -0
- package/src/shared/rewrites.ts +35 -0
- package/src/shared/route.ts +14 -0
- package/src/shared/search.ts +105 -0
- package/src/shared/sidebar.ts +67 -0
- package/src/shared/slug.ts +23 -0
- package/src/shared/socialIcons.ts +44 -0
- package/src/shared/tags.ts +36 -0
- package/src/shared/theme.ts +26 -0
- package/src/shared/themeLabels.ts +72 -0
- package/src/shared/url.ts +14 -0
- package/templates/default/.preactpress/config.ts +31 -0
- package/templates/default/README.md +45 -0
- package/templates/default/about.md +11 -0
- package/templates/default/guide/first-five-minutes.md +83 -0
- package/templates/default/index.html +18 -0
- package/templates/default/index.md +55 -0
- package/templates/default/package.json +15 -0
- package/templates/default/pnpm-lock.yaml +2917 -0
- package/templates/docs/.preactpress/config.ts +94 -0
- package/templates/docs/README.md +21 -0
- package/templates/docs/about.md +10 -0
- package/templates/docs/components/Counter.tsx +25 -0
- package/templates/docs/de/guide/getting-started.md +19 -0
- package/templates/docs/de/guide/what-is-preactpress.md +15 -0
- package/templates/docs/de/index.md +23 -0
- package/templates/docs/dist/404.html +29 -0
- package/templates/docs/dist/about/index.html +32 -0
- package/templates/docs/dist/assets/esm-DzlBxN5p.js +110 -0
- package/templates/docs/dist/assets/interactive-64o6YwrR.js +9 -0
- package/templates/docs/dist/assets/interactive-BedCloEw.js +9 -0
- package/templates/docs/dist/assets/main-BVLeh8GO.js +1 -0
- package/templates/docs/dist/assets/main-CreUBb3N.js +1 -0
- package/templates/docs/dist/assets/main-oodK-zZy.css +2 -0
- package/templates/docs/dist/de/guide/getting-started/index.html +36 -0
- package/templates/docs/dist/de/guide/what-is-preactpress/index.html +38 -0
- package/templates/docs/dist/de/index.html +29 -0
- package/templates/docs/dist/favicon-32.png +0 -0
- package/templates/docs/dist/favicon.png +0 -0
- package/templates/docs/dist/favicon.svg +28 -0
- package/templates/docs/dist/guide/advanced/index.html +53 -0
- package/templates/docs/dist/guide/commands/index.html +89 -0
- package/templates/docs/dist/guide/configuration/index.html +196 -0
- package/templates/docs/dist/guide/creating-pages/index.html +234 -0
- package/templates/docs/dist/guide/custom-themes/index.html +52 -0
- package/templates/docs/dist/guide/default-theme/index.html +53 -0
- package/templates/docs/dist/guide/deploy/index.html +195 -0
- package/templates/docs/dist/guide/first-five-minutes/index.html +99 -0
- package/templates/docs/dist/guide/getting-started/index.html +173 -0
- package/templates/docs/dist/guide/markdown-and-mdx/index.html +59 -0
- package/templates/docs/dist/guide/routing/index.html +192 -0
- package/templates/docs/dist/guide/what-is-preactpress/index.html +141 -0
- package/templates/docs/dist/index.html +30 -0
- package/templates/docs/dist/interactive/index.html +37 -0
- package/templates/docs/dist/markdown-examples/index.html +231 -0
- package/templates/docs/dist/preactpress-content/404.json +8 -0
- package/templates/docs/dist/preactpress-content/_index.json +50 -0
- package/templates/docs/dist/preactpress-content/about.json +15 -0
- package/templates/docs/dist/preactpress-content/de.json +45 -0
- package/templates/docs/dist/preactpress-content/de__guide__getting-started.json +26 -0
- package/templates/docs/dist/preactpress-content/de__guide__what-is-preactpress.json +21 -0
- package/templates/docs/dist/preactpress-content/guide__advanced.json +46 -0
- package/templates/docs/dist/preactpress-content/guide__commands.json +26 -0
- package/templates/docs/dist/preactpress-content/guide__configuration.json +51 -0
- package/templates/docs/dist/preactpress-content/guide__creating-pages.json +71 -0
- package/templates/docs/dist/preactpress-content/guide__custom-themes.json +15 -0
- package/templates/docs/dist/preactpress-content/guide__default-theme.json +36 -0
- package/templates/docs/dist/preactpress-content/guide__deploy.json +56 -0
- package/templates/docs/dist/preactpress-content/guide__first-five-minutes.json +36 -0
- package/templates/docs/dist/preactpress-content/guide__getting-started.json +51 -0
- package/templates/docs/dist/preactpress-content/guide__markdown-and-mdx.json +31 -0
- package/templates/docs/dist/preactpress-content/guide__routing.json +71 -0
- package/templates/docs/dist/preactpress-content/guide__what-is-preactpress.json +51 -0
- package/templates/docs/dist/preactpress-content/markdown-examples.json +71 -0
- package/templates/docs/dist/preactpress-content/tags__markdown.json +16 -0
- package/templates/docs/dist/preactpress-search.json +166 -0
- package/templates/docs/dist/preactpress-theme.js +1 -0
- package/templates/docs/dist/tags/markdown/index.html +32 -0
- package/templates/docs/guide/advanced.md +44 -0
- package/templates/docs/guide/commands.md +41 -0
- package/templates/docs/guide/configuration.md +130 -0
- package/templates/docs/guide/creating-pages.md +171 -0
- package/templates/docs/guide/custom-themes.md +39 -0
- package/templates/docs/guide/default-theme.md +41 -0
- package/templates/docs/guide/deploy.md +197 -0
- package/templates/docs/guide/first-five-minutes.md +82 -0
- package/templates/docs/guide/getting-started.md +146 -0
- package/templates/docs/guide/markdown-and-mdx.md +59 -0
- package/templates/docs/guide/routing.md +263 -0
- package/templates/docs/guide/what-is-preactpress.md +87 -0
- package/templates/docs/index.html +18 -0
- package/templates/docs/index.md +28 -0
- package/templates/docs/interactive.mdx +32 -0
- package/templates/docs/markdown-examples.md +72 -0
- package/templates/docs/package.json +15 -0
- package/templates/docs/partials/shared-note.md +3 -0
- package/templates/docs/parts/include-body.md +9 -0
- package/templates/docs/pnpm-lock.yaml +2917 -0
- package/templates/docs/snippets/greet.ts +3 -0
- package/templates/hono/.preactpress/config.ts +100 -0
- package/templates/hono/.preactpress/theme/CodeSnippet.tsx +41 -0
- package/templates/hono/.preactpress/theme/FeatureGrid.tsx +27 -0
- package/templates/hono/.preactpress/theme/Hero.tsx +45 -0
- package/templates/hono/.preactpress/theme/Layout.tsx +388 -0
- package/templates/hono/.preactpress/theme/Logo.tsx +26 -0
- package/templates/hono/.preactpress/theme/ThemeToggle.tsx +72 -0
- package/templates/hono/.preactpress/theme/hono.css +1058 -0
- package/templates/hono/README.md +41 -0
- package/templates/hono/about.md +10 -0
- package/templates/hono/components/Counter.tsx +25 -0
- package/templates/hono/de/about.md +10 -0
- package/templates/hono/de/guide/commands.md +44 -0
- package/templates/hono/de/guide/configuration.md +64 -0
- package/templates/hono/de/guide/deploy.md +197 -0
- package/templates/hono/de/guide/first-five-minutes.md +82 -0
- package/templates/hono/de/guide/getting-started.md +146 -0
- package/templates/hono/de/guide/routing.md +220 -0
- package/templates/hono/de/guide/seiten-erstellen.md +171 -0
- package/templates/hono/de/guide/what-is-preactpress.md +87 -0
- package/templates/hono/de/index.mdx +51 -0
- package/templates/hono/de/interactive.mdx +32 -0
- package/templates/hono/de/markdown-examples.md +142 -0
- package/templates/hono/de/parts/include-body.md +9 -0
- package/templates/hono/de/snippets/greet.ts +3 -0
- package/templates/hono/dist/404.html +29 -0
- package/templates/hono/dist/README/index.html +104 -0
- package/templates/hono/dist/about/index.html +32 -0
- package/templates/hono/dist/assets/Counter-CCEByS-J.js +1 -0
- package/templates/hono/dist/assets/Hero--o6WMNvm.js +2 -0
- package/templates/hono/dist/assets/de-D5r6Ye70.js +10 -0
- package/templates/hono/dist/assets/hono-BXWYYdyv.js +10 -0
- package/templates/hono/dist/assets/interactive-Bxo-WBpC.js +9 -0
- package/templates/hono/dist/assets/interactive-BznI4IQ3.js +9 -0
- package/templates/hono/dist/assets/main-Bqi-VFEk.js +2 -0
- package/templates/hono/dist/assets/main-DIIN7FO0.css +1 -0
- package/templates/hono/dist/de/about/index.html +32 -0
- package/templates/hono/dist/de/guide/commands/index.html +41 -0
- package/templates/hono/dist/de/guide/configuration/index.html +105 -0
- package/templates/hono/dist/de/guide/deploy/index.html +195 -0
- package/templates/hono/dist/de/guide/first-five-minutes/index.html +99 -0
- package/templates/hono/dist/de/guide/getting-started/index.html +173 -0
- package/templates/hono/dist/de/guide/routing/index.html +165 -0
- package/templates/hono/dist/de/guide/seiten-erstellen/index.html +234 -0
- package/templates/hono/dist/de/guide/what-is-preactpress/index.html +141 -0
- package/templates/hono/dist/de/index.html +30 -0
- package/templates/hono/dist/de/interactive/index.html +37 -0
- package/templates/hono/dist/de/markdown-examples/index.html +97 -0
- package/templates/hono/dist/de/parts/include-body/index.html +36 -0
- package/templates/hono/dist/de/tags/markdown/index.html +32 -0
- package/templates/hono/dist/favicon-32.png +0 -0
- package/templates/hono/dist/favicon.png +0 -0
- package/templates/hono/dist/favicon.svg +28 -0
- package/templates/hono/dist/guide/commands/index.html +41 -0
- package/templates/hono/dist/guide/configuration/index.html +158 -0
- package/templates/hono/dist/guide/creating-pages/index.html +234 -0
- package/templates/hono/dist/guide/deploy/index.html +195 -0
- package/templates/hono/dist/guide/first-five-minutes/index.html +99 -0
- package/templates/hono/dist/guide/getting-started/index.html +173 -0
- package/templates/hono/dist/guide/routing/index.html +165 -0
- package/templates/hono/dist/guide/what-is-preactpress/index.html +141 -0
- package/templates/hono/dist/index.html +30 -0
- package/templates/hono/dist/interactive/index.html +37 -0
- package/templates/hono/dist/markdown-examples/index.html +105 -0
- package/templates/hono/dist/partials/shared-note/index.html +30 -0
- package/templates/hono/dist/parts/include-body/index.html +36 -0
- package/templates/hono/dist/preactpress-content/404.json +8 -0
- package/templates/hono/dist/preactpress-content/README.json +26 -0
- package/templates/hono/dist/preactpress-content/about.json +15 -0
- package/templates/hono/dist/preactpress-content/de__about.json +15 -0
- package/templates/hono/dist/preactpress-content/de__guide__commands.json +36 -0
- package/templates/hono/dist/preactpress-content/de__guide__configuration.json +41 -0
- package/templates/hono/dist/preactpress-content/de__guide__deploy.json +56 -0
- package/templates/hono/dist/preactpress-content/de__guide__first-five-minutes.json +36 -0
- package/templates/hono/dist/preactpress-content/de__guide__getting-started.json +51 -0
- package/templates/hono/dist/preactpress-content/de__guide__routing.json +61 -0
- package/templates/hono/dist/preactpress-content/de__guide__seiten-erstellen.json +71 -0
- package/templates/hono/dist/preactpress-content/de__guide__what-is-preactpress.json +51 -0
- package/templates/hono/dist/preactpress-content/de__markdown-examples.json +131 -0
- package/templates/hono/dist/preactpress-content/de__parts__include-body.json +16 -0
- package/templates/hono/dist/preactpress-content/de__tags__markdown.json +16 -0
- package/templates/hono/dist/preactpress-content/guide__commands.json +36 -0
- package/templates/hono/dist/preactpress-content/guide__configuration.json +51 -0
- package/templates/hono/dist/preactpress-content/guide__creating-pages.json +71 -0
- package/templates/hono/dist/preactpress-content/guide__deploy.json +56 -0
- package/templates/hono/dist/preactpress-content/guide__first-five-minutes.json +36 -0
- package/templates/hono/dist/preactpress-content/guide__getting-started.json +51 -0
- package/templates/hono/dist/preactpress-content/guide__routing.json +61 -0
- package/templates/hono/dist/preactpress-content/guide__what-is-preactpress.json +51 -0
- package/templates/hono/dist/preactpress-content/markdown-examples.json +141 -0
- package/templates/hono/dist/preactpress-content/partials__shared-note.json +10 -0
- package/templates/hono/dist/preactpress-content/parts__include-body.json +16 -0
- package/templates/hono/dist/preactpress-content/tags__markdown.json +16 -0
- package/templates/hono/dist/preactpress-search.json +242 -0
- package/templates/hono/dist/preactpress-theme.js +1 -0
- package/templates/hono/dist/tags/markdown/index.html +32 -0
- package/templates/hono/guide/commands.md +44 -0
- package/templates/hono/guide/configuration.md +177 -0
- package/templates/hono/guide/creating-pages.md +171 -0
- package/templates/hono/guide/deploy.md +197 -0
- package/templates/hono/guide/first-five-minutes.md +82 -0
- package/templates/hono/guide/getting-started.md +146 -0
- package/templates/hono/guide/routing.md +263 -0
- package/templates/hono/guide/what-is-preactpress.md +87 -0
- package/templates/hono/index.html +18 -0
- package/templates/hono/index.mdx +51 -0
- package/templates/hono/interactive.mdx +32 -0
- package/templates/hono/markdown-examples.md +160 -0
- package/templates/hono/package.json +15 -0
- package/templates/hono/partials/shared-note.md +3 -0
- package/templates/hono/parts/include-body.md +9 -0
- package/templates/hono/pnpm-lock.yaml +2917 -0
- package/templates/hono/snippets/greet.ts +3 -0
- package/templates/magazine/.preactpress/config.ts +36 -0
- package/templates/magazine/.preactpress/theme/Layout.tsx +319 -0
- package/templates/magazine/.preactpress/theme/TeaserGrid.tsx +39 -0
- package/templates/magazine/.preactpress/theme/ThemeToggle.tsx +73 -0
- package/templates/magazine/.preactpress/theme/magazine.css +587 -0
- package/templates/magazine/article-markets.md +24 -0
- package/templates/magazine/article-tech.mdx +35 -0
- package/templates/magazine/index.data.ts +19 -0
- package/templates/magazine/index.html +14 -0
- package/templates/magazine/index.mdx +13 -0
- package/templates/magazine/package.json +15 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineConfig } from '@kamod-ch/preactpress/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
srcExclude: ['README.md', 'partials/**', 'parts/**'],
|
|
5
|
+
site: {
|
|
6
|
+
title: 'Hono Starter',
|
|
7
|
+
description: 'Fast, lightweight docs and landing pages built on Web Standards.'
|
|
8
|
+
},
|
|
9
|
+
theme: './theme/Layout.tsx',
|
|
10
|
+
markdown: {
|
|
11
|
+
html: false
|
|
12
|
+
},
|
|
13
|
+
themeConfig: {
|
|
14
|
+
outline: true,
|
|
15
|
+
search: true,
|
|
16
|
+
lastUpdated: true,
|
|
17
|
+
footer: 'Built with PreactPress.',
|
|
18
|
+
socialLinks: [
|
|
19
|
+
{
|
|
20
|
+
icon: 'github',
|
|
21
|
+
link: 'https://github.com/your-org/your-project',
|
|
22
|
+
ariaLabel: 'GitHub'
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
locales: {
|
|
27
|
+
root: {
|
|
28
|
+
label: 'English',
|
|
29
|
+
lang: 'en',
|
|
30
|
+
themeConfig: {
|
|
31
|
+
nav: [
|
|
32
|
+
{ text: 'Docs', link: '/guide/what-is-preactpress' },
|
|
33
|
+
{ text: 'Examples', link: '/markdown-examples' },
|
|
34
|
+
{ text: 'About', link: '/about' }
|
|
35
|
+
],
|
|
36
|
+
sidebar: [
|
|
37
|
+
{
|
|
38
|
+
text: 'Introduction',
|
|
39
|
+
items: [
|
|
40
|
+
{ text: 'Welcome', link: '/' },
|
|
41
|
+
{ text: 'What is PreactPress?', link: '/guide/what-is-preactpress' },
|
|
42
|
+
{ text: 'Getting Started', link: '/guide/getting-started' },
|
|
43
|
+
{ text: 'Routing', link: '/guide/routing' },
|
|
44
|
+
{ text: 'Deploy', link: '/guide/deploy' },
|
|
45
|
+
{ text: 'Your first 5 minutes', link: '/guide/first-five-minutes' },
|
|
46
|
+
{ text: 'Creating pages', link: '/guide/creating-pages' },
|
|
47
|
+
{ text: 'Commands', link: '/guide/commands' },
|
|
48
|
+
{ text: 'Configuration', link: '/guide/configuration' }
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
text: 'Reference',
|
|
53
|
+
items: [
|
|
54
|
+
{ text: 'Markdown examples', link: '/markdown-examples' },
|
|
55
|
+
{ text: 'Interactive MDX', link: '/interactive' }
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
de: {
|
|
62
|
+
label: 'Deutsch',
|
|
63
|
+
lang: 'de',
|
|
64
|
+
link: '/de/',
|
|
65
|
+
title: 'Hono Starter',
|
|
66
|
+
description: 'Schnelle, schlanke Docs und Landing Pages auf Web-Standards.',
|
|
67
|
+
themeConfig: {
|
|
68
|
+
footer: 'Erstellt mit PreactPress.',
|
|
69
|
+
nav: [
|
|
70
|
+
{ text: 'Docs', link: '/de/guide/what-is-preactpress' },
|
|
71
|
+
{ text: 'Beispiele', link: '/de/markdown-examples' },
|
|
72
|
+
{ text: 'Über uns', link: '/de/about' }
|
|
73
|
+
],
|
|
74
|
+
sidebar: [
|
|
75
|
+
{
|
|
76
|
+
text: 'Einführung',
|
|
77
|
+
items: [
|
|
78
|
+
{ text: 'Willkommen', link: '/de' },
|
|
79
|
+
{ text: 'Was ist PreactPress?', link: '/de/guide/what-is-preactpress' },
|
|
80
|
+
{ text: 'Getting Started', link: '/de/guide/getting-started' },
|
|
81
|
+
{ text: 'Routing', link: '/de/guide/routing' },
|
|
82
|
+
{ text: 'Deploy', link: '/de/guide/deploy' },
|
|
83
|
+
{ text: 'Die ersten 5 Minuten', link: '/de/guide/first-five-minutes' },
|
|
84
|
+
{ text: 'Seiten erstellen', link: '/de/guide/seiten-erstellen' },
|
|
85
|
+
{ text: 'Befehle', link: '/de/guide/commands' },
|
|
86
|
+
{ text: 'Konfiguration', link: '/de/guide/configuration' }
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
text: 'Referenz',
|
|
91
|
+
items: [
|
|
92
|
+
{ text: 'Markdown-Beispiele', link: '/de/markdown-examples' },
|
|
93
|
+
{ text: 'Interaktives MDX', link: '/de/interactive' }
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'preact'
|
|
2
|
+
|
|
3
|
+
interface CodeSnippetProps {
|
|
4
|
+
code: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function tokenClass(line: string): string {
|
|
8
|
+
const trimmed = line.trim()
|
|
9
|
+
if (!trimmed) return 'empty'
|
|
10
|
+
if (
|
|
11
|
+
trimmed.startsWith('import ') ||
|
|
12
|
+
trimmed.startsWith('export ') ||
|
|
13
|
+
trimmed.startsWith('const ') ||
|
|
14
|
+
trimmed.startsWith('return ')
|
|
15
|
+
) {
|
|
16
|
+
return 'keyword'
|
|
17
|
+
}
|
|
18
|
+
if (trimmed.includes("'.") || trimmed.includes("'") || trimmed.includes('"')) return 'string'
|
|
19
|
+
return 'plain'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const CodeSnippet: FunctionalComponent<CodeSnippetProps> = ({ code }) => (
|
|
23
|
+
<div class="hn-code-card" aria-label="Example code">
|
|
24
|
+
<div class="hn-code-topbar" aria-hidden="true">
|
|
25
|
+
<span />
|
|
26
|
+
<span />
|
|
27
|
+
<span />
|
|
28
|
+
</div>
|
|
29
|
+
<pre>
|
|
30
|
+
<code>
|
|
31
|
+
{code.split('\n').map((line, index) => (
|
|
32
|
+
<span class={`hn-code-line hn-code-${tokenClass(line)}`} key={`${index}:${line}`}>
|
|
33
|
+
{line || ' '}
|
|
34
|
+
</span>
|
|
35
|
+
))}
|
|
36
|
+
</code>
|
|
37
|
+
</pre>
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
export default CodeSnippet
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'preact'
|
|
2
|
+
|
|
3
|
+
interface Feature {
|
|
4
|
+
icon: string
|
|
5
|
+
title: string
|
|
6
|
+
details: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface FeatureGridProps {
|
|
10
|
+
features: Feature[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const FeatureGrid: FunctionalComponent<FeatureGridProps> = ({ features }) => (
|
|
14
|
+
<section class="hn-features" aria-label="Highlights">
|
|
15
|
+
{features.map((feature) => (
|
|
16
|
+
<article class="hn-feature-card" key={feature.title}>
|
|
17
|
+
<div class="hn-feature-icon" aria-hidden="true">
|
|
18
|
+
{feature.icon}
|
|
19
|
+
</div>
|
|
20
|
+
<h2>{feature.title}</h2>
|
|
21
|
+
<p>{feature.details}</p>
|
|
22
|
+
</article>
|
|
23
|
+
))}
|
|
24
|
+
</section>
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
export default FeatureGrid
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'preact'
|
|
2
|
+
import CodeSnippet from './CodeSnippet.js'
|
|
3
|
+
|
|
4
|
+
interface HeroAction {
|
|
5
|
+
text: string
|
|
6
|
+
link: string
|
|
7
|
+
theme?: 'brand' | 'alt'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface HeroProps {
|
|
11
|
+
eyebrow?: string
|
|
12
|
+
title: string
|
|
13
|
+
subtitle: string
|
|
14
|
+
actions?: HeroAction[]
|
|
15
|
+
code: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Hero: FunctionalComponent<HeroProps> = ({ eyebrow, title, subtitle, actions = [], code }) => (
|
|
19
|
+
<section class="hn-hero" aria-labelledby="hero-title">
|
|
20
|
+
<div class="hn-hero-glow" aria-hidden="true" />
|
|
21
|
+
<div class="hn-hero-copy">
|
|
22
|
+
{eyebrow ? <p class="hn-hero-eyebrow">{eyebrow}</p> : null}
|
|
23
|
+
<h1 id="hero-title">{title}</h1>
|
|
24
|
+
<p class="hn-hero-subtitle">{subtitle}</p>
|
|
25
|
+
{actions.length > 0 ? (
|
|
26
|
+
<div class="hn-hero-actions">
|
|
27
|
+
{actions.map((action) => (
|
|
28
|
+
<a
|
|
29
|
+
class={`hn-button hn-button-${action.theme ?? 'alt'}`}
|
|
30
|
+
href={action.link}
|
|
31
|
+
key={`${action.text}:${action.link}`}
|
|
32
|
+
>
|
|
33
|
+
{action.text}
|
|
34
|
+
</a>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
) : null}
|
|
38
|
+
</div>
|
|
39
|
+
<div class="hn-hero-code">
|
|
40
|
+
<CodeSnippet code={code} />
|
|
41
|
+
</div>
|
|
42
|
+
</section>
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
export default Hero
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import type { ComponentChildren, FunctionalComponent, JSX } from 'preact'
|
|
2
|
+
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
3
|
+
import type { LayoutProps } from '@kamod-ch/preactpress/client'
|
|
4
|
+
import Logo from './Logo.js'
|
|
5
|
+
import ThemeToggle from './ThemeToggle.js'
|
|
6
|
+
import './hono.css'
|
|
7
|
+
|
|
8
|
+
interface SidebarItem {
|
|
9
|
+
text: string
|
|
10
|
+
link?: string
|
|
11
|
+
items?: SidebarItem[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface SidebarGroup {
|
|
15
|
+
text?: string
|
|
16
|
+
items: SidebarItem[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type SocialLink = NonNullable<LayoutProps['themeConfig']['socialLinks']>[number]
|
|
20
|
+
|
|
21
|
+
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
|
+
}
|
|
66
|
+
|
|
67
|
+
function tagRoute(tag: string): string {
|
|
68
|
+
return `/tags/${slugify(tag)}`
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function resolveSidebar(
|
|
72
|
+
sidebar: LayoutProps['themeConfig']['sidebar'],
|
|
73
|
+
routePath: string
|
|
74
|
+
): SidebarGroup[] {
|
|
75
|
+
if (!sidebar) return []
|
|
76
|
+
if (Array.isArray(sidebar)) return sidebar
|
|
77
|
+
|
|
78
|
+
const route = normalizeLink(routePath)
|
|
79
|
+
const entries = Object.entries(sidebar)
|
|
80
|
+
.map(([prefix, groups]) => ({ prefix: normalizeLink(prefix), groups }))
|
|
81
|
+
.filter(({ prefix }) => prefix !== '/')
|
|
82
|
+
.sort((a, b) => b.prefix.length - a.prefix.length)
|
|
83
|
+
|
|
84
|
+
for (const { prefix, groups } of entries) {
|
|
85
|
+
if (route === prefix || route.startsWith(`${prefix}/`)) return groups
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return sidebar['/'] ?? sidebar[''] ?? []
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function flattenItems(items: SidebarItem[]): Array<{ text: string; link: string }> {
|
|
92
|
+
const out: Array<{ text: string; link: string }> = []
|
|
93
|
+
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))
|
|
96
|
+
}
|
|
97
|
+
return out
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function flattenSidebarItems(sidebar: SidebarGroup[]): Array<{ text: string; link: string }> {
|
|
101
|
+
return sidebar.flatMap((group) => flattenItems(group.items))
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function socialIconSvg(icon: SocialLink['icon']): string | undefined {
|
|
105
|
+
if (typeof icon === 'object') return icon.svg
|
|
106
|
+
return icon.toLowerCase() === 'github' ? GITHUB_SVG : undefined
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function socialLinkLabel(icon: SocialLink['icon'], ariaLabel?: string): string {
|
|
110
|
+
if (ariaLabel) return ariaLabel
|
|
111
|
+
return typeof icon === 'string' ? icon : 'Social link'
|
|
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
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function isHomeRoute(routePath: string, prefix: string | undefined): boolean {
|
|
140
|
+
return normalizeLink(routePath) === normalizeLink(prefix || '/')
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const Layout: FunctionalComponent<LayoutProps> = ({
|
|
144
|
+
site,
|
|
145
|
+
themeConfig,
|
|
146
|
+
routePath,
|
|
147
|
+
page,
|
|
148
|
+
locale,
|
|
149
|
+
locales = [],
|
|
150
|
+
localizeRoute
|
|
151
|
+
}) => {
|
|
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()
|
|
158
|
+
const visibleSidebar = useMemo(() => {
|
|
159
|
+
if (!normalizedQuery) return activeSidebar
|
|
160
|
+
return activeSidebar
|
|
161
|
+
.map((group) => ({
|
|
162
|
+
...group,
|
|
163
|
+
items: group.items.filter((item) => item.text.toLowerCase().includes(normalizedQuery))
|
|
164
|
+
}))
|
|
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
|
|
169
|
+
const next =
|
|
170
|
+
activeIndex >= 0 && activeIndex < sidebarItems.length - 1 ? sidebarItems[activeIndex + 1] : undefined
|
|
171
|
+
const mdxComponents = createMdxHeadingComponents()
|
|
172
|
+
const MdxComponent = page?.kind === 'mdx' ? page.Component : undefined
|
|
173
|
+
const pageTags = page?.tags ?? []
|
|
174
|
+
const showTags = themeConfig.tags !== false && pageTags.length > 0 && !Boolean(page?.meta.tagIndex)
|
|
175
|
+
const editHref =
|
|
176
|
+
themeConfig.editLink && page?.relativePath
|
|
177
|
+
? themeConfig.editLink.pattern.replace(/:path/g, page.relativePath)
|
|
178
|
+
: undefined
|
|
179
|
+
const lastUpdated = page?.lastUpdated
|
|
180
|
+
? new Date(page.lastUpdated).toLocaleDateString(site.lang || 'en', {
|
|
181
|
+
year: 'numeric',
|
|
182
|
+
month: 'short',
|
|
183
|
+
day: 'numeric'
|
|
184
|
+
})
|
|
185
|
+
: undefined
|
|
186
|
+
const outlineItems = themeConfig.outline === false || isHome ? [] : page?.headings ?? []
|
|
187
|
+
const contentClass = isHome ? 'hn-home-content' : 'hn-doc-content'
|
|
188
|
+
const renderedContent = MdxComponent ? (
|
|
189
|
+
<div class={contentClass}>
|
|
190
|
+
<MdxComponent components={mdxComponents} />
|
|
191
|
+
</div>
|
|
192
|
+
) : (
|
|
193
|
+
<div class={contentClass} dangerouslySetInnerHTML={{ __html: page?.kind === 'markdown' ? page.html : '' }} />
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
setQuery('')
|
|
198
|
+
if (window.matchMedia('(max-width: 820px)').matches) {
|
|
199
|
+
setSidebarOpen(false)
|
|
200
|
+
}
|
|
201
|
+
}, [routePath])
|
|
202
|
+
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
const media = window.matchMedia('(max-width: 820px)')
|
|
205
|
+
const syncSidebar = () => setSidebarOpen(!media.matches)
|
|
206
|
+
syncSidebar()
|
|
207
|
+
media.addEventListener('change', syncSidebar)
|
|
208
|
+
return () => media.removeEventListener('change', syncSidebar)
|
|
209
|
+
}, [])
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<div class={`hn-site${isHome ? ' is-home' : ''}`}>
|
|
213
|
+
<a class="hn-skip" href="#content">
|
|
214
|
+
Skip to content
|
|
215
|
+
</a>
|
|
216
|
+
<header class="hn-header">
|
|
217
|
+
<div class="hn-header-inner">
|
|
218
|
+
<a class="hn-brand" href={withBase(site.base, locale?.prefix || '/')} aria-label={site.title}>
|
|
219
|
+
<Logo label={site.title} />
|
|
220
|
+
</a>
|
|
221
|
+
<div class="hn-header-actions">
|
|
222
|
+
<nav class="hn-nav" aria-label="Main navigation">
|
|
223
|
+
{(themeConfig.nav ?? []).map((item) =>
|
|
224
|
+
item.link ? (
|
|
225
|
+
<a
|
|
226
|
+
key={item.link}
|
|
227
|
+
class={isActive(routePath, item.link) ? 'active' : ''}
|
|
228
|
+
href={withBase(site.base, item.link)}
|
|
229
|
+
aria-current={isActive(routePath, item.link) ? 'page' : undefined}
|
|
230
|
+
>
|
|
231
|
+
{item.text}
|
|
232
|
+
</a>
|
|
233
|
+
) : null
|
|
234
|
+
)}
|
|
235
|
+
</nav>
|
|
236
|
+
{themeConfig.socialLinks?.length ? (
|
|
237
|
+
<div class="hn-social" aria-label="Social links">
|
|
238
|
+
{themeConfig.socialLinks.map((link) => {
|
|
239
|
+
const svg = socialIconSvg(link.icon)
|
|
240
|
+
return (
|
|
241
|
+
<a
|
|
242
|
+
href={withBase(site.base, link.link)}
|
|
243
|
+
aria-label={socialLinkLabel(link.icon, link.ariaLabel)}
|
|
244
|
+
key={`${socialLinkLabel(link.icon, link.ariaLabel)}:${link.link}`}
|
|
245
|
+
>
|
|
246
|
+
{svg ? <span dangerouslySetInnerHTML={{ __html: svg }} /> : socialLinkLabel(link.icon, link.ariaLabel)}
|
|
247
|
+
</a>
|
|
248
|
+
)
|
|
249
|
+
})}
|
|
250
|
+
</div>
|
|
251
|
+
) : null}
|
|
252
|
+
{locales.length > 1 && localizeRoute ? (
|
|
253
|
+
<details class="hn-locale-switcher">
|
|
254
|
+
<summary>{locale?.label ?? 'Language'}</summary>
|
|
255
|
+
<div class="hn-locale-menu">
|
|
256
|
+
{locales.map((item) => {
|
|
257
|
+
const active = item.key === locale?.key
|
|
258
|
+
return (
|
|
259
|
+
<a
|
|
260
|
+
key={item.key}
|
|
261
|
+
href={withBase(site.base, localizeRoute(item))}
|
|
262
|
+
aria-current={active ? 'page' : undefined}
|
|
263
|
+
class={active ? 'active' : ''}
|
|
264
|
+
>
|
|
265
|
+
{item.label}
|
|
266
|
+
</a>
|
|
267
|
+
)
|
|
268
|
+
})}
|
|
269
|
+
</div>
|
|
270
|
+
</details>
|
|
271
|
+
) : null}
|
|
272
|
+
<ThemeToggle />
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
</header>
|
|
276
|
+
{isHome ? (
|
|
277
|
+
<main id="content" class="hn-home-main">
|
|
278
|
+
{renderedContent}
|
|
279
|
+
</main>
|
|
280
|
+
) : (
|
|
281
|
+
<div class="hn-doc-shell">
|
|
282
|
+
<aside class="hn-sidebar" aria-label="Documentation navigation">
|
|
283
|
+
<details
|
|
284
|
+
class="hn-sidebar-panel"
|
|
285
|
+
open={sidebarOpen}
|
|
286
|
+
onToggle={(event) => setSidebarOpen(event.currentTarget.open)}
|
|
287
|
+
>
|
|
288
|
+
<summary>Documentation menu</summary>
|
|
289
|
+
{themeConfig.search ? (
|
|
290
|
+
<label class="hn-search">
|
|
291
|
+
<span>Search pages</span>
|
|
292
|
+
<input
|
|
293
|
+
type="search"
|
|
294
|
+
value={query}
|
|
295
|
+
placeholder="Filter documentation..."
|
|
296
|
+
onInput={(event) => setQuery(event.currentTarget.value)}
|
|
297
|
+
/>
|
|
298
|
+
</label>
|
|
299
|
+
) : null}
|
|
300
|
+
{visibleSidebar.map((group, groupIndex) => (
|
|
301
|
+
<div class="hn-sidebar-group" key={`${group.text ?? 'group'}:${groupIndex}`}>
|
|
302
|
+
{group.text ? <h2>{group.text}</h2> : null}
|
|
303
|
+
<ul>
|
|
304
|
+
{group.items.map((item) =>
|
|
305
|
+
item.link ? (
|
|
306
|
+
<li key={item.link}>
|
|
307
|
+
<a
|
|
308
|
+
class={isActive(routePath, item.link) ? 'active' : ''}
|
|
309
|
+
href={withBase(site.base, item.link)}
|
|
310
|
+
aria-current={isActive(routePath, item.link) ? 'page' : undefined}
|
|
311
|
+
>
|
|
312
|
+
{item.text}
|
|
313
|
+
</a>
|
|
314
|
+
</li>
|
|
315
|
+
) : null
|
|
316
|
+
)}
|
|
317
|
+
</ul>
|
|
318
|
+
</div>
|
|
319
|
+
))}
|
|
320
|
+
</details>
|
|
321
|
+
</aside>
|
|
322
|
+
<main id="content" class="hn-doc-main">
|
|
323
|
+
<article class="hn-doc">
|
|
324
|
+
<h1 class="hn-doc-title">{page?.title ?? site.title}</h1>
|
|
325
|
+
{page?.description ? <p class="hn-doc-lead">{page.description}</p> : null}
|
|
326
|
+
{showTags ? (
|
|
327
|
+
<ul class="hn-tags" aria-label="Tags">
|
|
328
|
+
{pageTags.map((tag) => (
|
|
329
|
+
<li key={tag}>
|
|
330
|
+
<a href={withBase(site.base, tagRoute(tag))}>{tag}</a>
|
|
331
|
+
</li>
|
|
332
|
+
))}
|
|
333
|
+
</ul>
|
|
334
|
+
) : null}
|
|
335
|
+
{renderedContent}
|
|
336
|
+
{previous || next ? (
|
|
337
|
+
<nav class="hn-pager" aria-label="Page navigation">
|
|
338
|
+
{previous ? (
|
|
339
|
+
<a class="previous" href={withBase(site.base, previous.link)}>
|
|
340
|
+
<span>Previous</span>
|
|
341
|
+
{previous.text}
|
|
342
|
+
</a>
|
|
343
|
+
) : (
|
|
344
|
+
<span />
|
|
345
|
+
)}
|
|
346
|
+
{next ? (
|
|
347
|
+
<a class="next" href={withBase(site.base, next.link)}>
|
|
348
|
+
<span>Next</span>
|
|
349
|
+
{next.text}
|
|
350
|
+
</a>
|
|
351
|
+
) : null}
|
|
352
|
+
</nav>
|
|
353
|
+
) : null}
|
|
354
|
+
{themeConfig.lastUpdated || editHref ? (
|
|
355
|
+
<footer class="hn-doc-meta">
|
|
356
|
+
{themeConfig.lastUpdated && lastUpdated ? <span>Updated {lastUpdated}</span> : null}
|
|
357
|
+
{editHref ? (
|
|
358
|
+
<span>
|
|
359
|
+
{themeConfig.lastUpdated && lastUpdated ? ' · ' : null}
|
|
360
|
+
<a href={editHref}>{themeConfig.editLink?.text ?? 'Edit this page'}</a>
|
|
361
|
+
</span>
|
|
362
|
+
) : null}
|
|
363
|
+
</footer>
|
|
364
|
+
) : null}
|
|
365
|
+
</article>
|
|
366
|
+
</main>
|
|
367
|
+
{outlineItems.length > 0 ? (
|
|
368
|
+
<aside class="hn-outline" aria-label="On this page">
|
|
369
|
+
<div class="hn-outline-panel">
|
|
370
|
+
<h2>On this page</h2>
|
|
371
|
+
<ul>
|
|
372
|
+
{outlineItems.map((heading) => (
|
|
373
|
+
<li key={heading.id} class={`level-${heading.level}`}>
|
|
374
|
+
<a href={`#${heading.id}`}>{heading.text}</a>
|
|
375
|
+
</li>
|
|
376
|
+
))}
|
|
377
|
+
</ul>
|
|
378
|
+
</div>
|
|
379
|
+
</aside>
|
|
380
|
+
) : null}
|
|
381
|
+
</div>
|
|
382
|
+
)}
|
|
383
|
+
{themeConfig.footer ? <footer class="hn-footer">{themeConfig.footer}</footer> : null}
|
|
384
|
+
</div>
|
|
385
|
+
)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export default Layout
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'preact'
|
|
2
|
+
|
|
3
|
+
interface LogoProps {
|
|
4
|
+
class?: string
|
|
5
|
+
label: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const Logo: FunctionalComponent<LogoProps> = ({ class: className, label }) => (
|
|
9
|
+
<span class={`hn-logo ${className ?? ''}`.trim()} aria-label={label}>
|
|
10
|
+
<svg aria-hidden="true" viewBox="0 0 36 36" width="36" height="36">
|
|
11
|
+
<rect width="36" height="36" rx="11" fill="currentColor" opacity="0.12" />
|
|
12
|
+
<path
|
|
13
|
+
d="M19.8 5.5c.8 4-2.8 5.9-4.7 8.2-1.8 2.1-2.5 4.9-.3 7 0-2.8 1.7-4.6 4.2-6.7 3.2 3 5.3 5.8 5.3 9.2 0 4.4-3.3 7.3-7.6 7.3-4.8 0-8.3-3.6-8.3-8.4 0-6.1 6.3-9.2 11.4-16.6Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
<path
|
|
17
|
+
d="M21.7 25.7c0 2.2-1.7 3.8-3.9 3.8s-4-1.6-4-3.8c0-1.7 1-3.1 3.4-5.2.1 1.7 1.4 2.6 2.4 3.4.8.6 2.1 1 2.1 1.8Z"
|
|
18
|
+
fill="currentColor"
|
|
19
|
+
opacity="0.38"
|
|
20
|
+
/>
|
|
21
|
+
</svg>
|
|
22
|
+
<span>{label}</span>
|
|
23
|
+
</span>
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
export default Logo
|