sproutsite 0.5.28 → 0.5.29

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.
Files changed (35) hide show
  1. package/README.md +21 -4
  2. package/VERSION +1 -1
  3. package/package.json +35 -3
  4. package/src/package/404.astro +2 -2
  5. package/src/package/500.astro +2 -2
  6. package/src/package/Document.astro +119 -0
  7. package/src/package/ErrorDocument.astro +28 -0
  8. package/src/package/branding.ts +53 -0
  9. package/src/package/components.ts +19 -19
  10. package/src/package/config.ts +31 -10
  11. package/src/package/default-components.ts +31 -0
  12. package/src/package/error-copy.ts +53 -0
  13. package/src/package/manifest.ts +1 -1
  14. package/src/package/page.astro +31 -12
  15. package/src/package/styles.ts +14 -2
  16. package/src/package/theme-env.d.ts +6 -0
  17. package/src/package/theme-types.ts +119 -0
  18. package/src/package/themes.ts +305 -0
  19. package/src/themes/default/branding.ts +1 -53
  20. package/src/themes/default/components/layout/Columns/Columns.astro +1 -1
  21. package/src/themes/default/components/molecules/AccordionItem/AccordionItem.astro +2 -2
  22. package/src/themes/default/components/molecules/Card/Card.astro +1 -1
  23. package/src/themes/default/components/molecules/Feature/Feature.astro +1 -1
  24. package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro +1 -1
  25. package/src/themes/default/components/molecules/LegalIdentity/LegalIdentity.astro +4 -4
  26. package/src/themes/default/components/molecules/PrivacyInfrastructure/PrivacyInfrastructure.astro +2 -2
  27. package/src/themes/default/components/organisms/BlogIndex/BlogIndex.astro +38 -49
  28. package/src/themes/default/components/organisms/BlogPost/BlogPost.astro +16 -24
  29. package/src/themes/default/components/organisms/Footer/Footer.astro +3 -3
  30. package/src/themes/default/components/organisms/Header/Header.astro +4 -4
  31. package/src/themes/default/components/organisms/Hero/Hero.astro +3 -3
  32. package/src/themes/default/components/organisms/PageTitle/PageTitle.astro +2 -2
  33. package/src/themes/default/layouts/ErrorPage/ErrorPage.astro +38 -106
  34. package/src/themes/default/layouts/PageLayout/PageLayout.astro +6 -112
  35. package/src/themes/default/layouts/ThemeLayout/ThemeLayout.astro +6 -0
package/README.md CHANGED
@@ -504,7 +504,7 @@ export default defineConfig(
504
504
  );
505
505
  ```
506
506
 
507
- The optional list accepts existing project-relative `.css` files. The complete default theme loads first, followed by these files in list order, for all shared page layouts and locales. Missing files and invalid entries stop configuration. CSS imports, local assets and development updates use Astro/Vite; restart the dev server after changing the entry list. Omission or `styles: []` retains theme-only output. Use targeted unlayered rules for overrides such as `.ss-card { border-radius: 1.25rem; }`; normal cascade priorities and specificity still apply. Layered rules may lose to higher-priority DaisyUI or utility layers. Supported inline colour and typography settings remain in `site.yaml`. This option does not replace components or create theme inheritance. See the [small design changes guide](https://sproutsite.dev/documentation/getting-started/your-website/theme-overrides/).
507
+ The optional list accepts existing project-relative `.css` files. The resolved theme styles load first, followed by these files in list order, for all shared page layouts and locales. Missing files and invalid entries stop configuration. CSS imports, local assets and development updates use Astro/Vite; restart the dev server after changing the entry list. Omission or `styles: []` retains theme-only output. Use targeted unlayered rules for overrides such as `.ss-card { border-radius: 1.25rem; }`; normal cascade priorities and specificity still apply. Layered rules may lose to higher-priority DaisyUI or utility layers. Supported inline colour and typography settings remain in `site.yaml`. This option does not replace components or create theme inheritance. See the [small design changes guide](https://sproutsite.dev/documentation/getting-started/your-website/theme-overrides/).
508
508
 
509
509
  A small build-time Vite CSS entry imports the unchanged theme entry followed by the configured files. Astro/Vite retain responsibility for compilation, asset URLs and HMR; no stylesheet registry or browser script is added.
510
510
 
@@ -522,15 +522,32 @@ export default defineConfig(
522
522
  );
523
523
  ```
524
524
 
525
- Only `Header` and `Footer` are supported. Paths must be existing project-relative `.astro` files; unknown keys and invalid paths fail configuration. Omitted slots retain their defaults independently. Both components receive `site` (the resolved active-locale configuration) and `route` (translated content path without locale/base prefixes). Use `HeaderProps` or `FooterProps` from `sproutsite` as the component's Props type; no other required props are supplied. Error pages also use these slots; landing pages still omit the header. The shared layout retains metadata, main content, fonts, colour variables and skip link.
525
+ Only `Header` and `Footer` are supported. Paths must be existing project-relative `.astro` files; unknown keys and invalid paths fail configuration. Omitted slots retain the selected theme implementations independently. Both components receive `site` (the resolved active-locale configuration) and `route` (translated content path without locale/base prefixes). Use `HeaderProps` or `FooterProps` from `sproutsite` as the component's Props type; no other required props are supplied. Error pages also use these slots; landing pages still omit the header. The shared layout retains metadata, main content, fonts, colour variables and skip link.
526
526
 
