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.
Files changed (59) hide show
  1. package/README.md +13 -4
  2. package/bin/ferst-media.mjs +96 -0
  3. package/components/Card.astro +53 -51
  4. package/components/PostCard.astro +138 -136
  5. package/components/SiteHeader.astro +10 -14
  6. package/components/blocks/Grid.astro +49 -48
  7. package/components/blocks/Heading.astro +4 -1
  8. package/components/recipes/Banner.astro +146 -146
  9. package/components/recipes/FeatureCards.astro +112 -118
  10. package/components/recipes/Gallery.astro +57 -59
  11. package/components/recipes/Hero.astro +112 -10
  12. package/components/recipes/LatestPosts.astro +295 -292
  13. package/components/recipes/Locations.astro +146 -143
  14. package/components/recipes/Marquee.astro +75 -75
  15. package/components/recipes/MediaCards.astro +213 -219
  16. package/components/recipes/Pricing.astro +149 -150
  17. package/components/recipes/Stats.astro +150 -157
  18. package/components/recipes/Tiles.astro +342 -296
  19. package/content/blocks.ts +1072 -1024
  20. package/content/imageSlots.mjs +542 -0
  21. package/content/schemas.ts +13 -11
  22. package/examples/recipes.ts +4 -0
  23. package/fonts/OFL.txt +1332 -287
  24. package/fonts/anton-latin-400-normal.woff2 +0 -0
  25. package/fonts/bangers-latin-400-normal.woff2 +0 -0
  26. package/fonts/bebas-neue-latin-400-normal.woff2 +0 -0
  27. package/fonts/bowlby-one-latin-400-normal.woff2 +0 -0
  28. package/fonts/fredoka-latin-400-normal.woff2 +0 -0
  29. package/fonts/fredoka-latin-600-normal.woff2 +0 -0
  30. package/fonts/fredoka-latin-700-normal.woff2 +0 -0
  31. package/fonts/knewave-latin-400-normal.woff2 +0 -0
  32. package/fonts/lora-latin-400-normal.woff2 +0 -0
  33. package/fonts/lora-latin-600-normal.woff2 +0 -0
  34. package/fonts/lora-latin-700-normal.woff2 +0 -0
  35. package/fonts/merriweather-latin-400-normal.woff2 +0 -0
  36. package/fonts/merriweather-latin-600-normal.woff2 +0 -0
  37. package/fonts/merriweather-latin-700-normal.woff2 +0 -0
  38. package/fonts/nunito-latin-400-normal.woff2 +0 -0
  39. package/fonts/nunito-latin-600-normal.woff2 +0 -0
  40. package/fonts/nunito-latin-700-normal.woff2 +0 -0
  41. package/fonts/oswald-latin-400-normal.woff2 +0 -0
  42. package/fonts/oswald-latin-600-normal.woff2 +0 -0
  43. package/fonts/oswald-latin-700-normal.woff2 +0 -0
  44. package/fonts/rubik-dirt-latin-400-normal.woff2 +0 -0
  45. package/integration.mjs +4 -14
  46. package/layouts/Base.astro +7 -16
  47. package/lib/fonts.ts +130 -0
  48. package/lib/gridRows.ts +197 -0
  49. package/lib/image-fields.ts +140 -0
  50. package/lib/image-size.mjs +108 -73
  51. package/lib/image-sizes.ts +16 -0
  52. package/lib/logo-header.ts +46 -0
  53. package/lib/media-check.mjs +524 -0
  54. package/lib/theme-preview.ts +203 -140
  55. package/lib/themeTokens.ts +235 -220
  56. package/package.json +3 -2
  57. package/styles/fonts.css +239 -76
  58. package/styles/theme.css +228 -160
  59. package/lib/gridColumns.ts +0 -22
