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
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image slots: every place a block or a setting shows a picture, and what that place expects.
|
|
3
|
+
* It sits next to the schema (content/blocks.ts, content/schemas.ts, content/posts.ts) because
|
|
4
|
+
* it's the engine's own layout knowledge: the numbers below are read off each component's CSS,
|
|
5
|
+
* and each slot names the component it mirrors (`mirrors`), so a CSS change has a visible place
|
|
6
|
+
* to update. A coverage test (tests/image-slots.test.ts) walks the Zod schemas and fails when
|
|
7
|
+
* an image field has no slot here, or when a slot ignores a `ratio` field its block has.
|
|
8
|
+
*
|
|
9
|
+
* Plain JavaScript (with JSDoc types), not TypeScript, so the `ferst-media` bin can read it
|
|
10
|
+
* with plain Node in a client site, where nothing compiles TypeScript.
|
|
11
|
+
*
|
|
12
|
+
* A slot's key is the block type (or `page`, `post`, or a settings collection such as
|
|
13
|
+
* `logoSettings`) and the path to the field, `[]` marking a list: `tiles.tiles[].image.src`.
|
|
14
|
+
* A key maps to one spec, or to a list of modes when one field shows differently by its
|
|
15
|
+
* block's settings (the first mode whose `when` matches is the one on the page; none
|
|
16
|
+
* matching means the block doesn't show that picture).
|
|
17
|
+
*
|
|
18
|
+
* Sizes assume the page's content column on a desktop: `.site-main` is 72rem with up to
|
|
19
|
+
* 2.5rem padding a side (layouts/Base.astro), so 1072px of content, and a full-width band
|
|
20
|
+
* is the screen (1440px on a typical laptop). `recommended` is about twice the CSS size (sharp
|
|
21
|
+
* on high-density screens), `min` about once (soft below it). Nothing needs more than 2400px.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** No picture needs to be wider than this: anything wider only slows the page. */
|
|
25
|
+
export const MAX_WIDTH = 2400;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {{ width?: number, height?: number }} Px
|
|
29
|
+
* @typedef {{ block: Record<string, any>, item: Record<string, any> }} SlotContext
|
|
30
|
+
* `block`: the block (or page, post, settings file); `item`: the list entry the picture is in
|
|
31
|
+
* (a tile, a card), or the block itself when it isn't in a list.
|
|
32
|
+
* @typedef {{
|
|
33
|
+
* label: string,
|
|
34
|
+
* ratio: string,
|
|
35
|
+
* ratioDefault?: string,
|
|
36
|
+
* shapes?: Record<string, string>,
|
|
37
|
+
* recommended: Px,
|
|
38
|
+
* min: Px,
|
|
39
|
+
* max: { width: number },
|
|
40
|
+
* fit: 'cover' | 'contain',
|
|
41
|
+
* focus: boolean,
|
|
42
|
+
* safe: string,
|
|
43
|
+
* text: boolean,
|
|
44
|
+
* textNote?: string,
|
|
45
|
+
* alpha: boolean,
|
|
46
|
+
* when?: (ctx: SlotContext) => boolean,
|
|
47
|
+
* mirrors: string,
|
|
48
|
+
* }} ImageSlot
|
|
49
|
+
* - `label`: what the place is, in plain words (the asset brief's heading).
|
|
50
|
+
* - `ratio`: the shape: fixed (`'16/9'`), `'any'` (the picture keeps its own), or the field that
|
|
51
|
+
* sets it (`'mediaCards.ratio'`, `'bento.items[].size'`); `ratioDefault` is that field's
|
|
52
|
+
* default, and `shapes` turns its values into shapes when they aren't shapes themselves.
|
|
53
|
+
* - `recommended` / `min`: pixels; a missing side follows from the shape.
|
|
54
|
+
* - `fit`: `cover` (cropped to fill the shape; `focus` says the block's `focus` is honoured)
|
|
55
|
+
* or `contain` (never cropped).
|
|
56
|
+
* - `safe`: where subjects and words stay in view. `text`: whether words in the picture are
|
|
57
|
+
* fine. `alpha`: whether it needs a see-through background.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
const max = { width: MAX_WIDTH };
|
|
61
|
+
const isMediaHero = ({ block }) => (block.layout ?? 'centered') === 'media';
|
|
62
|
+
/** A tile with a picture and no words is a picture tile, shown whole (Tiles.astro `plain`). */
|
|
63
|
+
const isPictureTile = ({ block, item }) =>
|
|
64
|
+
(block.variant ?? 'elevated') === 'image' && !item.title && !item.text && !item.eyebrow;
|
|
65
|
+
|
|
66
|
+
/** The opening band's background, a picture, a slide or a video's still (all the same place). */
|
|
67
|
+
const heroBackground = (label, when = isMediaHero) => ({
|
|
68
|
+
label,
|
|
69
|
+
// Hero.astro: .b-hero__img / .b-hero__slide cover the band, object-position --hero-focus.
|
|
70
|
+
// The band's height by `size` (desktop, 1440x900 screen, 1072px column): compact
|
|
71
|
+
// clamp(8rem, 18vw, 16rem) = 256px (about 9:2); standard min(68vh, 38rem) = 608px (about
|
|
72
|
+
// 2:1); tall min(85vh, 52rem) = 765px (about 3:2); screen fills the screen under the header
|
|
73
|
+
// (1440 x 836, about 16:9). Full bleed makes a band wider still; phones show a tall slice.
|
|
74
|
+
ratio: 'hero.size',
|
|
75
|
+
ratioDefault: 'standard',
|
|
76
|
+
shapes: { compact: '9/2', standard: '2/1', tall: '3/2', screen: '16/9' },
|
|
77
|
+
recommended: { width: 2400 },
|
|
78
|
+
min: { width: 1280 },
|
|
79
|
+
max,
|
|
80
|
+
fit: 'cover',
|
|
81
|
+
focus: true,
|
|
82
|
+
safe: 'Keep the subject in the middle third. Wide screens crop the top and bottom, and phones show a tall slice from the middle (or around the focus point).',
|
|
83
|
+
text: false,
|
|
84
|
+
textNote: 'The title and button sit on top of it, so words in the picture would clash.',
|
|
85
|
+
alpha: false,
|
|
86
|
+
when,
|
|
87
|
+
mirrors: 'components/recipes/Hero.astro (.b-hero[data-size] min-height, .b-hero__img object-fit: cover)',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
/** The opening band's picture shown whole (`media.fit: "contain"`), e.g. a designed poster. */
|
|
91
|
+
const isPosterHero = ({ block }) => isMediaHero({ block }) && block.media?.fit === 'contain' && !block.media?.video;
|
|
92
|
+
const heroPoster = (label) => ({
|
|
93
|
+
label,
|
|
94
|
+
// Hero.astro [data-fit='contain']: the band takes the picture's own shape (aspect-ratio from
|
|
95
|
+
// its size), edge to edge with `screen` or full bleed (1440px wide on the 1440x900 desktop);
|
|
96
|
+
// the picture is object-fit: contain, never cropped, with no shade over it.
|
|
97
|
+
ratio: 'any',
|
|
98
|
+
recommended: { width: 2400 },
|
|
99
|
+
min: { width: 1280 },
|
|
100
|
+
max,
|
|
101
|
+
fit: 'contain',
|
|
102
|
+
focus: false,
|
|
103
|
+
safe: 'Shown whole, never cropped, as wide as the screen: on a phone it is small, so keep lettering large.',
|
|
104
|
+
text: true,
|
|
105
|
+
alpha: false,
|
|
106
|
+
when: isPosterHero,
|
|
107
|
+
mirrors: "components/recipes/Hero.astro ([data-fit='contain'] .b-hero__img object-fit: contain)",
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
/** @type {Record<string, ImageSlot | ImageSlot[]>} */
|
|
111
|
+
export const IMAGE_SLOTS = {
|
|
112
|
+
// ── Primitives ──
|
|
113
|
+
'image.src': {
|
|
114
|
+
label: 'Picture',
|
|
115
|
+
// ImageBlock.astro: width 100% of its column (up to 1072px), height auto; a `ratio` sets
|
|
116
|
+
// aspect-ratio with object-fit: cover, cropped around `focus`.
|
|
117
|
+
ratio: 'image.ratio',
|
|
118
|
+
ratioDefault: 'auto',
|
|
119
|
+
recommended: { width: 2000 },
|
|
120
|
+
min: { width: 800 },
|
|
121
|
+
max,
|
|
122
|
+
fit: 'cover',
|
|
123
|
+
focus: true,
|
|
124
|
+
safe: 'Shown whole unless the block sets a shape; then it is cropped from the middle (or around the focus point).',
|
|
125
|
+
text: true,
|
|
126
|
+
alpha: false,
|
|
127
|
+
mirrors: 'components/blocks/ImageBlock.astro (width: 100%; aspect-ratio from `ratio`, object-fit: cover)',
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
// ── Recipes ──
|
|
131
|
+
'hero.image.src': {
|
|
132
|
+
label: 'Picture beside the opening words',
|
|
133
|
+
// Hero.astro split layout: two equal columns from 48em, (1072 - 2rem gap) / 2 = 520px;
|
|
134
|
+
// .b-hero__media img is width 100%, height auto (shown whole).
|
|
135
|
+
ratio: 'any',
|
|
136
|
+
recommended: { width: 1100 },
|
|
137
|
+
min: { width: 550 },
|
|
138
|
+
max,
|
|
139
|
+
fit: 'contain',
|
|
140
|
+
focus: false,
|
|
141
|
+
safe: 'Shown whole, beside the title. A landscape or square picture sits best next to the words.',
|
|
142
|
+
text: true,
|
|
143
|
+
alpha: false,
|
|
144
|
+
when: ({ block }) => block.layout === 'split',
|
|
145
|
+
mirrors: 'components/recipes/Hero.astro (split: grid 1fr 1fr, .b-hero__media img width: 100%)',
|
|
146
|
+
},
|
|
147
|
+
'hero.media.image': [heroPoster('Opening poster (shown whole)'), heroBackground('Opening band background')],
|
|
148
|
+
'hero.media.images[]': [heroPoster('Opening poster slideshow picture (shown whole)'), heroBackground('Opening band slideshow picture')],
|
|
149
|
+
'hero.titleImage.src': {
|
|
150
|
+
label: 'Title picture (a wordmark)',
|
|
151
|
+
// Hero.astro .b-hero__title-image: in the h1, width by `width` (20 / 32.5 / 47.5rem = 320 /
|
|
152
|
+
// 520 / 760px, at most 85vw and its column), height auto: shown whole over the opener.
|
|
153
|
+
ratio: 'any',
|
|
154
|
+
recommended: { width: 1520 },
|
|
155
|
+
min: { width: 760 },
|
|
156
|
+
max,
|
|
157
|
+
fit: 'contain',
|
|
158
|
+
focus: false,
|
|
159
|
+
safe: 'Shown whole in place of the title, over the opening picture: trim it close to the lettering.',
|
|
160
|
+
text: true,
|
|
161
|
+
alpha: true,
|
|
162
|
+
mirrors: 'components/recipes/Hero.astro (.b-hero__title-image width --title-image-w, height auto)',
|
|
163
|
+
},
|
|
164
|
+
'hero.media.poster': heroBackground('Opening band video still', ({ block }) => isMediaHero({ block }) && !!block.media?.video),
|
|
165
|
+
|
|
166
|
+
'gallery.images[].src': {
|
|
167
|
+
label: 'Gallery picture',
|
|
168
|
+
// Gallery.astro: img aspect-ratio 4 / 3, object-fit: cover; two columns of (1072 - gap) / 2
|
|
169
|
+
// = 525px, a single picture 34rem = 544px.
|
|
170
|
+
ratio: '4/3',
|
|
171
|
+
recommended: { width: 1100 },
|
|
172
|
+
min: { width: 550 },
|
|
173
|
+
max,
|
|
174
|
+
fit: 'cover',
|
|
175
|
+
focus: false,
|
|
176
|
+
safe: 'Cropped to 4:3 from the middle: keep the subject centred.',
|
|
177
|
+
text: false,
|
|
178
|
+
textNote: 'The edges are cropped, so words near them can be cut.',
|
|
179
|
+
alpha: false,
|
|
180
|
+
mirrors: 'components/recipes/Gallery.astro (img aspect-ratio: 4 / 3, object-fit: cover)',
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
'testimonial.avatar.src': {
|
|
184
|
+
label: 'Portrait beside a quote',
|
|
185
|
+
// Testimonial.astro: .b-testimonial__avatar 44 x 44px, border-radius 999px, object-fit: cover.
|
|
186
|
+
ratio: '1/1',
|
|
187
|
+
recommended: { width: 200, height: 200 },
|
|
188
|
+
min: { width: 88, height: 88 },
|
|
189
|
+
max,
|
|
190
|
+
fit: 'cover',
|
|
191
|
+
focus: false,
|
|
192
|
+
safe: 'Shown as a small circle: the face in the centre, filling most of the picture.',
|
|
193
|
+
text: false,
|
|
194
|
+
alpha: false,
|
|
195
|
+
mirrors: 'components/recipes/Testimonial.astro (.b-testimonial__avatar 44px circle, object-fit: cover)',
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
'tiles.tiles[].image.src': [
|
|
199
|
+
{
|
|
200
|
+
label: 'Picture tile, filling its tile',
|
|
201
|
+
// Tiles.astro `fit: "bleed"` with a set `ratio`: the picture is the tile (no padding),
|
|
202
|
+
// aspect-ratio --tile-ratio, object-fit: cover round the tile image's focus. Three
|
|
203
|
+
// columns are (1072 - 2 gaps) / 3 = 340px; two are 520px.
|
|
204
|
+
ratio: 'tiles.ratio',
|
|
205
|
+
ratioDefault: 'auto',
|
|
206
|
+
recommended: { width: 1000 },
|
|
207
|
+
min: { width: 500 },
|
|
208
|
+
max,
|
|
209
|
+
fit: 'cover',
|
|
210
|
+
focus: true,
|
|
211
|
+
safe: 'Cropped to the tiles’ shape from the middle (or around the focus point): keep the subject and any lettering away from the edges.',
|
|
212
|
+
text: true,
|
|
213
|
+
alpha: false,
|
|
214
|
+
when: (ctx) => isPictureTile(ctx) && ctx.block.fit === 'bleed' && (ctx.block.ratio ?? 'auto') !== 'auto',
|
|
215
|
+
mirrors: "components/recipes/Tiles.astro ([data-fit='bleed'] .b-tile__picture: aspect-ratio --tile-ratio, object-fit: cover)",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: 'Picture tile',
|
|
219
|
+
// Tiles.astro: a tile with a picture and no words (`plain`): .b-tile__picture width 100%,
|
|
220
|
+
// max-height 18rem (288px) in a frame (none with `bleed`), object-fit: contain, never
|
|
221
|
+
// cropped; a set `ratio` gives the frame that shape. Three columns are
|
|
222
|
+
// (1072 - 2 gaps) / 3 = 340px less 0.75rem padding; two are 520px.
|
|
223
|
+
ratio: 'tiles.ratio',
|
|
224
|
+
ratioDefault: 'auto',
|
|
225
|
+
recommended: { width: 1000 },
|
|
226
|
+
min: { width: 500 },
|
|
227
|
+
max,
|
|
228
|
+
fit: 'contain',
|
|
229
|
+
focus: false,
|
|
230
|
+
safe: 'Shown whole, never cropped. Pictures in one row look tidiest when they share one shape.',
|
|
231
|
+
text: true,
|
|
232
|
+
alpha: false,
|
|
233
|
+
when: isPictureTile,
|
|
234
|
+
mirrors: 'components/recipes/Tiles.astro ([data-plain] .b-tile__picture: max-height 18rem, object-fit: contain)',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
label: 'Picture behind a tile’s words',
|
|
238
|
+
// Tiles.astro variant `image`: the picture is the tile's background (background-size:
|
|
239
|
+
// cover, position --tile-focus) under a dark shade; the tile is min-height 15rem (240px)
|
|
240
|
+
// and 340px wide in three columns (about 3:2), 520px in two.
|
|
241
|
+
ratio: '3/2',
|
|
242
|
+
recommended: { width: 1100 },
|
|
243
|
+
min: { width: 550 },
|
|
244
|
+
max,
|
|
245
|
+
fit: 'cover',
|
|
246
|
+
focus: true,
|
|
247
|
+
safe: 'Keep the subject in the upper half: the tile’s words sit over the bottom on a dark shade.',
|
|
248
|
+
text: false,
|
|
249
|
+
textNote: 'The tile’s own words sit on top of it.',
|
|
250
|
+
alpha: false,
|
|
251
|
+
when: ({ block }) => (block.variant ?? 'elevated') === 'image',
|
|
252
|
+
mirrors: 'components/recipes/Tiles.astro ([data-variant=image] .b-tile::before background-size: cover, min-height 15rem)',
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
|
|
256
|
+
'banner.image': {
|
|
257
|
+
label: 'Feature band background',
|
|
258
|
+
// Banner.astro: background-size: cover behind a card of words. With parallax (the default)
|
|
259
|
+
// the background is pinned to the screen (background-attachment: fixed), so it is sized to
|
|
260
|
+
// the screen (16:10 on a laptop); without it, the band is 1072px by min(60vh, 34rem) =
|
|
261
|
+
// 540px (about 2:1). 16:9 sits between the two.
|
|
262
|
+
ratio: '16/9',
|
|
263
|
+
recommended: { width: 2400, height: 1350 },
|
|
264
|
+
min: { width: 1280, height: 720 },
|
|
265
|
+
max,
|
|
266
|
+
fit: 'cover',
|
|
267
|
+
focus: false,
|
|
268
|
+
safe: 'Keep the subject clear of the side the words card sits on, and away from the very top and bottom.',
|
|
269
|
+
text: false,
|
|
270
|
+
textNote: 'A card of words floats over it.',
|
|
271
|
+
alpha: false,
|
|
272
|
+
mirrors: 'components/recipes/Banner.astro (background-size: cover; fixed under parallax; min-height min(60vh, 34rem))',
|
|
273
|
+
},
|
|
274
|
+
|
|
275
|
+
'logos.items[].src': {
|
|
276
|
+
label: 'Logo in a logo wall',
|
|
277
|
+
// Logos.astro: img height clamp(1.75rem, 4vw, 2.5rem) = up to 40px, width auto (whole).
|
|
278
|
+
ratio: 'any',
|
|
279
|
+
recommended: { height: 80 },
|
|
280
|
+
min: { height: 40 },
|
|
281
|
+
max,
|
|
282
|
+
fit: 'contain',
|
|
283
|
+
focus: false,
|
|
284
|
+
safe: 'Shown about 40 pixels tall, in grey until pointed at. Trim empty space around the logo so it shows at the right size.',
|
|
285
|
+
text: true,
|
|
286
|
+
alpha: true,
|
|
287
|
+
mirrors: 'components/recipes/Logos.astro (img height: clamp(1.75rem, 4vw, 2.5rem), width: auto)',
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
'tabs.items[].image.src': {
|
|
291
|
+
label: 'Picture in a tab',
|
|
292
|
+
// Tabs.astro: max-width 60rem (960px); a panel with a picture is two columns from 48em,
|
|
293
|
+
// so about 460px; .b-tabs__img width 100%, height auto (whole).
|
|
294
|
+
ratio: 'any',
|
|
295
|
+
recommended: { width: 1000 },
|
|
296
|
+
min: { width: 500 },
|
|
297
|
+
max,
|
|
298
|
+
fit: 'contain',
|
|
299
|
+
focus: false,
|
|
300
|
+
safe: 'Shown whole, beside the tab’s words.',
|
|
301
|
+
text: true,
|
|
302
|
+
alpha: false,
|
|
303
|
+
mirrors: 'components/recipes/Tabs.astro (.b-tabs__img width: 100%, height: auto; panel grid 1fr 1fr)',
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
'bento.items[].image.src': {
|
|
307
|
+
label: 'Picture behind a mosaic tile',
|
|
308
|
+
// Bento.astro: four columns from 64em, (1072 - 3rem of gaps) / 4 = 256px, rows at least
|
|
309
|
+
// 11rem (176px), background-size: cover at --bento-focus. By `size`: sm 256x176 (about
|
|
310
|
+
// 3:2), wide 528x176 (3:1), tall 256x368 (3:4), lg 528x368 (3:2).
|
|
311
|
+
ratio: 'bento.items[].size',
|
|
312
|
+
ratioDefault: 'sm',
|
|
313
|
+
shapes: { sm: '3/2', wide: '3/1', tall: '3/4', lg: '3/2' },
|
|
314
|
+
recommended: { width: 1100 },
|
|
315
|
+
min: { width: 550 },
|
|
316
|
+
max,
|
|
317
|
+
fit: 'cover',
|
|
318
|
+
focus: true,
|
|
319
|
+
safe: 'Keep the subject in the upper half: the tile’s words sit over the bottom on a dark shade.',
|
|
320
|
+
text: false,
|
|
321
|
+
textNote: 'The tile’s own words sit on top of it.',
|
|
322
|
+
alpha: false,
|
|
323
|
+
when: ({ item }) => (item.variant ?? 'surface') === 'image',
|
|
324
|
+
mirrors: 'components/recipes/Bento.astro ([data-variant=image]::before background-size: cover; grid-auto-rows minmax(11rem, auto))',
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
'mediaCards.cards[].image.src': {
|
|
328
|
+
label: 'Card picture',
|
|
329
|
+
// MediaCards.astro: .b-media-cards__media aspect-ratio from the block's `ratio`, img
|
|
330
|
+
// object-fit: cover at the card's focus; two columns 520px, one card 28rem = 448px.
|
|
331
|
+
ratio: 'mediaCards.ratio',
|
|
332
|
+
ratioDefault: '16/9',
|
|
333
|
+
recommended: { width: 1100 },
|
|
334
|
+
min: { width: 550 },
|
|
335
|
+
max,
|
|
336
|
+
fit: 'cover',
|
|
337
|
+
focus: true,
|
|
338
|
+
safe: 'Cropped to the cards’ shape from the middle (or around the focus point): keep the subject centred.',
|
|
339
|
+
text: false,
|
|
340
|
+
textNote: 'The picture is cropped to the card’s shape, so words in it can be cut.',
|
|
341
|
+
alpha: false,
|
|
342
|
+
mirrors: 'components/recipes/MediaCards.astro (.b-media-cards__media aspect-ratio from `ratio`, img object-fit: cover)',
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
'mediaText.image.src': {
|
|
346
|
+
label: 'Picture beside text',
|
|
347
|
+
// MediaText.astro: two equal columns from 48em, (1072 - 3rem gap) / 2 = 512px; img width
|
|
348
|
+
// 100%, height auto, or aspect-ratio from `ratio` with object-fit: cover at `focus`.
|
|
349
|
+
ratio: 'mediaText.ratio',
|
|
350
|
+
ratioDefault: 'auto',
|
|
351
|
+
recommended: { width: 1100 },
|
|
352
|
+
min: { width: 550 },
|
|
353
|
+
max,
|
|
354
|
+
fit: 'cover',
|
|
355
|
+
focus: true,
|
|
356
|
+
safe: 'Shown whole unless the block sets a shape; then it is cropped from the middle (or around the focus point).',
|
|
357
|
+
text: true,
|
|
358
|
+
alpha: false,
|
|
359
|
+
mirrors: 'components/recipes/MediaText.astro (img width: 100%; aspect-ratio from `ratio`, object-fit: cover)',
|
|
360
|
+
},
|
|
361
|
+
|
|
362
|
+
// ── A page and a post ──
|
|
363
|
+
'page.heroImage': {
|
|
364
|
+
label: 'Page’s sharing picture',
|
|
365
|
+
// layouts/Base.astro: preloaded, and the page's og:image (lib/seo.mjs previewTags), which
|
|
366
|
+
// social sites show at 1200 x 630 (1.91:1), cropping other shapes.
|
|
367
|
+
ratio: '40/21',
|
|
368
|
+
recommended: { width: 1200, height: 630 },
|
|
369
|
+
min: { width: 600, height: 315 },
|
|
370
|
+
max,
|
|
371
|
+
fit: 'cover',
|
|
372
|
+
focus: false,
|
|
373
|
+
safe: 'Shown when the page is shared. Social sites crop the edges: keep the subject and any words in the middle.',
|
|
374
|
+
text: true,
|
|
375
|
+
textNote: 'Keep them large and in the middle.',
|
|
376
|
+
alpha: false,
|
|
377
|
+
mirrors: 'layouts/Base.astro (heroImage preload; og:image via lib/seo.mjs previewTags)',
|
|
378
|
+
},
|
|
379
|
+
'post.heroImage': {
|
|
380
|
+
label: 'News post picture',
|
|
381
|
+
// PostArticle.astro shows it whole across the column (1072px); PostCard.astro crops it to
|
|
382
|
+
// aspect-ratio 16 / 9 with object-fit: cover; LatestPosts.astro's list to a 3.25rem square.
|
|
383
|
+
ratio: '16/9',
|
|
384
|
+
recommended: { width: 1600, height: 900 },
|
|
385
|
+
min: { width: 800, height: 450 },
|
|
386
|
+
max,
|
|
387
|
+
fit: 'cover',
|
|
388
|
+
focus: false,
|
|
389
|
+
safe: 'Keep the subject in the middle: news cards crop it to 16:9, and the short list to a small square.',
|
|
390
|
+
text: false,
|
|
391
|
+
textNote: 'Cards crop it, so words in it can be cut.',
|
|
392
|
+
alpha: false,
|
|
393
|
+
mirrors: 'components/PostCard.astro (aspect-ratio: 16 / 9, object-fit: cover); components/PostArticle.astro',
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
// ── Settings: logos and the browser icon ──
|
|
397
|
+
'logoSettings.primaryLogoLight': {
|
|
398
|
+
label: 'Header logo',
|
|
399
|
+
// SiteHeader.astro: .primary-logo height --header-logo-h (44px phones, 56px desktops;
|
|
400
|
+
// `large` 112px, `xl` 216px on desktops), width auto (whole).
|
|
401
|
+
ratio: 'any',
|
|
402
|
+
recommended: { height: 432 },
|
|
403
|
+
min: { height: 112 },
|
|
404
|
+
max,
|
|
405
|
+
fit: 'contain',
|
|
406
|
+
focus: false,
|
|
407
|
+
safe: 'Shown whole in the header. Trim empty space around it so it shows at the right size. An SVG stays sharp at every size.',
|
|
408
|
+
text: true,
|
|
409
|
+
alpha: true,
|
|
410
|
+
mirrors: 'components/SiteHeader.astro (.primary-logo height: var(--header-logo-h), 56px to 216px)',
|
|
411
|
+
},
|
|
412
|
+
'logoSettings.primaryLogoDark': {
|
|
413
|
+
label: 'Header logo for dark mode',
|
|
414
|
+
// SiteHeader.astro: the same place as the light logo, swapped in dark mode.
|
|
415
|
+
ratio: 'any',
|
|
416
|
+
recommended: { height: 432 },
|
|
417
|
+
min: { height: 112 },
|
|
418
|
+
max,
|
|
419
|
+
fit: 'contain',
|
|
420
|
+
focus: false,
|
|
421
|
+
safe: 'The same as the header logo, in colours that read on a dark background.',
|
|
422
|
+
text: true,
|
|
423
|
+
alpha: true,
|
|
424
|
+
mirrors: 'components/SiteHeader.astro (.primary-logo height: var(--header-logo-h), 56px to 216px)',
|
|
425
|
+
},
|
|
426
|
+
'logoSettings.secondaryLogoLight': {
|
|
427
|
+
label: 'Footer logo',
|
|
428
|
+
// SecondaryLogo.astro + layouts/Base.astro: .secondary-logo__img max-width min(150px, 100%).
|
|
429
|
+
ratio: 'any',
|
|
430
|
+
recommended: { width: 300 },
|
|
431
|
+
min: { width: 150 },
|
|
432
|
+
max,
|
|
433
|
+
fit: 'contain',
|
|
434
|
+
focus: false,
|
|
435
|
+
safe: 'Shown whole, up to 150 pixels wide.',
|
|
436
|
+
text: true,
|
|
437
|
+
alpha: true,
|
|
438
|
+
mirrors: 'components/SecondaryLogo.astro (.secondary-logo__img max-width: min(150px, 100%), in layouts/Base.astro)',
|
|
439
|
+
},
|
|
440
|
+
'logoSettings.secondaryLogoDark': {
|
|
441
|
+
label: 'Footer logo for dark mode',
|
|
442
|
+
ratio: 'any',
|
|
443
|
+
recommended: { width: 300 },
|
|
444
|
+
min: { width: 150 },
|
|
445
|
+
max,
|
|
446
|
+
fit: 'contain',
|
|
447
|
+
focus: false,
|
|
448
|
+
safe: 'The same as the footer logo, in colours that read on a dark background.',
|
|
449
|
+
text: true,
|
|
450
|
+
alpha: true,
|
|
451
|
+
mirrors: 'components/SecondaryLogo.astro (.secondary-logo__img max-width: min(150px, 100%), in layouts/Base.astro)',
|
|
452
|
+
},
|
|
453
|
+
'logoSettings.favicon': {
|
|
454
|
+
label: 'Browser icon',
|
|
455
|
+
// lib/site-icon.mjs draws /favicon.ico at 32 and 48px and /apple-touch-icon.png at 180px.
|
|
456
|
+
ratio: '1/1',
|
|
457
|
+
recommended: { width: 512, height: 512 },
|
|
458
|
+
min: { width: 48, height: 48 },
|
|
459
|
+
max,
|
|
460
|
+
fit: 'contain',
|
|
461
|
+
focus: false,
|
|
462
|
+
safe: 'A square mark that fills most of the square: it shows as small as 16 pixels in a browser tab.',
|
|
463
|
+
text: false,
|
|
464
|
+
textNote: 'Words can’t be read that small: use a mark or a single letter.',
|
|
465
|
+
alpha: true,
|
|
466
|
+
mirrors: 'lib/site-icon.mjs (favicon.ico 32 + 48px, apple-touch-icon 180px)',
|
|
467
|
+
},
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
/** A slot's modes, always a list. */
|
|
471
|
+
export function slotModes(key) {
|
|
472
|
+
const s = IMAGE_SLOTS[key];
|
|
473
|
+
return !s ? [] : Array.isArray(s) ? s : [s];
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const SHAPE = /^(\d+(?:\.\d+)?)\/(\d+(?:\.\d+)?)$/;
|
|
477
|
+
|
|
478
|
+
/** A shape's width over height (`'16/9'` gives 1.777…), or null for `'any'` / not a shape. */
|
|
479
|
+
export function shapeValue(shape) {
|
|
480
|
+
const m = SHAPE.exec(String(shape ?? '').replace(/\s+/g, ''));
|
|
481
|
+
return m && Number(m[2]) > 0 ? Number(m[1]) / Number(m[2]) : null;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** Whether a slot's `ratio` names a field (`'mediaCards.ratio'`) rather than a shape. */
|
|
485
|
+
export const isFieldRef = (ratio) => ratio !== 'any' && shapeValue(ratio) === null;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* The shape a field value means for a slot: a shape itself (`'4/3'`), `square`, `auto` (the
|
|
489
|
+
* picture keeps its own, `'any'`), or a value the slot's `shapes` maps. Null when unknown.
|
|
490
|
+
*/
|
|
491
|
+
export function shapeForValue(slot, value) {
|
|
492
|
+
const v = String(value);
|
|
493
|
+
if (slot.shapes) return slot.shapes[v] ?? null;
|
|
494
|
+
if (v === 'auto' || v === 'any') return 'any';
|
|
495
|
+
if (v === 'square') return '1/1';
|
|
496
|
+
return shapeValue(v) !== null ? v.replace(/\s+/g, '') : null;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Read the value a field reference points at, from the objects a picture sits in. `refPath`
|
|
501
|
+
* and `imagePath` are a key's path after its block type (`['items[]', 'size']`,
|
|
502
|
+
* `['items[]', 'image', 'src']`); `ancestors[i]` is the object after `i` steps of the image path.
|
|
503
|
+
*/
|
|
504
|
+
export function readRef(refPath, imagePath, ancestors) {
|
|
505
|
+
let k = 0;
|
|
506
|
+
while (k < refPath.length - 1 && k < imagePath.length && refPath[k] === imagePath[k]) k++;
|
|
507
|
+
let obj = ancestors[Math.min(k, ancestors.length - 1)];
|
|
508
|
+
for (const seg of refPath.slice(k)) {
|
|
509
|
+
if (obj == null || typeof obj !== 'object') return undefined;
|
|
510
|
+
obj = obj[seg.replace(/\[\]$/, '')];
|
|
511
|
+
}
|
|
512
|
+
return obj;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** Split a key or a ratio reference into its block type and path: `'a.b[].c'` → ['a', ['b[]', 'c']]. */
|
|
516
|
+
export function splitKey(key) {
|
|
517
|
+
const [head, ...path] = key.split('.');
|
|
518
|
+
return [head, path];
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* The shape a slot has where a picture is used: fixed, `'any'`, or read from the field the
|
|
523
|
+
* slot names (its default when the block leaves it out).
|
|
524
|
+
* @param {ImageSlot} slot
|
|
525
|
+
* @param {string} key the slot's key
|
|
526
|
+
* @param {Record<string, any>[]} ancestors the objects along the key's path, block first
|
|
527
|
+
*/
|
|
528
|
+
export function resolveShape(slot, key, ancestors) {
|
|
529
|
+
if (!isFieldRef(slot.ratio)) return slot.ratio;
|
|
530
|
+
const [, imagePath] = splitKey(key);
|
|
531
|
+
const [, refPath] = splitKey(slot.ratio);
|
|
532
|
+
const value = readRef(refPath, imagePath, ancestors) ?? slot.ratioDefault;
|
|
533
|
+
return (value === undefined ? null : shapeForValue(slot, value)) ?? 'any';
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Recommended (or minimum) pixel size for a shape: fills in the side the slot leaves out. */
|
|
537
|
+
export function sizeFor(px, shape) {
|
|
538
|
+
const r = shapeValue(shape);
|
|
539
|
+
const width = px.width ?? (r && px.height ? Math.round(px.height * r) : undefined);
|
|
540
|
+
const height = px.height ?? (r && px.width ? Math.round(px.width / r) : undefined);
|
|
541
|
+
return { width, height };
|
|
542
|
+
}
|
package/content/schemas.ts
CHANGED
|
@@ -83,6 +83,25 @@ export const siteSettingsSchema = z.object({
|
|
|
83
83
|
verification: verificationSchema,
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
+
/** How the header logo sits: its size and whether it hangs below the bar. The defaults are
|
|
87
|
+
* the header every site had before these settings (a 56px logo inside the bar). */
|
|
88
|
+
export const logoHeaderSchema = z
|
|
89
|
+
.object({
|
|
90
|
+
/** The logo's height on a desktop at the top of the page: `standard` 56px, `large` about
|
|
91
|
+
* twice that (112px), `xl` about four times (216px). Tablets and phones take smaller steps. */
|
|
92
|
+
size: z.enum(['standard', 'large', 'xl']).default('standard'),
|
|
93
|
+
/** `inline` sits in the bar (a larger logo makes the bar taller, on desktops only).
|
|
94
|
+
* `overhang` pins the logo to the top of the bar and lets it hang below the bar over the
|
|
95
|
+
* top of the page, and the bar keeps its height. */
|
|
96
|
+
placement: z.enum(['inline', 'overhang']).default('inline'),
|
|
97
|
+
/** Overhang only: once the visitor scrolls, the logo tucks back into the bar at the
|
|
98
|
+
* small size, and grows again at the top. Off keeps it hanging while they read. */
|
|
99
|
+
shrinkOnScroll: z.boolean().default(true),
|
|
100
|
+
/** A soft shadow under the logo, so a dark round badge stands out from a dark header. */
|
|
101
|
+
shadow: z.boolean().default(false),
|
|
102
|
+
})
|
|
103
|
+
.default({});
|
|
104
|
+
|
|
86
105
|
export const logoSettingsSchema = z.object({
|
|
87
106
|
/** Primary/header logo — light theme variant. Optional (SiteHeader falls back to a wordmark). */
|
|
88
107
|
primaryLogoLight: z.string().optional(),
|
|
@@ -103,6 +122,8 @@ export const logoSettingsSchema = z.object({
|
|
|
103
122
|
url: z.string().default(''),
|
|
104
123
|
})
|
|
105
124
|
.default({}),
|
|
125
|
+
/** The header logo's size and placement (optional; the defaults change nothing). */
|
|
126
|
+
header: logoHeaderSchema,
|
|
106
127
|
});
|
|
107
128
|
|
|
108
129
|
export const navbarSettingsSchema = z.object({
|
|
@@ -128,6 +149,10 @@ export const footerSettingsSchema = z.object({
|
|
|
128
149
|
.default([]),
|
|
129
150
|
});
|
|
130
151
|
|
|
152
|
+
/** The finishes a theme can give its display titles (`themeSettings.titleEffect`). */
|
|
153
|
+
export const TITLE_EFFECTS = ['none', 'stroke', 'shadow', 'glow'] as const;
|
|
154
|
+
export type TitleEffect = (typeof TITLE_EFFECTS)[number];
|
|
155
|
+
|
|
131
156
|
/**
|
|
132
157
|
* The brand — a client's design tokens, set in the CMS. The whole system is
|
|
133
158
|
* built to derive from just THREE source colours: `brand` (interactive accent),
|
|
@@ -143,7 +168,7 @@ export const footerSettingsSchema = z.object({
|
|
|
143
168
|
* the CMS), never baked into the shared core.
|
|
144
169
|
*
|
|
145
170
|
* This shape is what the Sveltia token pane edits (apps/showcase/public/admin):
|
|
146
|
-
* a client picks three colours + a font pairing +
|
|
171
|
+
* a client picks three colours + a font pairing + a few knobs, not 40 tokens.
|
|
147
172
|
*/
|
|
148
173
|
export const themeSettingsSchema = z.object({
|
|
149
174
|
/** Interactive accent — buttons, links, icons, highlights. Blank ⇒ neutral. */
|
|
@@ -152,7 +177,9 @@ export const themeSettingsSchema = z.object({
|
|
|
152
177
|
ink: z.string().default(''),
|
|
153
178
|
/** Background — page, cards, sections (tints derived from it). Blank ⇒ neutral. */
|
|
154
179
|
surface: z.string().default(''),
|
|
155
|
-
/** Site-wide font pairing (role → CSS font-family stack). Blank ⇒ core default.
|
|
180
|
+
/** Site-wide font pairing (role → CSS font-family stack). Blank ⇒ core default. The
|
|
181
|
+
* stacks a picker offers, grouped by mood and limited to the roles each face suits,
|
|
182
|
+
* are the curated list in lib/fonts.ts; any other stack is kept as the site's own. */
|
|
156
183
|
fonts: z
|
|
157
184
|
.object({
|
|
158
185
|
heading: z.string().default(''),
|
|
@@ -168,6 +195,11 @@ export const themeSettingsSchema = z.object({
|
|
|
168
195
|
stroke: z.enum(['on', 'off']).default('on'),
|
|
169
196
|
/** Input treatment — a single site-wide choice (a `data-field` attr on <html>). */
|
|
170
197
|
fields: z.enum(['boxed', 'filled', 'underline']).default('boxed'),
|
|
198
|
+
/** A finish on the display titles (the opener's title, a banner's title, the marquee),
|
|
199
|
+
* one site-wide choice (a `data-title-effect` attr on <html>): an outline, a hard
|
|
200
|
+
* poster shadow or a soft glow, in the brand colour. Always extra to the text's own
|
|
201
|
+
* contrast, never instead of it, and never animated. */
|
|
202
|
+
titleEffect: z.enum(TITLE_EFFECTS).default('none'),
|
|
171
203
|
/** Dark-mode formula knobs (root-derivation model). `darkDepth` = how light the
|
|
172
204
|
* dark page background sits (OKLCH L); `darkChroma` = the cap on how much colour
|
|
173
205
|
* the dark ground may carry. Both feed the AUTOMATIC dark roots. */
|
|
@@ -195,6 +227,7 @@ export const themeSettingsSchema = z.object({
|
|
|
195
227
|
|
|
196
228
|
export type SiteSettings = z.infer<typeof siteSettingsSchema>;
|
|
197
229
|
export type LogoSettings = z.infer<typeof logoSettingsSchema>;
|
|
230
|
+
export type LogoHeader = z.infer<typeof logoHeaderSchema>;
|
|
198
231
|
export type NavbarSettings = z.infer<typeof navbarSettingsSchema>;
|
|
199
232
|
export type FooterSettings = z.infer<typeof footerSettingsSchema>;
|
|
200
233
|
export type ThemeSettings = z.infer<typeof themeSettingsSchema>;
|
package/examples/recipes.ts
CHANGED
|
@@ -5,7 +5,10 @@ export const recipes: GalleryEntry[] = [
|
|
|
5
5
|
{ type: 'hero', description: 'Page-opening band — split preset (text beside image).', block: { type: 'hero', title: 'Hero (split)', subtitle: 'Text beside an image.', cta: { label: 'Primary action', href: '#' }, image: { src: '/placeholder.svg', alt: 'Placeholder' }, layout: 'split' } },
|
|
6
6
|
{ type: 'hero', description: 'Media preset with a slow crossfade through several images — pauses off-screen, has a pause button, and stays on the first image under reduced motion. A single image is a still background; a `video` loops instead (and `size: "screen"` fills the first screen, edge to edge).', block: { type: 'hero', eyebrow: 'Welcome', title: 'Hero (media, rotating images)', subtitle: 'Text over a background that changes slowly.', cta: { label: 'Primary action', href: '#' }, layout: 'media', size: 'tall', media: { images: ['/showcase-hero.svg', '/placeholder.svg'], overlay: 45 } } },
|
|
7
7
|
{ type: 'hero', description: 'Media preset looping a YouTube (or Vimeo) video behind the text: paste the ordinary link as `video`. Until the visitor accepts cookies it shows the `poster` still and links to the video; then the muted, chromeless loop fades in, with a pause button. Reduced motion keeps the still.', block: { type: 'hero', title: 'Hero (media, YouTube background)', subtitle: 'A video opener without hosting the file yourself.', layout: 'media', size: 'tall', media: { video: 'https://youtu.be/aqz-KE-bpKQ', poster: '/showcase-hero.svg', overlay: 50 } } },
|
|
8
|
+
{ type: 'hero', description: 'A title set as a picture (`titleImage`): a designed wordmark, ideally transparent, drawn inside the page’s h1 in place of the title text. The `title` describes it, so screen readers and search engines still read the name. `width` small / medium / large (about 320 / 520 / 760px, capped to the screen on phones, never cropped); `shadow` keeps light lettering readable over a photo. Works in every layout.', block: { type: 'hero', eyebrow: 'Sea kayaking and coasteering', title: 'Tideline Outdoors', titleImage: { src: '/wordmark.svg', width: 'medium', shadow: true }, subtitle: 'The wordmark is the title.', cta: { label: 'Primary action', href: '#' }, layout: 'media', media: { image: '/showcase-hero.svg', overlay: 40 } } },
|
|
9
|
+
{ type: 'hero', description: 'A designed poster shown whole (`media.fit: "contain"`): never cropped, at its own shape, edge to edge with `size: "screen"` or `fullBleed`, the band as tall as the picture. No scrim; the words sit below the picture. `titleHidden` keeps the title as the page’s h1 for screen readers and search engines without showing it, since the poster already carries the name.', block: { type: 'hero', title: 'Harbour Adventures', titleHidden: true, subtitle: 'The poster carries the name; the words sit below it.', cta: { label: 'Primary action', href: '#' }, layout: 'media', media: { image: '/poster.svg', fit: 'contain' } } },
|
|
8
10
|
{ type: 'featureCards', description: 'An optional header over a responsive grid of icon + title + text cards.', block: { type: 'featureCards', title: 'Feature cards', columns: 3, cards: [{ icon: 'book-open', title: 'First feature', text: 'A short description.' }, { icon: 'shield', title: 'Second feature', text: 'A short description.' }, { icon: 'sparkle', title: 'Third feature', text: 'A short description.' }] } },
|
|
11
|
+
{ type: 'featureCards', description: 'Any count lays out neatly, with nothing to set: every grid of cards, tiles or numbers plans its rows per screen width (lib/gridRows). Never more to a row than the block’s columns or than stay readable; even rows only by using fewer columns; otherwise the full rows stay full and the last row is tidied: it spreads across the width (here 4 + 3), or, when that would stretch it, sits centred at the same width. `lastRow: "fill" | "center"` overrides that.', block: { type: 'featureCards', title: 'Seven cards, four to a row', columns: 4, cards: [{ icon: 'book-open', title: 'Plan', text: 'A short description.' }, { icon: 'shield', title: 'Protect', text: 'A short description.' }, { icon: 'sparkle', title: 'Polish', text: 'A short description.' }, { icon: 'heart', title: 'Care', text: 'A short description.' }, { icon: 'people', title: 'Gather', text: 'A short description.' }, { icon: 'gift', title: 'Give', text: 'A short description.' }, { icon: 'calendar', title: 'Schedule', text: 'A short description.' }] } },
|
|
9
12
|
{ type: 'cta', description: 'A centred call-to-action band (heading + text + button).', block: { type: 'cta', title: 'Ready to start?', text: 'A closing nudge with a single, clear action.', cta: { label: 'Get in touch', href: '#' }, background: 'accent' } },
|
|
10
13
|
{ type: 'faq', description: 'Expandable question / answer list — native, accessible, no JavaScript.', block: { type: 'faq', title: 'Frequently asked', items: [{ question: 'How are pages built?', answer: 'From a curated set of blocks, composed into your pages and verified before they go live — see the [architecture notes](https://example.com/architecture).' }, { question: 'Can I use my own brand?', answer: 'Yes — colours and fonts are your config; the core is brand-agnostic.' }] } },
|
|
11
14
|
{ type: 'gallery', description: 'A responsive grid of images with optional captions.', block: { type: 'gallery', columns: 3, images: [{ src: '/placeholder.svg', alt: 'One', caption: 'One' }, { src: '/placeholder.svg', alt: 'Two', caption: 'Two' }, { src: '/placeholder.svg', alt: 'Three', caption: 'Three' }] } },
|
|
@@ -16,6 +19,7 @@ export const recipes: GalleryEntry[] = [
|
|
|
16
19
|
{ type: 'tiles', description: 'The “gradient” variant — brand → a derived accent-2 (an OKLCH hue-shift of your one brand colour), light text.', block: { type: 'tiles', variant: 'gradient', columns: 3, tiles: [{ icon: 'flame', title: 'Vibrant', text: 'One brand colour, a harmonious gradient.' }, { icon: 'sparkle', title: 'Derived', text: 'Accent-2 is computed, not configured.' }, { icon: 'heart', title: 'On-brand', text: 'Always harmonises with your hue.' }] } },
|
|
17
20
|
{ type: 'tiles', description: 'The “image” variant — a full-bleed photo with a legibility scrim and light text; the whole tile links.', block: { type: 'tiles', variant: 'image', columns: 3, tiles: [{ eyebrow: 'Feature', title: 'Photo tile', text: 'Text stays legible over any image.', href: '#', image: { src: '/placeholder.svg', alt: 'Placeholder' } }, { title: 'Second', text: 'Cover-fit background.', href: '#', image: { src: '/placeholder.svg', alt: 'Placeholder' } }, { title: 'Third', text: 'With a gradient scrim.', href: '#', image: { src: '/placeholder.svg', alt: 'Placeholder' } }] } },
|
|
18
21
|
{ type: 'tiles', description: 'Picture tiles — the “image” variant with no words: the picture alone is the tile (and the button, when it links), shown whole whatever its shape (a poster, a wide logo, a badge), named by its alt text. Mix with worded tiles; `linkLabel` sets the cue.', block: { type: 'tiles', variant: 'image', columns: 3, tiles: [{ href: '#', image: { src: '/placeholder.svg', alt: 'Summer fair poster — details' } }, { href: '#', image: { src: '/logos/acme.svg', alt: 'Acme — our partner' } }, { title: 'Newsletters', text: 'Every issue, newest first.', href: '#', linkLabel: 'Read them', image: { src: '/placeholder.svg', alt: '' } }] } },
|
|
22
|
+
{ type: 'tiles', description: 'Picture tiles edge to edge — `fit: "bleed"` makes each picture the tile itself (no frame, the site’s corners clip it; a linked one lifts with a shadow), and `ratio: "3/2"` gives every tile one shape, cropping each picture round its `focus`. Leave `ratio` at `auto` to keep each picture’s own shape; with the default `fit: "frame"` a set ratio shows each picture whole inside the frame.', block: { type: 'tiles', variant: 'image', fit: 'bleed', ratio: '3/2', columns: 3, tiles: [{ href: '#', image: { src: '/placeholder.svg', alt: 'Craft market poster — details' } }, { href: '#', image: { src: '/showcase-hero.svg', alt: 'Open day poster — details', focus: 'left' } }, { href: '#', image: { src: '/logos/badge.svg', alt: 'Club badge — about us', focus: 'center 25%' } }] } },
|
|
19
23
|
{ type: 'banner', description: 'A full-bleed feature band — a fixed/parallax background image with a scrim and a floating “shaded glass” card. Pure-CSS parallax; disabled on touch and under reduced-motion.', block: { type: 'banner', image: '/showcase-hero.svg', eyebrow: 'Featured', title: 'A banner that moves', text: 'The image is pinned to the viewport, so it drifts under this card as you scroll.', cta: { label: 'Take a look', href: '#' }, align: 'start' } },
|
|
20
24
|
{ type: 'stats', description: 'A band of headline numbers (value + label) over an optional heading — social proof at a glance.', block: { type: 'stats', title: 'By the numbers', background: 'muted', columns: 3, items: [{ value: '250+', label: 'projects shipped' }, { value: '99.9%', label: 'uptime', description: 'rolling 12 months' }, { value: '<1 day', label: 'average reply' }] } },
|
|
21
25
|
{ type: 'steps', description: 'A numbered process — connected cards (horizontal) or a stacked timeline (vertical).', block: { type: 'steps', title: 'How it works', layout: 'horizontal', items: [{ icon: 'chat', title: 'Tell us the problem', text: 'A straight conversation about the work costing you time.' }, { icon: 'sparkle', title: 'We fit it to you', text: 'The platform, shaped around how you actually work.' }, { icon: 'shield', title: 'You run it', text: 'Yours to use; we keep it running.' }] } },
|