sproutsite 0.5.27 → 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 (38) hide show
  1. package/README.md +40 -3
  2. package/VERSION +1 -1
  3. package/package.json +38 -2
  4. package/src/lib/sproutsite/types.ts +8 -0
  5. package/src/package/404.astro +2 -2
  6. package/src/package/500.astro +2 -2
  7. package/src/package/Document.astro +119 -0
  8. package/src/package/ErrorDocument.astro +28 -0
  9. package/src/package/branding.ts +53 -0
  10. package/src/package/component-overrides.ts +56 -0
  11. package/src/package/components.ts +21 -19
  12. package/src/package/config.ts +40 -9
  13. package/src/package/default-components.ts +31 -0
  14. package/src/package/error-copy.ts +53 -0
  15. package/src/package/index.ts +7 -1
  16. package/src/package/manifest.ts +1 -1
  17. package/src/package/page.astro +31 -12
  18. package/src/package/styles.ts +14 -2
  19. package/src/package/theme-env.d.ts +6 -0
  20. package/src/package/theme-types.ts +119 -0
  21. package/src/package/themes.ts +305 -0
  22. package/src/themes/default/branding.ts +1 -53
  23. package/src/themes/default/components/layout/Columns/Columns.astro +1 -1
  24. package/src/themes/default/components/molecules/AccordionItem/AccordionItem.astro +2 -2
  25. package/src/themes/default/components/molecules/Card/Card.astro +1 -1
  26. package/src/themes/default/components/molecules/Feature/Feature.astro +1 -1
  27. package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro +1 -1
  28. package/src/themes/default/components/molecules/LegalIdentity/LegalIdentity.astro +4 -4
  29. package/src/themes/default/components/molecules/PrivacyInfrastructure/PrivacyInfrastructure.astro +2 -2
  30. package/src/themes/default/components/organisms/BlogIndex/BlogIndex.astro +38 -49
  31. package/src/themes/default/components/organisms/BlogPost/BlogPost.astro +16 -24
  32. package/src/themes/default/components/organisms/Footer/Footer.astro +5 -8
  33. package/src/themes/default/components/organisms/Header/Header.astro +6 -9
  34. package/src/themes/default/components/organisms/Hero/Hero.astro +3 -3
  35. package/src/themes/default/components/organisms/PageTitle/PageTitle.astro +2 -2
  36. package/src/themes/default/layouts/ErrorPage/ErrorPage.astro +38 -106
  37. package/src/themes/default/layouts/PageLayout/PageLayout.astro +6 -112
  38. package/src/themes/default/layouts/ThemeLayout/ThemeLayout.astro +6 -0
@@ -5,11 +5,10 @@ import {
5
5
  contentHref,
6
6
  } from '../../../../../lib/sproutsite/urls.js';
7
7
  import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
8
- import PageLayout from '../../../layouts/PageLayout/PageLayout.astro';
9
8
  import { t } from '../../../i18n/index.js';
10
- import Card from '../../molecules/Card/Card.astro';
11
- import CardActions from '../../molecules/CardActions/CardActions.astro';
12
- import PageTitle from '../PageTitle/PageTitle.astro';
9
+ import Card from '#sproutsite/card';
10
+ import CardActions from '#sproutsite/cardactions';
11
+ import PageTitle from '#sproutsite/pagetitle';
13
12
 
