sproutsite 0.0.0-stage → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +14 -0
- package/README.md +604 -2
- package/THIRD_PARTY_NOTICES.md +85 -0
- package/VERSION +1 -0
- package/package.json +107 -5
- package/src/lib/sproutsite/colors.ts +7 -0
- package/src/lib/sproutsite/language-links.ts +60 -0
- package/src/lib/sproutsite/pages.ts +78 -0
- package/src/lib/sproutsite/rehype-ids.ts +20 -0
- package/src/lib/sproutsite/rehype-links.ts +19 -0
- package/src/lib/sproutsite/rehype-tables.ts +74 -0
- package/src/lib/sproutsite/remark-links.ts +19 -0
- package/src/lib/sproutsite/site-config.ts +110 -0
- package/src/lib/sproutsite/sitemap.ts +160 -0
- package/src/lib/sproutsite/types.ts +45 -0
- package/src/lib/sproutsite/urls.ts +79 -0
- package/src/lib/sproutsite/validation.ts +1406 -0
- package/src/package/404.astro +5 -0
- package/src/package/500.astro +5 -0
- package/src/package/components.ts +17 -0
- package/src/package/config.ts +161 -0
- package/src/package/content.ts +117 -0
- package/src/package/index.ts +3 -0
- package/src/package/manifest.ts +27 -0
- package/src/package/page.astro +124 -0
- package/src/themes/default/assets/branding/apple-touch-icon.png +0 -0
- package/src/themes/default/assets/branding/favicon-16x16.png +0 -0
- package/src/themes/default/assets/branding/favicon-32x32.png +0 -0
- package/src/themes/default/assets/branding/favicon-48x48.png +0 -0
- package/src/themes/default/assets/branding/favicon.ico +0 -0
- package/src/themes/default/assets/branding/favicon.svg +1 -0
- package/src/themes/default/assets/branding/icon-192x192.png +0 -0
- package/src/themes/default/assets/branding/icon-512x512.png +0 -0
- package/src/themes/default/assets/branding/icon-monochrome.svg +1 -0
- package/src/themes/default/assets/branding/icon.svg +18 -0
- package/src/themes/default/assets/branding/logo-dark.svg +18 -0
- package/src/themes/default/assets/branding/logo-monochrome.svg +1 -0
- package/src/themes/default/assets/branding/logo.svg +18 -0
- package/src/themes/default/assets/branding/social-card.png +0 -0
- package/src/themes/default/assets/hero-waves.svg +41 -0
- package/src/themes/default/components/atoms/Badge/Badge.astro +65 -0
- package/src/themes/default/components/atoms/Badge/Badge.css +5 -0
- package/src/themes/default/components/atoms/BrandLogo/BrandLogo.astro +26 -0
- package/src/themes/default/components/atoms/BrandLogo/BrandLogo.css +22 -0
- package/src/themes/default/components/atoms/Button/Button.astro +106 -0
- package/src/themes/default/components/atoms/Button/Button.css +14 -0
- package/src/themes/default/components/atoms/ContentImage/ContentImage.astro +54 -0
- package/src/themes/default/components/atoms/ContentImage/ContentImage.css +21 -0
- package/src/themes/default/components/atoms/Eyebrow/Eyebrow.astro +3 -0
- package/src/themes/default/components/atoms/Eyebrow/Eyebrow.css +18 -0
- package/src/themes/default/components/atoms/Icon/Icon.astro +80 -0
- package/src/themes/default/components/atoms/Icon/Icon.css +68 -0
- package/src/themes/default/components/atoms/Tab/Tab.astro +15 -0
- package/src/themes/default/components/atoms/Tab/Tab.css +34 -0
- package/src/themes/default/components/layout/Column/Column.astro +18 -0
- package/src/themes/default/components/layout/Column/Column.css +82 -0
- package/src/themes/default/components/layout/Columns/Columns.astro +163 -0
- package/src/themes/default/components/layout/Columns/Columns.css +177 -0
- package/src/themes/default/components/molecules/Accordion/Accordion.astro +17 -0
- package/src/themes/default/components/molecules/Accordion/Accordion.css +11 -0
- package/src/themes/default/components/molecules/Accordion/accordion.ts +47 -0
- package/src/themes/default/components/molecules/AccordionItem/AccordionItem.astro +100 -0
- package/src/themes/default/components/molecules/AccordionItem/AccordionItem.css +118 -0
- package/src/themes/default/components/molecules/Alert/Alert.astro +42 -0
- package/src/themes/default/components/molecules/Alert/Alert.css +13 -0
- package/src/themes/default/components/molecules/Card/Card.astro +57 -0
- package/src/themes/default/components/molecules/Card/Card.css +25 -0
- package/src/themes/default/components/molecules/CardActions/CardActions.astro +3 -0
- package/src/themes/default/components/molecules/CardActions/CardActions.css +13 -0
- package/src/themes/default/components/molecules/ContentTable/ContentTable.astro +42 -0
- package/src/themes/default/components/molecules/ContentTable/ContentTable.css +59 -0
- package/src/themes/default/components/molecules/Feature/Feature.astro +108 -0
- package/src/themes/default/components/molecules/Feature/Feature.css +157 -0
- package/src/themes/default/components/molecules/FoundationSample/FoundationSample.astro +165 -0
- package/src/themes/default/components/molecules/FoundationSample/FoundationSample.css +201 -0
- package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.astro +118 -0
- package/src/themes/default/components/molecules/LanguageSwitcher/LanguageSwitcher.css +134 -0
- package/src/themes/default/components/molecules/Tabs/Tabs.astro +33 -0
- package/src/themes/default/components/molecules/Tabs/Tabs.css +38 -0
- package/src/themes/default/components/molecules/Tabs/tabs.ts +91 -0
- package/src/themes/default/components/organisms/BlogIndex/BlogIndex.astro +86 -0
- package/src/themes/default/components/organisms/BlogIndex/BlogIndex.css +17 -0
- package/src/themes/default/components/organisms/BlogPost/BlogPost.astro +51 -0
- package/src/themes/default/components/organisms/BlogPost/BlogPost.css +5 -0
- package/src/themes/default/components/organisms/Footer/Footer.astro +57 -0
- package/src/themes/default/components/organisms/Footer/Footer.css +63 -0
- package/src/themes/default/components/organisms/Header/Header.astro +223 -0
- package/src/themes/default/components/organisms/Header/Header.css +282 -0
- package/src/themes/default/components/organisms/Hero/Hero.astro +106 -0
- package/src/themes/default/components/organisms/Hero/Hero.css +187 -0
- package/src/themes/default/components/organisms/PageTitle/PageTitle.astro +39 -0
- package/src/themes/default/components/organisms/PageTitle/PageTitle.css +25 -0
- package/src/themes/default/components/organisms/Section/Section.astro +39 -0
- package/src/themes/default/components/organisms/Section/Section.css +21 -0
- package/src/themes/default/i18n/de.yaml +38 -0
- package/src/themes/default/i18n/en.yaml +38 -0
- package/src/themes/default/i18n/index.ts +63 -0
- package/src/themes/default/layouts/ErrorPage/ErrorPage.astro +110 -0
- package/src/themes/default/layouts/PageLayout/PageLayout.astro +108 -0
- package/src/themes/default/layouts/PageLayout/PageLayout.css +15 -0
- package/src/themes/default/styles/foundation/base.css +19 -0
- package/src/themes/default/styles/foundation/focus.css +6 -0
- package/src/themes/default/styles/foundation/fonts/OFL.txt +93 -0
- package/src/themes/default/styles/foundation/fonts/nunito-latin-variable.woff2 +0 -0
- package/src/themes/default/styles/foundation/fonts.css +17 -0
- package/src/themes/default/styles/foundation/layout.css +6 -0
- package/src/themes/default/styles/foundation/prose.css +54 -0
- package/src/themes/default/styles/foundation/tokens.css +48 -0
- package/src/themes/default/styles/theme.css +99 -0
- package/src/themes/default/styles/themes/section-tones.css +30 -0
- package/third-party-licenses/daisyui-LICENSE +21 -0
- package/third-party-licenses/flag-icons-LICENSE +21 -0
- package/third-party-licenses/lucide-LICENSE +43 -0
- package/third-party-licenses/tailwindcss-LICENSE +21 -0
- package/third-party-licenses/tailwindcss-typography-LICENSE +21 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/* DaisyUI collapse uses the utilities layer; keep these local overrides there. */
|
|
2
|
+
@layer utilities {
|
|
3
|
+
.ss-accordion-item {
|
|
4
|
+
--ss-accordion-icon-color: var(--color-primary);
|
|
5
|
+
border: 1px solid var(--color-base-300);
|
|
6
|
+
border-radius: var(--radius-box);
|
|
7
|
+
background: var(--ss-accordion-surface, var(--color-base-100));
|
|
8
|
+
color: var(--color-base-content);
|
|
9
|
+
overflow-wrap: anywhere;
|
|
10
|
+
|
|
11
|
+
> .ss-accordion-item__summary {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 1rem;
|
|
16
|
+
padding: 1.25rem;
|
|
17
|
+
min-height: 4rem;
|
|
18
|
+
list-style: none;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
|
|
21
|
+
.ss-accordion-item__icon {
|
|
22
|
+
display: grid;
|
|
23
|
+
place-items: center;
|
|
24
|
+
width: 3.5rem;
|
|
25
|
+
height: 3.5rem;
|
|
26
|
+
border-radius: 1rem;
|
|
27
|
+
color: var(--ss-accordion-icon-color);
|
|
28
|
+
background-color: var(
|
|
29
|
+
--ss-accordion-icon-background,
|
|
30
|
+
color-mix(
|
|
31
|
+
in srgb,
|
|
32
|
+
var(--ss-accordion-icon-color) 8%,
|
|
33
|
+
transparent
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ss-accordion-item__title {
|
|
39
|
+
font-family: var(--font-heading);
|
|
40
|
+
font-size: 1.25rem;
|
|
41
|
+
font-weight: 700;
|
|
42
|
+
line-height: 1.4;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ss-accordion-item__indicator {
|
|
46
|
+
color: var(--color-primary);
|
|
47
|
+
|
|
48
|
+
.ss-accordion-item__up {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
.ss-icon {
|
|
52
|
+
display: block;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
> .ss-accordion-item__answer {
|
|
58
|
+
padding: 0 1.25rem;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
|
|
61
|
+
> .content-prose {
|
|
62
|
+
color: var(--color-base-content);
|
|
63
|
+
font-size: 1rem;
|
|
64
|
+
line-height: 1.6;
|
|
65
|
+
|
|
66
|
+
> :first-child {
|
|
67
|
+
margin-top: 0;
|
|
68
|
+
}
|
|
69
|
+
> :last-child {
|
|
70
|
+
margin-bottom: 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&[open] {
|
|
76
|
+
border-color: var(
|
|
77
|
+
--ss-accordion-open-border,
|
|
78
|
+
color-mix(
|
|
79
|
+
in srgb,
|
|
80
|
+
var(--color-primary) 40%,
|
|
81
|
+
var(--color-base-100)
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
background: var(
|
|
85
|
+
--ss-accordion-open-surface,
|
|
86
|
+
color-mix(
|
|
87
|
+
in srgb,
|
|
88
|
+
var(--color-primary) 5%,
|
|
89
|
+
var(--color-base-100)
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
> .ss-accordion-item__summary .ss-accordion-item__indicator {
|
|
94
|
+
.ss-accordion-item__plus {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
.ss-accordion-item__up {
|
|
98
|
+
display: block;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
> .ss-accordion-item__answer {
|
|
102
|
+
padding-bottom: 1.25rem;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&.ss-accordion-item--icon {
|
|
107
|
+
> .ss-accordion-item__summary {
|
|
108
|
+
grid-template-columns: 3.5rem minmax(0, 1fr) auto;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@media (width >= 40rem) {
|
|
112
|
+
> .ss-accordion-item__answer {
|
|
113
|
+
padding-left: 5.75rem;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
type AlertVariant = 'default' | 'info' | 'success' | 'warning' | 'error';
|
|
3
|
+
type AlertStyle = 'normal' | 'soft' | 'outline' | 'dash';
|
|
4
|
+
|
|
5
|
+
/** A DaisyUI alert with a default slot for a concise status message. */
|
|
6
|
+
interface Props {
|
|
7
|
+
/** Semantic status variant. */
|
|
8
|
+
variant?: AlertVariant;
|
|
9
|
+
/** Visual treatment independent of the status variant. */
|
|
10
|
+
style?: AlertStyle;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { variant = 'default', style = 'normal' } = Astro.props;
|
|
14
|
+
const variantClasses: Record<AlertVariant, string> = {
|
|
15
|
+
default: '',
|
|
16
|
+
info: 'alert-info',
|
|
17
|
+
success: 'alert-success',
|
|
18
|
+
warning: 'alert-warning',
|
|
19
|
+
error: 'alert-error',
|
|
20
|
+
};
|
|
21
|
+
const styleClasses: Record<AlertStyle, string> = {
|
|
22
|
+
normal: '',
|
|
23
|
+
soft: 'alert-soft',
|
|
24
|
+
outline: 'alert-outline',
|
|
25
|
+
dash: 'alert-dash',
|
|
26
|
+
};
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
role="alert"
|
|
31
|
+
class:list={[
|
|
32
|
+
'ss-alert',
|
|
33
|
+
'alert',
|
|
34
|
+
variantClasses[variant],
|
|
35
|
+
styleClasses[style],
|
|
36
|
+
]}
|
|
37
|
+
>
|
|
38
|
+
<div class="ss-alert__content">
|
|
39
|
+
{/* @slot Alert message content. */}
|
|
40
|
+
<slot />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ImageMetadata } from 'astro';
|
|
3
|
+
import { Image } from 'astro:assets';
|
|
4
|
+
|
|
5
|
+
type CardShadow = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
|
|
7
|
+
/** A reusable content card with an optional optimized local image and default content slot. */
|
|
8
|
+
interface Props {
|
|
9
|
+
/** Imported Astro image metadata for the optional figure. */
|
|
10
|
+
image?: ImageMetadata;
|
|
11
|
+
/** Required accessible alternative text when image is set. */
|
|
12
|
+
imageAlt?: string;
|
|
13
|
+
/** Elevation treatment for the card. */
|
|
14
|
+
shadow?: CardShadow;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { image, imageAlt, shadow = 'sm' } = Astro.props;
|
|
18
|
+
const shadowClasses: Record<CardShadow, string> = {
|
|
19
|
+
none: 'shadow-none',
|
|
20
|
+
sm: 'shadow-sm',
|
|
21
|
+
md: 'shadow-md',
|
|
22
|
+
lg: 'shadow-lg',
|
|
23
|
+
xl: 'shadow-xl',
|
|
24
|
+
};
|
|
25
|
+
if (Boolean(image) !== Boolean(imageAlt))
|
|
26
|
+
throw new Error(
|
|
27
|
+
'Sproutsite Card requires image and imageAlt together, or neither prop.',
|
|
28
|
+
);
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<article
|
|
32
|
+
class:list={[
|
|
33
|
+
'ss-card',
|
|
34
|
+
'card',
|
|
35
|
+
'bg-base-100',
|
|
36
|
+
shadowClasses[shadow],
|
|
37
|
+
'not-prose',
|
|
38
|
+
]}
|
|
39
|
+
>
|
|
40
|
+
{image && (
|
|
41
|
+
<figure class="ss-card__figure">
|
|
42
|
+
<Image
|
|
43
|
+
src={image}
|
|
44
|
+
alt={imageAlt!}
|
|
45
|
+
format="webp"
|
|
46
|
+
quality={80}
|
|
47
|
+
loading="lazy"
|
|
48
|
+
decoding="async"
|
|
49
|
+
class="ss-card__image"
|
|
50
|
+
/>
|
|
51
|
+
</figure>
|
|
52
|
+
)}
|
|
53
|
+
<div class="ss-card__body card-body">
|
|
54
|
+
{/* @slot Markdown-compatible card body content. */}
|
|
55
|
+
<slot />
|
|
56
|
+
</div>
|
|
57
|
+
</article>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ss-card {
|
|
3
|
+
@apply my-5 flex flex-1 flex-col overflow-hidden;
|
|
4
|
+
|
|
5
|
+
.ss-card__figure {
|
|
6
|
+
@apply overflow-hidden;
|
|
7
|
+
|
|
8
|
+
.ss-card__image {
|
|
9
|
+
@apply h-56 w-full object-cover;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ss-card__body {
|
|
14
|
+
@apply flex flex-1 flex-col;
|
|
15
|
+
|
|
16
|
+
> h3:first-child {
|
|
17
|
+
@apply card-title;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
> p {
|
|
21
|
+
@apply leading-relaxed;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
caption: string;
|
|
4
|
+
variant?: 'plain' | 'striped';
|
|
5
|
+
density?: 'comfortable' | 'compact';
|
|
6
|
+
wide?: boolean;
|
|
7
|
+
highlight?: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
caption,
|
|
12
|
+
variant = 'plain',
|
|
13
|
+
density = 'comfortable',
|
|
14
|
+
wide = false,
|
|
15
|
+
highlight,
|
|
16
|
+
} = Astro.props;
|
|
17
|
+
if (
|
|
18
|
+
!caption?.trim() ||
|
|
19
|
+
!['plain', 'striped'].includes(variant) ||
|
|
20
|
+
!['comfortable', 'compact'].includes(density) ||
|
|
21
|
+
typeof wide !== 'boolean' ||
|
|
22
|
+
(highlight !== undefined && (!Number.isInteger(highlight) || highlight < 1))
|
|
23
|
+
)
|
|
24
|
+
throw new Error(
|
|
25
|
+
'ContentTable requires a caption; variant is plain or striped, density is comfortable or compact, wide is boolean, and highlight is a positive row number.',
|
|
26
|
+
);
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
class:list={[
|
|
31
|
+
'ss-content-table',
|
|
32
|
+
'not-prose',
|
|
33
|
+
variant === 'striped' && 'ss-content-table--striped',
|
|
34
|
+
density === 'compact' && 'ss-content-table--compact',
|
|
35
|
+
wide && 'ss-content-table--wide',
|
|
36
|
+
]}
|
|
37
|
+
role="region"
|
|
38
|
+
aria-label={`Tabellenbereich: ${caption}`}
|
|
39
|
+
tabindex="0"
|
|
40
|
+
>
|
|
41
|
+
<slot />
|
|
42
|
+
</div>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ss-content-table {
|
|
3
|
+
@apply my-5 max-w-full overflow-x-auto rounded-box border border-base-300 bg-base-100 text-base-content;
|
|
4
|
+
overscroll-behavior-inline: contain;
|
|
5
|
+
|
|
6
|
+
table {
|
|
7
|
+
@apply table;
|
|
8
|
+
overflow-wrap: normal;
|
|
9
|
+
|
|
10
|
+
caption {
|
|
11
|
+
@apply px-4 py-4 text-left text-base font-semibold text-base-content;
|
|
12
|
+
caption-side: top;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
th {
|
|
16
|
+
@apply text-base-content;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
th,
|
|
20
|
+
td {
|
|
21
|
+
vertical-align: top;
|
|
22
|
+
|
|
23
|
+
&[align='left'] {
|
|
24
|
+
text-align: left;
|
|
25
|
+
}
|
|
26
|
+
&[align='center'] {
|
|
27
|
+
text-align: center;
|
|
28
|
+
}
|
|
29
|
+
&[align='right'] {
|
|
30
|
+
text-align: right;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
tr[data-highlighted] {
|
|
35
|
+
background-color: var(--color-base-200);
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
box-shadow: inset 3px 0 var(--color-primary);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.ss-content-table--striped {
|
|
42
|
+
table {
|
|
43
|
+
@apply table-zebra;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.ss-content-table--compact {
|
|
48
|
+
table {
|
|
49
|
+
@apply table-sm;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.ss-content-table--wide {
|
|
54
|
+
table {
|
|
55
|
+
min-width: 60rem;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { ComponentProps } from 'astro/types';
|
|
3
|
+
import Icon from '../../atoms/Icon/Icon.astro';
|
|
4
|
+
import { isHexColor } from '../../../../../lib/sproutsite/colors.js';
|
|
5
|
+
|
|
6
|
+
/** A compact benefit with a decorative icon, heading, and Markdown description. */
|
|
7
|
+
interface Props {
|
|
8
|
+
icon: ComponentProps<typeof Icon>['name'];
|
|
9
|
+
title: string;
|
|
10
|
+
layout?: 'horizontal' | 'vertical' | 'card';
|
|
11
|
+
iconSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
/** Explicit background: icon box, or entire surface for layout card. */
|
|
13
|
+
backgroundColor?: `#${string}`;
|
|
14
|
+
variant?: 'soft' | 'solid' | 'plain';
|
|
15
|
+
color?:
|
|
16
|
+
| 'primary'
|
|
17
|
+
| 'secondary'
|
|
18
|
+
| 'accent'
|
|
19
|
+
| 'neutral'
|
|
20
|
+
| 'info'
|
|
21
|
+
| 'success'
|
|
22
|
+
| 'warning'
|
|
23
|
+
| 'error'
|
|
24
|
+
| `#${string}`;
|
|
25
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
icon,
|
|
30
|
+
title,
|
|
31
|
+
layout = 'horizontal',
|
|
32
|
+
iconSize = 'md',
|
|
33
|
+
variant = 'soft',
|
|
34
|
+
color = 'primary',
|
|
35
|
+
backgroundColor,
|
|
36
|
+
headingLevel = 3,
|
|
37
|
+
} = Astro.props;
|
|
38
|
+
if (backgroundColor !== undefined && !isHexColor(backgroundColor))
|
|
39
|
+
throw new Error(
|
|
40
|
+
'Sproutsite Feature backgroundColor must be a CSS hex color.',
|
|
41
|
+
);
|
|
42
|
+
const iconPixels = { xs: 14, sm: 21, md: 28, lg: 42, xl: 56 } as const;
|
|
43
|
+
if (!Object.hasOwn(iconPixels, iconSize))
|
|
44
|
+
throw new Error(
|
|
45
|
+
'Sproutsite Feature iconSize must be xs, sm, md, lg, or xl.',
|
|
46
|
+
);
|
|
47
|
+
if (!['horizontal', 'vertical', 'card'].includes(layout))
|
|
48
|
+
throw new Error(
|
|
49
|
+
'Sproutsite Feature layout must be horizontal, vertical, or card.',
|
|
50
|
+
);
|
|
51
|
+
if (!title?.trim())
|
|
52
|
+
throw new Error('Sproutsite Feature requires a non-empty title.');
|
|
53
|
+
if (![2, 3, 4, 5, 6].includes(headingLevel))
|
|
54
|
+
throw new Error(
|
|
55
|
+
'Sproutsite Feature headingLevel must be 2, 3, 4, 5, or 6.',
|
|
56
|
+
);
|
|
57
|
+
const Heading = `h${headingLevel}` as 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
58
|
+
const customColor = isHexColor(color);
|
|
59
|
+
if (
|
|
60
|
+
!customColor &&
|
|
61
|
+
![
|
|
62
|
+
'primary',
|
|
63
|
+
'secondary',
|
|
64
|
+
'accent',
|
|
65
|
+
'neutral',
|
|
66
|
+
'info',
|
|
67
|
+
'success',
|
|
68
|
+
'warning',
|
|
69
|
+
'error',
|
|
70
|
+
].includes(color)
|
|
71
|
+
) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
'Sproutsite Feature color must be a semantic theme color or a valid hexadecimal CSS color.',
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
<div
|
|
79
|
+
class:list={[
|
|
80
|
+
'ss-feature',
|
|
81
|
+
'not-prose',
|
|
82
|
+
`ss-feature--${layout}`,
|
|
83
|
+
`ss-feature--icon-${iconSize}`,
|
|
84
|
+
customColor
|
|
85
|
+
? 'ss-feature--custom'
|
|
86
|
+
: layout !== 'card' && `ss-feature--${variant}`,
|
|
87
|
+
!customColor && `ss-feature--${color}`,
|
|
88
|
+
backgroundColor && layout !== 'card' && 'ss-feature--custom-background',
|
|
89
|
+
]}
|
|
90
|
+
style={
|
|
91
|
+
[
|
|
92
|
+
customColor && `--ss-feature-color: ${color};`,
|
|
93
|
+
backgroundColor && `--ss-feature-background: ${backgroundColor};`,
|
|
94
|
+
]
|
|
95
|
+
.filter(Boolean)
|
|
96
|
+
.join(' ') || undefined
|
|
97
|
+
}
|
|
98
|
+
>
|
|
99
|
+
<span class="ss-feature__icon" aria-hidden="true">
|
|
100
|
+
<Icon name={icon} size={iconPixels[iconSize]} />
|
|
101
|
+
</span>
|
|
102
|
+
<div class="ss-feature__content">
|
|
103
|
+
<Heading class="ss-feature__title">{title.trim()}</Heading>
|
|
104
|
+
<div class="ss-feature__description">
|
|
105
|
+
<slot />
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ss-feature {
|
|
3
|
+
--ss-feature-color: var(--color-primary);
|
|
4
|
+
--ss-feature-contrast: var(--color-primary-content);
|
|
5
|
+
--ss-feature-icon-box: 3.5rem;
|
|
6
|
+
--ss-feature-icon-radius: 1rem;
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: var(--ss-feature-icon-box) minmax(0, 1fr);
|
|
9
|
+
align-items: start;
|
|
10
|
+
gap: 1rem;
|
|
11
|
+
margin-bottom: 1.25em;
|
|
12
|
+
|
|
13
|
+
.ss-feature__icon {
|
|
14
|
+
display: grid;
|
|
15
|
+
place-items: center;
|
|
16
|
+
width: var(--ss-feature-icon-box);
|
|
17
|
+
height: var(--ss-feature-icon-box);
|
|
18
|
+
border-radius: var(--ss-feature-icon-radius);
|
|
19
|
+
color: var(--ss-feature-color);
|
|
20
|
+
background-color: color-mix(
|
|
21
|
+
in srgb,
|
|
22
|
+
var(--ss-feature-color) 8%,
|
|
23
|
+
transparent
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
.ss-icon {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ss-feature__content {
|
|
32
|
+
min-width: 0;
|
|
33
|
+
overflow-wrap: anywhere;
|
|
34
|
+
|
|
35
|
+
.ss-feature__title {
|
|
36
|
+
margin: 0;
|
|
37
|
+
color: inherit;
|
|
38
|
+
font-family: var(--font-heading);
|
|
39
|
+
font-size: 1.25rem;
|
|
40
|
+
font-weight: 700;
|
|
41
|
+
line-height: 1.3;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ss-feature__description {
|
|
45
|
+
margin-top: 0.375rem;
|
|
46
|
+
font-size: 1rem;
|
|
47
|
+
line-height: 1.5;
|
|
48
|
+
|
|
49
|
+
> :first-child {
|
|
50
|
+
margin-top: 0;
|
|
51
|
+
}
|
|
52
|
+
> :last-child {
|
|
53
|
+
margin-bottom: 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.ss-feature--icon-xs {
|
|
59
|
+
--ss-feature-icon-box: 1.75rem;
|
|
60
|
+
--ss-feature-icon-radius: 0.5rem;
|
|
61
|
+
}
|
|
62
|
+
&.ss-feature--icon-sm {
|
|
63
|
+
--ss-feature-icon-box: 2.625rem;
|
|
64
|
+
--ss-feature-icon-radius: 0.75rem;
|
|
65
|
+
}
|
|
66
|
+
&.ss-feature--icon-lg {
|
|
67
|
+
--ss-feature-icon-box: 5.25rem;
|
|
68
|
+
--ss-feature-icon-radius: 1.5rem;
|
|
69
|
+
}
|
|
70
|
+
&.ss-feature--icon-xl {
|
|
71
|
+
--ss-feature-icon-box: 7rem;
|
|
72
|
+
--ss-feature-icon-radius: 2rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.ss-feature--vertical {
|
|
76
|
+
grid-template-columns: minmax(0, 1fr);
|
|
77
|
+
justify-items: center;
|
|
78
|
+
text-align: center;
|
|
79
|
+
|
|
80
|
+
.ss-feature__content {
|
|
81
|
+
width: 100%;
|
|
82
|
+
max-width: 36ch;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.ss-feature--card {
|
|
87
|
+
flex: 1;
|
|
88
|
+
grid-template-columns: minmax(0, 1fr);
|
|
89
|
+
align-content: start;
|
|
90
|
+
justify-items: start;
|
|
91
|
+
text-align: start;
|
|
92
|
+
padding: 1.5rem;
|
|
93
|
+
border-radius: var(--radius-box);
|
|
94
|
+
background-color: var(
|
|
95
|
+
--ss-feature-background,
|
|
96
|
+
color-mix(in srgb, var(--ss-feature-color) 8%, transparent)
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
.ss-feature__icon {
|
|
100
|
+
width: auto;
|
|
101
|
+
height: auto;
|
|
102
|
+
border-radius: 0;
|
|
103
|
+
background: transparent;
|
|
104
|
+
color: var(--ss-feature-color);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ss-feature__content {
|
|
108
|
+
width: 100%;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&.ss-feature--solid {
|
|
113
|
+
.ss-feature__icon {
|
|
114
|
+
background-color: var(--ss-feature-color);
|
|
115
|
+
color: var(--ss-feature-contrast);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
&.ss-feature--plain {
|
|
119
|
+
.ss-feature__icon {
|
|
120
|
+
background: transparent;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
&.ss-feature--secondary {
|
|
124
|
+
--ss-feature-color: var(--color-secondary);
|
|
125
|
+
--ss-feature-contrast: var(--color-secondary-content);
|
|
126
|
+
}
|
|
127
|
+
&.ss-feature--custom-background {
|
|
128
|
+
.ss-feature__icon {
|
|
129
|
+
background-color: var(--ss-feature-background);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
&.ss-feature--accent {
|
|
133
|
+
--ss-feature-color: var(--color-accent);
|
|
134
|
+
--ss-feature-contrast: var(--color-accent-content);
|
|
135
|
+
}
|
|
136
|
+
&.ss-feature--neutral {
|
|
137
|
+
--ss-feature-color: var(--color-neutral);
|
|
138
|
+
--ss-feature-contrast: var(--color-neutral-content);
|
|
139
|
+
}
|
|
140
|
+
&.ss-feature--info {
|
|
141
|
+
--ss-feature-color: var(--color-info);
|
|
142
|
+
--ss-feature-contrast: var(--color-info-content);
|
|
143
|
+
}
|
|
144
|
+
&.ss-feature--success {
|
|
145
|
+
--ss-feature-color: var(--color-success);
|
|
146
|
+
--ss-feature-contrast: var(--color-success-content);
|
|
147
|
+
}
|
|
148
|
+
&.ss-feature--warning {
|
|
149
|
+
--ss-feature-color: var(--color-warning);
|
|
150
|
+
--ss-feature-contrast: var(--color-warning-content);
|
|
151
|
+
}
|
|
152
|
+
&.ss-feature--error {
|
|
153
|
+
--ss-feature-color: var(--color-error);
|
|
154
|
+
--ss-feature-contrast: var(--color-error-content);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|