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
package/styles/theme.css
CHANGED
|
@@ -1,160 +1,228 @@
|
|
|
1
|
-
/* Theme tokens — the single home for every colour, surface, and breakpoint
|
|
2
|
-
width the rest of the core references via `var(--…)`. Lifted out of
|
|
3
|
-
`Base.astro` so the chrome components (`SiteHeader`, `SiteFooter`,
|
|
4
|
-
`CookiePreferences`) and any future "modify page elements" feature can
|
|
5
|
-
read the same palette without touching the layout file.
|
|
6
|
-
|
|
7
|
-
These are the core's NEUTRAL DEFAULTS — a deliberately unbranded slate +
|
|
8
|
-
indigo set. Every client overrides the ones it cares about via the
|
|
9
|
-
`themeSettings` collection (Base.astro emits those as a higher-specificity
|
|
10
|
-
<style> in the document head), so brand colours live in the client's repo,
|
|
11
|
-
never here. That's why the accent tokens keep their historic names
|
|
12
|
-
(`--gold`, `--brown`, `--gold-light`) even though the default values are no
|
|
13
|
-
longer gold: renaming them would churn ~60 call-sites across the chrome for
|
|
14
|
-
no functional gain, and clients set them by name regardless. Roles:
|
|
15
|
-
--gold interactive accent (links hover, buttons, focus, active)
|
|
16
|
-
--accent dark readable text accent (nav/footer link text)
|
|
17
|
-
--brown secondary muted text
|
|
18
|
-
--gold-light soft accent background (callouts, gradients)
|
|
19
|
-
--dark-bg dark-mode chrome background (header/footer/nav)
|
|
20
|
-
|
|
21
|
-
Breakpoints are em-based (MDN-recommended); duplicated as literals inside
|
|
22
|
-
@media rules elsewhere because media queries can't reference custom
|
|
23
|
-
properties. Read them in JS via getComputedStyle if you ever need the
|
|
24
|
-
numeric value at runtime. */
|
|
25
|
-
|
|
26
|
-
:root {
|
|
27
|
-
--bp-tablet: 48em; /* 768px @ default 16px root */
|
|
28
|
-
--bp-desktop: 64em; /* 1024px @ default 16px root */
|
|
29
|
-
|
|
30
|
-
--fg: #1F2937;
|
|
31
|
-
--muted: #4B5563;
|
|
32
|
-
--accent: #334155;
|
|
33
|
-
--bg: #F1F5F9;
|
|
34
|
-
--bg-surface: #FFFFFF;
|
|
35
|
-
--bg-section: #E2E8F0;
|
|
36
|
-
--bg-tag: #E2E8F0;
|
|
37
|
-
--border: #CBD5E1;
|
|
38
|
-
--max: 72ch;
|
|
39
|
-
--dark-bg: #0F172A;
|
|
40
|
-
--gold: #4F46E5;
|
|
41
|
-
--gold-light: #E0E7FF;
|
|
42
|
-
--brown: #4B5563;
|
|
43
|
-
--text-light: #FFFFFF;
|
|
44
|
-
--on-brand: #FFFFFF; /* text on brand-coloured fills (buttons, badges) */
|
|
45
|
-
--text-footer: #4B5563;
|
|
46
|
-
--text-footer-link: #4F46E5;
|
|
47
|
-
--text-copyright: #94A3B8;
|
|
48
|
-
--divider-dark: #94A3B8;
|
|
49
|
-
--text-subtle: #94A3B8;
|
|
50
|
-
--overlay-accent-08: rgba(51,65,85,0.08);
|
|
51
|
-
--overlay-accent-18: rgba(51,65,85,0.18);
|
|
52
|
-
--overlay-white-07: rgba(255,255,255,0.07);
|
|
53
|
-
--overlay-white-08: rgba(255,255,255,0.08);
|
|
54
|
-
--overlay-white-12: rgba(255,255,255,0.12);
|
|
55
|
-
/* Accent-tinted cards (e.g. the news carousel) — reuse the accent tokens */
|
|
56
|
-
--news-card-body: #1F2937;
|
|
57
|
-
--news-card-meta: #4B5563;
|
|
58
|
-
/* All `h3` / `.t-h3`: ~22px (1.375rem) floor on mobile → max 26px (1.625rem) */
|
|
59
|
-
--type-h3-size: clamp(1.375rem, 1.2rem + 0.55vw, 1.625rem);
|
|
60
|
-
|
|
61
|
-
/* ── Surface treatment — the design "knobs" every card / tile / input reads,
|
|
62
|
-
so a single change restyles the whole site consistently (a client sets
|
|
63
|
-
these once in themeSettings; the showcase /theme playground sets them live).
|
|
64
|
-
--radius corner radius for cards, tiles, inputs, buttons-as-tiles
|
|
65
|
-
--card-border the stroke around a surface (set to `none` for borderless)
|
|
66
|
-
--shadow-* elevation ramp (sm/md/lg); set --shadow-md:none for flat. */
|
|
67
|
-
--radius: 12px;
|
|
68
|
-
/* Derived from --radius so the one "corners" control also rounds the smaller
|
|
69
|
-
surfaces (fields, accordion rows) proportionally — sharp brand → sharp
|
|
70
|
-
fields, soft brand → soft fields. */
|
|
71
|
-
--radius-sm: calc(var(--radius) * 0.66);
|
|
72
|
-
--radius-pill: 999px;
|
|
73
|
-
--card-border: 1px solid var(--border);
|
|
74
|
-
--shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
|
|
75
|
-
--shadow-md: 0 6px 22px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04);
|
|
76
|
-
--shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.08);
|
|
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
|
-
--
|
|
134
|
-
|
|
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
|
-
|
|
1
|
+
/* Theme tokens — the single home for every colour, surface, and breakpoint
|
|
2
|
+
width the rest of the core references via `var(--…)`. Lifted out of
|
|
3
|
+
`Base.astro` so the chrome components (`SiteHeader`, `SiteFooter`,
|
|
4
|
+
`CookiePreferences`) and any future "modify page elements" feature can
|
|
5
|
+
read the same palette without touching the layout file.
|
|
6
|
+
|
|
7
|
+
These are the core's NEUTRAL DEFAULTS — a deliberately unbranded slate +
|
|
8
|
+
indigo set. Every client overrides the ones it cares about via the
|
|
9
|
+
`themeSettings` collection (Base.astro emits those as a higher-specificity
|
|
10
|
+
<style> in the document head), so brand colours live in the client's repo,
|
|
11
|
+
never here. That's why the accent tokens keep their historic names
|
|
12
|
+
(`--gold`, `--brown`, `--gold-light`) even though the default values are no
|
|
13
|
+
longer gold: renaming them would churn ~60 call-sites across the chrome for
|
|
14
|
+
no functional gain, and clients set them by name regardless. Roles:
|
|
15
|
+
--gold interactive accent (links hover, buttons, focus, active)
|
|
16
|
+
--accent dark readable text accent (nav/footer link text)
|
|
17
|
+
--brown secondary muted text
|
|
18
|
+
--gold-light soft accent background (callouts, gradients)
|
|
19
|
+
--dark-bg dark-mode chrome background (header/footer/nav)
|
|
20
|
+
|
|
21
|
+
Breakpoints are em-based (MDN-recommended); duplicated as literals inside
|
|
22
|
+
@media rules elsewhere because media queries can't reference custom
|
|
23
|
+
properties. Read them in JS via getComputedStyle if you ever need the
|
|
24
|
+
numeric value at runtime. */
|
|
25
|
+
|
|
26
|
+
:root {
|
|
27
|
+
--bp-tablet: 48em; /* 768px @ default 16px root */
|
|
28
|
+
--bp-desktop: 64em; /* 1024px @ default 16px root */
|
|
29
|
+
|
|
30
|
+
--fg: #1F2937;
|
|
31
|
+
--muted: #4B5563;
|
|
32
|
+
--accent: #334155;
|
|
33
|
+
--bg: #F1F5F9;
|
|
34
|
+
--bg-surface: #FFFFFF;
|
|
35
|
+
--bg-section: #E2E8F0;
|
|
36
|
+
--bg-tag: #E2E8F0;
|
|
37
|
+
--border: #CBD5E1;
|
|
38
|
+
--max: 72ch;
|
|
39
|
+
--dark-bg: #0F172A;
|
|
40
|
+
--gold: #4F46E5;
|
|
41
|
+
--gold-light: #E0E7FF;
|
|
42
|
+
--brown: #4B5563;
|
|
43
|
+
--text-light: #FFFFFF;
|
|
44
|
+
--on-brand: #FFFFFF; /* text on brand-coloured fills (buttons, badges) */
|
|
45
|
+
--text-footer: #4B5563;
|
|
46
|
+
--text-footer-link: #4F46E5;
|
|
47
|
+
--text-copyright: #94A3B8;
|
|
48
|
+
--divider-dark: #94A3B8;
|
|
49
|
+
--text-subtle: #94A3B8;
|
|
50
|
+
--overlay-accent-08: rgba(51,65,85,0.08);
|
|
51
|
+
--overlay-accent-18: rgba(51,65,85,0.18);
|
|
52
|
+
--overlay-white-07: rgba(255,255,255,0.07);
|
|
53
|
+
--overlay-white-08: rgba(255,255,255,0.08);
|
|
54
|
+
--overlay-white-12: rgba(255,255,255,0.12);
|
|
55
|
+
/* Accent-tinted cards (e.g. the news carousel) — reuse the accent tokens */
|
|
56
|
+
--news-card-body: #1F2937;
|
|
57
|
+
--news-card-meta: #4B5563;
|
|
58
|
+
/* All `h3` / `.t-h3`: ~22px (1.375rem) floor on mobile → max 26px (1.625rem) */
|
|
59
|
+
--type-h3-size: clamp(1.375rem, 1.2rem + 0.55vw, 1.625rem);
|
|
60
|
+
|
|
61
|
+
/* ── Surface treatment — the design "knobs" every card / tile / input reads,
|
|
62
|
+
so a single change restyles the whole site consistently (a client sets
|
|
63
|
+
these once in themeSettings; the showcase /theme playground sets them live).
|
|
64
|
+
--radius corner radius for cards, tiles, inputs, buttons-as-tiles
|
|
65
|
+
--card-border the stroke around a surface (set to `none` for borderless)
|
|
66
|
+
--shadow-* elevation ramp (sm/md/lg); set --shadow-md:none for flat. */
|
|
67
|
+
--radius: 12px;
|
|
68
|
+
/* Derived from --radius so the one "corners" control also rounds the smaller
|
|
69
|
+
surfaces (fields, accordion rows) proportionally — sharp brand → sharp
|
|
70
|
+
fields, soft brand → soft fields. */
|
|
71
|
+
--radius-sm: calc(var(--radius) * 0.66);
|
|
72
|
+
--radius-pill: 999px;
|
|
73
|
+
--card-border: 1px solid var(--border);
|
|
74
|
+
--shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
|
|
75
|
+
--shadow-md: 0 6px 22px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04);
|
|
76
|
+
--shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.08);
|
|
77
|
+
/* The soft shadow under a logo or a wordmark (logoSettings.header.shadow, a hero's
|
|
78
|
+
titleImage.shadow), one drop-shadow() value so it follows the picture's own outline: a
|
|
79
|
+
round badge gets a round shadow, brush lettering a lettered one. */
|
|
80
|
+
--shadow-logo: 0 4px 12px rgba(15, 23, 42, 0.35);
|
|
81
|
+
|
|
82
|
+
/* Derived secondary accent for gradients / two-tone tiles — a tonal shade of
|
|
83
|
+
the single brand accent, so a one-colour brand still yields depth. Clients
|
|
84
|
+
(or the showcase's live playground) can override with a distinct hue. */
|
|
85
|
+
--accent-2: color-mix(in oklch, var(--gold) 82%, #000);
|
|
86
|
+
|
|
87
|
+
/* ── Typography roles — the site-wide font config. Every heading / body /
|
|
88
|
+
accent face reads one of these, so a client sets fonts by name (in
|
|
89
|
+
themeSettings, same as colours) and it propagates everywhere. A recipe that
|
|
90
|
+
needs a special face uses the DISPLAY role by design — we don't allow a
|
|
91
|
+
free-form per-block font (that's the inconsistency the system prevents).
|
|
92
|
+
--font-heading h1/h3, nav, buttons, card titles (the workhorse UI face)
|
|
93
|
+
--font-display h2/h4 and hero display type (the characterful face)
|
|
94
|
+
--font-body paragraphs, lists, form fields, meta
|
|
95
|
+
--font-mono code, block-type labels, tabular data
|
|
96
|
+
The faces a theme can pick are the curated list in lib/fonts.ts.
|
|
97
|
+
--font-title is derived, not set: the face of the display titles (the opener's
|
|
98
|
+
title, the marquee). It is the heading face until a theme picks a display face,
|
|
99
|
+
then that face (lib/themeTokens.ts). */
|
|
100
|
+
--font-heading: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
|
|
101
|
+
--font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
|
|
102
|
+
--font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
|
|
103
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
104
|
+
--font-title: var(--font-heading);
|
|
105
|
+
|
|
106
|
+
/* The colour of a title effect (outline, shadow, glow): the brand, kept at least
|
|
107
|
+
mid-light so it stands apart from dark text even when the brand itself is dark
|
|
108
|
+
(in dark mode, at most mid-light, apart from light text). It follows light and
|
|
109
|
+
dark mode; a site can set its own in `advanced`. */
|
|
110
|
+
--title-effect-colour: oklch(from var(--gold) max(l, 0.62) c h);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* ── Dark mode ── */
|
|
114
|
+
[data-theme="dark"] {
|
|
115
|
+
--fg: #E2E8F0;
|
|
116
|
+
--muted: #94A3B8;
|
|
117
|
+
--accent: #CBD5E1;
|
|
118
|
+
--bg: #0F172A;
|
|
119
|
+
--bg-surface: #1E293B;
|
|
120
|
+
--bg-section: #1E293B;
|
|
121
|
+
--bg-tag: #1E293B;
|
|
122
|
+
--border: #334155;
|
|
123
|
+
--dark-bg: #0B1120;
|
|
124
|
+
--gold: #818CF8;
|
|
125
|
+
--gold-light: #312E81;
|
|
126
|
+
--brown: #94A3B8;
|
|
127
|
+
--text-light: #E2E8F0;
|
|
128
|
+
--on-brand: #0F172A; /* the light accent needs dark text */
|
|
129
|
+
--text-footer: #94A3B8;
|
|
130
|
+
--text-footer-link: #818CF8;
|
|
131
|
+
--text-copyright: #64748B;
|
|
132
|
+
--divider-dark: #334155;
|
|
133
|
+
--text-subtle: #64748B;
|
|
134
|
+
/* Footer secondary-logo raster: darken toward paragraph copy (--muted) */
|
|
135
|
+
--secondary-logo-filter: brightness(0.68) contrast(1.12) saturate(0.82);
|
|
136
|
+
--overlay-accent-08: rgba(255,255,255,0.07);
|
|
137
|
+
--overlay-accent-18: rgba(255,255,255,0.12);
|
|
138
|
+
--overlay-white-07: rgba(255,255,255,0.07);
|
|
139
|
+
--overlay-white-08: rgba(255,255,255,0.08);
|
|
140
|
+
--overlay-white-12: rgba(255,255,255,0.12);
|
|
141
|
+
--news-card-body: var(--fg);
|
|
142
|
+
--news-card-meta: rgba(226, 232, 240, 0.78);
|
|
143
|
+
/* On dark, depth comes from the elevated surface + border, not soft shadows —
|
|
144
|
+
keep shadows deep and quiet so they don't glow. */
|
|
145
|
+
--shadow-sm: none;
|
|
146
|
+
--shadow-md: 0 1px 0 rgba(255, 255, 255, 0.03);
|
|
147
|
+
--shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
|
|
148
|
+
--shadow-logo: 0 4px 14px rgba(0, 0, 0, 0.6);
|
|
149
|
+
--accent-2: color-mix(in oklch, var(--gold) 82%, #fff);
|
|
150
|
+
--title-effect-colour: oklch(from var(--gold) min(l, 0.6) c h);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* ── Global utilities ────────────────────────────────────────────────────────
|
|
154
|
+
Unscoped helpers usable from any component — including from inside an Astro
|
|
155
|
+
scoped style, where a parent can't reach a child element's root. */
|
|
156
|
+
|
|
157
|
+
/* Overlay convention: an element hidden via the `hidden` attribute must never
|
|
158
|
+
linger in the layout intercepting pointer events. An author `display` rule
|
|
159
|
+
(e.g. `display:flex` on a fixed banner) otherwise beats the UA `[hidden]`
|
|
160
|
+
rule, leaving an invisible click-blocker — the cookie-banner / map-tile
|
|
161
|
+
footgun we hit twice. This is the site-wide safety net; components need no
|
|
162
|
+
per-element guard of their own. */
|
|
163
|
+
[hidden] { display: none !important; }
|
|
164
|
+
|
|
165
|
+
/* Card/tile surface — the single home for the "tile" look, driven by the global
|
|
166
|
+
surface knobs (--radius / --card-border / --shadow-*) so every tile restyles
|
|
167
|
+
at once, in both themes. Add `.ferst-tile` to a recipe's card element instead
|
|
168
|
+
of re-inlining these four properties; `.ferst-tile--sm` swaps to the lighter
|
|
169
|
+
shadow for denser grids. Recipes with a genuinely different surface (image /
|
|
170
|
+
gradient tiles, tinted panels) keep their own styling. */
|
|
171
|
+
.ferst-tile {
|
|
172
|
+
background: var(--bg-surface);
|
|
173
|
+
border: var(--card-border);
|
|
174
|
+
border-radius: var(--radius);
|
|
175
|
+
box-shadow: var(--shadow-md);
|
|
176
|
+
}
|
|
177
|
+
.ferst-tile--sm { box-shadow: var(--shadow-sm); }
|
|
178
|
+
|
|
179
|
+
/* Display titles: the opener's title, a banner's title, the marquee. A recipe marks
|
|
180
|
+
the element that holds its title with `data-display-title`; the title is its heading
|
|
181
|
+
(each item, for the marquee). The opener's title takes the title face (--font-title),
|
|
182
|
+
and every display title takes the theme's title effect (`themeSettings.titleEffect`,
|
|
183
|
+
a `data-title-effect` attribute on <html>) in --title-effect-colour.
|
|
184
|
+
An effect is extra to the text's own colour, never instead of it: no rule here
|
|
185
|
+
touches the text's colour or fill, so its contrast (lib/contrast.ts) stands as it
|
|
186
|
+
is. Nothing animates, so reduced motion needs nothing. A gradient heading keeps its
|
|
187
|
+
own look. */
|
|
188
|
+
[data-display-title] > h1 { font-family: var(--font-title); }
|
|
189
|
+
|
|
190
|
+
:root[data-title-effect='shadow'] [data-display-title] > :is(.b-heading, .b-marquee__item):not([data-gradient='true']) {
|
|
191
|
+
/* A hard offset shadow: the poster look. */
|
|
192
|
+
text-shadow: 0.06em 0.06em 0 var(--title-effect-colour);
|
|
193
|
+
}
|
|
194
|
+
:root[data-title-effect='glow'] [data-display-title] > :is(.b-heading, .b-marquee__item):not([data-gradient='true']) {
|
|
195
|
+
text-shadow:
|
|
196
|
+
0 0 0.1em color-mix(in srgb, var(--title-effect-colour) 70%, transparent),
|
|
197
|
+
0 0 0.45em color-mix(in srgb, var(--title-effect-colour) 45%, transparent);
|
|
198
|
+
}
|
|
199
|
+
/* An outline drawn behind the letters (paint-order), so it never eats into them. Where
|
|
200
|
+
outlines aren't supported the title is simply plain. */
|
|
201
|
+
@supports (-webkit-text-stroke: 1px black) and (paint-order: stroke fill) {
|
|
202
|
+
:root[data-title-effect='stroke'] [data-display-title] > :is(.b-heading, .b-marquee__item):not([data-gradient='true']) {
|
|
203
|
+
-webkit-text-stroke: 0.08em var(--title-effect-colour);
|
|
204
|
+
paint-order: stroke fill;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Planned rows — the one layout rule for every grid of items (lib/gridRows). A recipe adds
|
|
209
|
+
`.ferst-rows` to its grid and the plan's inline custom properties: `--tracks-p/t/d` on the
|
|
210
|
+
grid (its track count on phones, on tablets from 40em, on desktops from 60em), `--span-*`
|
|
211
|
+
and `--start-*` on each item that needs them. Decided at build time: no script, no shift.
|
|
212
|
+
The item properties are reset on every planned grid, so a grid inside another grid's item
|
|
213
|
+
never inherits that item's placement. */
|
|
214
|
+
.ferst-rows {
|
|
215
|
+
display: grid;
|
|
216
|
+
grid-template-columns: repeat(var(--tracks-p, 1), minmax(0, 1fr));
|
|
217
|
+
--span-p: 1; --span-t: 1; --span-d: 1;
|
|
218
|
+
--start-p: auto; --start-t: auto; --start-d: auto;
|
|
219
|
+
}
|
|
220
|
+
.ferst-rows > * { grid-column: var(--start-p) / span var(--span-p); }
|
|
221
|
+
@media (min-width: 40em) {
|
|
222
|
+
.ferst-rows { grid-template-columns: repeat(var(--tracks-t, 1), minmax(0, 1fr)); }
|
|
223
|
+
.ferst-rows > * { grid-column: var(--start-t) / span var(--span-t); }
|
|
224
|
+
}
|
|
225
|
+
@media (min-width: 60em) {
|
|
226
|
+
.ferst-rows { grid-template-columns: repeat(var(--tracks-d, 1), minmax(0, 1fr)); }
|
|
227
|
+
.ferst-rows > * { grid-column: var(--start-d) / span var(--span-d); }
|
|
228
|
+
}
|
package/lib/gridColumns.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* How many columns a grid of cards or numbers uses, so the last row is never short.
|
|
3
|
-
* - **Desktop:** everything in one row when it fits within `max`; otherwise the widest column
|
|
4
|
-
* count up to `max` that divides the items evenly; failing that, `max`.
|
|
5
|
-
* - **Tablet:** twos for an even count, one column for an odd one (an odd count sits in one row
|
|
6
|
-
* on desktop and one column below it, never 2 + 1).
|
|
7
|
-
* - **Phones:** always one column (the recipes' base style).
|
|
8
|
-
*/
|
|
9
|
-
export interface GridColumns { tablet: 1 | 2; desktop: number }
|
|
10
|
-
|
|
11
|
-
export function gridColumns(count: number, max: number): GridColumns {
|
|
12
|
-
if (count <= 1) return { tablet: 1, desktop: 1 };
|
|
13
|
-
let desktop = max;
|
|
14
|
-
if (count <= max) desktop = count;
|
|
15
|
-
else {
|
|
16
|
-
for (let c = max; c >= 2; c--) {
|
|
17
|
-
if (count % c === 0) { desktop = c; break; }
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const tablet = desktop > 1 && count % 2 === 0 ? 2 : 1;
|
|
21
|
-
return { tablet, desktop };
|
|
22
|
-
}
|