14
13
  interface Props {
15
14
  posts: CollectionEntry<'blogPages'>[];
@@ -34,56 +33,46 @@ const dateFormatter = new Intl.DateTimeFormat(site.i18n.locale, {
34
33
  });
35
34
  ---
36
35
 
37
- <PageLayout
36
+ <PageTitle
38
37
  site={site}
39
38
  title={blog.hero.title}
39
+ eyebrow={blog.hero.eyebrow}
40
40
  description={blog.hero.description}
41
- route="/blog/"
41
+ classes={site.hero.classes}
42
+ variant="hero"
43
+ />
44
+ <section
45
+ class="tone-default ss-section ss-blog-index"
46
+ aria-labelledby="blog-overview"
42
47
  >
43
- <PageTitle
44
- site={site}
45
- title={blog.hero.title}
46
- eyebrow={blog.hero.eyebrow}
47
- description={blog.hero.description}
48
- classes={site.hero.classes}
49
- variant="hero"
50
- />
51
- <section
52
- class="tone-default ss-section ss-blog-index"
53
- aria-labelledby="blog-overview"
54
- >
55
- <div class="ss-section__inner site-shell">
56
- <div class="content-prose ss-blog-index__content">
57
- <h2 id="blog-overview">{blog.articles.heading}</h2>
58
- <div class="ss-blog-index__grid">
59
- {posts.map((post) => (
60
- <Card
61
- image={post.data.image}
62
- imageAlt={post.data.imageAlt}
48
+ <div class="ss-section__inner site-shell">
49
+ <div class="content-prose ss-blog-index__content">
50
+ <h2 id="blog-overview">{blog.articles.heading}</h2>
51
+ <div class="ss-blog-index__grid">
52
+ {posts.map((post) => (
53
+ <Card image={post.data.image} imageAlt={post.data.imageAlt}>
54
+ <time
55
+ class="ss-blog-index__date"
56
+ datetime={post.data.pubDate.toISOString()}
63
57
  >
64
- <time
65
- class="ss-blog-index__date"
66
- datetime={post.data.pubDate.toISOString()}
58
+ {dateFormatter.format(post.data.pubDate)}
59
+ </time>
60
+ <h3>{post.data.title}</h3>
61
+ <p>{post.data.description}</p>
62
+ <CardActions>
63
+ <a
64
+ aria-label={`${t(locale, 'readMore')}: ${post.data.title}`}
65
+ href={contentHref(
66
+ blogRouteFromId(post.id),
67
+ site,
68
+ )}
67
69
  >
68
- {dateFormatter.format(post.data.pubDate)}
69
- </time>
70
- <h3>{post.data.title}</h3>
71
- <p>{post.data.description}</p>
72
- <CardActions>
73
- <a
74
- aria-label={`${t(locale, 'readMore')}: ${post.data.title}`}
75
- href={contentHref(
76
- blogRouteFromId(post.id),
77
- site,
78
- )}
79
- >
80
- {t(locale, 'readMore')}
81
- </a>
82
- </CardActions>
83
- </Card>
84
- ))}
85
- </div>
70
+ {t(locale, 'readMore')}
71
+ </a>
72
+ </CardActions>
73
+ </Card>
74
+ ))}
86
75
  </div>
87
76
  </div>
88
- </section>
89
- </PageLayout>
77
+ </div>
78
+ </section>
@@ -2,9 +2,8 @@
2
2
  import type { CollectionEntry } from 'astro:content';
3
3
  import type { AssembledPage } from '../../../../../lib/sproutsite/pages.js';
4
4
  import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
5
- import PageLayout from '../../../layouts/PageLayout/PageLayout.astro';
6
- import Hero from '../Hero/Hero.astro';
7
- import Section from '../Section/Section.astro';
5
+ import Hero from '#sproutsite/hero';
6
+ import Section from '#sproutsite/section';
8
7
 
9
8
  type BlogPage = CollectionEntry<'blogPages'>;
10
9
  type BlogDocument = CollectionEntry<'blogDocuments'>;
@@ -28,24 +27,17 @@ const dateFormatter = new Intl.DateTimeFormat(site.i18n.locale, {
28
27
  });
29
28
  ---
30
29
 
31
- <PageLayout
32
- site={site}
33
- title={post.entry.data.title}
34
- description={post.entry.data.description}
35
- route={post.route}
36
- >
37
- <div class="ss-blog-post">
38
- <Hero hero={post.hero!} site={site} Content={HeroContent}>
39
- <time
40
- slot="meta"
41
- class="ss-hero__meta"
42
- datetime={post.entry.data.pubDate.toISOString()}
43
- >
44
- {dateFormatter.format(post.entry.data.pubDate)}
45
- </time>
46
- </Hero>
47
- {sections.map(({ section, Content }) => (
48
- <Section section={section} Content={Content} />
49
- ))}
50
- </div>
51
- </PageLayout>
30
+ <div class="ss-blog-post">
31
+ <Hero hero={post.hero!} site={site} Content={HeroContent}>
32
+ <time
33
+ slot="meta"
34
+ class="ss-hero__meta"
35
+ datetime={post.entry.data.pubDate.toISOString()}
36
+ >
37
+ {dateFormatter.format(post.entry.data.pubDate)}
38
+ </time>
39
+ </Hero>
40
+ {sections.map(({ section, Content }) => (
41
+ <Section section={section} Content={Content} />
42
+ ))}
43
+ </div>
@@ -1,20 +1,17 @@
1
1
  ---
2
2
  import type { ComponentProps } from 'astro/types';
3
3
  import { siGithub, siInstagram, siFacebook } from 'simple-icons';
4
- import BrandLogo from '../../atoms/BrandLogo/BrandLogo.astro';
5
- import Icon from '../../atoms/Icon/Icon.astro';
6
- import LanguageSwitcher from '../../molecules/LanguageSwitcher/LanguageSwitcher.astro';
4
+ import BrandLogo from '#sproutsite/brandlogo';
5
+ import Icon from '#sproutsite/icon';
6
+ import LanguageSwitcher from '#sproutsite/languageswitcher';
7
7
  import version from '../../../../../../VERSION?raw';
8
8
  import { t } from '../../../i18n/index.js';
9
- import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
9
+ import type { FooterProps } from '../../../../../lib/sproutsite/types.js';
10
10
  import {
11
11
  contentHref,
12
12
  externalLinkAttributes,
13
13
  } from '../../../../../lib/sproutsite/urls.js';
14
- interface Props {
15
- site: SiteConfig;
16
- route: string;
17
- }
14
+ type Props = FooterProps;
18
15
  const { site, route } = Astro.props;
19
16
  const language = site.i18n.locale === 'de' ? 'de' : 'en';
20
17
  const socialIcons = {
@@ -1,21 +1,18 @@
1
1
  ---
2
- import BrandLogo from '../../atoms/BrandLogo/BrandLogo.astro';
3
- import Button from '../../atoms/Button/Button.astro';
4
- import Icon from '../../atoms/Icon/Icon.astro';
5
- import LanguageSwitcher from '../../molecules/LanguageSwitcher/LanguageSwitcher.astro';
2
+ import BrandLogo from '#sproutsite/brandlogo';
3
+ import Button from '#sproutsite/button';
4
+ import Icon from '#sproutsite/icon';
5
+ import LanguageSwitcher from '#sproutsite/languageswitcher';
6
6
  import type { ComponentProps } from 'astro/types';
7
7
  import { t } from '../../../i18n/index.js';
8
- import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
8
+ import type { HeaderProps } from '../../../../../lib/sproutsite/types.js';
9
9
  import { navigationCurrent } from './navigation.js';
10
10
  import {
11
11
  contentHref,
12
12
  externalLinkAttributes,
13
13
  } from '../../../../../lib/sproutsite/urls.js';
14
14
 
15
- interface Props {
16
- site: SiteConfig;
17
- route: string;
18
- }
15
+ type Props = HeaderProps;
19
16
  const { site, route } = Astro.props;
20
17
  const language = site.i18n.locale === 'de' ? 'de' : 'en';
21
18
  const hasLanguageSwitcher = site.header.links.some(
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import HeroBackground from '../../atoms/HeroBackground/HeroBackground.astro';
3
+ import HeroBackground from '#sproutsite/herobackground';
4
4
  import {
5
5
  selectHeroBackground,
6
6
  isSvgHeroImage,
7
7
  } from '../../../../../lib/sproutsite/hero-background.js';
8
8
  import { toneOf } from '../../../../../lib/sproutsite/pages.js';
9
9
  import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
10
- import Button from '../../atoms/Button/Button.astro';
11
- import Eyebrow from '../../atoms/Eyebrow/Eyebrow.astro';
10
+ import Button from '#sproutsite/button';
11
+ import Eyebrow from '#sproutsite/eyebrow';
12
12
 
13
13
  interface Props {
14
14
  hero: Pick<CollectionEntry<'documents' | 'blogDocuments'>, 'id' | 'data'>;
@@ -1,6 +1,6 @@
1
1
  ---
2
- import Eyebrow from '../../atoms/Eyebrow/Eyebrow.astro';
3
- import HeroBackground from '../../atoms/HeroBackground/HeroBackground.astro';
2
+ import Eyebrow from '#sproutsite/eyebrow';
3
+ import HeroBackground from '#sproutsite/herobackground';
4
4
  import type { SiteConfig } from '../../../../../lib/sproutsite/types.js';
5
5
  import { isSvgHeroImage } from '../../../../../lib/sproutsite/hero-background.js';
6
6
 
@@ -1,111 +1,43 @@
1
1
  ---
2
- import { loadSiteConfig } from '../../../../lib/sproutsite/site-config.js';
3
- import PageLayout from '../PageLayout/PageLayout.astro';
4
- import Hero from '../../components/organisms/Hero/Hero.astro';
5
- import Section from '../../components/organisms/Section/Section.astro';
6
- import Button from '../../components/atoms/Button/Button.astro';
7
-
8
- interface Props {
9
- status: 404 | 500;
10
- }
11
- const { status } = Astro.props;
12
- const defaultSite = loadSiteConfig();
13
- const locale =
14
- defaultSite.i18n.locales.find((candidate) =>
15
- Astro.url.pathname.startsWith(`${defaultSite.base}${candidate}/`),
16
- ) ?? defaultSite.i18n.defaultLocale;
17
- const site = loadSiteConfig(locale);
18
- const german = site.i18n.locale === 'de';
19
- const introduction = german
20
- ? status === 404
21
- ? 'Diese Adresse führt gerade ins Grüne.'
22
- : 'Auf dem Server ist gerade eine kleine Pause angesagt.'
23
- : status === 404
24
- ? 'This address leads a little off the garden path.'
25
- : 'The server is taking an unscheduled breather.';
26
- const sectionTitle = german
27
- ? status === 404
28
- ? 'Zurück auf den Gartenweg'
29
- : 'Kurz durchatmen, dann weiter'
30
- : status === 404
31
- ? 'Back on the garden path'
32
- : 'Take a breath, then try again';
33
- const copy = german
34
- ? status === 404
35
- ? {
36
- title: 'Hier wächst gerade nichts.',
37
- eyebrow: '404 · Seite nicht gefunden',
38
- description:
39
- 'Der Agent hat überall nachgesehen. Sogar unter den Blättern. Diese Adresse konnte er leider nicht finden.',
40
- detail: 'Vielleicht hat sich ein Tippfehler eingeschlichen oder die Seite ist umgezogen. Auf der Startseite geht es weiter.',
41
- action: 'Zur Startseite',
42
- }
43
- : {
44
- title: 'Der Agent ist kurz im Funkloch.',
45
- eyebrow: '500 · Serverfehler',
46
- description:
47
- 'Wir haben gerufen. Auch ein zweites Mal. Der Agent ist gerade nicht erreichbar.',
48
- detail: 'Hier hakt es auf dem Server. Versuch es später noch einmal. Deine Ideen laufen in der Zwischenzeit nicht weg.',
49
- action: 'Zur Startseite',
50
- }
51
- : status === 404
52
- ? {
53
- title: 'Nothing growing here.',
54
- eyebrow: '404 · Page not found',
55
- description:
56
- 'The agent looked everywhere. Even under the leaves. This address is still nowhere to be found.',
57
- detail: 'There might be a typo, or the page may have moved. The homepage is a good place to pick up the trail.',
58
- action: 'Back to the homepage',
59
- }
60
- : {
61
- title: 'The agent has lost signal.',
62
- eyebrow: '500 · Server error',
63
- description:
64
- 'We called. Twice, actually. The agent is currently out of reach.',
65
- detail: 'Something on the server needs a little attention. Try again later. Your ideas can wait a moment.',
66
- action: 'Back to the homepage',
67
- };
2
+ import Hero from '#sproutsite/hero';
3
+ import Section from '#sproutsite/section';
4
+ import Button from '#sproutsite/button';
5
+ import type { ErrorPageProps } from '../../../../package/theme-types.js';
6
+ type Props = ErrorPageProps;
7
+ const { status, site, copy } = Astro.props;
68
8
  ---
69
9
 
70
- <PageLayout
10
+ <Hero
71
11
  site={site}
72
- title={copy.eyebrow}
73
- description={copy.description}
74
- route={`/${status}${site.i18n.locale === defaultSite.i18n.defaultLocale ? '' : `-${site.i18n.locale}`}.html`}
75
- noindex
12
+ hero={{
13
+ id: String(status),
14
+ data: {
15
+ title: copy.title,
16
+ eyebrow: copy.eyebrow,
17
+ type: 'small',
18
+ tone: 'brand',
19
+ fullWidth: false,
20
+ spacing: 'default',
21
+ },
22
+ }}
23
+ >
24
+ <p>{copy.introduction}</p>
25
+ </Hero>
26
+ <Section
27
+ section={{
28
+ id: '01-error-details',
29
+ data: {
30
+ tone: 'default',
31
+ type: 'small',
32
+ fullWidth: false,
33
+ spacing: 'default',
34
+ },
35
+ }}
76
36
  >
77
- <Hero
78
- site={site}
79
- hero={{
80
- id: String(status),
81
- data: {
82
- title: copy.title,
83
- eyebrow: copy.eyebrow,
84
- type: 'small',
85
- tone: 'brand',
86
- fullWidth: false,
87
- spacing: 'default',
88
- },
89
- }}
90
- >
91
- <p>{introduction}</p>
92
- </Hero>
93
- <Section
94
- section={{
95
- id: '01-error-details',
96
- data: {
97
- tone: 'default',
98
- type: 'small',
99
- fullWidth: false,
100
- spacing: 'default',
101
- },
102
- }}
103
- >
104
- <h2>{sectionTitle}</h2>
105
- <p>{copy.description}</p>
106
- <p>{copy.detail}</p>
107
- <Button href="/" variant="primary">
108
- {copy.action}
109
- </Button>
110
- </Section>
111
- </PageLayout>
37
+ <h2>{copy.sectionTitle}</h2>
38
+ <p>{copy.description}</p>
39
+ <p>{copy.detail}</p>
40
+ <Button href="/" variant="primary">
41
+ {copy.action}
42
+ </Button>
43
+ </Section>
@@ -1,115 +1,9 @@
1
1
  ---
2
- import '../../../../package/styles.css';
3
- import Header from '../../components/organisms/Header/Header.astro';
4
- import { t } from '../../i18n/index.js';
5
- import Footer from '../../components/organisms/Footer/Footer.astro';
6
- import type { SiteConfig } from '../../../../lib/sproutsite/types.js';
7
- import { canonicalUrl, withBase } from '../../../../lib/sproutsite/urls.js';
8
- import { resolveBranding } from '../../branding.js';
9
- import { colorStyles } from '../../colors.js';
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 = colorStyles(
33
- site.colors,
34
- `site configuration (${site.i18n.locale})`,
35
- );
2
+ import Document from '../../../../package/Document.astro';
3
+ import type { DocumentProps } from '../../../../package/theme-types.js';
4
+ type Props = DocumentProps;
36
5
  ---
37
6
 
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
- {t(site.i18n.locale === 'de' ? 'de' : 'en', 'skipToContent')}
108
- </a>
109
- {layout !== 'landing' && <Header site={site} route={route} />}
110
- <main id="main-content">
111
- <slot />
112
- </main>
113
- <Footer site={site} route={route} />
114
- </body>
115
- </html>
7
+ <Document {...Astro.props}>
8
+ <slot />
9
+ </Document>
@@ -0,0 +1,6 @@
1
+ ---
2
+ import type { ThemeLayoutProps } from '../../../../package/theme-types.js';
3
+ type Props = ThemeLayoutProps;
4
+ ---
5
+
6
+ <slot />