ferst-core 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -4
- package/bin/ferst-media.mjs +96 -0
- package/components/Card.astro +53 -51
- package/components/PostCard.astro +138 -136
- package/components/SiteHeader.astro +10 -14
- package/components/blocks/Grid.astro +49 -48
- package/components/blocks/Heading.astro +4 -1
- package/components/recipes/Banner.astro +146 -146
- package/components/recipes/FeatureCards.astro +112 -118
- package/components/recipes/Gallery.astro +57 -59
- package/components/recipes/Hero.astro +112 -10
- package/components/recipes/LatestPosts.astro +295 -292
- package/components/recipes/Locations.astro +146 -143
- package/components/recipes/Marquee.astro +75 -75
- package/components/recipes/MediaCards.astro +213 -219
- package/components/recipes/Pricing.astro +149 -150
- package/components/recipes/Stats.astro +150 -157
- package/components/recipes/Tiles.astro +342 -296
- package/content/blocks.ts +1072 -1024
- package/content/imageSlots.mjs +542 -0
- package/content/schemas.ts +13 -11
- package/examples/recipes.ts +4 -0
- package/fonts/OFL.txt +1332 -287
- package/fonts/anton-latin-400-normal.woff2 +0 -0
- package/fonts/bangers-latin-400-normal.woff2 +0 -0
- package/fonts/bebas-neue-latin-400-normal.woff2 +0 -0
- package/fonts/bowlby-one-latin-400-normal.woff2 +0 -0
- package/fonts/fredoka-latin-400-normal.woff2 +0 -0
- package/fonts/fredoka-latin-600-normal.woff2 +0 -0
- package/fonts/fredoka-latin-700-normal.woff2 +0 -0
- package/fonts/knewave-latin-400-normal.woff2 +0 -0
- package/fonts/lora-latin-400-normal.woff2 +0 -0
- package/fonts/lora-latin-600-normal.woff2 +0 -0
- package/fonts/lora-latin-700-normal.woff2 +0 -0
- package/fonts/merriweather-latin-400-normal.woff2 +0 -0
- package/fonts/merriweather-latin-600-normal.woff2 +0 -0
- package/fonts/merriweather-latin-700-normal.woff2 +0 -0
- package/fonts/nunito-latin-400-normal.woff2 +0 -0
- package/fonts/nunito-latin-600-normal.woff2 +0 -0
- package/fonts/nunito-latin-700-normal.woff2 +0 -0
- package/fonts/oswald-latin-400-normal.woff2 +0 -0
- package/fonts/oswald-latin-600-normal.woff2 +0 -0
- package/fonts/oswald-latin-700-normal.woff2 +0 -0
- package/fonts/rubik-dirt-latin-400-normal.woff2 +0 -0
- package/integration.mjs +4 -14
- package/layouts/Base.astro +7 -16
- package/lib/fonts.ts +130 -0
- package/lib/gridRows.ts +197 -0
- package/lib/image-fields.ts +140 -0
- package/lib/image-size.mjs +108 -73
- package/lib/image-sizes.ts +16 -0
- package/lib/logo-header.ts +46 -0
- package/lib/media-check.mjs +524 -0
- package/lib/theme-preview.ts +203 -140
- package/lib/themeTokens.ts +235 -220
- package/package.json +3 -2
- package/styles/fonts.css +239 -76
- package/styles/theme.css +228 -160
- package/lib/gridColumns.ts +0 -22
|
@@ -1,219 +1,213 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* MediaCards — a Level-2 recipe: a grid of rich content cards with the IMAGE as a
|
|
4
|
-
* header on top (cover-cropped to a uniform ratio, like PostCard), then an optional
|
|
5
|
-
* icon badge, a title, a meta line (e.g. "Sundays 10:45 · Main hall"), a description, and
|
|
6
|
-
* an optional CTA link. The image-HEADER pattern (distinct from `tiles`, which puts
|
|
7
|
-
* the image BEHIND the text): use it for groups, team members, services or events —
|
|
8
|
-
* anywhere the photo and the copy both need to be fully legible. Whole card links
|
|
9
|
-
* when `href` is set. Token-driven, equal-height.
|
|
10
|
-
*/
|
|
11
|
-
import Icon from '../Icon.astro';
|
|
12
|
-
import {
|
|
13
|
-
import { isIconKey } from '../../lib/icons';
|
|
14
|
-
import Heading from '../blocks/Heading.astro';
|
|
15
|
-
|
|
16
|
-
import { inlineMarkdown, inlineMarkdownNoLinks } from '../../lib/inline-markdown';
|
|
17
|
-
interface Card {
|
|
18
|
-
image?: { src: string; alt?: string; focus?: string };
|
|
19
|
-
icon?: string;
|
|
20
|
-
title: string;
|
|
21
|
-
meta?: string;
|
|
22
|
-
text?: string;
|
|
23
|
-
href?: string;
|
|
24
|
-
linkLabel?: string;
|
|
25
|
-
}
|
|
26
|
-
interface Props {
|
|
27
|
-
title?: string;
|
|
28
|
-
intro?: string;
|
|
29
|
-
columns?: 2 | 3;
|
|
30
|
-
ratio?: '16/9' | '4/3' | '3/2' | '1/1' | '3/4';
|
|
31
|
-
cards?: Card[];
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{
|
|
68
|
-
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/*
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
.b-media-cards__media {
|
|
134
|
-
position:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
margin-top:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
.b-media-cards__title {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
font-size: 0.85rem;
|
|
215
|
-
font-weight: 600;
|
|
216
|
-
color: var(--gold);
|
|
217
|
-
overflow-wrap: anywhere;
|
|
218
|
-
}
|
|
219
|
-
</style>
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* MediaCards — a Level-2 recipe: a grid of rich content cards with the IMAGE as a
|
|
4
|
+
* header on top (cover-cropped to a uniform ratio, like PostCard), then an optional
|
|
5
|
+
* icon badge, a title, a meta line (e.g. "Sundays 10:45 · Main hall"), a description, and
|
|
6
|
+
* an optional CTA link. The image-HEADER pattern (distinct from `tiles`, which puts
|
|
7
|
+
* the image BEHIND the text): use it for groups, team members, services or events —
|
|
8
|
+
* anywhere the photo and the copy both need to be fully legible. Whole card links
|
|
9
|
+
* when `href` is set. Token-driven, equal-height.
|
|
10
|
+
*/
|
|
11
|
+
import Icon from '../Icon.astro';
|
|
12
|
+
import { planGrid } from '../../lib/gridRows';
|
|
13
|
+
import { isIconKey } from '../../lib/icons';
|
|
14
|
+
import Heading from '../blocks/Heading.astro';
|
|
15
|
+
|
|
16
|
+
import { inlineMarkdown, inlineMarkdownNoLinks } from '../../lib/inline-markdown';
|
|
17
|
+
interface Card {
|
|
18
|
+
image?: { src: string; alt?: string; focus?: string };
|
|
19
|
+
icon?: string;
|
|
20
|
+
title: string;
|
|
21
|
+
meta?: string;
|
|
22
|
+
text?: string;
|
|
23
|
+
href?: string;
|
|
24
|
+
linkLabel?: string;
|
|
25
|
+
}
|
|
26
|
+
interface Props {
|
|
27
|
+
title?: string;
|
|
28
|
+
intro?: string;
|
|
29
|
+
columns?: 2 | 3;
|
|
30
|
+
ratio?: '16/9' | '4/3' | '3/2' | '1/1' | '3/4';
|
|
31
|
+
cards?: Card[];
|
|
32
|
+
/** How the ragged last row lays out (lib/gridRows). */
|
|
33
|
+
lastRow?: 'auto' | 'fill' | 'center';
|
|
34
|
+
}
|
|
35
|
+
const { title, intro, columns = 3, ratio = '16/9', cards = [], lastRow = 'auto' } = Astro.props;
|
|
36
|
+
// Rows planned per screen (lib/gridRows); `data-single` centres a lone card.
|
|
37
|
+
const plan = planGrid(cards.length, { columns, item: 'mediaCards', lastRow });
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
<section class="b-media-cards">
|
|
41
|
+
{(title || intro) && (
|
|
42
|
+
<div class="b-media-cards__head">
|
|
43
|
+
{title && <Heading text={title} level={2} />}
|
|
44
|
+
{intro && <p class="b-media-cards__intro" set:html={inlineMarkdown(intro)} />}
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
<div class="b-media-cards__grid ferst-rows" data-cols={plan.cols} data-single={cards.length === 1 ? 'true' : undefined} style={plan.gridStyle}>
|
|
48
|
+
{cards.map((card, i) => {
|
|
49
|
+
// Surface a mailto:/tel: as visible, copyable text — a plain mailto does
|
|
50
|
+
// nothing on a device with no mail app, so the address must be readable too.
|
|
51
|
+
const email = card.href?.startsWith('mailto:') ? card.href.slice(7).split('?')[0] : null;
|
|
52
|
+
const phone = card.href?.startsWith('tel:') ? card.href.slice(4) : null;
|
|
53
|
+
return (
|
|
54
|
+
<article class:list={['b-media-cards__card', 'ferst-tile', 'ferst-tile--sm', card.href && 'is-link']} style={plan.itemStyles[i]}>
|
|
55
|
+
{card.image && (
|
|
56
|
+
<div class="b-media-cards__media" data-ratio={ratio} style={`aspect-ratio: ${ratio.replace('/', ' / ')}`}>
|
|
57
|
+
<img src={card.image.src} alt={card.image.alt ?? ''} loading="lazy" style={card.image.focus ? `object-position: ${card.image.focus}` : undefined} />
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
<div class="b-media-cards__body">
|
|
61
|
+
{card.icon && isIconKey(card.icon) && (
|
|
62
|
+
<span class="b-media-cards__badge" aria-hidden="true"><Icon name={card.icon} size={20} /></span>
|
|
63
|
+
)}
|
|
64
|
+
<h3 class="b-media-cards__title">
|
|
65
|
+
{card.href ? <a href={card.href}>{card.title}</a> : card.title}
|
|
66
|
+
</h3>
|
|
67
|
+
{card.meta && <p class="b-media-cards__meta">{card.meta}</p>}
|
|
68
|
+
{card.text && <p class="b-media-cards__text" set:html={card.href ? inlineMarkdownNoLinks(card.text) : inlineMarkdown(card.text)} />}
|
|
69
|
+
{(email || phone) && (
|
|
70
|
+
<span class="b-media-cards__contact">{email ?? phone}</span>
|
|
71
|
+
)}
|
|
72
|
+
{card.href && !email && !phone && (
|
|
73
|
+
<span class="b-media-cards__cta" aria-hidden="true">{card.linkLabel ?? 'Learn more'} →</span>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
</article>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</div>
|
|
80
|
+
</section>
|
|
81
|
+
|
|
82
|
+
<style>
|
|
83
|
+
.b-media-cards {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
gap: 2rem;
|
|
87
|
+
width: 100%; /* the full content width, whatever its items hold (lib/gridRows) */
|
|
88
|
+
max-width: 72rem;
|
|
89
|
+
margin-inline: auto;
|
|
90
|
+
padding-inline: 1rem;
|
|
91
|
+
}
|
|
92
|
+
.b-media-cards__head {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: 0.75rem;
|
|
96
|
+
}
|
|
97
|
+
.b-media-cards__intro {
|
|
98
|
+
margin: 0;
|
|
99
|
+
color: var(--muted);
|
|
100
|
+
font-size: 1.0625rem;
|
|
101
|
+
line-height: 1.6;
|
|
102
|
+
max-width: var(--max);
|
|
103
|
+
}
|
|
104
|
+
.b-media-cards__grid {
|
|
105
|
+
display: grid;
|
|
106
|
+
gap: 1.5rem;
|
|
107
|
+
}
|
|
108
|
+
/* A solitary card is a centred feature, not a full-width slab. */
|
|
109
|
+
.b-media-cards__grid[data-single] { max-width: 28rem; margin-inline: auto; }
|
|
110
|
+
/* Rows come from lib/gridRows (the global .ferst-rows rules): even rows where the
|
|
111
|
+
count allows by using fewer columns, else full rows and a tidied last row. */
|
|
112
|
+
.b-media-cards__card {
|
|
113
|
+
position: relative;
|
|
114
|
+
display: flex;
|
|
115
|
+
flex-direction: column;
|
|
116
|
+
/* surface comes from .ferst-tile .ferst-tile--sm (bg/border/radius/shadow-sm) */
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
|
|
119
|
+
}
|
|
120
|
+
.b-media-cards__card.is-link:hover {
|
|
121
|
+
transform: translateY(-2px);
|
|
122
|
+
box-shadow: var(--shadow-md);
|
|
123
|
+
border-color: var(--gold);
|
|
124
|
+
}
|
|
125
|
+
/* Image header — cover-cropped to a uniform 16:9 so any source ratio fits (the
|
|
126
|
+
PostCard technique; also out-specifies the global img{height:auto}). */
|
|
127
|
+
.b-media-cards__media {
|
|
128
|
+
position: relative;
|
|
129
|
+
aspect-ratio: 16 / 9;
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
background: var(--bg-section);
|
|
132
|
+
}
|
|
133
|
+
.b-media-cards .b-media-cards__media img {
|
|
134
|
+
position: absolute;
|
|
135
|
+
inset: 0;
|
|
136
|
+
width: 100%;
|
|
137
|
+
height: 100%;
|
|
138
|
+
object-fit: cover;
|
|
139
|
+
display: block;
|
|
140
|
+
}
|
|
141
|
+
.b-media-cards__body {
|
|
142
|
+
display: flex;
|
|
143
|
+
flex-direction: column;
|
|
144
|
+
align-items: var(--content-items, stretch); /* follows the page / section alignment */
|
|
145
|
+
gap: 0.5rem;
|
|
146
|
+
padding: 1.1rem 1.2rem 1.3rem;
|
|
147
|
+
flex: 1;
|
|
148
|
+
}
|
|
149
|
+
/* Icon badge — a small brand chip; slightly lifted over the image edge when an
|
|
150
|
+
image is present (the negative margin only bites inside a card with a header). */
|
|
151
|
+
.b-media-cards__badge {
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
justify-content: center;
|
|
155
|
+
width: 2.25rem;
|
|
156
|
+
height: 2.25rem;
|
|
157
|
+
border-radius: 999px;
|
|
158
|
+
background: var(--gold-light);
|
|
159
|
+
color: var(--gold);
|
|
160
|
+
margin-top: -2.3rem;
|
|
161
|
+
margin-bottom: 0.2rem;
|
|
162
|
+
border: 3px solid var(--bg-surface);
|
|
163
|
+
}
|
|
164
|
+
/* No image → the badge sits normally at the top of the body. */
|
|
165
|
+
.b-media-cards__card:not(:has(.b-media-cards__media)) .b-media-cards__badge {
|
|
166
|
+
margin-top: 0;
|
|
167
|
+
border: none;
|
|
168
|
+
}
|
|
169
|
+
.b-media-cards__title {
|
|
170
|
+
margin: 0;
|
|
171
|
+
font-size: 1.2rem;
|
|
172
|
+
color: var(--fg);
|
|
173
|
+
}
|
|
174
|
+
.b-media-cards__card.is-link:hover .b-media-cards__title a { color: var(--gold); }
|
|
175
|
+
.b-media-cards__title a { color: var(--fg); }
|
|
176
|
+
/* Stretch the title link over the whole card so it's clickable. */
|
|
177
|
+
.b-media-cards__title a::after { content: ''; position: absolute; inset: 0; }
|
|
178
|
+
.b-media-cards__meta {
|
|
179
|
+
margin: 0;
|
|
180
|
+
align-self: var(--content-self, flex-start); /* a pill keeps its width, follows the alignment */
|
|
181
|
+
padding: 0.2rem 0.6rem;
|
|
182
|
+
border-radius: 999px;
|
|
183
|
+
background: var(--bg-section);
|
|
184
|
+
color: var(--muted);
|
|
185
|
+
font-family: var(--font-heading);
|
|
186
|
+
font-size: 0.72rem;
|
|
187
|
+
font-weight: 600;
|
|
188
|
+
letter-spacing: 0.03em;
|
|
189
|
+
}
|
|
190
|
+
.b-media-cards__text {
|
|
191
|
+
margin: 0;
|
|
192
|
+
color: var(--muted);
|
|
193
|
+
line-height: 1.6;
|
|
194
|
+
}
|
|
195
|
+
.b-media-cards__cta {
|
|
196
|
+
margin-top: auto;
|
|
197
|
+
padding-top: 0.5rem;
|
|
198
|
+
font-family: var(--font-heading);
|
|
199
|
+
font-size: 0.85rem;
|
|
200
|
+
font-weight: 600;
|
|
201
|
+
color: var(--gold);
|
|
202
|
+
}
|
|
203
|
+
/* A mailto/tel shown as visible, copyable text (below any description). */
|
|
204
|
+
.b-media-cards__contact {
|
|
205
|
+
margin-top: auto;
|
|
206
|
+
padding-top: 0.5rem;
|
|
207
|
+
font-family: var(--font-heading);
|
|
208
|
+
font-size: 0.85rem;
|
|
209
|
+
font-weight: 600;
|
|
210
|
+
color: var(--gold);
|
|
211
|
+
overflow-wrap: anywhere;
|
|
212
|
+
}
|
|
213
|
+
</style>
|