@@ -1,143 +1,146 @@
1
- ---
2
- /**
3
- * Locations ("Where to find us") — a Level-2 recipe: one or more places, each a
4
- * neat tile with a consent-gated map on top and its name / address / directions
5
- * below. Replaces stacking bare map embeds. The map loads once the visitor accepts
6
- * the site cookie banner (shared consent — no per-tile gate for anyone who
7
- * accepted); the per-tile "Show map" button is a fallback that grants the same
8
- * consent. Token-driven, equal-height tiles. https embed URLs only.
9
- */
10
- import Icon from '../Icon.astro';
11
- import Heading from '../blocks/Heading.astro';
12
- import { isSafeEmbedUrl } from '../../content/calendar';
13
-
14
- interface Item {
15
- name: string;
16
- address?: string;
17
- embedUrl: string;
18
- directionsUrl?: string;
19
- }
20
- interface Props {
21
- title?: string;
22
- intro?: string;
23
- columns?: 1 | 2;
24
- provider?: string;
25
- items?: Item[];
26
- }
27
- const { title, intro, columns = 2, provider = 'Google Maps', items = [] } = Astro.props;
28
- // A single location shouldn't sit in one half of a two-column grid; `data-single`
29
- // centres a lone tile. (A deliberate columns=1 with several items is untouched.)
30
- const cols = Math.min(columns, Math.max(items.length, 1)) as 1 | 2;
31
- ---
32
-
33
- <section class="b-locations">
34
- {(title || intro) && (
35
- <div class="b-locations__head">
36
- {title && <Heading text={title} level={2} />}
37
- {intro && <p class="b-locations__intro">{intro}</p>}
38
- </div>
39
- )}
40
- <div class="b-locations__grid" data-cols={cols} data-single={items.length === 1 ? 'true' : undefined}>
41
- {items.map((item) => (
42
- <article class="b-locations__card ferst-tile ferst-tile--sm">
43
- <div class="b-locations__map">
44
- {isSafeEmbedUrl(item.embedUrl) ? (
45
- <div class="b-loc-map" data-embed-url={item.embedUrl} data-title={`Map — ${item.name}`}>
46
- <div class="b-loc-map__consent">
47
- <p class="b-loc-map__text">This map is provided by {provider}.</p>
48
- <button type="button" class="b-loc-map__load">Show map</button>
49
- </div>
50
- <div class="b-loc-map__frame"></div>
51
- </div>
52
- ) : (
53
- <div class="b-loc-map__fallback" aria-hidden="true"><Icon name="map-pin" size={30} /></div>
54
- )}
55
- </div>
56
- <div class="b-locations__body">
57
- <h3 class="b-locations__name">{item.name}</h3>
58
- {item.address && <p class="b-locations__address">{item.address}</p>}
59
- {item.directionsUrl && (
60
- <a class="b-locations__dir" href={item.directionsUrl} target="_blank" rel="noopener">
61
- Get directions <span aria-hidden="true">→</span>
62
- </a>
63
- )}
64
- </div>
65
- </article>
66
- ))}
67
- </div>
68
- </section>
69
-
70
- <script>
71
- // Shared consent-gated embed loader (see lib/embed-consent). Accepting the cookie
72
- // banner or the footer panel auto-loads every map tile here; the per-tile button
73
- // is a fallback that grants the same shared consent.
74
- import { initEmbedConsent, makeEmbedFrame } from '../../lib/embed-consent';
75
-
76
- initEmbedConsent({
77
- root: '.b-loc-map',
78
- frame: '.b-loc-map__frame',
79
- consent: '.b-loc-map__consent',
80
- button: '.b-loc-map__load',
81
- buildFrame: (el, url) =>
82
- makeEmbedFrame(url, { title: el.dataset.title || 'Map', height: '100%', referrer: true }),
83
- });
84
- </script>
85
-
86
- <style>
87
- .b-locations {
88
- display: flex;
89
- flex-direction: column;
90
- gap: 1.75rem;
91
- max-width: 72rem;
92
- margin-inline: auto;
93
- padding-inline: 1rem;
94
- }
95
- .b-locations__head { display: flex; flex-direction: column; gap: 0.6rem; }
96
- .b-locations__intro { margin: 0; color: var(--muted); max-width: var(--max); }
97
- .b-locations__grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
98
- /* A solitary location is a centred feature, not a full-width slab. */
99
- .b-locations__grid[data-single] { max-width: 32rem; margin-inline: auto; }
100
- @media (min-width: 44em) {
101
- .b-locations__grid[data-cols='2'] { grid-template-columns: repeat(2, 1fr); }
102
- }
103
- .b-locations__card {
104
- display: flex;
105
- flex-direction: column;
106
- /* surface comes from .ferst-tile .ferst-tile--sm (bg/border/radius/shadow-sm) */
107
- overflow: hidden;
108
- }
109
- /* Map region — uniform ratio; the consent card fills it until the iframe loads. */
110
- .b-locations__map { position: relative; aspect-ratio: 4 / 3; background: var(--bg-section); }
111
- .b-loc-map, .b-loc-map__frame, .b-loc-map__consent, .b-loc-map__fallback { position: absolute; inset: 0; }
112
- /* The frame slot sits AFTER the consent card (both inset:0), so while it's empty
113
- it would paint on top and swallow clicks meant for the "Show map" button. Keep
114
- an empty slot click-through; once the iframe is injected it's no longer :empty
115
- and becomes interactive. The consent card is also lifted above it as a belt-
116
- and-braces guard while it's visible. */
117
- .b-loc-map__frame:empty { pointer-events: none; }
118
- .b-loc-map__frame :global(iframe) { display: block; }
119
- .b-loc-map__consent {
120
- display: flex; flex-direction: column; align-items: center; justify-content: center;
121
- gap: 0.75rem; padding: 1.5rem; text-align: center;
122
- z-index: 1;
123
- }
124
- .b-loc-map__consent[hidden] { display: none; }
125
- .b-loc-map__text { margin: 0; color: var(--muted); font-size: 0.9rem; max-width: 32ch; }
126
- .b-loc-map__load {
127
- font: inherit; font-family: var(--font-heading); font-weight: 600; font-size: 0.9rem;
128
- padding: 0.5rem 1.1rem; border: none; border-radius: var(--radius-sm);
129
- background: var(--gold); color: var(--on-brand); cursor: pointer;
130
- transition: filter 0.15s ease;
131
- }
132
- .b-loc-map__load:hover { filter: brightness(0.94); }
133
- .b-loc-map__load:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
134
- .b-loc-map__fallback { display: flex; align-items: center; justify-content: center; color: var(--muted); }
135
- .b-locations__body { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.1rem 1.2rem 1.3rem; }
136
- .b-locations__name { margin: 0; font-size: 1.15rem; }
137
- .b-locations__address { margin: 0; color: var(--muted); line-height: 1.55; white-space: pre-line; }
138
- .b-locations__dir {
139
- margin-top: 0.35rem;
140
- font-family: var(--font-heading); font-weight: 600; font-size: 0.9rem;
141
- color: var(--gold);
142
- }
143
- </style>
1
+ ---
2
+ /**
3
+ * Locations ("Where to find us") — a Level-2 recipe: one or more places, each a
4
+ * neat tile with a consent-gated map on top and its name / address / directions
5
+ * below. Replaces stacking bare map embeds. The map loads once the visitor accepts
6
+ * the site cookie banner (shared consent — no per-tile gate for anyone who
7
+ * accepted); the per-tile "Show map" button is a fallback that grants the same
8
+ * consent. Token-driven, equal-height tiles. https embed URLs only.
9
+ */
10
+ import Icon from '../Icon.astro';
11
+ import Heading from '../blocks/Heading.astro';
12
+ import { isSafeEmbedUrl } from '../../content/calendar';
13
+ import { planGrid } from '../../lib/gridRows';
14
+
15
+ interface Item {
16
+ name: string;
17
+ address?: string;
18
+ embedUrl: string;
19
+ directionsUrl?: string;
20
+ }
21
+ interface Props {
22
+ title?: string;
23
+ intro?: string;
24
+ columns?: 1 | 2;
25
+ provider?: string;
26
+ items?: Item[];
27
+ /** How the ragged last row lays out (lib/gridRows). */
28
+ lastRow?: 'auto' | 'fill' | 'center';
29
+ }
30
+ const { title, intro, columns = 2, provider = 'Google Maps', items = [], lastRow = 'auto' } = Astro.props;
31
+ // Rows planned per screen (lib/gridRows); `data-single` centres a lone place. (A deliberate
32
+ // columns=1 stacks every place.)
33
+ const rows = planGrid(items.length, { columns, item: 'locations', lastRow });
34
+ ---
35
+
36
+ <section class="b-locations">
37
+ {(title || intro) && (
38
+ <div class="b-locations__head">
39
+ {title && <Heading text={title} level={2} />}
40
+ {intro && <p class="b-locations__intro">{intro}</p>}
41
+ </div>
42
+ )}
43
+ <div class="b-locations__grid ferst-rows" data-cols={rows.cols} data-single={items.length === 1 ? 'true' : undefined} style={rows.gridStyle}>
44
+ {items.map((item, i) => (
45
+ <article class="b-locations__card ferst-tile ferst-tile--sm" style={rows.itemStyles[i]}>
46
+ <div class="b-locations__map">
47
+ {isSafeEmbedUrl(item.embedUrl) ? (
48
+ <div class="b-loc-map" data-embed-url={item.embedUrl} data-title={`Map — ${item.name}`}>
49
+ <div class="b-loc-map__consent">
50
+ <p class="b-loc-map__text">This map is provided by {provider}.</p>
51
+ <button type="button" class="b-loc-map__load">Show map</button>
52
+ </div>
53
+ <div class="b-loc-map__frame"></div>
54
+ </div>
55
+ ) : (
56
+ <div class="b-loc-map__fallback" aria-hidden="true"><Icon name="map-pin" size={30} /></div>
57
+ )}
58
+ </div>
59
+ <div class="b-locations__body">
60
+ <h3 class="b-locations__name">{item.name}</h3>
61
+ {item.address && <p class="b-locations__address">{item.address}</p>}
62
+ {item.directionsUrl && (
63
+ <a class="b-locations__dir" href={item.directionsUrl} target="_blank" rel="noopener">
64
+ Get directions <span aria-hidden="true">→</span>
65
+ </a>
66
+ )}
67
+ </div>
68
+ </article>
69
+ ))}
70
+ </div>
71
+ </section>
72
+
73
+ <script>
74
+ // Shared consent-gated embed loader (see lib/embed-consent). Accepting the cookie
75
+ // banner or the footer panel auto-loads every map tile here; the per-tile button
76
+ // is a fallback that grants the same shared consent.
77
+ import { initEmbedConsent, makeEmbedFrame } from '../../lib/embed-consent';
78
+
79
+ initEmbedConsent({
80
+ root: '.b-loc-map',
81
+ frame: '.b-loc-map__frame',
82
+ consent: '.b-loc-map__consent',
83
+ button: '.b-loc-map__load',
84
+ buildFrame: (el, url) =>
85
+ makeEmbedFrame(url, { title: el.dataset.title || 'Map', height: '100%', referrer: true }),
86
+ });
87
+ </script>
88
+
89
+ <style>
90
+ .b-locations {
91
+ display: flex;
92
+ flex-direction: column;
93
+ gap: 1.75rem;
94
+ width: 100%; /* the full content width, whatever its items hold (lib/gridRows) */
95
+ max-width: 72rem;
96
+ margin-inline: auto;
97
+ padding-inline: 1rem;
98
+ }
99
+ .b-locations__head { display: flex; flex-direction: column; gap: 0.6rem; }
100
+ .b-locations__intro { margin: 0; color: var(--muted); max-width: var(--max); }
101
+ .b-locations__grid { display: grid; gap: 1.5rem; }
102
+ /* Rows come from lib/gridRows (the global .ferst-rows rules): even rows where the
103
+ count allows by using fewer columns, else full rows and a tidied last row. */
104
+ /* A solitary location is a centred feature, not a full-width slab. */
105
+ .b-locations__grid[data-single] { max-width: 32rem; margin-inline: auto; }
106
+ .b-locations__card {
107
+ display: flex;
108
+ flex-direction: column;
109
+ /* surface comes from .ferst-tile .ferst-tile--sm (bg/border/radius/shadow-sm) */
110
+ overflow: hidden;
111
+ }
112
+ /* Map region — uniform ratio; the consent card fills it until the iframe loads. */
113
+ .b-locations__map { position: relative; aspect-ratio: 4 / 3; background: var(--bg-section); }
114
+ .b-loc-map, .b-loc-map__frame, .b-loc-map__consent, .b-loc-map__fallback { position: absolute; inset: 0; }
115
+ /* The frame slot sits AFTER the consent card (both inset:0), so while it's empty
116
+ it would paint on top and swallow clicks meant for the "Show map" button. Keep
117
+ an empty slot click-through; once the iframe is injected it's no longer :empty
118
+ and becomes interactive. The consent card is also lifted above it as a belt-
119
+ and-braces guard while it's visible. */
120
+ .b-loc-map__frame:empty { pointer-events: none; }
121
+ .b-loc-map__frame :global(iframe) { display: block; }
122
+ .b-loc-map__consent {
123
+ display: flex; flex-direction: column; align-items: center; justify-content: center;
124
+ gap: 0.75rem; padding: 1.5rem; text-align: center;
125
+ z-index: 1;
126
+ }
127
+ .b-loc-map__consent[hidden] { display: none; }
128
+ .b-loc-map__text { margin: 0; color: var(--muted); font-size: 0.9rem; max-width: 32ch; }
129
+ .b-loc-map__load {
130
+ font: inherit; font-family: var(--font-heading); font-weight: 600; font-size: 0.9rem;
131
+ padding: 0.5rem 1.1rem; border: none; border-radius: var(--radius-sm);
132
+ background: var(--gold); color: var(--on-brand); cursor: pointer;
133
+ transition: filter 0.15s ease;
134
+ }
135
+ .b-loc-map__load:hover { filter: brightness(0.94); }
136
+ .b-loc-map__load:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
137
+ .b-loc-map__fallback { display: flex; align-items: center; justify-content: center; color: var(--muted); }
138
+ .b-locations__body { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.1rem 1.2rem 1.3rem; }
139
+ .b-locations__name { margin: 0; font-size: 1.15rem; }
140
+ .b-locations__address { margin: 0; color: var(--muted); line-height: 1.55; white-space: pre-line; }
141
+ .b-locations__dir {
142
+ margin-top: 0.35rem;
143
+ font-family: var(--font-heading); font-weight: 600; font-size: 0.9rem;
144
+ color: var(--gold);
145
+ }
146
+ </style>
@@ -1,75 +1,75 @@
1
- ---
2
- /** Marquee — a Level-2 recipe: an infinite horizontal scroll of short phrases
3
- * (a feature strip). Pure-CSS transform loop (GPU-composited); pauses on hover.
4
- * Under reduced-motion it doesn't move — the phrases wrap and centre statically.
5
- * The moving track is duplicated for a seamless loop and marked decorative. */
6
- interface Props {
7
- items?: string[];
8
- speed?: 'slow' | 'normal' | 'fast';
9
- }
10
- const { items = [], speed = 'normal' } = Astro.props;
11
- ---
12
-
13
- <div class="b-marquee" data-speed={speed}>
14
- <div class="b-marquee__track" aria-hidden="true">
15
- {[...items, ...items].map((item) => (
16
- <span class="b-marquee__item">{item}</span>
17
- ))}
18
- </div>
19
- </div>
20
-
21
- <style>
22
- .b-marquee {
23
- overflow: hidden;
24
- border-block: 1px solid var(--border);
25
- padding-block: 0.85rem;
26
- background: var(--bg-section);
27
- -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
28
- mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
29
- }
30
- .b-marquee__track {
31
- display: flex;
32
- width: max-content;
33
- gap: 0;
34
- animation: b-marquee-scroll linear infinite;
35
- }
36
- .b-marquee[data-speed='slow'] .b-marquee__track { animation-duration: 45s; }
37
- .b-marquee[data-speed='normal'] .b-marquee__track { animation-duration: 30s; }
38
- .b-marquee[data-speed='fast'] .b-marquee__track { animation-duration: 18s; }
39
- .b-marquee:hover .b-marquee__track { animation-play-state: paused; }
40
-
41
- .b-marquee__item {
42
- display: inline-flex;
43
- align-items: center;
44
- padding-inline: 1.75rem;
45
- font-family: var(--font-heading);
46
- font-weight: 600;
47
- font-size: 0.95rem;
48
- color: var(--fg);
49
- white-space: nowrap;
50
- }
51
- .b-marquee__item::after {
52
- content: '';
53
- width: 6px;
54
- height: 6px;
55
- margin-left: 3.5rem;
56
- border-radius: 999px;
57
- background: var(--gold);
58
- }
59
-
60
- @keyframes b-marquee-scroll {
61
- from { transform: translateX(0); }
62
- to { transform: translateX(-50%); }
63
- }
64
-
65
- @media (prefers-reduced-motion: reduce) {
66
- .b-marquee { -webkit-mask-image: none; mask-image: none; }
67
- .b-marquee__track {
68
- animation: none;
69
- width: auto;
70
- flex-wrap: wrap;
71
- justify-content: center;
72
- gap: 0.25rem 0;
73
- }
74
- }
75
- </style>
1
+ ---
2
+ /** Marquee — a Level-2 recipe: an infinite horizontal scroll of short phrases
3
+ * (a feature strip). Pure-CSS transform loop (GPU-composited); pauses on hover.
4
+ * Under reduced-motion it doesn't move — the phrases wrap and centre statically.
5
+ * The moving track is duplicated for a seamless loop and marked decorative. */
6
+ interface Props {
7
+ items?: string[];
8
+ speed?: 'slow' | 'normal' | 'fast';
9
+ }
10
+ const { items = [], speed = 'normal' } = Astro.props;
11
+ ---
12
+
13
+ <div class="b-marquee" data-speed={speed}>
14
+ <div class="b-marquee__track" aria-hidden="true" data-display-title>
15
+ {[...items, ...items].map((item) => (
16
+ <span class="b-marquee__item">{item}</span>
17
+ ))}
18
+ </div>
19
+ </div>
20
+
21
+ <style>
22
+ .b-marquee {
23
+ overflow: hidden;
24
+ border-block: 1px solid var(--border);
25
+ padding-block: 0.85rem;
26
+ background: var(--bg-section);
27
+ -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
28
+ mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent);
29
+ }
30
+ .b-marquee__track {
31
+ display: flex;
32
+ width: max-content;
33
+ gap: 0;
34
+ animation: b-marquee-scroll linear infinite;
35
+ }
36
+ .b-marquee[data-speed='slow'] .b-marquee__track { animation-duration: 45s; }
37
+ .b-marquee[data-speed='normal'] .b-marquee__track { animation-duration: 30s; }
38
+ .b-marquee[data-speed='fast'] .b-marquee__track { animation-duration: 18s; }
39
+ .b-marquee:hover .b-marquee__track { animation-play-state: paused; }
40
+
41
+ .b-marquee__item {
42
+ display: inline-flex;
43
+ align-items: center;
44
+ padding-inline: 1.75rem;
45
+ font-family: var(--font-title, var(--font-heading));
46
+ font-weight: 600;
47
+ font-size: 0.95rem;
48
+ color: var(--fg);
49
+ white-space: nowrap;
50
+ }
51
+ .b-marquee__item::after {
52
+ content: '';
53
+ width: 6px;
54
+ height: 6px;
55
+ margin-left: 3.5rem;
56
+ border-radius: 999px;
57
+ background: var(--gold);
58
+ }
59
+
60
+ @keyframes b-marquee-scroll {
61
+ from { transform: translateX(0); }
62
+ to { transform: translateX(-50%); }
63
+ }
64
+
65
+ @media (prefers-reduced-motion: reduce) {
66
+ .b-marquee { -webkit-mask-image: none; mask-image: none; }
67
+ .b-marquee__track {
68
+ animation: none;
69
+ width: auto;
70
+ flex-wrap: wrap;
71
+ justify-content: center;
72
+ gap: 0.25rem 0;
73
+ }
74
+ }
75
+ </style>