527
527
  The public `DefaultHeader` and `DefaultFooter` exports from `sproutsite/components` always target the supplied implementations. A replacement can delegate to them without recursively resolving itself. Completely new markup requires the website team to implement responsive behavior, locale/base-aware links, active navigation and accessibility. Local files survive package updates, but their compatibility still needs review. This is not a general theme loader or an extension of the allowed MDX imports. See the [header/footer guide](https://sproutsite.dev/documentation/getting-started/your-website/header-and-footer/).
528
528
 
529
529
  Internally, the shared layout uses two private [Node package imports](https://nodejs.org/api/packages.html#subpath-imports) with default targets. Configured replacements use standard [Vite aliases](https://vite.dev/config/shared-options.html#resolve-alias), then Astro compiles the selected files normally. There is no browser-side resolver or component registry. Website components must use the public default exports rather than the private `#sproutsite/` aliases.
530
530
 
531
- The entry point for the default theme is `src/themes/default/styles/theme.css`. It documents the import order and remains the only central import. Global foundations live in `styles/foundation/`, semantic content variants in `styles/themes/`. Components follow Atomic Design: `atoms/`, `molecules/`, `organisms/`, and `layout/` for technical layout primitives. Every visible building block is organized locally as a pair, for example `components/organisms/Header/Header.astro` and `components/organisms/Header/Header.css`; `layouts/PageLayout/` follows the same pattern. Theme-owned classes begin with `ss-`, for example `ss-header` and `ss-header__inner`. The default theme is named `sproutsite`, intentionally light, and centrally defines semantic DaisyUI tokens, font sizes, spacing, radii, and shadows in its theme and foundation files.
531
+ A local descriptor uses the public theme contract:
532
532
 
533
- Another theme can replace these components and the technical CSS integration without migrating Markdown or YAML. This is not yet a configurable theme loader and deliberately does not claim every UI library can be switched through a setting.
533
+ ```ts
534
+ import { defaultTheme, type SproutsiteTheme } from 'sproutsite/themes';
535
+
536
+ export default {
537
+ name: 'website',
538
+ extends: defaultTheme,
539
+ styles: [new URL('./styles/theme.css', import.meta.url)],
540
+ components: {
541
+ Header: new URL('./components/Header.astro', import.meta.url),
542
+ },
543
+ } satisfies SproutsiteTheme;
544
+ ```
545
+
546
+ Import that descriptor into astro.config.ts and pass it as theme. ThemeProps<'Header'> and the other documented names provide component prop types. Use sproutsite/default-components to explicitly delegate to the supplied markup without resolving your own replacement recursively. Ancestor styles precede descendant styles; website CSS loads last, and website Header/Footer overrides win over the selected theme. Changing the descriptor or selected paths requires a dev-server restart; edits to selected Astro/CSS files use Astro/Vite HMR. Unknown slots, missing independent-theme slots, invalid files and cyclic inheritance stop configuration.
547
+
548
+ The entry point for the default theme is `src/themes/default/styles/theme.css`. It documents the import order and remains the only central import. Global foundations live in `styles/foundation/`, semantic content variants in `styles/themes/`. Components follow Atomic Design: `atoms/`, `molecules/`, `organisms/`, and `layout/` for technical layout primitives. Every visible building block is organized locally as a pair, for example `components/organisms/Header/Header.astro` and `components/organisms/Header/Header.css`; `layouts/PageLayout/` follows the same pattern. Theme-owned classes begin with `ss-`, for example `ss-header` and `ss-header__inner`. The default descriptor is named `default`; its DaisyUI theme is named `sproutsite`, is intentionally light, and centrally defines semantic DaisyUI tokens, font sizes, spacing, radii, and shadows in its theme and foundation files.
549
+
550
+ Another theme can replace these components and the technical CSS integration without migrating Markdown or YAML. Select a typed local descriptor through createSproutsiteConfig({ theme }). Themes can extend defaultTheme or another local descriptor, overriding components individually and appending CSS. An independent theme must provide every documented component and loads no default CSS or fonts. The shared document retains metadata, language, main, skip link and error noindex. See the [theme guide](https://sproutsite.dev/documentation/getting-started/your-website/custom-theme/).
534
551
 
535
552
  ## Accordions
536
553
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.28
1
+ 0.5.29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutsite",
3
- "version": "0.5.28",
3
+ "version": "0.5.29",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Björn Hempel",
6
6
  "description": "Agent-ready, Markdown-first Static CMS powered by Astro and TypeScript.",
@@ -32,11 +32,43 @@
32
32
  "./components": "./src/package/components.ts",
33
33
  "./starter-assets": "./src/package/starter-assets/manifest.json",
34
34
  "./page": "./src/package/page.astro",
35
- "./package.json": "./package.json"
35
+ "./package.json": "./package.json",
36
+ "./themes": "./src/package/themes.ts",
37
+ "./default-components": "./src/package/default-components.ts"
36
38
  },
37
39
  "imports": {
38
40
  "#sproutsite/header": "./src/themes/default/components/organisms/Header/Header.astro",
39
- "#sproutsite/footer": "./src/themes/default/components/organisms/Footer/Footer.astro"
41
+ "#sproutsite/footer": "./src/themes/default/components/organisms/Footer/Footer.astro",
42
+ "#sproutsite/layout": "./src/themes/default/layouts/ThemeLayout/ThemeLayout.astro",
43
+ "#sproutsite/alert": "./src/themes/default/components/molecules/Alert/Alert.astro",
44
+ "#sproutsite/contenttable": "./src/themes/default/components/molecules/ContentTable/ContentTable.astro",
45
+ "#sproutsite/foundationsample": "./src/themes/default/components/molecules/FoundationSample/FoundationSample.astro",
46
+ "#sproutsite/tabs": "./src/themes/default/components/molecules/Tabs/Tabs.astro",
47
+ "#sproutsite/tab": "./src/themes/default/components/atoms/Tab/Tab.astro",
48
+ "#sproutsite/card": "./src/themes/default/components/molecules/Card/Card.astro",
49
+ "#sproutsite/cardactions": "./src/themes/default/components/molecules/CardActions/CardActions.astro",
50
+ "#sproutsite/contentimage": "./src/themes/default/components/atoms/ContentImage/ContentImage.astro",
51
+ "#sproutsite/eyebrow": "./src/themes/default/components/atoms/Eyebrow/Eyebrow.astro",
52
+ "#sproutsite/badge": "./src/themes/default/components/atoms/Badge/Badge.astro",
53
+ "#sproutsite/button": "./src/themes/default/components/atoms/Button/Button.astro",
54
+ "#sproutsite/icon": "./src/themes/default/components/atoms/Icon/Icon.astro",
55
+ "#sproutsite/feature": "./src/themes/default/components/molecules/Feature/Feature.astro",
56
+ "#sproutsite/legalidentity": "./src/themes/default/components/molecules/LegalIdentity/LegalIdentity.astro",
57
+ "#sproutsite/privacyinfrastructure": "./src/themes/default/components/molecules/PrivacyInfrastructure/PrivacyInfrastructure.astro",
58
+ "#sproutsite/accordion": "./src/themes/default/components/molecules/Accordion/Accordion.astro",
59
+ "#sproutsite/accordionitem": "./src/themes/default/components/molecules/AccordionItem/AccordionItem.astro",
60
+ "#sproutsite/column": "./src/themes/default/components/layout/Column/Column.astro",
61
+ "#sproutsite/columns": "./src/themes/default/components/layout/Columns/Columns.astro",
62
+ "#sproutsite/hero": "./src/themes/default/components/organisms/Hero/Hero.astro",
63
+ "#sproutsite/pagetitle": "./src/themes/default/components/organisms/PageTitle/PageTitle.astro",
64
+ "#sproutsite/section": "./src/themes/default/components/organisms/Section/Section.astro",
65
+ "#sproutsite/blogindex": "./src/themes/default/components/organisms/BlogIndex/BlogIndex.astro",
66
+ "#sproutsite/blogpost": "./src/themes/default/components/organisms/BlogPost/BlogPost.astro",
67
+ "#sproutsite/errorpage": "./src/themes/default/layouts/ErrorPage/ErrorPage.astro",
68
+ "#sproutsite/brandlogo": "./src/themes/default/components/atoms/BrandLogo/BrandLogo.astro",
69
+ "#sproutsite/herobackground": "./src/themes/default/components/atoms/HeroBackground/HeroBackground.astro",
70
+ "#sproutsite/languageswitcher": "./src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro",
71
+ "#sproutsite/document": "./src/package/Document.astro"
40
72
  },
41
73
  "engines": {
42
74
  "node": ">=24.0.0"
@@ -1,5 +1,5 @@
1
1
  ---
2
- import ErrorPage from '../themes/default/layouts/ErrorPage/ErrorPage.astro';
2
+ import ErrorDocument from './ErrorDocument.astro';
3
3
  ---
4
4
 
5
- <ErrorPage status={404} />
5
+ <ErrorDocument status={404} />
@@ -1,5 +1,5 @@
1
1
  ---
2
- import ErrorPage from '../themes/default/layouts/ErrorPage/ErrorPage.astro';
2
+ import ErrorDocument from './ErrorDocument.astro';
3
3
  ---
4
4
 
5
- <ErrorPage status={500} />
5
+ <ErrorDocument status={500} />
@@ -0,0 +1,119 @@
1
+ ---
2
+ import './styles.css';
3
+ import Header from '#sproutsite/header';
4
+ import Footer from '#sproutsite/footer';
5
+ import type { SiteConfig } from '../lib/sproutsite/types.js';
6
+ import { canonicalUrl, withBase } from '../lib/sproutsite/urls.js';
7
+ import { resolveBranding } from './branding.js';
8
+ import Layout from '#sproutsite/layout';
9
+ import { paletteStyles as themePaletteStyles } from 'virtual:sproutsite/theme';
10
+ interface Props {
11
+ site: SiteConfig;
12
+ title: string;
13
+ description: string;
14
+ route: string;
15
+ layout?: 'default' | 'landing';
16
+ noindex?: boolean;
17
+ }
18
+ const {
19
+ site,
20
+ title,
21
+ description,
22
+ route,
23
+ layout = 'default',
24
+ noindex = false,
25
+ } = Astro.props;
26
+ const documentTitle = `${title} | ${site.name}`;
27
+ const canonical = noindex
28
+ ? new URL(withBase(route, site.base), site.url).href
29
+ : canonicalUrl(route, site);
30
+ const branding = await resolveBranding(site);
31
+ const socialImage = branding.sharingImage;
32
+ const paletteStyles = themePaletteStyles(
33
+ site.colors,
34
+ `site configuration (${site.i18n.locale})`,
35
+ );
36
+ ---
37
+
38
+ <!doctype html>
39
+ <html lang={site.i18n.locale} data-theme="sproutsite" style={paletteStyles}>
40
+ <head>
41
+ <meta charset="utf-8" />
42
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
43
+ <title>{documentTitle}</title>
44
+ <meta name="description" content={description} />
45
+ {noindex && <meta name="robots" content="noindex, follow" />}
46
+ <link rel="canonical" href={canonical} />
47
+ <link
48
+ rel="sitemap"
49
+ type="application/xml"
50
+ href={withBase('/sitemap.xml', site.base)}
51
+ />
52
+ <link
53
+ rel="icon"
54
+ type={branding.favicon.type}
55
+ href={branding.favicon.src}
56
+ />
57
+ {branding.shortcut && (
58
+ <link rel="icon" type="image/x-icon" href={branding.shortcut} />
59
+ )}
60
+ <link
61
+ rel="apple-touch-icon"
62
+ sizes="180x180"
63
+ href={branding.appleTouch}
64
+ />
65
+ <link rel="manifest" href={withBase('/site.webmanifest', site.base)} />
66
+ <meta property="og:title" content={documentTitle} />
67
+ <meta property="og:description" content={description} />
68
+ <meta property="og:url" content={canonical} />
69
+ <meta property="og:site_name" content={site.name} />
70
+ <meta property="og:type" content="website" />
71
+ {socialImage && (
72
+ <>
73
+ <meta property="og:image" content={socialImage.src} />
74
+ <meta
75
+ property="og:image:width"
76
+ content={String(socialImage.width)}
77
+ />
78
+ <meta
79
+ property="og:image:height"
80
+ content={String(socialImage.height)}
81
+ />
82
+ <meta property="og:image:alt" content={socialImage.alt} />
83
+ <meta name="twitter:image" content={socialImage.src} />
84
+ <meta name="twitter:image:alt" content={socialImage.alt} />
85
+ </>
86
+ )}
87
+ <meta
88
+ name="twitter:card"
89
+ content={socialImage ? 'summary_large_image' : 'summary'}
90
+ />
91
+ <meta name="twitter:title" content={documentTitle} />
92
+ <meta name="twitter:description" content={description} />
93
+ </head>
94
+ <body
95
+ data-heading-font={site.typography.headings.family}
96
+ data-eyebrow-font={site.typography.eyebrow.family}
97
+ style={{
98
+ '--ss-heading-weight': String(site.typography.headings.weight),
99
+ '--ss-eyebrow-weight': String(site.typography.eyebrow.weight),
100
+ }}
101
+ class:list={{
102
+ 'ss-page--landing': layout === 'landing',
103
+ 'ss-links--external-icons': site.links?.external?.icon === true,
104
+ }}
105
+ >
106
+ <a class="ss-skip-link" href="#main-content">
107
+ {site.i18n.locale === 'de'
108
+ ? 'Zum Inhalt springen'
109
+ : 'Skip to content'}
110
+ </a>
111
+ <Layout site={site} route={route} layout={layout}>
112
+ {layout !== 'landing' && <Header site={site} route={route} />}
113
+ <main id="main-content">
114
+ <slot />
115
+ </main>
116
+ <Footer site={site} route={route} />
117
+ </Layout>
118
+ </body>
119
+ </html>
@@ -0,0 +1,28 @@
1
+ ---
2
+ import Document from './Document.astro';
3
+ import ErrorPage from '#sproutsite/errorpage';
4
+ import { loadSiteConfig } from '../lib/sproutsite/site-config.js';
5
+ import { errorCopy } from './error-copy.js';
6
+ interface Props {
7
+ status: 404 | 500;
8
+ }
9
+ const { status } = Astro.props;
10
+ const defaults = loadSiteConfig();
11
+ const locale =
12
+ defaults.i18n.locales.find((candidate) =>
13
+ Astro.url.pathname.startsWith(`${defaults.base}${candidate}/`),
14
+ ) ?? defaults.i18n.defaultLocale;
15
+ const site = loadSiteConfig(locale);
16
+ const copy = errorCopy(status, locale === 'de');
17
+ const route = `/${status}${locale === defaults.i18n.defaultLocale ? '' : `-${locale}`}.html`;
18
+ ---
19
+
20
+ <Document
21
+ site={site}
22
+ title={copy.eyebrow}
23
+ description={copy.description}
24
+ route={route}
25
+ noindex
26
+ >
27
+ <ErrorPage status={status} site={site} copy={copy} />
28
+ </Document>
@@ -0,0 +1,53 @@
1
+ import favicon from './starter-assets/public/branding/favicon.svg?url&no-inline';
2
+ import appleTouch from './starter-assets/public/branding/apple-touch-icon.png';
3
+ import app192 from './starter-assets/public/branding/icon-192.png';
4
+ import app512 from './starter-assets/public/branding/icon-512.png';
5
+ import type { SiteConfig } from '../lib/sproutsite/types.js';
6
+ import { withBase } from '../lib/sproutsite/urls.js';
7
+ import { brandingImageMetadata } from '../lib/sproutsite/branding.js';
8
+
9
+ /** Theme defaults are neutral; all configured files belong to the website. */
10
+ export async function resolveBranding(site: SiteConfig) {
11
+ const icons = site.branding?.icons;
12
+ const publicUrl = (src: string) => withBase(src, site.base);
13
+ const faviconSrc = icons?.favicon ? publicUrl(icons.favicon) : favicon;
14
+ const faviconType = faviconSrc.toLowerCase().endsWith('.svg')
15
+ ? 'image/svg+xml'
16
+ : faviconSrc.toLowerCase().endsWith('.png')
17
+ ? 'image/png'
18
+ : 'image/x-icon';
19
+ const sharing = site.branding?.sharingImage;
20
+ const metadata = sharing
21
+ ? await brandingImageMetadata(sharing.src)
22
+ : undefined;
23
+ return {
24
+ favicon: { src: faviconSrc, type: faviconType },
25
+ shortcut: icons?.shortcut ? publicUrl(icons.shortcut) : undefined,
26
+ appleTouch: icons?.appleTouch
27
+ ? publicUrl(icons.appleTouch)
28
+ : appleTouch.src,
29
+ appIcons: [
30
+ {
31
+ src: icons?.app192 ? publicUrl(icons.app192) : app192.src,
32
+ sizes: '192x192',
33
+ type: 'image/png',
34
+ purpose: 'any',
35
+ },
36
+ {
37
+ src: icons?.app512 ? publicUrl(icons.app512) : app512.src,
38
+ sizes: '512x512',
39
+ type: 'image/png',
40
+ purpose: 'any',
41
+ },
42
+ ],
43
+ sharingImage:
44
+ sharing && metadata
45
+ ? {
46
+ src: new URL(publicUrl(sharing.src), site.url).href,
47
+ alt: sharing.alt,
48
+ width: metadata.width,
49
+ height: metadata.height,
50
+ }
51
+ : undefined,
52
+ };
53
+ }
@@ -1,22 +1,22 @@
1
- export { default as Alert } from '../themes/default/components/molecules/Alert/Alert.astro';
2
- export { default as ContentTable } from '../themes/default/components/molecules/ContentTable/ContentTable.astro';
3
- export { default as FoundationSample } from '../themes/default/components/molecules/FoundationSample/FoundationSample.astro';
4
- export { default as Tabs } from '../themes/default/components/molecules/Tabs/Tabs.astro';
5
- export { default as Tab } from '../themes/default/components/atoms/Tab/Tab.astro';
6
- export { default as Card } from '../themes/default/components/molecules/Card/Card.astro';
1
+ export { default as Alert } from '#sproutsite/alert';
2
+ export { default as ContentTable } from '#sproutsite/contenttable';
3
+ export { default as FoundationSample } from '#sproutsite/foundationsample';
4
+ export { default as Tabs } from '#sproutsite/tabs';
5
+ export { default as Tab } from '#sproutsite/tab';
6
+ export { default as Card } from '#sproutsite/card';
7
7
  export type { CardBadge } from '../lib/sproutsite/badges.js';
8
- export { default as CardActions } from '../themes/default/components/molecules/CardActions/CardActions.astro';
9
- export { default as ContentImage } from '../themes/default/components/atoms/ContentImage/ContentImage.astro';
10
- export { default as Eyebrow } from '../themes/default/components/atoms/Eyebrow/Eyebrow.astro';
11
- export { default as Badge } from '../themes/default/components/atoms/Badge/Badge.astro';
12
- export { default as Button } from '../themes/default/components/atoms/Button/Button.astro';
13
- export { default as Icon } from '../themes/default/components/atoms/Icon/Icon.astro';
14
- export { default as Feature } from '../themes/default/components/molecules/Feature/Feature.astro';
15
- export { default as LegalIdentity } from '../themes/default/components/molecules/LegalIdentity/LegalIdentity.astro';
16
- export { default as PrivacyInfrastructure } from '../themes/default/components/molecules/PrivacyInfrastructure/PrivacyInfrastructure.astro';
17
- export { default as Accordion } from '../themes/default/components/molecules/Accordion/Accordion.astro';
18
- export { default as AccordionItem } from '../themes/default/components/molecules/AccordionItem/AccordionItem.astro';
19
- export { default as Column } from '../themes/default/components/layout/Column/Column.astro';
20
- export { default as Columns } from '../themes/default/components/layout/Columns/Columns.astro';
8
+ export { default as CardActions } from '#sproutsite/cardactions';
9
+ export { default as ContentImage } from '#sproutsite/contentimage';
10
+ export { default as Eyebrow } from '#sproutsite/eyebrow';
11
+ export { default as Badge } from '#sproutsite/badge';
12
+ export { default as Button } from '#sproutsite/button';
13
+ export { default as Icon } from '#sproutsite/icon';
14
+ export { default as Feature } from '#sproutsite/feature';
15
+ export { default as LegalIdentity } from '#sproutsite/legalidentity';
16
+ export { default as PrivacyInfrastructure } from '#sproutsite/privacyinfrastructure';
17
+ export { default as Accordion } from '#sproutsite/accordion';
18
+ export { default as AccordionItem } from '#sproutsite/accordionitem';
19
+ export { default as Column } from '#sproutsite/column';
20
+ export { default as Columns } from '#sproutsite/columns';
21
21
  export { default as DefaultHeader } from '../themes/default/components/organisms/Header/Header.astro';
22
22
  export { default as DefaultFooter } from '../themes/default/components/organisms/Footer/Footer.astro';
@@ -21,29 +21,46 @@ import { validateBrandingImages } from '../lib/sproutsite/branding.js';
21
21
  import { validateHeroBackgroundImage } from '../lib/sproutsite/hero-background.js';
22
22
  import { colorStyles } from '../themes/default/colors.js';
23
23
  import { createStylesPlugin } from './styles.js';
24
+ import {
25
+ resolveTheme,
26
+ themeAliases,
27
+ themeDataPlugin,
28
+ type SproutsiteTheme,
29
+ } from './themes.js';
24
30
  import {
25
31
  resolveComponentAliases,
26
32
  type ComponentOverrides,
27
33
  } from './component-overrides.js';
28
34
 
29
35
  export interface SproutsiteConfigOptions {
30
- /** Project-relative CSS files, loaded after the default theme in list order. */
36
+ /** Select a local complete or inherited theme; omission uses default. */
37
+ theme?: SproutsiteTheme;
38
+ /** Project-relative CSS files, loaded after the selected theme in list order. */
31
39
  styles?: readonly string[];
32
40
  /** Optional website-owned Header/Footer Astro components. */
33
41
  components?: ComponentOverrides;
34
42
  }
35
43
 
36
- /** Returns the Astro configuration required by the default Sproutsite theme. */
44
+ /** Returns the Astro shared Astro configuration and selected presentation theme. */
37
45
  export function createSproutsiteConfig(options: SproutsiteConfigOptions = {}) {
38
- const stylesPlugin = createStylesPlugin(options.styles);
39
- const componentAliases = resolveComponentAliases(options.components);
46
+ const theme = resolveTheme(options.theme);
47
+ const stylesPlugin = createStylesPlugin(
48
+ options.styles,
49
+ process.cwd(),
50
+ theme.styles,
51
+ );
52
+ const componentAliases = [
53
+ ...resolveComponentAliases(options.components),
54
+ ...themeAliases(theme),
55
+ ];
40
56
  validateSproutsiteContent();
41
57
  const site = loadSiteConfig();
42
- for (const locale of site.i18n.locales) {
43
- colorStyles(
44
- loadSiteConfig(locale).colors,
45
- `src/content/site.yaml / site.${locale}.yaml`,
46
- );
58
+ if (theme.colors === 'default') {
59
+ for (const locale of site.i18n.locales)
60
+ colorStyles(
61
+ loadSiteConfig(locale).colors,
62
+ `src/content/site.yaml / site.${locale}.yaml`,
63
+ );
47
64
  }
48
65
  let sitemapMetadata: ReturnType<typeof createSitemapMetadata> | undefined;
49
66
 
@@ -176,7 +193,11 @@ export function createSproutsiteConfig(options: SproutsiteConfigOptions = {}) {
176
193
  } satisfies AstroIntegration,
177
194
  ],
178
195
  vite: {
179
- plugins: [stylesPlugin, tailwindcss()],
196
+ plugins: [
197
+ stylesPlugin,
198
+ themeDataPlugin(theme.colors),
199
+ tailwindcss(),
200
+ ],
180
201
  resolve: { alias: componentAliases },
181
202
  },
182
203
  markdown: {
@@ -0,0 +1,31 @@
1
+ export { default as Layout } from '../themes/default/layouts/ThemeLayout/ThemeLayout.astro';
2
+ export { default as Alert } from '../themes/default/components/molecules/Alert/Alert.astro';
3
+ export { default as ContentTable } from '../themes/default/components/molecules/ContentTable/ContentTable.astro';
4
+ export { default as FoundationSample } from '../themes/default/components/molecules/FoundationSample/FoundationSample.astro';
5
+ export { default as Tabs } from '../themes/default/components/molecules/Tabs/Tabs.astro';
6
+ export { default as Tab } from '../themes/default/components/atoms/Tab/Tab.astro';
7
+ export { default as Card } from '../themes/default/components/molecules/Card/Card.astro';
8
+ export { default as CardActions } from '../themes/default/components/molecules/CardActions/CardActions.astro';
9
+ export { default as ContentImage } from '../themes/default/components/atoms/ContentImage/ContentImage.astro';
10
+ export { default as Eyebrow } from '../themes/default/components/atoms/Eyebrow/Eyebrow.astro';
11
+ export { default as Badge } from '../themes/default/components/atoms/Badge/Badge.astro';
12
+ export { default as Button } from '../themes/default/components/atoms/Button/Button.astro';
13
+ export { default as Icon } from '../themes/default/components/atoms/Icon/Icon.astro';
14
+ export { default as Feature } from '../themes/default/components/molecules/Feature/Feature.astro';
15
+ export { default as LegalIdentity } from '../themes/default/components/molecules/LegalIdentity/LegalIdentity.astro';
16
+ export { default as PrivacyInfrastructure } from '../themes/default/components/molecules/PrivacyInfrastructure/PrivacyInfrastructure.astro';
17
+ export { default as Accordion } from '../themes/default/components/molecules/Accordion/Accordion.astro';
18
+ export { default as AccordionItem } from '../themes/default/components/molecules/AccordionItem/AccordionItem.astro';
19
+ export { default as Column } from '../themes/default/components/layout/Column/Column.astro';
20
+ export { default as Columns } from '../themes/default/components/layout/Columns/Columns.astro';
21
+ export { default as Header } from '../themes/default/components/organisms/Header/Header.astro';
22
+ export { default as Footer } from '../themes/default/components/organisms/Footer/Footer.astro';
23
+ export { default as Hero } from '../themes/default/components/organisms/Hero/Hero.astro';
24
+ export { default as PageTitle } from '../themes/default/components/organisms/PageTitle/PageTitle.astro';
25
+ export { default as Section } from '../themes/default/components/organisms/Section/Section.astro';
26
+ export { default as BlogIndex } from '../themes/default/components/organisms/BlogIndex/BlogIndex.astro';
27
+ export { default as BlogPost } from '../themes/default/components/organisms/BlogPost/BlogPost.astro';
28
+ export { default as ErrorPage } from '../themes/default/layouts/ErrorPage/ErrorPage.astro';
29
+ export { default as BrandLogo } from '../themes/default/components/atoms/BrandLogo/BrandLogo.astro';
30
+ export { default as HeroBackground } from '../themes/default/components/atoms/HeroBackground/HeroBackground.astro';
31
+ export { default as LanguageSwitcher } from '../themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro';
@@ -0,0 +1,53 @@
1
+ /** Localized error content is shared across presentation themes. */
2
+ export function errorCopy(status: 404 | 500, german: boolean) {
3
+ const introduction = german
4
+ ? status === 404
5
+ ? 'Diese Adresse führt gerade ins Grüne.'
6
+ : 'Auf dem Server ist gerade eine kleine Pause angesagt.'
7
+ : status === 404
8
+ ? 'This address leads a little off the garden path.'
9
+ : 'The server is taking an unscheduled breather.';
10
+ const sectionTitle = german
11
+ ? status === 404
12
+ ? 'Zurück auf den Gartenweg'
13
+ : 'Kurz durchatmen, dann weiter'
14
+ : status === 404
15
+ ? 'Back on the garden path'
16
+ : 'Take a breath, then try again';
17
+ const copy = german
18
+ ? status === 404
19
+ ? {
20
+ title: 'Hier wächst gerade nichts.',
21
+ eyebrow: '404 · Seite nicht gefunden',
22
+ description:
23
+ 'Der Agent hat überall nachgesehen. Sogar unter den Blättern. Diese Adresse konnte er leider nicht finden.',
24
+ detail: 'Vielleicht hat sich ein Tippfehler eingeschlichen oder die Seite ist umgezogen. Auf der Startseite geht es weiter.',
25
+ action: 'Zur Startseite',
26
+ }
27
+ : {
28
+ title: 'Der Agent ist kurz im Funkloch.',
29
+ eyebrow: '500 · Serverfehler',
30
+ description:
31
+ 'Wir haben gerufen. Auch ein zweites Mal. Der Agent ist gerade nicht erreichbar.',
32
+ detail: 'Hier hakt es auf dem Server. Versuch es später noch einmal. Deine Ideen laufen in der Zwischenzeit nicht weg.',
33
+ action: 'Zur Startseite',
34
+ }
35
+ : status === 404
36
+ ? {
37
+ title: 'Nothing growing here.',
38
+ eyebrow: '404 · Page not found',
39
+ description:
40
+ 'The agent looked everywhere. Even under the leaves. This address is still nowhere to be found.',
41
+ detail: 'There might be a typo, or the page may have moved. The homepage is a good place to pick up the trail.',
42
+ action: 'Back to the homepage',
43
+ }
44
+ : {
45
+ title: 'The agent has lost signal.',
46
+ eyebrow: '500 · Server error',
47
+ description:
48
+ 'We called. Twice, actually. The agent is currently out of reach.',
49
+ detail: 'Something on the server needs a little attention. Try again later. Your ideas can wait a moment.',
50
+ action: 'Back to the homepage',
51
+ };
52
+ return { introduction, sectionTitle, ...copy };
53
+ }
@@ -1,5 +1,5 @@
1
1
  import type { APIRoute } from 'astro';
2
- import { resolveBranding } from '../themes/default/branding.js';
2
+ import { resolveBranding } from './branding.js';
3
3
  import { loadSiteConfig } from '../lib/sproutsite/site-config.js';
4
4
 
5
5
  // A native static Astro endpoint keeps bundled, hashed icon URLs correct for
@@ -4,12 +4,12 @@ import { assemblePages, type AssembledPage } from '../lib/sproutsite/pages.js';
4
4
  import { loadSiteConfig } from '../lib/sproutsite/site-config.js';
5
5
  import { blogRouteFromId } from '../lib/sproutsite/urls.js';
6
6
  import { localeOf, logicalId } from '../lib/sproutsite/language-links.js';
7
- import PageLayout from '../themes/default/layouts/PageLayout/PageLayout.astro';
8
- import BlogIndex from '../themes/default/components/organisms/BlogIndex/BlogIndex.astro';
9
- import BlogPost from '../themes/default/components/organisms/BlogPost/BlogPost.astro';
10
- import Hero from '../themes/default/components/organisms/Hero/Hero.astro';
11
- import PageTitle from '../themes/default/components/organisms/PageTitle/PageTitle.astro';
12
- import Section from '../themes/default/components/organisms/Section/Section.astro';
7
+ import PageLayout from '#sproutsite/document';
8
+ import BlogIndex from '#sproutsite/blogindex';
9
+ import BlogPost from '#sproutsite/blogpost';
10
+ import Hero from '#sproutsite/hero';
11
+ import PageTitle from '#sproutsite/pagetitle';
12
+ import Section from '#sproutsite/section';
13
13
  import { getBlogCollection } from './blog.js';
14
14
 
15
15
  type Locale = 'en' | 'de';
@@ -117,12 +117,31 @@ const postSections = post
117
117
  ))}
118
118
  </PageLayout>
119
119
  ) : blogIndex && posts ? (
120
- <BlogIndex posts={posts} site={site} />
120
+ <PageLayout
121
+ site={site}
122
+ title={site.blog?.hero.title ?? 'Blog'}
123
+ description={
124
+ site.blog?.hero.description ??
125
+ (locale === 'de'
126
+ ? 'Neuigkeiten, Entscheidungen und Meilensteine.'
127
+ : 'Updates, decisions, and milestones.')
128
+ }
129
+ route="/blog/"
130
+ >
131
+ <BlogIndex posts={posts} site={site} />
132
+ </PageLayout>
121
133
  ) : post && postHero ? (
122
- <BlogPost
123
- post={post}
134
+ <PageLayout
124
135
  site={site}
125
- HeroContent={postHero.Content}
126
- sections={postSections}
127
- />
136
+ title={post.entry.data.title}
137
+ description={post.entry.data.description}
138
+ route={post.route}
139
+ >
140
+ <BlogPost
141
+ post={post}
142
+ site={site}
143
+ HeroContent={postHero.Content}
144
+ sections={postSections}
145
+ />
146
+ </PageLayout>
128
147
  ) : null}
@@ -12,6 +12,7 @@ const entry = fileURLToPath(
12
12
  export function createStylesPlugin(
13
13
  styles: readonly string[] = [],
14
14
  root = process.cwd(),
15
+ themeStyles?: readonly string[],
15
16
  ) {
16
17
  if (!Array.isArray(styles))
17
18
  throw new Error(
@@ -51,10 +52,21 @@ export function createStylesPlugin(
51
52
  transform(code: string, id: string) {
52
53
  if (
53
54
  id.split('?')[0]?.replaceAll('\\', '/') !== entry ||
54
- paths.length === 0
55
+ (paths.length === 0 && themeStyles === undefined)
55
56
  )
56
57
  return;
57
- return code + '\n' + css;
58
+ const base =
59
+ themeStyles === undefined
60
+ ? code
61
+ : themeStyles
62
+ .map(
63
+ (path) =>
64
+ '@import ' +
65
+ JSON.stringify(path.replaceAll('\\', '/')) +
66
+ ';',
67
+ )
68
+ .join('\n');
69
+ return base + '\n' + css;
58
70
  },
59
71
  };
60
72
  }