ferst-core 0.14.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/cms/config.template.yml +11 -0
- package/components/Card.astro +53 -51
- package/components/PostCard.astro +138 -136
- package/components/SiteHeader.astro +1356 -1273
- package/components/blocks/Grid.astro +49 -48
- package/components/blocks/Heading.astro +4 -1
- package/components/recipes/Banner.astro +146 -146
- package/components/recipes/Book.astro +39 -4
- package/components/recipes/FeatureCards.astro +112 -118
- package/components/recipes/Gallery.astro +57 -59
- package/components/recipes/Hero.astro +638 -533
- 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 +35 -2
- 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 +253 -249
- package/layouts/Base.astro +13 -3
- package/lib/book.ts +94 -1
- 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 -0
- 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,118 +1,112 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* FeatureCards — a Level-2 recipe: an optional section header over a responsive
|
|
4
|
-
* grid of cards, each with an optional icon, a title, text, and an optional
|
|
5
|
-
* link. Composes the Card, Icon, Heading and Button primitives.
|
|
6
|
-
*/
|
|
7
|
-
import Heading from '../blocks/Heading.astro';
|
|
8
|
-
import {
|
|
9
|
-
import Card from '../Card.astro';
|
|
10
|
-
import Icon from '../Icon.astro';
|
|
11
|
-
import Button from '../Button.astro';
|
|
12
|
-
import { isIconKey } from '../../lib/icons';
|
|
13
|
-
|
|
14
|
-
import { inlineMarkdown } from '../../lib/inline-markdown';
|
|
15
|
-
interface Props {
|
|
16
|
-
title?: string;
|
|
17
|
-
intro?: string;
|
|
18
|
-
columns?: 2 | 3 | 4;
|
|
19
|
-
cards?: { icon?: string; title: string; text?: string; href?: string }[];
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{card.
|
|
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
|
-
stretch), and Card is a flex column — margin-top:auto does the rest. */
|
|
114
|
-
.b-feature-cards__cta {
|
|
115
|
-
margin-top: auto;
|
|
116
|
-
padding-top: 1rem;
|
|
117
|
-
}
|
|
118
|
-
</style>
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* FeatureCards — a Level-2 recipe: an optional section header over a responsive
|
|
4
|
+
* grid of cards, each with an optional icon, a title, text, and an optional
|
|
5
|
+
* link. Composes the Card, Icon, Heading and Button primitives.
|
|
6
|
+
*/
|
|
7
|
+
import Heading from '../blocks/Heading.astro';
|
|
8
|
+
import { planGrid } from '../../lib/gridRows';
|
|
9
|
+
import Card from '../Card.astro';
|
|
10
|
+
import Icon from '../Icon.astro';
|
|
11
|
+
import Button from '../Button.astro';
|
|
12
|
+
import { isIconKey } from '../../lib/icons';
|
|
13
|
+
|
|
14
|
+
import { inlineMarkdown } from '../../lib/inline-markdown';
|
|
15
|
+
interface Props {
|
|
16
|
+
title?: string;
|
|
17
|
+
intro?: string;
|
|
18
|
+
columns?: 2 | 3 | 4;
|
|
19
|
+
cards?: { icon?: string; title: string; text?: string; href?: string }[];
|
|
20
|
+
/** How the ragged last row lays out (lib/gridRows). */
|
|
21
|
+
lastRow?: 'auto' | 'fill' | 'center';
|
|
22
|
+
}
|
|
23
|
+
const { title, intro, columns = 3, cards = [], lastRow = 'auto' } = Astro.props;
|
|
24
|
+
// Alignment overrides (BlockLayout): the title + intro default to centred; the block's
|
|
25
|
+
// own `align`, or `headingAlign` for the title alone, overrides it from the page data.
|
|
26
|
+
const { align: blockAlign, headingAlign } = Astro.props as { align?: 'start' | 'center' | 'end'; headingAlign?: 'start' | 'center' | 'end' };
|
|
27
|
+
const headAlign = headingAlign ?? blockAlign ?? 'center';
|
|
28
|
+
// Never reserve more columns than there are cards (a lone card in a 3-col grid
|
|
29
|
+
// would strand two empty cells); `data-single` centres a solitary card.
|
|
30
|
+
const plan = planGrid(cards.length, { columns, item: 'featureCards', lastRow }); // rows planned per screen (lib/gridRows)
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<section class="b-feature-cards">
|
|
34
|
+
{(title || intro) && (
|
|
35
|
+
<div class="b-feature-cards__head" data-recipe-head data-content-align={headAlign}>
|
|
36
|
+
{title && <Heading text={title} level={2} />}
|
|
37
|
+
{intro && <p class="b-feature-cards__intro" set:html={inlineMarkdown(intro)} />}
|
|
38
|
+
</div>
|
|
39
|
+
)}
|
|
40
|
+
<div class="b-feature-cards__grid ferst-rows" data-cols={plan.cols} data-single={cards.length === 1 ? 'true' : undefined} style={plan.gridStyle}>
|
|
41
|
+
{cards.map((card, i) => (
|
|
42
|
+
<Card style={plan.itemStyles[i]}>
|
|
43
|
+
{card.icon && isIconKey(card.icon) && (
|
|
44
|
+
<span class="b-feature-cards__icon"><Icon name={card.icon} size={28} /></span>
|
|
45
|
+
)}
|
|
46
|
+
<h3 class="b-feature-cards__title">{card.title}</h3>
|
|
47
|
+
{card.text && <p class="b-feature-cards__text" set:html={inlineMarkdown(card.text)} />}
|
|
48
|
+
{card.href && (
|
|
49
|
+
<span class="b-feature-cards__cta">
|
|
50
|
+
<Button href={card.href} variant="secondary" size="sm">Learn more</Button>
|
|
51
|
+
</span>
|
|
52
|
+
)}
|
|
53
|
+
</Card>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
</section>
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
.b-feature-cards {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: 2rem;
|
|
63
|
+
width: 100%; /* the full content width, whatever its items hold (lib/gridRows) */
|
|
64
|
+
max-width: 72rem;
|
|
65
|
+
margin-inline: auto;
|
|
66
|
+
padding-inline: 1rem;
|
|
67
|
+
}
|
|
68
|
+
.b-feature-cards__head {
|
|
69
|
+
max-width: var(--max);
|
|
70
|
+
margin-inline: auto;
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
gap: 0.75rem;
|
|
74
|
+
}
|
|
75
|
+
.b-feature-cards__intro {
|
|
76
|
+
margin: 0;
|
|
77
|
+
color: var(--muted);
|
|
78
|
+
font-size: 1.0625rem;
|
|
79
|
+
line-height: 1.6;
|
|
80
|
+
}
|
|
81
|
+
.b-feature-cards__grid {
|
|
82
|
+
display: grid;
|
|
83
|
+
gap: 1.5rem;
|
|
84
|
+
}
|
|
85
|
+
/* Rows come from lib/gridRows (the global .ferst-rows rules): even rows where the
|
|
86
|
+
count allows by using fewer columns, else full rows and a tidied last row. */
|
|
87
|
+
/* A solitary card is a centred feature, not a full-width slab. */
|
|
88
|
+
.b-feature-cards__grid[data-single] { max-width: 26rem; margin-inline: auto;
|
|
89
|
+
}
|
|
90
|
+
.b-feature-cards__icon {
|
|
91
|
+
color: var(--gold);
|
|
92
|
+
margin-bottom: 0.5rem;
|
|
93
|
+
display: inline-flex;
|
|
94
|
+
}
|
|
95
|
+
.b-feature-cards__title {
|
|
96
|
+
margin: 0 0 0.5rem;
|
|
97
|
+
font-size: 1.125rem;
|
|
98
|
+
color: var(--fg);
|
|
99
|
+
}
|
|
100
|
+
.b-feature-cards__text {
|
|
101
|
+
margin: 0;
|
|
102
|
+
color: var(--muted);
|
|
103
|
+
line-height: 1.6;
|
|
104
|
+
}
|
|
105
|
+
/* Push the CTA to the bottom so a row of cards aligns its buttons regardless
|
|
106
|
+
of how much text each card has. Cards are equal height already (grid items
|
|
107
|
+
stretch), and Card is a flex column — margin-top:auto does the rest. */
|
|
108
|
+
.b-feature-cards__cta {
|
|
109
|
+
margin-top: auto;
|
|
110
|
+
padding-top: 1rem;
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
@@ -1,59 +1,57 @@
|
|
|
1
|
-
---
|
|
2
|
-
/** Gallery — a Level-2 recipe: a responsive grid of images with optional
|
|
3
|
-
* captions. (Distinct from the `grid` layout primitive, which holds arbitrary
|
|
4
|
-
* child blocks; this one is image-specific.) */
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
</style>
|
|
1
|
+
---
|
|
2
|
+
/** Gallery — a Level-2 recipe: a responsive grid of images with optional
|
|
3
|
+
* captions. (Distinct from the `grid` layout primitive, which holds arbitrary
|
|
4
|
+
* child blocks; this one is image-specific.) */
|
|
5
|
+
import { planGrid } from '../../lib/gridRows';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
columns?: 2 | 3 | 4;
|
|
9
|
+
images?: { src: string; alt?: string; caption?: string }[];
|
|
10
|
+
/** How the ragged last row lays out (lib/gridRows). */
|
|
11
|
+
lastRow?: 'auto' | 'fill' | 'center';
|
|
12
|
+
}
|
|
13
|
+
const { columns = 3, images = [], lastRow = 'auto' } = Astro.props;
|
|
14
|
+
// Rows planned per screen (lib/gridRows); `data-single` centres a lone image.
|
|
15
|
+
const rows = planGrid(images.length, { columns, item: 'gallery', lastRow });
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<div class="b-gallery ferst-rows" data-cols={rows.cols} data-single={images.length === 1 ? 'true' : undefined} style={rows.gridStyle}>
|
|
19
|
+
{images.map((img, i) => (
|
|
20
|
+
<figure class="b-gallery__item" style={rows.itemStyles[i]}>
|
|
21
|
+
<img src={img.src} alt={img.alt ?? ''} loading="lazy" decoding="async" />
|
|
22
|
+
{img.caption && <figcaption>{img.caption}</figcaption>}
|
|
23
|
+
</figure>
|
|
24
|
+
))}
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.b-gallery {
|
|
29
|
+
display: grid;
|
|
30
|
+
gap: 1rem;
|
|
31
|
+
width: 100%; /* the full content width, whatever its items hold (lib/gridRows) */
|
|
32
|
+
max-width: 72rem;
|
|
33
|
+
margin-inline: auto;
|
|
34
|
+
padding-inline: 1rem;
|
|
35
|
+
}
|
|
36
|
+
/* A solitary image is a centred feature, not a full-bleed slab. */
|
|
37
|
+
.b-gallery[data-single] { max-width: 34rem; }
|
|
38
|
+
/* Rows come from lib/gridRows (the global .ferst-rows rules): even rows where the
|
|
39
|
+
count allows by using fewer columns, else full rows and a tidied last row. */
|
|
40
|
+
.b-gallery__item {
|
|
41
|
+
margin: 0;
|
|
42
|
+
}
|
|
43
|
+
.b-gallery__item img {
|
|
44
|
+
display: block;
|
|
45
|
+
width: 100%;
|
|
46
|
+
height: auto;
|
|
47
|
+
aspect-ratio: 4 / 3;
|
|
48
|
+
object-fit: cover;
|
|
49
|
+
border-radius: 6px;
|
|
50
|
+
}
|
|
51
|
+
.b-gallery__item figcaption {
|
|
52
|
+
margin-top: 0.4rem;
|
|
53
|
+
color: var(--muted);
|
|
54
|
+
font-size: 0.875rem;
|
|
55
|
+
text-align: center;
|
|
56
|
+
}
|
|
57
|
+
</style>
|