@kamod-ch/preactpress 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -49
- package/bin/preactpress.mjs +5 -5
- package/dist/client/app.d.ts +1 -1
- package/dist/client/app.d.ts.map +1 -1
- package/dist/client/app.js +34 -38
- package/dist/client/app.js.map +1 -1
- package/dist/client/entry-client.js +11 -12
- package/dist/client/entry-client.js.map +1 -1
- package/dist/client/entry-ssr.d.ts +2 -2
- package/dist/client/entry-ssr.d.ts.map +1 -1
- package/dist/client/entry-ssr.js +16 -16
- package/dist/client/entry-ssr.js.map +1 -1
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/loadPage.d.ts +1 -1
- package/dist/client/loadPage.d.ts.map +1 -1
- package/dist/client/loadPage.js +12 -12
- package/dist/client/loadPage.js.map +1 -1
- package/dist/client/prefetchLinks.js +4 -4
- package/dist/client/prefetchLinks.js.map +1 -1
- package/dist/client/theme-default/AlgoliaSearch.d.ts +3 -3
- package/dist/client/theme-default/AlgoliaSearch.d.ts.map +1 -1
- package/dist/client/theme-default/AlgoliaSearch.js +15 -15
- package/dist/client/theme-default/AlgoliaSearch.js.map +1 -1
- package/dist/client/theme-default/Features.d.ts +2 -2
- package/dist/client/theme-default/Features.d.ts.map +1 -1
- package/dist/client/theme-default/Features.js +10 -8
- package/dist/client/theme-default/Features.js.map +1 -1
- package/dist/client/theme-default/Hero.d.ts +2 -2
- package/dist/client/theme-default/Hero.d.ts.map +1 -1
- package/dist/client/theme-default/Hero.js +9 -7
- package/dist/client/theme-default/Hero.js.map +1 -1
- package/dist/client/theme-default/Layout.d.ts +3 -3
- package/dist/client/theme-default/Layout.d.ts.map +1 -1
- package/dist/client/theme-default/Layout.js +56 -99
- package/dist/client/theme-default/Layout.js.map +1 -1
- package/dist/client/theme-default/Logo.d.ts +2 -2
- package/dist/client/theme-default/Logo.d.ts.map +1 -1
- package/dist/client/theme-default/Logo.js +8 -8
- package/dist/client/theme-default/Logo.js.map +1 -1
- package/dist/client/theme-default/NavLinks.d.ts +2 -2
- package/dist/client/theme-default/NavLinks.d.ts.map +1 -1
- package/dist/client/theme-default/NavLinks.js +3 -3
- package/dist/client/theme-default/NavLinks.js.map +1 -1
- package/dist/client/theme-default/SidebarNav.d.ts +2 -2
- package/dist/client/theme-default/SidebarNav.d.ts.map +1 -1
- package/dist/client/theme-default/SidebarNav.js +3 -3
- package/dist/client/theme-default/SidebarNav.js.map +1 -1
- package/dist/client/theme-default/SocialLinks.d.ts +2 -2
- package/dist/client/theme-default/SocialLinks.d.ts.map +1 -1
- package/dist/client/theme-default/SocialLinks.js +1 -1
- package/dist/client/theme-default/SocialLinks.js.map +1 -1
- package/dist/client/theme-default/ThemeToggle.d.ts +2 -3
- package/dist/client/theme-default/ThemeToggle.d.ts.map +1 -1
- package/dist/client/theme-default/ThemeToggle.js +2 -30
- package/dist/client/theme-default/ThemeToggle.js.map +1 -1
- package/dist/client/theme-default/index.d.ts +1 -1
- package/dist/client/theme-default/index.d.ts.map +1 -1
- package/dist/client/theme-default/index.js +1 -1
- package/dist/client/theme-default/index.js.map +1 -1
- package/dist/client/theme-utils.d.ts +24 -0
- package/dist/client/theme-utils.d.ts.map +1 -0
- package/dist/client/theme-utils.js +107 -0
- package/dist/client/theme-utils.js.map +1 -0
- package/dist/client/types.d.ts +5 -5
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/usePageHead.d.ts +2 -2
- package/dist/client/usePageHead.d.ts.map +1 -1
- package/dist/client/usePageHead.js +61 -56
- package/dist/client/usePageHead.js.map +1 -1
- package/dist/client/useSiteSearch.d.ts.map +1 -1
- package/dist/client/useSiteSearch.js +8 -8
- package/dist/client/useSiteSearch.js.map +1 -1
- package/dist/node/build.d.ts +1 -1
- package/dist/node/build.d.ts.map +1 -1
- package/dist/node/build.js +105 -96
- package/dist/node/build.js.map +1 -1
- package/dist/node/buildCache.d.ts.map +1 -1
- package/dist/node/buildCache.js +7 -7
- package/dist/node/buildCache.js.map +1 -1
- package/dist/node/check.d.ts +1 -1
- package/dist/node/check.d.ts.map +1 -1
- package/dist/node/check.js +52 -52
- package/dist/node/check.js.map +1 -1
- package/dist/node/cli.js +61 -64
- package/dist/node/cli.js.map +1 -1
- package/dist/node/config-helpers.d.ts +4 -4
- package/dist/node/config-helpers.d.ts.map +1 -1
- package/dist/node/config-helpers.js +1 -1
- package/dist/node/config-helpers.js.map +1 -1
- package/dist/node/config.d.ts +4 -4
- package/dist/node/config.d.ts.map +1 -1
- package/dist/node/config.js +37 -40
- package/dist/node/config.js.map +1 -1
- package/dist/node/content.d.ts +4 -4
- package/dist/node/content.d.ts.map +1 -1
- package/dist/node/content.js +28 -28
- package/dist/node/content.js.map +1 -1
- package/dist/node/createContentLoader.d.ts +1 -1
- package/dist/node/createContentLoader.d.ts.map +1 -1
- package/dist/node/createContentLoader.js +3 -3
- package/dist/node/createContentLoader.js.map +1 -1
- package/dist/node/devCss.d.ts +1 -1
- package/dist/node/devCss.d.ts.map +1 -1
- package/dist/node/devCss.js +5 -6
- package/dist/node/devCss.js.map +1 -1
- package/dist/node/devSsr.d.ts +3 -3
- package/dist/node/devSsr.d.ts.map +1 -1
- package/dist/node/devSsr.js +32 -32
- package/dist/node/devSsr.js.map +1 -1
- package/dist/node/dynamicRoutes.d.ts +2 -2
- package/dist/node/dynamicRoutes.d.ts.map +1 -1
- package/dist/node/dynamicRoutes.js +24 -24
- package/dist/node/dynamicRoutes.js.map +1 -1
- package/dist/node/favicon.d.ts +2 -2
- package/dist/node/favicon.d.ts.map +1 -1
- package/dist/node/favicon.js +26 -24
- package/dist/node/favicon.js.map +1 -1
- package/dist/node/feed.d.ts +2 -2
- package/dist/node/feed.d.ts.map +1 -1
- package/dist/node/feed.js +18 -16
- package/dist/node/feed.js.map +1 -1
- package/dist/node/hooks.d.ts +2 -2
- package/dist/node/hooks.d.ts.map +1 -1
- package/dist/node/hooks.js +1 -1
- package/dist/node/hooks.js.map +1 -1
- package/dist/node/html.d.ts +8 -8
- package/dist/node/html.d.ts.map +1 -1
- package/dist/node/html.js +75 -64
- package/dist/node/html.js.map +1 -1
- package/dist/node/index.d.ts +11 -11
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +8 -8
- package/dist/node/index.js.map +1 -1
- package/dist/node/init.d.ts +2 -0
- package/dist/node/init.d.ts.map +1 -1
- package/dist/node/init.js +59 -27
- package/dist/node/init.js.map +1 -1
- package/dist/node/lastUpdated.d.ts +2 -2
- package/dist/node/lastUpdated.d.ts.map +1 -1
- package/dist/node/lastUpdated.js +7 -4
- package/dist/node/lastUpdated.js.map +1 -1
- package/dist/node/loadSiteModule.js +2 -2
- package/dist/node/loadSiteModule.js.map +1 -1
- package/dist/node/markdown.d.ts +2 -2
- package/dist/node/markdown.d.ts.map +1 -1
- package/dist/node/markdown.js +110 -110
- package/dist/node/markdown.js.map +1 -1
- package/dist/node/markdownHeadings.d.ts +1 -1
- package/dist/node/markdownHeadings.d.ts.map +1 -1
- package/dist/node/markdownHeadings.js +11 -11
- package/dist/node/markdownHeadings.js.map +1 -1
- package/dist/node/markdownInclude.d.ts.map +1 -1
- package/dist/node/markdownInclude.js +11 -11
- package/dist/node/markdownInclude.js.map +1 -1
- package/dist/node/markdownSnippets.d.ts.map +1 -1
- package/dist/node/markdownSnippets.js +34 -34
- package/dist/node/markdownSnippets.js.map +1 -1
- package/dist/node/mdx.d.ts +1 -1
- package/dist/node/mdx.d.ts.map +1 -1
- package/dist/node/mdx.js +4 -4
- package/dist/node/mdx.js.map +1 -1
- package/dist/node/packageRoot.d.ts.map +1 -1
- package/dist/node/packageRoot.js +4 -4
- package/dist/node/packageRoot.js.map +1 -1
- package/dist/node/pageDataLoaders.d.ts +2 -2
- package/dist/node/pageDataLoaders.d.ts.map +1 -1
- package/dist/node/pageDataLoaders.js +24 -20
- package/dist/node/pageDataLoaders.js.map +1 -1
- package/dist/node/paths.d.ts.map +1 -1
- package/dist/node/paths.js +4 -4
- package/dist/node/paths.js.map +1 -1
- package/dist/node/plugin.d.ts +3 -3
- package/dist/node/plugin.d.ts.map +1 -1
- package/dist/node/plugin.js +66 -66
- package/dist/node/plugin.js.map +1 -1
- package/dist/node/resolveDeps.js +10 -10
- package/dist/node/resolveDeps.js.map +1 -1
- package/dist/node/serve.d.ts.map +1 -1
- package/dist/node/serve.js +13 -15
- package/dist/node/serve.js.map +1 -1
- package/dist/node/server.d.ts +3 -3
- package/dist/node/server.d.ts.map +1 -1
- package/dist/node/server.js +28 -25
- package/dist/node/server.js.map +1 -1
- package/dist/node/siteConfig.d.ts +12 -12
- package/dist/node/siteConfig.d.ts.map +1 -1
- package/dist/node/tagIndex.d.ts +5 -5
- package/dist/node/tagIndex.d.ts.map +1 -1
- package/dist/node/tagIndex.js +10 -10
- package/dist/node/tagIndex.js.map +1 -1
- package/dist/shared/contentChunk.d.ts.map +1 -1
- package/dist/shared/contentChunk.js +6 -6
- package/dist/shared/contentChunk.js.map +1 -1
- package/dist/shared/contentSchema.d.ts.map +1 -1
- package/dist/shared/contentSchema.js +11 -11
- package/dist/shared/contentSchema.js.map +1 -1
- package/dist/shared/deadLinks.d.ts.map +1 -1
- package/dist/shared/deadLinks.js +6 -6
- package/dist/shared/deadLinks.js.map +1 -1
- package/dist/shared/escapeHtml.js +4 -4
- package/dist/shared/escapeHtml.js.map +1 -1
- package/dist/shared/index.d.ts +14 -14
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +14 -14
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/locale.d.ts +1 -1
- package/dist/shared/locale.d.ts.map +1 -1
- package/dist/shared/locale.js +10 -10
- package/dist/shared/locale.js.map +1 -1
- package/dist/shared/pageChrome.d.ts +4 -4
- package/dist/shared/pageChrome.d.ts.map +1 -1
- package/dist/shared/pageChrome.js +21 -21
- package/dist/shared/pageChrome.js.map +1 -1
- package/dist/shared/pageHead.d.ts +1 -1
- package/dist/shared/pageHead.d.ts.map +1 -1
- package/dist/shared/pageHead.js +4 -4
- package/dist/shared/pageHead.js.map +1 -1
- package/dist/shared/pageMeta.d.ts +5 -5
- package/dist/shared/pageMeta.d.ts.map +1 -1
- package/dist/shared/pageMeta.js +15 -17
- package/dist/shared/pageMeta.js.map +1 -1
- package/dist/shared/rewrites.d.ts +1 -1
- package/dist/shared/rewrites.d.ts.map +1 -1
- package/dist/shared/rewrites.js +2 -2
- package/dist/shared/rewrites.js.map +1 -1
- package/dist/shared/route.js +5 -5
- package/dist/shared/route.js.map +1 -1
- package/dist/shared/search.d.ts +3 -3
- package/dist/shared/search.d.ts.map +1 -1
- package/dist/shared/search.js +14 -14
- package/dist/shared/search.js.map +1 -1
- package/dist/shared/sidebar.d.ts +1 -1
- package/dist/shared/sidebar.d.ts.map +1 -1
- package/dist/shared/sidebar.js +4 -4
- package/dist/shared/sidebar.js.map +1 -1
- package/dist/shared/slug.d.ts +1 -1
- package/dist/shared/slug.d.ts.map +1 -1
- package/dist/shared/slug.js +5 -5
- package/dist/shared/slug.js.map +1 -1
- package/dist/shared/socialIcons.d.ts.map +1 -1
- package/dist/shared/socialIcons.js +4 -4
- package/dist/shared/socialIcons.js.map +1 -1
- package/dist/shared/tags.js +8 -8
- package/dist/shared/tags.js.map +1 -1
- package/dist/shared/theme.d.ts +1 -1
- package/dist/shared/theme.d.ts.map +1 -1
- package/dist/shared/theme.js +16 -10
- package/dist/shared/theme.js.map +1 -1
- package/dist/shared/themeLabels.d.ts +1 -1
- package/dist/shared/themeLabels.d.ts.map +1 -1
- package/dist/shared/themeLabels.js +26 -26
- package/dist/shared/themeLabels.js.map +1 -1
- package/dist/shared/url.d.ts.map +1 -1
- package/dist/shared/url.js +3 -3
- package/dist/shared/url.js.map +1 -1
- package/package.json +33 -9
- package/src/client/app.tsx +89 -92
- package/src/client/entry-client.tsx +17 -19
- package/src/client/entry-ssr.tsx +33 -33
- package/src/client/index.ts +16 -2
- package/src/client/loadPage.ts +37 -38
- package/src/client/prefetchLinks.ts +30 -30
- package/src/client/theme-default/AlgoliaSearch.tsx +46 -46
- package/src/client/theme-default/Features.tsx +27 -21
- package/src/client/theme-default/Hero.tsx +22 -18
- package/src/client/theme-default/Layout.tsx +189 -244
- package/src/client/theme-default/Logo.tsx +30 -40
- package/src/client/theme-default/NavLinks.tsx +21 -21
- package/src/client/theme-default/SidebarNav.tsx +29 -29
- package/src/client/theme-default/SocialLinks.tsx +11 -11
- package/src/client/theme-default/ThemeToggle.tsx +2 -78
- package/src/client/theme-default/index.ts +1 -1
- package/src/client/theme-default/styles.css +30 -21
- package/src/client/theme-utils.tsx +184 -0
- package/src/client/types.ts +30 -24
- package/src/client/usePageHead.ts +128 -128
- package/src/client/useSiteSearch.ts +34 -34
- package/src/client/virtual.d.ts +76 -76
- package/src/shared/contentChunk.ts +6 -6
- package/src/shared/contentSchema.ts +52 -49
- package/src/shared/deadLinks.ts +16 -16
- package/src/shared/escapeHtml.ts +5 -5
- package/src/shared/index.ts +21 -25
- package/src/shared/locale.ts +46 -46
- package/src/shared/pageChrome.ts +123 -123
- package/src/shared/pageHead.ts +16 -16
- package/src/shared/pageMeta.ts +79 -79
- package/src/shared/rewrites.ts +14 -16
- package/src/shared/route.ts +7 -7
- package/src/shared/search.ts +52 -52
- package/src/shared/sidebar.ts +28 -28
- package/src/shared/slug.ts +13 -13
- package/src/shared/socialIcons.ts +12 -14
- package/src/shared/tags.ts +20 -20
- package/src/shared/theme.ts +22 -13
- package/src/shared/themeLabels.ts +45 -45
- package/src/shared/url.ts +6 -10
- package/templates/default/.preactpress/config.ts +17 -17
- package/templates/default/README.md +16 -16
- package/templates/default/guide/first-five-minutes.md +21 -21
- package/templates/default/index.html +1 -1
- package/templates/default/index.md +9 -9
- package/templates/default/package.json +1 -1
- package/templates/default/pnpm-lock.yaml +5 -5
- package/templates/docs/.preactpress/config.ts +76 -56
- package/templates/docs/README.md +6 -6
- package/templates/docs/components/BenefitsGrid.tsx +45 -0
- package/templates/docs/components/CliBlock.tsx +38 -0
- package/templates/docs/components/ComparisonTable.tsx +60 -0
- package/templates/docs/components/CopyableCommand.tsx +86 -0
- package/templates/docs/components/Counter.tsx +7 -5
- package/templates/docs/components/MarketingHero.tsx +63 -0
- package/templates/docs/components/MdxDemo.tsx +96 -0
- package/templates/docs/components/References.tsx +62 -0
- package/templates/docs/components/TemplateGallery.tsx +46 -0
- package/templates/docs/components/marketing.css +992 -0
- package/templates/docs/examples/algolia-docsearch.md +33 -0
- package/templates/docs/examples/content-loader.data.ts +11 -0
- package/templates/docs/examples/content-loader.md +29 -0
- package/templates/docs/examples/dynamic-routes.md +16 -0
- package/templates/docs/examples/static-assets.md +13 -0
- package/templates/docs/guide/advanced.md +4 -4
- package/templates/docs/guide/commands.md +10 -10
- package/templates/docs/guide/configuration.md +43 -43
- package/templates/docs/guide/creating-pages.md +60 -39
- package/templates/docs/guide/custom-themes.md +9 -9
- package/templates/docs/guide/deploy.md +29 -29
- package/templates/docs/guide/first-five-minutes.md +22 -22
- package/templates/docs/guide/getting-started.md +29 -31
- package/templates/docs/guide/markdown-and-mdx.md +1 -1
- package/templates/docs/guide/routing.md +40 -40
- package/templates/docs/guide/what-is-preactpress.md +18 -18
- package/templates/docs/index.html +1 -1
- package/templates/docs/index.mdx +25 -0
- package/templates/docs/interactive.mdx +1 -1
- package/templates/docs/markdown-examples.md +73 -21
- package/templates/docs/package.json +1 -1
- package/templates/docs/packages/[pkg].md +15 -0
- package/templates/docs/packages/[pkg].paths.ts +20 -0
- package/templates/docs/parts/include-body.md +1 -0
- package/templates/docs/pnpm-lock.yaml +5 -5
- package/templates/docs/public/preactpress-example.txt +1 -0
- package/templates/docs/snippets/greet.ts +1 -1
- package/templates/hono/.preactpress/config.ts +65 -65
- package/templates/hono/.preactpress/theme/CodeSnippet.tsx +15 -15
- package/templates/hono/.preactpress/theme/FeatureGrid.tsx +7 -7
- package/templates/hono/.preactpress/theme/Hero.tsx +13 -13
- package/templates/hono/.preactpress/theme/Layout.tsx +122 -164
- package/templates/hono/.preactpress/theme/Logo.tsx +6 -6
- package/templates/hono/.preactpress/theme/ThemeToggle.tsx +3 -70
- package/templates/hono/.preactpress/theme/hono.css +31 -14
- package/templates/hono/README.md +17 -15
- package/templates/hono/components/Counter.tsx +7 -5
- package/templates/hono/de/guide/configuration.md +18 -20
- package/templates/hono/de/guide/deploy.md +29 -29
- package/templates/hono/de/guide/first-five-minutes.md +21 -21
- package/templates/hono/de/guide/getting-started.md +29 -29
- package/templates/hono/de/guide/routing.md +26 -25
- package/templates/hono/de/guide/seiten-erstellen.md +39 -39
- package/templates/hono/de/guide/what-is-preactpress.md +18 -18
- package/templates/hono/de/index.mdx +20 -17
- package/templates/hono/de/interactive.mdx +1 -1
- package/templates/hono/de/markdown-examples.md +6 -6
- package/templates/hono/de/parts/include-body.md +1 -0
- package/templates/hono/de/snippets/greet.ts +1 -1
- package/templates/hono/guide/configuration.md +25 -25
- package/templates/hono/guide/creating-pages.md +39 -39
- package/templates/hono/guide/deploy.md +29 -29
- package/templates/hono/guide/first-five-minutes.md +21 -21
- package/templates/hono/guide/getting-started.md +29 -29
- package/templates/hono/guide/routing.md +40 -40
- package/templates/hono/guide/what-is-preactpress.md +18 -18
- package/templates/hono/index.html +1 -1
- package/templates/hono/index.mdx +21 -17
- package/templates/hono/interactive.mdx +1 -1
- package/templates/hono/markdown-examples.md +6 -6
- package/templates/hono/package.json +1 -1
- package/templates/hono/parts/include-body.md +1 -0
- package/templates/hono/pnpm-lock.yaml +5 -5
- package/templates/hono/snippets/greet.ts +1 -1
- package/templates/magazine/.preactpress/config.ts +19 -19
- package/templates/magazine/.preactpress/theme/Layout.tsx +69 -172
- package/templates/magazine/.preactpress/theme/TeaserGrid.tsx +14 -14
- package/templates/magazine/.preactpress/theme/ThemeToggle.tsx +4 -70
- package/templates/magazine/.preactpress/theme/magazine.css +13 -8
- package/templates/magazine/README.md +30 -0
- package/templates/magazine/article-markets.md +2 -2
- package/templates/magazine/article-tech.mdx +10 -10
- package/templates/magazine/index.data.ts +9 -9
- package/templates/magazine/index.html +5 -1
- package/templates/magazine/index.mdx +1 -1
- package/templates/magazine/package.json +1 -1
- package/templates/magazine/pnpm-lock.yaml +2917 -0
- package/templates/docs/about.md +0 -10
- package/templates/docs/dist/404.html +0 -29
- package/templates/docs/dist/about/index.html +0 -32
- package/templates/docs/dist/assets/esm-DzlBxN5p.js +0 -110
- package/templates/docs/dist/assets/interactive-64o6YwrR.js +0 -9
- package/templates/docs/dist/assets/interactive-BedCloEw.js +0 -9
- package/templates/docs/dist/assets/main-BVLeh8GO.js +0 -1
- package/templates/docs/dist/assets/main-CreUBb3N.js +0 -1
- package/templates/docs/dist/assets/main-oodK-zZy.css +0 -2
- package/templates/docs/dist/de/guide/getting-started/index.html +0 -36
- package/templates/docs/dist/de/guide/what-is-preactpress/index.html +0 -38
- package/templates/docs/dist/de/index.html +0 -29
- package/templates/docs/dist/favicon-32.png +0 -0
- package/templates/docs/dist/favicon.png +0 -0
- package/templates/docs/dist/favicon.svg +0 -28
- package/templates/docs/dist/guide/advanced/index.html +0 -53
- package/templates/docs/dist/guide/commands/index.html +0 -89
- package/templates/docs/dist/guide/configuration/index.html +0 -196
- package/templates/docs/dist/guide/creating-pages/index.html +0 -234
- package/templates/docs/dist/guide/custom-themes/index.html +0 -52
- package/templates/docs/dist/guide/default-theme/index.html +0 -53
- package/templates/docs/dist/guide/deploy/index.html +0 -195
- package/templates/docs/dist/guide/first-five-minutes/index.html +0 -99
- package/templates/docs/dist/guide/getting-started/index.html +0 -173
- package/templates/docs/dist/guide/markdown-and-mdx/index.html +0 -59
- package/templates/docs/dist/guide/routing/index.html +0 -192
- package/templates/docs/dist/guide/what-is-preactpress/index.html +0 -141
- package/templates/docs/dist/index.html +0 -30
- package/templates/docs/dist/interactive/index.html +0 -37
- package/templates/docs/dist/markdown-examples/index.html +0 -231
- package/templates/docs/dist/preactpress-content/404.json +0 -8
- package/templates/docs/dist/preactpress-content/_index.json +0 -50
- package/templates/docs/dist/preactpress-content/about.json +0 -15
- package/templates/docs/dist/preactpress-content/de.json +0 -45
- package/templates/docs/dist/preactpress-content/de__guide__getting-started.json +0 -26
- package/templates/docs/dist/preactpress-content/de__guide__what-is-preactpress.json +0 -21
- package/templates/docs/dist/preactpress-content/guide__advanced.json +0 -46
- package/templates/docs/dist/preactpress-content/guide__commands.json +0 -26
- package/templates/docs/dist/preactpress-content/guide__configuration.json +0 -51
- package/templates/docs/dist/preactpress-content/guide__creating-pages.json +0 -71
- package/templates/docs/dist/preactpress-content/guide__custom-themes.json +0 -15
- package/templates/docs/dist/preactpress-content/guide__default-theme.json +0 -36
- package/templates/docs/dist/preactpress-content/guide__deploy.json +0 -56
- package/templates/docs/dist/preactpress-content/guide__first-five-minutes.json +0 -36
- package/templates/docs/dist/preactpress-content/guide__getting-started.json +0 -51
- package/templates/docs/dist/preactpress-content/guide__markdown-and-mdx.json +0 -31
- package/templates/docs/dist/preactpress-content/guide__routing.json +0 -71
- package/templates/docs/dist/preactpress-content/guide__what-is-preactpress.json +0 -51
- package/templates/docs/dist/preactpress-content/markdown-examples.json +0 -71
- package/templates/docs/dist/preactpress-content/tags__markdown.json +0 -16
- package/templates/docs/dist/preactpress-search.json +0 -166
- package/templates/docs/dist/preactpress-theme.js +0 -1
- package/templates/docs/dist/tags/markdown/index.html +0 -32
- package/templates/docs/index.md +0 -28
- package/templates/hono/dist/404.html +0 -29
- package/templates/hono/dist/README/index.html +0 -104
- package/templates/hono/dist/about/index.html +0 -32
- package/templates/hono/dist/assets/Counter-CCEByS-J.js +0 -1
- package/templates/hono/dist/assets/Hero--o6WMNvm.js +0 -2
- package/templates/hono/dist/assets/de-D5r6Ye70.js +0 -10
- package/templates/hono/dist/assets/hono-BXWYYdyv.js +0 -10
- package/templates/hono/dist/assets/interactive-Bxo-WBpC.js +0 -9
- package/templates/hono/dist/assets/interactive-BznI4IQ3.js +0 -9
- package/templates/hono/dist/assets/main-Bqi-VFEk.js +0 -2
- package/templates/hono/dist/assets/main-DIIN7FO0.css +0 -1
- package/templates/hono/dist/de/about/index.html +0 -32
- package/templates/hono/dist/de/guide/commands/index.html +0 -41
- package/templates/hono/dist/de/guide/configuration/index.html +0 -105
- package/templates/hono/dist/de/guide/deploy/index.html +0 -195
- package/templates/hono/dist/de/guide/first-five-minutes/index.html +0 -99
- package/templates/hono/dist/de/guide/getting-started/index.html +0 -173
- package/templates/hono/dist/de/guide/routing/index.html +0 -165
- package/templates/hono/dist/de/guide/seiten-erstellen/index.html +0 -234
- package/templates/hono/dist/de/guide/what-is-preactpress/index.html +0 -141
- package/templates/hono/dist/de/index.html +0 -30
- package/templates/hono/dist/de/interactive/index.html +0 -37
- package/templates/hono/dist/de/markdown-examples/index.html +0 -97
- package/templates/hono/dist/de/parts/include-body/index.html +0 -36
- package/templates/hono/dist/de/tags/markdown/index.html +0 -32
- package/templates/hono/dist/favicon-32.png +0 -0
- package/templates/hono/dist/favicon.png +0 -0
- package/templates/hono/dist/favicon.svg +0 -28
- package/templates/hono/dist/guide/commands/index.html +0 -41
- package/templates/hono/dist/guide/configuration/index.html +0 -158
- package/templates/hono/dist/guide/creating-pages/index.html +0 -234
- package/templates/hono/dist/guide/deploy/index.html +0 -195
- package/templates/hono/dist/guide/first-five-minutes/index.html +0 -99
- package/templates/hono/dist/guide/getting-started/index.html +0 -173
- package/templates/hono/dist/guide/routing/index.html +0 -165
- package/templates/hono/dist/guide/what-is-preactpress/index.html +0 -141
- package/templates/hono/dist/index.html +0 -30
- package/templates/hono/dist/interactive/index.html +0 -37
- package/templates/hono/dist/markdown-examples/index.html +0 -105
- package/templates/hono/dist/partials/shared-note/index.html +0 -30
- package/templates/hono/dist/parts/include-body/index.html +0 -36
- package/templates/hono/dist/preactpress-content/404.json +0 -8
- package/templates/hono/dist/preactpress-content/README.json +0 -26
- package/templates/hono/dist/preactpress-content/about.json +0 -15
- package/templates/hono/dist/preactpress-content/de__about.json +0 -15
- package/templates/hono/dist/preactpress-content/de__guide__commands.json +0 -36
- package/templates/hono/dist/preactpress-content/de__guide__configuration.json +0 -41
- package/templates/hono/dist/preactpress-content/de__guide__deploy.json +0 -56
- package/templates/hono/dist/preactpress-content/de__guide__first-five-minutes.json +0 -36
- package/templates/hono/dist/preactpress-content/de__guide__getting-started.json +0 -51
- package/templates/hono/dist/preactpress-content/de__guide__routing.json +0 -61
- package/templates/hono/dist/preactpress-content/de__guide__seiten-erstellen.json +0 -71
- package/templates/hono/dist/preactpress-content/de__guide__what-is-preactpress.json +0 -51
- package/templates/hono/dist/preactpress-content/de__markdown-examples.json +0 -131
- package/templates/hono/dist/preactpress-content/de__parts__include-body.json +0 -16
- package/templates/hono/dist/preactpress-content/de__tags__markdown.json +0 -16
- package/templates/hono/dist/preactpress-content/guide__commands.json +0 -36
- package/templates/hono/dist/preactpress-content/guide__configuration.json +0 -51
- package/templates/hono/dist/preactpress-content/guide__creating-pages.json +0 -71
- package/templates/hono/dist/preactpress-content/guide__deploy.json +0 -56
- package/templates/hono/dist/preactpress-content/guide__first-five-minutes.json +0 -36
- package/templates/hono/dist/preactpress-content/guide__getting-started.json +0 -51
- package/templates/hono/dist/preactpress-content/guide__routing.json +0 -61
- package/templates/hono/dist/preactpress-content/guide__what-is-preactpress.json +0 -51
- package/templates/hono/dist/preactpress-content/markdown-examples.json +0 -141
- package/templates/hono/dist/preactpress-content/partials__shared-note.json +0 -10
- package/templates/hono/dist/preactpress-content/parts__include-body.json +0 -16
- package/templates/hono/dist/preactpress-content/tags__markdown.json +0 -16
- package/templates/hono/dist/preactpress-search.json +0 -242
- package/templates/hono/dist/preactpress-theme.js +0 -1
- package/templates/hono/dist/tags/markdown/index.html +0 -32
package/src/shared/pageMeta.ts
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
import type { Feature, Hero, PageAside, PageOutlineConfig } from
|
|
1
|
+
import type { Feature, Hero, PageAside, PageOutlineConfig } from "./pageChrome.js";
|
|
2
2
|
|
|
3
|
-
export const META_DESCRIPTION_MAX = 155
|
|
4
|
-
export const PAGE_LAYOUTS = [
|
|
5
|
-
export type PageLayout = (typeof PAGE_LAYOUTS)[number]
|
|
3
|
+
export const META_DESCRIPTION_MAX = 155;
|
|
4
|
+
export const PAGE_LAYOUTS = ["doc", "home", "page"] as const;
|
|
5
|
+
export type PageLayout = (typeof PAGE_LAYOUTS)[number];
|
|
6
6
|
|
|
7
|
-
export const DEFAULT_TITLE_TEMPLATE =
|
|
7
|
+
export const DEFAULT_TITLE_TEMPLATE = ":title | :siteTitle";
|
|
8
8
|
|
|
9
9
|
/** Frontmatter and page metadata fields supported by PreactPress pages. */
|
|
10
10
|
export interface PageMetaInput {
|
|
11
|
-
meta?: Record<string, unknown
|
|
12
|
-
title?: string
|
|
13
|
-
titleTemplate?: string | false
|
|
14
|
-
description?: string
|
|
15
|
-
tags?: string[]
|
|
16
|
-
image?: string
|
|
17
|
-
pageType?:
|
|
18
|
-
layout?: PageLayout
|
|
19
|
-
navbar?: boolean
|
|
20
|
-
sidebar?: boolean
|
|
21
|
-
aside?: PageAside
|
|
22
|
-
outline?: PageOutlineConfig
|
|
23
|
-
footer?: boolean
|
|
24
|
-
editLink?: boolean
|
|
25
|
-
lastUpdated?: boolean
|
|
26
|
-
pageClass?: string
|
|
27
|
-
isHome?: boolean
|
|
28
|
-
markdownStyles?: boolean
|
|
29
|
-
hero?: Hero
|
|
30
|
-
features?: Feature[]
|
|
31
|
-
kind?:
|
|
32
|
-
html?: string
|
|
11
|
+
meta?: Record<string, unknown>;
|
|
12
|
+
title?: string;
|
|
13
|
+
titleTemplate?: string | false;
|
|
14
|
+
description?: string;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
image?: string;
|
|
17
|
+
pageType?: "website" | "article";
|
|
18
|
+
layout?: PageLayout;
|
|
19
|
+
navbar?: boolean;
|
|
20
|
+
sidebar?: boolean;
|
|
21
|
+
aside?: PageAside;
|
|
22
|
+
outline?: PageOutlineConfig;
|
|
23
|
+
footer?: boolean;
|
|
24
|
+
editLink?: boolean;
|
|
25
|
+
lastUpdated?: boolean;
|
|
26
|
+
pageClass?: string;
|
|
27
|
+
isHome?: boolean;
|
|
28
|
+
markdownStyles?: boolean;
|
|
29
|
+
hero?: Hero;
|
|
30
|
+
features?: Feature[];
|
|
31
|
+
kind?: "markdown" | "mdx";
|
|
32
|
+
html?: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/** Alias for {@link PageMetaInput} — use in themes, hooks, and custom frontmatter helpers. */
|
|
36
|
-
export type PageFrontmatter = PageMetaInput
|
|
36
|
+
export type PageFrontmatter = PageMetaInput;
|
|
37
37
|
|
|
38
38
|
export interface SiteMetaInput {
|
|
39
|
-
title: string
|
|
40
|
-
description: string
|
|
41
|
-
titleTemplate?: string | false
|
|
39
|
+
title: string;
|
|
40
|
+
description: string;
|
|
41
|
+
titleTemplate?: string | false;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export function formatTitleTemplate(
|
|
45
45
|
template: string | false | undefined,
|
|
46
|
-
params: { title?: string; siteTitle: string }
|
|
46
|
+
params: { title?: string; siteTitle: string },
|
|
47
47
|
): string {
|
|
48
48
|
if (template === false) {
|
|
49
|
-
return params.title?.trim() || params.siteTitle
|
|
49
|
+
return params.title?.trim() || params.siteTitle;
|
|
50
50
|
}
|
|
51
|
-
const pattern = template?.trim() || DEFAULT_TITLE_TEMPLATE
|
|
52
|
-
if (!params.title?.trim()) return params.siteTitle
|
|
53
|
-
return pattern
|
|
54
|
-
.replace(/:title/g, params.title.trim())
|
|
55
|
-
.replace(/:siteTitle/g, params.siteTitle)
|
|
51
|
+
const pattern = template?.trim() || DEFAULT_TITLE_TEMPLATE;
|
|
52
|
+
if (!params.title?.trim()) return params.siteTitle;
|
|
53
|
+
return pattern.replace(/:title/g, params.title.trim()).replace(/:siteTitle/g, params.siteTitle);
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
export function titleTemplateFromMeta(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
export function titleTemplateFromMeta(
|
|
57
|
+
meta: Record<string, unknown> | undefined,
|
|
58
|
+
): string | false | undefined {
|
|
59
|
+
const value = meta?.titleTemplate;
|
|
60
|
+
if (value === false) return false;
|
|
61
|
+
return typeof value === "string" ? value : undefined;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export function excerptFromHtml(html: string, maxLen = META_DESCRIPTION_MAX): string {
|
|
65
65
|
const text = html
|
|
66
|
-
.replace(/<[^>]+>/g,
|
|
67
|
-
.replace(/&[a-z0-9#]+;/gi,
|
|
68
|
-
.replace(/\s+/g,
|
|
69
|
-
.trim()
|
|
70
|
-
if (!text) return
|
|
71
|
-
if (text.length <= maxLen) return text
|
|
72
|
-
const cut = text.slice(0, maxLen)
|
|
73
|
-
const lastSpace = cut.lastIndexOf(
|
|
74
|
-
const trimmed = (lastSpace > 40 ? cut.slice(0, lastSpace) : cut).trim()
|
|
75
|
-
return `${trimmed}
|
|
66
|
+
.replace(/<[^>]+>/g, " ")
|
|
67
|
+
.replace(/&[a-z0-9#]+;/gi, " ")
|
|
68
|
+
.replace(/\s+/g, " ")
|
|
69
|
+
.trim();
|
|
70
|
+
if (!text) return "";
|
|
71
|
+
if (text.length <= maxLen) return text;
|
|
72
|
+
const cut = text.slice(0, maxLen);
|
|
73
|
+
const lastSpace = cut.lastIndexOf(" ");
|
|
74
|
+
const trimmed = (lastSpace > 40 ? cut.slice(0, lastSpace) : cut).trim();
|
|
75
|
+
return `${trimmed}…`;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export function resolvePageMeta(
|
|
79
79
|
page: PageMetaInput | undefined,
|
|
80
|
-
site: SiteMetaInput
|
|
80
|
+
site: SiteMetaInput,
|
|
81
81
|
): { title: string; description: string } {
|
|
82
|
-
const { title, description } = resolvePageHeadMeta(page, site)
|
|
83
|
-
return { title, description }
|
|
82
|
+
const { title, description } = resolvePageHeadMeta(page, site);
|
|
83
|
+
return { title, description };
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export function resolvePageHeadMeta(
|
|
87
87
|
page: PageMetaInput | undefined,
|
|
88
|
-
site: SiteMetaInput
|
|
88
|
+
site: SiteMetaInput,
|
|
89
89
|
): {
|
|
90
|
-
title: string
|
|
91
|
-
description: string
|
|
92
|
-
tags: string[]
|
|
93
|
-
image?: string
|
|
94
|
-
pageType:
|
|
90
|
+
title: string;
|
|
91
|
+
description: string;
|
|
92
|
+
tags: string[];
|
|
93
|
+
image?: string;
|
|
94
|
+
pageType: "website" | "article";
|
|
95
95
|
} {
|
|
96
|
-
const template = page?.titleTemplate ?? site.titleTemplate
|
|
96
|
+
const template = page?.titleTemplate ?? site.titleTemplate;
|
|
97
97
|
const title = formatTitleTemplate(template, {
|
|
98
98
|
title: page?.title,
|
|
99
|
-
siteTitle: site.title
|
|
100
|
-
})
|
|
99
|
+
siteTitle: site.title,
|
|
100
|
+
});
|
|
101
101
|
|
|
102
102
|
let description =
|
|
103
|
-
(page?.description && String(page.description).trim()) || site.description.trim()
|
|
103
|
+
(page?.description && String(page.description).trim()) || site.description.trim();
|
|
104
104
|
|
|
105
|
-
if (!description && page?.kind ===
|
|
106
|
-
description = excerptFromHtml(page.html)
|
|
105
|
+
if (!description && page?.kind === "markdown" && page.html) {
|
|
106
|
+
description = excerptFromHtml(page.html);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
const tags = page?.tags?.filter((tag) => tag.trim()).map((tag) => tag.trim()) ?? []
|
|
110
|
-
const image = page?.image?.trim() || undefined
|
|
111
|
-
const pageType = page?.pageType ===
|
|
109
|
+
const tags = page?.tags?.filter((tag) => tag.trim()).map((tag) => tag.trim()) ?? [];
|
|
110
|
+
const image = page?.image?.trim() || undefined;
|
|
111
|
+
const pageType = page?.pageType === "article" ? "article" : "website";
|
|
112
112
|
|
|
113
|
-
return { title, description, tags, image, pageType }
|
|
113
|
+
return { title, description, tags, image, pageType };
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export function pageImageFromMeta(meta: Record<string, unknown>): string | undefined {
|
|
117
|
-
const value = meta.ogImage ?? meta.image
|
|
118
|
-
return typeof value ===
|
|
117
|
+
const value = meta.ogImage ?? meta.image;
|
|
118
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
export function pageTypeFromMeta(meta: Record<string, unknown>):
|
|
122
|
-
return meta.type ===
|
|
121
|
+
export function pageTypeFromMeta(meta: Record<string, unknown>): "website" | "article" {
|
|
122
|
+
return meta.type === "article" ? "article" : "website";
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
export function pageLayoutFromMeta(meta: Record<string, unknown> | undefined): PageLayout {
|
|
126
|
-
const value = meta?.layout
|
|
127
|
-
return PAGE_LAYOUTS.includes(value as PageLayout) ? (value as PageLayout) :
|
|
126
|
+
const value = meta?.layout;
|
|
127
|
+
return PAGE_LAYOUTS.includes(value as PageLayout) ? (value as PageLayout) : "doc";
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
export function isPageLayout(value: unknown): value is PageLayout {
|
|
131
|
-
return PAGE_LAYOUTS.includes(value as PageLayout)
|
|
131
|
+
return PAGE_LAYOUTS.includes(value as PageLayout);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export function isDraftPage(meta: Record<string, unknown>): boolean {
|
|
135
|
-
return meta.draft === true
|
|
135
|
+
return meta.draft === true;
|
|
136
136
|
}
|
package/src/shared/rewrites.ts
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import type { ContentFile } from
|
|
2
|
-
import { normalizeRoute } from
|
|
1
|
+
import type { ContentFile } from "../node/content.js";
|
|
2
|
+
import { normalizeRoute } from "./route.js";
|
|
3
3
|
|
|
4
|
-
export type RouteRewrites = Record<string, string
|
|
4
|
+
export type RouteRewrites = Record<string, string>;
|
|
5
5
|
|
|
6
6
|
export function normalizeRewriteRoute(route: string): string {
|
|
7
|
-
return normalizeRoute(route)
|
|
7
|
+
return normalizeRoute(route);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function applyRouteRewrites(
|
|
11
11
|
routeToFile: Map<string, ContentFile>,
|
|
12
|
-
rewrites: RouteRewrites
|
|
12
|
+
rewrites: RouteRewrites,
|
|
13
13
|
): void {
|
|
14
14
|
for (const [aliasRaw, sourceRaw] of Object.entries(rewrites)) {
|
|
15
|
-
const alias = normalizeRewriteRoute(aliasRaw)
|
|
16
|
-
const source = normalizeRewriteRoute(sourceRaw)
|
|
17
|
-
const sourceFile = routeToFile.get(source)
|
|
15
|
+
const alias = normalizeRewriteRoute(aliasRaw);
|
|
16
|
+
const source = normalizeRewriteRoute(sourceRaw);
|
|
17
|
+
const sourceFile = routeToFile.get(source);
|
|
18
18
|
if (!sourceFile) {
|
|
19
|
-
throw new Error(
|
|
20
|
-
`preactpress: rewrite source route not found: ${sourceRaw} (${source})`
|
|
21
|
-
)
|
|
19
|
+
throw new Error(`preactpress: rewrite source route not found: ${sourceRaw} (${source})`);
|
|
22
20
|
}
|
|
23
|
-
const existing = routeToFile.get(alias)
|
|
21
|
+
const existing = routeToFile.get(alias);
|
|
24
22
|
if (existing && existing.file !== sourceFile.file) {
|
|
25
23
|
throw new Error(
|
|
26
|
-
`preactpress: rewrite collision for ${alias}: ${pathLabel(existing)} and ${pathLabel(sourceFile)}
|
|
27
|
-
)
|
|
24
|
+
`preactpress: rewrite collision for ${alias}: ${pathLabel(existing)} and ${pathLabel(sourceFile)}`,
|
|
25
|
+
);
|
|
28
26
|
}
|
|
29
|
-
routeToFile.set(alias, { ...sourceFile, route: alias })
|
|
27
|
+
routeToFile.set(alias, { ...sourceFile, route: alias });
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
function pathLabel(file: ContentFile): string {
|
|
34
|
-
return file.route ===
|
|
32
|
+
return file.route === "/" ? "/" : file.route;
|
|
35
33
|
}
|
package/src/shared/route.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/** Normalize a path or route to a site route (no query/hash, leading slash, no trailing slash except `/`). */
|
|
2
2
|
export function normalizeRoute(route: string): string {
|
|
3
|
-
const clean = route.split(/[?#]/, 1)[0] ||
|
|
4
|
-
const prefixed = clean.startsWith(
|
|
5
|
-
return prefixed.replace(/\/$/,
|
|
3
|
+
const clean = route.split(/[?#]/, 1)[0] || "/";
|
|
4
|
+
const prefixed = clean.startsWith("/") ? clean : `/${clean}`;
|
|
5
|
+
return prefixed.replace(/\/$/, "") || "/";
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/** Map a request pathname to a site route using the configured base. */
|
|
9
9
|
export function routeFromPathname(pathname: string, base: string): string {
|
|
10
|
-
const basePath = base ===
|
|
11
|
-
let p = pathname
|
|
12
|
-
if (basePath && p.startsWith(basePath)) p = p.slice(basePath.length) ||
|
|
13
|
-
return normalizeRoute(p)
|
|
10
|
+
const basePath = base === "/" ? "" : base.replace(/\/$/, "");
|
|
11
|
+
let p = pathname;
|
|
12
|
+
if (basePath && p.startsWith(basePath)) p = p.slice(basePath.length) || "/";
|
|
13
|
+
return normalizeRoute(p);
|
|
14
14
|
}
|
package/src/shared/search.ts
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
export type SearchProvider =
|
|
1
|
+
export type SearchProvider = "local" | "algolia";
|
|
2
2
|
|
|
3
3
|
export interface LocalSearchConfig {
|
|
4
|
-
provider:
|
|
4
|
+
provider: "local";
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export interface AlgoliaSearchOptions {
|
|
8
|
-
appId?: string
|
|
9
|
-
apiKey?: string
|
|
10
|
-
indexName?: string
|
|
11
|
-
placeholder?: string
|
|
12
|
-
maxResultsPerGroup?: number
|
|
13
|
-
disableUserPersonalization?: boolean
|
|
14
|
-
initialQuery?: string
|
|
15
|
-
recentSearchesLimit?: number
|
|
16
|
-
recentSearchesWithFavoritesLimit?: number
|
|
17
|
-
insights?: boolean
|
|
18
|
-
searchParameters?: Record<string, unknown
|
|
8
|
+
appId?: string;
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
indexName?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
maxResultsPerGroup?: number;
|
|
13
|
+
disableUserPersonalization?: boolean;
|
|
14
|
+
initialQuery?: string;
|
|
15
|
+
recentSearchesLimit?: number;
|
|
16
|
+
recentSearchesWithFavoritesLimit?: number;
|
|
17
|
+
insights?: boolean;
|
|
18
|
+
searchParameters?: Record<string, unknown>;
|
|
19
19
|
/** Locale-specific overrides (merged with root options). */
|
|
20
|
-
locales?: Record<string, Partial<AlgoliaSearchOptions
|
|
20
|
+
locales?: Record<string, Partial<AlgoliaSearchOptions>>;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface AlgoliaSearchConfig {
|
|
24
|
-
provider:
|
|
25
|
-
options: AlgoliaSearchOptions
|
|
24
|
+
provider: "algolia";
|
|
25
|
+
options: AlgoliaSearchOptions;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/** `true` keeps local sidebar search; use `{ provider }` for explicit providers. */
|
|
29
|
-
export type SearchConfig = boolean | LocalSearchConfig | AlgoliaSearchConfig
|
|
29
|
+
export type SearchConfig = boolean | LocalSearchConfig | AlgoliaSearchConfig;
|
|
30
30
|
|
|
31
31
|
export function resolveSearchProvider(search?: SearchConfig): SearchProvider | false {
|
|
32
|
-
if (search === true) return
|
|
33
|
-
if (search === false || search == null) return false
|
|
34
|
-
return search.provider
|
|
32
|
+
if (search === true) return "local";
|
|
33
|
+
if (search === false || search == null) return false;
|
|
34
|
+
return search.provider;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export function isLocalSearchEnabled(search?: SearchConfig): boolean {
|
|
38
|
-
return resolveSearchProvider(search) ===
|
|
38
|
+
return resolveSearchProvider(search) === "local";
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export function isAlgoliaSearchEnabled(search?: SearchConfig): boolean {
|
|
42
|
-
return resolveSearchProvider(search) ===
|
|
42
|
+
return resolveSearchProvider(search) === "algolia";
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export function algoliaOptionsFromSearch(search?: SearchConfig): AlgoliaSearchOptions | undefined {
|
|
46
|
-
if (typeof search ===
|
|
47
|
-
return undefined
|
|
46
|
+
if (typeof search === "object" && search.provider === "algolia") return search.options;
|
|
47
|
+
return undefined;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export function resolveAlgoliaOptions(
|
|
51
51
|
options: AlgoliaSearchOptions,
|
|
52
|
-
localeKey?: string
|
|
52
|
+
localeKey?: string,
|
|
53
53
|
): AlgoliaSearchOptions {
|
|
54
|
-
const { locales, ...root } = options
|
|
55
|
-
const override = localeKey && locales?.[localeKey] ? locales[localeKey] : {}
|
|
54
|
+
const { locales, ...root } = options;
|
|
55
|
+
const override = localeKey && locales?.[localeKey] ? locales[localeKey] : {};
|
|
56
56
|
return {
|
|
57
57
|
...root,
|
|
58
58
|
...override,
|
|
59
|
-
searchParameters: override.searchParameters ?? root.searchParameters
|
|
60
|
-
}
|
|
59
|
+
searchParameters: override.searchParameters ?? root.searchParameters,
|
|
60
|
+
};
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export function validateAlgoliaCredentials(options: AlgoliaSearchOptions): {
|
|
64
|
-
valid: boolean
|
|
65
|
-
appId?: string
|
|
66
|
-
apiKey?: string
|
|
67
|
-
indexName?: string
|
|
64
|
+
valid: boolean;
|
|
65
|
+
appId?: string;
|
|
66
|
+
apiKey?: string;
|
|
67
|
+
indexName?: string;
|
|
68
68
|
} {
|
|
69
|
-
const appId = options.appId?.trim()
|
|
70
|
-
const apiKey = options.apiKey?.trim()
|
|
71
|
-
const indexName = options.indexName?.trim()
|
|
69
|
+
const appId = options.appId?.trim();
|
|
70
|
+
const apiKey = options.apiKey?.trim();
|
|
71
|
+
const indexName = options.indexName?.trim();
|
|
72
72
|
return {
|
|
73
73
|
valid: Boolean(appId && apiKey && indexName),
|
|
74
74
|
appId,
|
|
75
75
|
apiKey,
|
|
76
|
-
indexName
|
|
77
|
-
}
|
|
76
|
+
indexName,
|
|
77
|
+
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export function getRelativeDocSearchUrl(url: string, base: string, cleanUrls = true): string {
|
|
81
|
-
const { pathname, hash } = new URL(url,
|
|
82
|
-
const normalizedBase = base ===
|
|
83
|
-
let path = pathname
|
|
81
|
+
const { pathname, hash } = new URL(url, "http://preactpress.local");
|
|
82
|
+
const normalizedBase = base === "/" ? "" : base.replace(/\/$/, "");
|
|
83
|
+
let path = pathname;
|
|
84
84
|
if (normalizedBase && path.startsWith(normalizedBase)) {
|
|
85
|
-
path = path.slice(normalizedBase.length) ||
|
|
85
|
+
path = path.slice(normalizedBase.length) || "/";
|
|
86
86
|
}
|
|
87
|
-
const route = cleanUrls ? path.replace(/\.html$/,
|
|
88
|
-
return `${route}${hash}
|
|
87
|
+
const route = cleanUrls ? path.replace(/\.html$/, "").replace(/\/index$/, "/") || "/" : path;
|
|
88
|
+
return `${route}${hash}`;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
export function navigateDocSearchResult(itemUrl: string, base: string): void {
|
|
92
|
-
const url = new URL(itemUrl, window.location.origin)
|
|
93
|
-
const normalizedBase = base ===
|
|
92
|
+
const url = new URL(itemUrl, window.location.origin);
|
|
93
|
+
const normalizedBase = base === "/" ? "" : base.replace(/\/$/, "");
|
|
94
94
|
const href =
|
|
95
95
|
normalizedBase && !url.pathname.startsWith(normalizedBase)
|
|
96
96
|
? itemUrl
|
|
97
|
-
: `${normalizedBase}${url.pathname.replace(normalizedBase,
|
|
97
|
+
: `${normalizedBase}${url.pathname.replace(normalizedBase, "") || "/"}${url.search}${url.hash}`;
|
|
98
98
|
if (url.origin !== window.location.origin) {
|
|
99
|
-
window.location.assign(href)
|
|
100
|
-
return
|
|
99
|
+
window.location.assign(href);
|
|
100
|
+
return;
|
|
101
101
|
}
|
|
102
|
-
window.history.pushState({},
|
|
103
|
-
window.dispatchEvent(new PopStateEvent(
|
|
104
|
-
window.scrollTo({ top: 0 })
|
|
102
|
+
window.history.pushState({}, "", href);
|
|
103
|
+
window.dispatchEvent(new PopStateEvent("popstate"));
|
|
104
|
+
window.scrollTo({ top: 0 });
|
|
105
105
|
}
|
package/src/shared/sidebar.ts
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import type { NavItem, ResolvedI18n, SidebarGroup, SidebarItem } from
|
|
2
|
-
import { routePathKey } from
|
|
3
|
-
import { normalizeRoute } from
|
|
1
|
+
import type { NavItem, ResolvedI18n, SidebarGroup, SidebarItem } from "../node/siteConfig.js";
|
|
2
|
+
import { routePathKey } from "./locale.js";
|
|
3
|
+
import { normalizeRoute } from "./route.js";
|
|
4
4
|
|
|
5
|
-
export type SidebarConfig = SidebarGroup[] | Record<string, SidebarGroup[]
|
|
5
|
+
export type SidebarConfig = SidebarGroup[] | Record<string, SidebarGroup[]>;
|
|
6
6
|
|
|
7
7
|
export function isPathSidebarConfig(
|
|
8
|
-
sidebar: SidebarConfig | undefined
|
|
8
|
+
sidebar: SidebarConfig | undefined,
|
|
9
9
|
): sidebar is Record<string, SidebarGroup[]> {
|
|
10
|
-
return Boolean(sidebar && !Array.isArray(sidebar))
|
|
10
|
+
return Boolean(sidebar && !Array.isArray(sidebar));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function resolveSidebarForRoute(
|
|
14
14
|
sidebar: SidebarConfig | undefined,
|
|
15
15
|
route: string,
|
|
16
|
-
i18n?: ResolvedI18n
|
|
16
|
+
i18n?: ResolvedI18n,
|
|
17
17
|
): SidebarGroup[] {
|
|
18
|
-
if (!sidebar) return []
|
|
19
|
-
if (Array.isArray(sidebar)) return sidebar
|
|
18
|
+
if (!sidebar) return [];
|
|
19
|
+
if (Array.isArray(sidebar)) return sidebar;
|
|
20
20
|
|
|
21
|
-
const pathKey = routePathKey(route, i18n)
|
|
21
|
+
const pathKey = routePathKey(route, i18n);
|
|
22
22
|
const entries = Object.entries(sidebar)
|
|
23
23
|
.map(([prefix, groups]) => ({ prefix: normalizeRoute(prefix), groups }))
|
|
24
|
-
.filter(({ prefix }) => prefix !==
|
|
25
|
-
.sort((a, b) => b.prefix.length - a.prefix.length)
|
|
24
|
+
.filter(({ prefix }) => prefix !== "/")
|
|
25
|
+
.sort((a, b) => b.prefix.length - a.prefix.length);
|
|
26
26
|
|
|
27
27
|
for (const { prefix, groups } of entries) {
|
|
28
28
|
if (pathKey === prefix || pathKey.startsWith(`${prefix}/`)) {
|
|
29
|
-
return groups
|
|
29
|
+
return groups;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
return sidebar[
|
|
33
|
+
return sidebar["/"] ?? sidebar[""] ?? [];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export function flattenSidebarLeafItems(
|
|
37
|
-
items: SidebarItem[]
|
|
37
|
+
items: SidebarItem[],
|
|
38
38
|
): Array<{ text: string; link: string }> {
|
|
39
|
-
const out: Array<{ text: string; link: string }> = []
|
|
39
|
+
const out: Array<{ text: string; link: string }> = [];
|
|
40
40
|
for (const item of items) {
|
|
41
|
-
if (item.link) out.push({ text: item.text, link: item.link })
|
|
42
|
-
if (item.items?.length) out.push(...flattenSidebarLeafItems(item.items))
|
|
41
|
+
if (item.link) out.push({ text: item.text, link: item.link });
|
|
42
|
+
if (item.items?.length) out.push(...flattenSidebarLeafItems(item.items));
|
|
43
43
|
}
|
|
44
|
-
return out
|
|
44
|
+
return out;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export function flattenSidebarItems(
|
|
48
|
-
sidebar: SidebarConfig | undefined
|
|
48
|
+
sidebar: SidebarConfig | undefined,
|
|
49
49
|
): Array<{ text: string; link: string }> {
|
|
50
|
-
return allSidebarGroups(sidebar).flatMap((group) => flattenSidebarLeafItems(group.items))
|
|
50
|
+
return allSidebarGroups(sidebar).flatMap((group) => flattenSidebarLeafItems(group.items));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export function flattenNavLeafItems(
|
|
54
|
-
items: NavItem[] | undefined
|
|
54
|
+
items: NavItem[] | undefined,
|
|
55
55
|
): Array<{ text: string; link: string }> {
|
|
56
|
-
const out: Array<{ text: string; link: string }> = []
|
|
56
|
+
const out: Array<{ text: string; link: string }> = [];
|
|
57
57
|
for (const item of items ?? []) {
|
|
58
|
-
if (item.link) out.push({ text: item.text, link: item.link })
|
|
59
|
-
if (item.items?.length) out.push(...flattenNavLeafItems(item.items))
|
|
58
|
+
if (item.link) out.push({ text: item.text, link: item.link });
|
|
59
|
+
if (item.items?.length) out.push(...flattenNavLeafItems(item.items));
|
|
60
60
|
}
|
|
61
|
-
return out
|
|
61
|
+
return out;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export function allSidebarGroups(sidebar: SidebarConfig | undefined): SidebarGroup[] {
|
|
65
|
-
if (!sidebar) return []
|
|
66
|
-
return Array.isArray(sidebar) ? sidebar : Object.values(sidebar).flat()
|
|
65
|
+
if (!sidebar) return [];
|
|
66
|
+
return Array.isArray(sidebar) ? sidebar : Object.values(sidebar).flat();
|
|
67
67
|
}
|
package/src/shared/slug.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { OutlineItem } from
|
|
1
|
+
import type { OutlineItem } from "../node/siteConfig.js";
|
|
2
2
|
|
|
3
|
-
export function slugifySegment(text: string, fallback =
|
|
3
|
+
export function slugifySegment(text: string, fallback = "section"): string {
|
|
4
4
|
const slug = text
|
|
5
5
|
.toLowerCase()
|
|
6
6
|
.trim()
|
|
7
|
-
.replace(/<[^>]+>/g,
|
|
8
|
-
.replace(/&[a-z0-9#]+;/gi,
|
|
9
|
-
.replace(/[^a-z0-9]+/g,
|
|
10
|
-
.replace(/^-+|-+$/g,
|
|
11
|
-
return slug || fallback
|
|
7
|
+
.replace(/<[^>]+>/g, "")
|
|
8
|
+
.replace(/&[a-z0-9#]+;/gi, "")
|
|
9
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
10
|
+
.replace(/^-+|-+$/g, "");
|
|
11
|
+
return slug || fallback;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function uniqueSlug(base: string, existing: OutlineItem[]): string {
|
|
15
|
-
let id = base
|
|
16
|
-
let i = 1
|
|
17
|
-
const used = new Set(existing.map((h) => h.id))
|
|
15
|
+
let id = base;
|
|
16
|
+
let i = 1;
|
|
17
|
+
const used = new Set(existing.map((h) => h.id));
|
|
18
18
|
while (used.has(id)) {
|
|
19
|
-
i += 1
|
|
20
|
-
id = `${base}-${i}
|
|
19
|
+
i += 1;
|
|
20
|
+
id = `${base}-${i}`;
|
|
21
21
|
}
|
|
22
|
-
return id
|
|
22
|
+
return id;
|
|
23
23
|
}
|
|
@@ -8,8 +8,7 @@ export const SOCIAL_ICON_SVGS: Record<string, string> = {
|
|
|
8
8
|
'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Discord</title><path fill="currentColor" d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286z"/></svg>',
|
|
9
9
|
twitter:
|
|
10
10
|
'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>X</title><path fill="currentColor" d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"/></svg>',
|
|
11
|
-
x:
|
|
12
|
-
'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>X</title><path fill="currentColor" d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"/></svg>',
|
|
11
|
+
x: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>X</title><path fill="currentColor" d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"/></svg>',
|
|
13
12
|
mastodon:
|
|
14
13
|
'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Mastodon</title><path fill="currentColor" d="M23.268 5.313c-.35-2.578-2.858-4.532-5.573-4.776-2.005-.18-3.927.586-5.01 1.776-1.083-1.19-3.005-1.956-5.01-1.776C4.97.781 2.462 2.735 2.112 5.313c-.372 2.75-.372 5.75 0 8.5.35 2.578 2.858 4.532 5.573 4.776 2.005.18 3.927-.586 5.01-1.776 1.083 1.19 3.005 1.956 5.01 1.776 2.715-.244 5.223-2.198 5.573-4.776.372-2.75.372-5.75 0-8.5ZM8.708 15.855c-1.365 0-2.47-1.105-2.47-2.47s1.105-2.47 2.47-2.47 2.47 1.105 2.47 2.47-1.105 2.47-2.47 2.47Zm6.584 0c-1.365 0-2.47-1.105-2.47-2.47s1.105-2.47 2.47-2.47 2.47 1.105 2.47 2.47-1.105 2.47-2.47 2.47Z"/></svg>',
|
|
15
14
|
bluesky:
|
|
@@ -20,25 +19,24 @@ export const SOCIAL_ICON_SVGS: Record<string, string> = {
|
|
|
20
19
|
'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>YouTube</title><path fill="currentColor" d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>',
|
|
21
20
|
slack:
|
|
22
21
|
'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Slack</title><path fill="currentColor" d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"/></svg>',
|
|
23
|
-
npm:
|
|
24
|
-
|
|
25
|
-
}
|
|
22
|
+
npm: '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>npm</title><path fill="currentColor" d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0ZM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113Z"/></svg>',
|
|
23
|
+
};
|
|
26
24
|
|
|
27
|
-
export type SocialLinkIcon = string | { svg: string }
|
|
25
|
+
export type SocialLinkIcon = string | { svg: string };
|
|
28
26
|
|
|
29
27
|
export interface SocialLink {
|
|
30
|
-
icon: SocialLinkIcon
|
|
31
|
-
link: string
|
|
32
|
-
ariaLabel?: string
|
|
28
|
+
icon: SocialLinkIcon;
|
|
29
|
+
link: string;
|
|
30
|
+
ariaLabel?: string;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
export function socialIconSvg(icon: SocialLinkIcon): string | undefined {
|
|
36
|
-
if (typeof icon ===
|
|
37
|
-
return SOCIAL_ICON_SVGS[icon.toLowerCase()]
|
|
34
|
+
if (typeof icon === "object") return icon.svg;
|
|
35
|
+
return SOCIAL_ICON_SVGS[icon.toLowerCase()];
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
export function socialLinkLabel(icon: SocialLinkIcon, ariaLabel?: string): string {
|
|
41
|
-
if (ariaLabel) return ariaLabel
|
|
42
|
-
if (typeof icon ===
|
|
43
|
-
return
|
|
39
|
+
if (ariaLabel) return ariaLabel;
|
|
40
|
+
if (typeof icon === "string") return icon;
|
|
41
|
+
return "Social link";
|
|
44
42
|
}
|