@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,36 @@
|
|
|
1
|
+
import { defineConfig } from '@kamod-ch/preactpress/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
site: {
|
|
5
|
+
title: 'Branchenjournal',
|
|
6
|
+
description: 'Static magazine-style starter for PreactPress',
|
|
7
|
+
lang: 'de'
|
|
8
|
+
},
|
|
9
|
+
theme: './theme/Layout.tsx',
|
|
10
|
+
markdown: {
|
|
11
|
+
html: false,
|
|
12
|
+
linkify: true,
|
|
13
|
+
typographer: true
|
|
14
|
+
},
|
|
15
|
+
themeConfig: {
|
|
16
|
+
outline: false,
|
|
17
|
+
search: true,
|
|
18
|
+
lastUpdated: true,
|
|
19
|
+
footer:
|
|
20
|
+
'© Demo — Layout nur als Vorlage. Inhalt fiktiv. Gebaut mit PreactPress.',
|
|
21
|
+
nav: [
|
|
22
|
+
{ text: 'Start', link: '/' },
|
|
23
|
+
{ text: 'Märkte', link: '/article-markets' },
|
|
24
|
+
{ text: 'Tech', link: '/article-tech' }
|
|
25
|
+
],
|
|
26
|
+
sidebar: [
|
|
27
|
+
{
|
|
28
|
+
text: 'In dieser Ausgabe',
|
|
29
|
+
items: [
|
|
30
|
+
{ text: 'Handel und Margen', link: '/article-markets' },
|
|
31
|
+
{ text: 'Tech & Logistik', link: '/article-tech' }
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
})
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import type { ComponentChildren, ComponentType, FunctionalComponent, JSX } from 'preact'
|
|
2
|
+
import { useEffect, useMemo, useState } from 'preact/hooks'
|
|
3
|
+
import type { ArticlePost } from '@kamod-ch/preactpress/shared'
|
|
4
|
+
import ThemeToggle from './ThemeToggle.js'
|
|
5
|
+
import TeaserGrid, { articlesToTeasers } from './TeaserGrid.js'
|
|
6
|
+
import './magazine.css'
|
|
7
|
+
|
|
8
|
+
/** Mirrors `preactpress` `LayoutProps` so this example stays self-contained. */
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
site: {
|
|
11
|
+
title: string
|
|
12
|
+
description: string
|
|
13
|
+
base: string
|
|
14
|
+
lang: string
|
|
15
|
+
url?: string
|
|
16
|
+
}
|
|
17
|
+
themeConfig: {
|
|
18
|
+
nav?: { text: string; link: string }[]
|
|
19
|
+
sidebar?: { text?: string; items: { text: string; link: string }[] }[]
|
|
20
|
+
outline?: boolean
|
|
21
|
+
search?: boolean
|
|
22
|
+
tags?: boolean
|
|
23
|
+
footer?: string
|
|
24
|
+
editLink?: { pattern: string; text?: string }
|
|
25
|
+
lastUpdated?: boolean
|
|
26
|
+
}
|
|
27
|
+
routePath: string
|
|
28
|
+
page?:
|
|
29
|
+
| {
|
|
30
|
+
kind: 'markdown'
|
|
31
|
+
title?: string
|
|
32
|
+
description?: string
|
|
33
|
+
tags?: string[]
|
|
34
|
+
meta: Record<string, unknown>
|
|
35
|
+
headings: { id: string; text: string; level: number }[]
|
|
36
|
+
relativePath?: string
|
|
37
|
+
lastUpdated?: string
|
|
38
|
+
html: string
|
|
39
|
+
}
|
|
40
|
+
| {
|
|
41
|
+
kind: 'mdx'
|
|
42
|
+
title?: string
|
|
43
|
+
description?: string
|
|
44
|
+
tags?: string[]
|
|
45
|
+
meta: Record<string, unknown>
|
|
46
|
+
headings: { id: string; text: string; level: number }[]
|
|
47
|
+
relativePath?: string
|
|
48
|
+
lastUpdated?: string
|
|
49
|
+
Component: ComponentType<{
|
|
50
|
+
components?: Record<string, ComponentType<Record<string, unknown>>>
|
|
51
|
+
}>
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function withBase(base: string, link: string): string {
|
|
56
|
+
if (/^https?:\/\//.test(link)) return link
|
|
57
|
+
const b = base === '/' ? '' : base.replace(/\/$/, '')
|
|
58
|
+
const l = link.startsWith('/') ? link : `/${link}`
|
|
59
|
+
return `${b}${l}`
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function normalizeLink(link: string): string {
|
|
63
|
+
const clean = link.split(/[?#]/, 1)[0] || '/'
|
|
64
|
+
const prefixed = clean.startsWith('/') ? clean : `/${clean}`
|
|
65
|
+
return prefixed.replace(/\/$/, '') || '/'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isActive(routePath: string, link: string): boolean {
|
|
69
|
+
const route = normalizeLink(routePath)
|
|
70
|
+
const target = normalizeLink(link)
|
|
71
|
+
return route === target || (target !== '/' && route.startsWith(`${target}/`))
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function childText(children: ComponentChildren): string {
|
|
75
|
+
if (children == null || typeof children === 'boolean') return ''
|
|
76
|
+
if (typeof children === 'string' || typeof children === 'number') return String(children)
|
|
77
|
+
if (Array.isArray(children)) return children.map(childText).join('')
|
|
78
|
+
if (typeof children === 'object' && 'props' in children) {
|
|
79
|
+
return childText(children.props.children as ComponentChildren)
|
|
80
|
+
}
|
|
81
|
+
return ''
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function slugify(text: string): string {
|
|
85
|
+
const slug = text
|
|
86
|
+
.toLowerCase()
|
|
87
|
+
.trim()
|
|
88
|
+
.replace(/<[^>]+>/g, '')
|
|
89
|
+
.replace(/&[a-z0-9#]+;/gi, '')
|
|
90
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
91
|
+
.replace(/^-+|-+$/g, '')
|
|
92
|
+
return slug || 'section'
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function tagRoute(tag: string): string {
|
|
96
|
+
return `/tags/${slugify(tag)}`
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function createMdxHeadingComponents() {
|
|
100
|
+
const used = new Map<string, number>()
|
|
101
|
+
const heading =
|
|
102
|
+
(Tag: 'h2' | 'h3') =>
|
|
103
|
+
({ children, ...props }: JSX.HTMLAttributes<HTMLHeadingElement>) => {
|
|
104
|
+
const base = slugify(childText(children))
|
|
105
|
+
const count = used.get(base) ?? 0
|
|
106
|
+
used.set(base, count + 1)
|
|
107
|
+
const id = count === 0 ? base : `${base}-${count + 1}`
|
|
108
|
+
return (
|
|
109
|
+
<Tag {...props} id={id} class={`mag-heading ${props.class ?? ''}`.trim()}>
|
|
110
|
+
{children}
|
|
111
|
+
<a class="mag-heading-anchor" href={`#${id}`} aria-label="Abschnitt verlinken">
|
|
112
|
+
#
|
|
113
|
+
</a>
|
|
114
|
+
</Tag>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
h2: heading('h2'),
|
|
120
|
+
h3: heading('h3')
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const Layout: FunctionalComponent<LayoutProps> = ({ site, themeConfig, routePath, page }) => {
|
|
125
|
+
const title = page?.title ? `${page.title} | ${site.title}` : site.title
|
|
126
|
+
const [query, setQuery] = useState('')
|
|
127
|
+
const sidebarItems = (themeConfig.sidebar ?? []).flatMap((group) => group.items)
|
|
128
|
+
const normalizedQuery = query.trim().toLowerCase()
|
|
129
|
+
const visibleSidebar = useMemo(() => {
|
|
130
|
+
if (!normalizedQuery) return themeConfig.sidebar ?? []
|
|
131
|
+
return (themeConfig.sidebar ?? [])
|
|
132
|
+
.map((group) => ({
|
|
133
|
+
...group,
|
|
134
|
+
items: group.items.filter((item) => item.text.toLowerCase().includes(normalizedQuery))
|
|
135
|
+
}))
|
|
136
|
+
.filter((group) => group.items.length > 0)
|
|
137
|
+
}, [normalizedQuery, themeConfig.sidebar])
|
|
138
|
+
const activeIndex = sidebarItems.findIndex((item) => isActive(routePath, item.link))
|
|
139
|
+
const previous = activeIndex > 0 ? sidebarItems[activeIndex - 1] : undefined
|
|
140
|
+
const next =
|
|
141
|
+
activeIndex >= 0 && activeIndex < sidebarItems.length - 1
|
|
142
|
+
? sidebarItems[activeIndex + 1]
|
|
143
|
+
: undefined
|
|
144
|
+
const MdxComponent = page?.kind === 'mdx' ? page.Component : undefined
|
|
145
|
+
const mdxComponents = createMdxHeadingComponents()
|
|
146
|
+
const editHref =
|
|
147
|
+
themeConfig.editLink && page?.relativePath
|
|
148
|
+
? themeConfig.editLink.pattern.replace(/:path/g, page.relativePath)
|
|
149
|
+
: undefined
|
|
150
|
+
const lastUpdated = page?.lastUpdated
|
|
151
|
+
? new Date(page.lastUpdated).toLocaleDateString(site.lang || 'de', {
|
|
152
|
+
year: 'numeric',
|
|
153
|
+
month: 'short',
|
|
154
|
+
day: 'numeric'
|
|
155
|
+
})
|
|
156
|
+
: undefined
|
|
157
|
+
const hasRail = (themeConfig.sidebar?.length ?? 0) > 0
|
|
158
|
+
const isHome = normalizeLink(routePath) === '/'
|
|
159
|
+
const homeArticles = isHome
|
|
160
|
+
? (page?.meta.contentData as ArticlePost[] | undefined)
|
|
161
|
+
: undefined
|
|
162
|
+
const homeTeasers = homeArticles?.length ? articlesToTeasers(homeArticles) : undefined
|
|
163
|
+
const pageTags = page?.tags ?? []
|
|
164
|
+
const showTags =
|
|
165
|
+
themeConfig.tags !== false && pageTags.length > 0 && !Boolean(page?.meta.tagIndex)
|
|
166
|
+
const today = new Intl.DateTimeFormat(site.lang || 'de', {
|
|
167
|
+
weekday: 'long',
|
|
168
|
+
day: 'numeric',
|
|
169
|
+
month: 'long',
|
|
170
|
+
year: 'numeric'
|
|
171
|
+
}).format(new Date())
|
|
172
|
+
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
setQuery('')
|
|
175
|
+
}, [routePath])
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<div class="mag-layout">
|
|
179
|
+
<a class="mag-skip" href="#content">
|
|
180
|
+
Zum Inhalt springen
|
|
181
|
+
</a>
|
|
182
|
+
<div class="mag-topbar">
|
|
183
|
+
<div class="mag-topbar-inner">
|
|
184
|
+
<span>{today}</span>
|
|
185
|
+
<span>{site.description}</span>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
<header class="mag-masthead">
|
|
189
|
+
<div class="mag-masthead-inner">
|
|
190
|
+
<a class="mag-logo" href={withBase(site.base, '/')}>
|
|
191
|
+
<span class="mag-logo-mark">Wochenausgabe</span>
|
|
192
|
+
<span class="mag-logo-title">{site.title}</span>
|
|
193
|
+
</a>
|
|
194
|
+
<div class="mag-masthead-tools">
|
|
195
|
+
<ThemeToggle />
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
</header>
|
|
199
|
+
<div class="mag-nav-wrap">
|
|
200
|
+
<nav class="mag-nav" aria-label="Hauptnavigation">
|
|
201
|
+
{(themeConfig.nav ?? []).map((item) => {
|
|
202
|
+
const active = isActive(routePath, item.link)
|
|
203
|
+
return (
|
|
204
|
+
<a
|
|
205
|
+
key={item.link}
|
|
206
|
+
class={active ? 'active' : ''}
|
|
207
|
+
href={withBase(site.base, item.link)}
|
|
208
|
+
aria-current={active ? 'page' : undefined}
|
|
209
|
+
>
|
|
210
|
+
{item.text}
|
|
211
|
+
</a>
|
|
212
|
+
)
|
|
213
|
+
})}
|
|
214
|
+
</nav>
|
|
215
|
+
</div>
|
|
216
|
+
<div class={`mag-shell${hasRail ? ' has-rail' : ''}`}>
|
|
217
|
+
<main id="content" class="mag-main">
|
|
218
|
+
<article class={`mag-article${isHome ? ' wide' : ''}`}>
|
|
219
|
+
{isHome ? <p class="mag-eyebrow">Schwerpunkte</p> : null}
|
|
220
|
+
<h1 class="mag-doc-title">{page?.title ?? title}</h1>
|
|
221
|
+
{page?.description ? <p class="mag-doc-lead">{page.description}</p> : null}
|
|
222
|
+
{showTags ? (
|
|
223
|
+
<ul class="mag-tags" aria-label="Tags">
|
|
224
|
+
{pageTags.map((tag) => (
|
|
225
|
+
<li key={tag}>
|
|
226
|
+
<a href={withBase(site.base, tagRoute(tag))}>{tag}</a>
|
|
227
|
+
</li>
|
|
228
|
+
))}
|
|
229
|
+
</ul>
|
|
230
|
+
) : null}
|
|
231
|
+
{homeTeasers?.length ? <TeaserGrid items={homeTeasers} /> : null}
|
|
232
|
+
{MdxComponent ? (
|
|
233
|
+
<div class="mag-doc-content">
|
|
234
|
+
<MdxComponent components={mdxComponents} />
|
|
235
|
+
</div>
|
|
236
|
+
) : (
|
|
237
|
+
<div
|
|
238
|
+
class="mag-doc-content"
|
|
239
|
+
dangerouslySetInnerHTML={{ __html: page?.kind === 'markdown' ? page.html : '' }}
|
|
240
|
+
/>
|
|
241
|
+
)}
|
|
242
|
+
{previous || next ? (
|
|
243
|
+
<nav class="mag-pager" aria-label="Seitennavigation">
|
|
244
|
+
{previous ? (
|
|
245
|
+
<a class="previous" href={withBase(site.base, previous.link)}>
|
|
246
|
+
<span>Zurück</span>
|
|
247
|
+
{previous.text}
|
|
248
|
+
</a>
|
|
249
|
+
) : (
|
|
250
|
+
<span />
|
|
251
|
+
)}
|
|
252
|
+
{next ? (
|
|
253
|
+
<a class="next" href={withBase(site.base, next.link)}>
|
|
254
|
+
<span>Weiter</span>
|
|
255
|
+
{next.text}
|
|
256
|
+
</a>
|
|
257
|
+
) : null}
|
|
258
|
+
</nav>
|
|
259
|
+
) : null}
|
|
260
|
+
{themeConfig.lastUpdated || editHref ? (
|
|
261
|
+
<footer class="mag-doc-meta">
|
|
262
|
+
{themeConfig.lastUpdated && lastUpdated ? <span>Stand: {lastUpdated}</span> : null}
|
|
263
|
+
{editHref ? (
|
|
264
|
+
<span>
|
|
265
|
+
{themeConfig.lastUpdated && lastUpdated ? ' · ' : null}
|
|
266
|
+
<a href={editHref}>{themeConfig.editLink?.text ?? 'Seite bearbeiten'}</a>
|
|
267
|
+
</span>
|
|
268
|
+
) : null}
|
|
269
|
+
</footer>
|
|
270
|
+
) : null}
|
|
271
|
+
</article>
|
|
272
|
+
</main>
|
|
273
|
+
{hasRail ? (
|
|
274
|
+
<aside class="mag-rail" aria-label="Seitenleiste">
|
|
275
|
+
<div class="mag-rail-panel">
|
|
276
|
+
{themeConfig.search ? (
|
|
277
|
+
<div class="mag-search">
|
|
278
|
+
<label>
|
|
279
|
+
<span>Filter</span>
|
|
280
|
+
<input
|
|
281
|
+
type="search"
|
|
282
|
+
value={query}
|
|
283
|
+
placeholder="Artikel suchen…"
|
|
284
|
+
onInput={(event) => setQuery((event.currentTarget as HTMLInputElement).value)}
|
|
285
|
+
/>
|
|
286
|
+
</label>
|
|
287
|
+
</div>
|
|
288
|
+
) : null}
|
|
289
|
+
{visibleSidebar.map((group, gi) => (
|
|
290
|
+
<div key={gi}>
|
|
291
|
+
{group.text ? <h2>{group.text}</h2> : null}
|
|
292
|
+
<ul>
|
|
293
|
+
{group.items.map((it) => {
|
|
294
|
+
const active = isActive(routePath, it.link)
|
|
295
|
+
return (
|
|
296
|
+
<li key={it.link}>
|
|
297
|
+
<a
|
|
298
|
+
class={active ? 'active' : ''}
|
|
299
|
+
href={withBase(site.base, it.link)}
|
|
300
|
+
aria-current={active ? 'page' : undefined}
|
|
301
|
+
>
|
|
302
|
+
{it.text}
|
|
303
|
+
</a>
|
|
304
|
+
</li>
|
|
305
|
+
)
|
|
306
|
+
})}
|
|
307
|
+
</ul>
|
|
308
|
+
</div>
|
|
309
|
+
))}
|
|
310
|
+
</div>
|
|
311
|
+
</aside>
|
|
312
|
+
) : null}
|
|
313
|
+
</div>
|
|
314
|
+
{themeConfig.footer ? <footer class="mag-footer">{themeConfig.footer}</footer> : null}
|
|
315
|
+
</div>
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export default Layout
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'preact'
|
|
2
|
+
import type { ArticlePost } from '@kamod-ch/preactpress/shared'
|
|
3
|
+
|
|
4
|
+
export interface TeaserItem {
|
|
5
|
+
href: string
|
|
6
|
+
kicker: string
|
|
7
|
+
title: string
|
|
8
|
+
dek: string
|
|
9
|
+
readTime?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface TeaserGridProps {
|
|
13
|
+
items: TeaserItem[]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function articlesToTeasers(posts: ArticlePost[]): TeaserItem[] {
|
|
17
|
+
return posts.map((post) => ({
|
|
18
|
+
href: post.route,
|
|
19
|
+
kicker: post.category?.name ?? 'Artikel',
|
|
20
|
+
title: post.title,
|
|
21
|
+
dek: post.description ?? '',
|
|
22
|
+
readTime: post.readTime
|
|
23
|
+
}))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const TeaserGrid: FunctionalComponent<TeaserGridProps> = ({ items }) => (
|
|
27
|
+
<div class="mag-teaser-grid">
|
|
28
|
+
{items.map((item) => (
|
|
29
|
+
<a key={item.href} class="mag-teaser-card" href={item.href}>
|
|
30
|
+
<span class="mag-teaser-kicker">{item.kicker}</span>
|
|
31
|
+
<span class="mag-teaser-title">{item.title}</span>
|
|
32
|
+
<span class="mag-teaser-dek">{item.dek}</span>
|
|
33
|
+
{item.readTime ? <span class="mag-teaser-meta">{item.readTime}</span> : null}
|
|
34
|
+
</a>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
export default TeaserGrid
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { FunctionalComponent } from 'preact'
|
|
2
|
+
import { useEffect } from 'preact/hooks'
|
|
3
|
+
|
|
4
|
+
const STORAGE_KEY = 'preactpress-theme' as const
|
|
5
|
+
|
|
6
|
+
type Stored = 'light' | 'dark'
|
|
7
|
+
|
|
8
|
+
function readStored(): Stored | null {
|
|
9
|
+
if (typeof localStorage === 'undefined') return null
|
|
10
|
+
try {
|
|
11
|
+
const v = localStorage.getItem(STORAGE_KEY)
|
|
12
|
+
return v === 'light' || v === 'dark' ? v : null
|
|
13
|
+
} catch {
|
|
14
|
+
return null
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function apply(theme: Stored | null): void {
|
|
19
|
+
if (typeof document === 'undefined') return
|
|
20
|
+
const root = document.documentElement
|
|
21
|
+
if (theme === null) root.removeAttribute('data-theme')
|
|
22
|
+
else root.setAttribute('data-theme', theme)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function toggle(): void {
|
|
26
|
+
const stored = readStored()
|
|
27
|
+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
28
|
+
const isDark = stored === 'dark' || (stored === null && prefersDark)
|
|
29
|
+
const next: Stored = isDark ? 'light' : 'dark'
|
|
30
|
+
apply(next)
|
|
31
|
+
try {
|
|
32
|
+
localStorage.setItem(STORAGE_KEY, next)
|
|
33
|
+
} catch {
|
|
34
|
+
/* ignore */
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const ThemeToggle: FunctionalComponent = () => {
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
function onStorage(e: StorageEvent): void {
|
|
41
|
+
if (e.key !== STORAGE_KEY) return
|
|
42
|
+
const v = e.newValue
|
|
43
|
+
apply(v === 'light' || v === 'dark' ? v : null)
|
|
44
|
+
}
|
|
45
|
+
window.addEventListener('storage', onStorage)
|
|
46
|
+
return () => window.removeEventListener('storage', onStorage)
|
|
47
|
+
}, [])
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<button type="button" class="mag-theme-toggle" onClick={toggle} aria-label="Hell- und Dunkelmodus wechseln">
|
|
51
|
+
<span class="mag-theme-toggle-moon" aria-hidden="true">
|
|
52
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24">
|
|
53
|
+
<path
|
|
54
|
+
strokeLinecap="round"
|
|
55
|
+
strokeLinejoin="round"
|
|
56
|
+
d="M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"
|
|
57
|
+
/>
|
|
58
|
+
</svg>
|
|
59
|
+
</span>
|
|
60
|
+
<span class="mag-theme-toggle-sun" aria-hidden="true">
|
|
61
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24">
|
|
62
|
+
<path
|
|
63
|
+
strokeLinecap="round"
|
|
64
|
+
strokeLinejoin="round"
|
|
65
|
+
d="M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"
|
|
66
|
+
/>
|
|
67
|
+
</svg>
|
|
68
|
+
</span>
|
|
69
|
+
</button>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default ThemeToggle
|