@contentrain/astro-kit 0.24.1 → 0.25.1
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/catalog.json +9 -0
- package/components/footer/Footer.astro +4 -2
- package/components/footer/fixtures.json +2 -1
- package/components/hero/Hero.astro +8 -4
- package/components/hero/fixtures.json +48 -0
- package/components/hero/hero.ts +8 -2
- package/components/hero/meta.json +9 -0
- package/package.json +1 -1
package/catalog.json
CHANGED
|
@@ -1711,6 +1711,15 @@
|
|
|
1711
1711
|
],
|
|
1712
1712
|
"default": "default",
|
|
1713
1713
|
"description": "default: the layout's own type scale. theme: the heading takes the site's size for its level (`--text-heading-1` for the page-opening hero, `-2` otherwise), as the source's own h1 does under a block theme."
|
|
1714
|
+
},
|
|
1715
|
+
"headingSize": {
|
|
1716
|
+
"options": [
|
|
1717
|
+
"own",
|
|
1718
|
+
"h1",
|
|
1719
|
+
"h2"
|
|
1720
|
+
],
|
|
1721
|
+
"default": "own",
|
|
1722
|
+
"description": "The level whose site size the heading takes when it is not the level it is written at: h1 on an h2 heading keeps a source's second h1 at the h1 size under a page that keeps one h1. own: the heading's own level under headingScale theme, nothing otherwise. Any other value than own sets the size by itself."
|
|
1714
1723
|
}
|
|
1715
1724
|
},
|
|
1716
1725
|
"props": {
|
|
@@ -28,8 +28,10 @@ const footer = tv({
|
|
|
28
28
|
// The `columns` layout's link columns: spread from the brand column over the footer's width, or packed at the end
|
|
29
29
|
// edge at their own width (a theme whose footer is the brand left and its menus on the right).
|
|
30
30
|
pack: { spread: {}, end: {} },
|
|
31
|
-
// Packed columns below `md`: stacked, or still side by side from the start edge under the brand.
|
|
32
|
-
|
|
31
|
+
// Packed columns below `md`: stacked, or still side by side from the start edge under the brand. The trailing `1fr` track is
|
|
32
|
+
// the room the brand block spans too: a spanning item that crossed only the `auto` tracks would grow them to its own
|
|
33
|
+
// max-content (menus as wide as the brand's longest line); with a flexible track under it, it does not.
|
|
34
|
+
narrow: { stack: {}, row: { inner: 'grid-cols-[repeat(var(--footer-columns),auto)_1fr] justify-start gap-x-[var(--footer-gap-narrow,1.5rem)]' } },
|
|
33
35
|
},
|
|
34
36
|
compoundVariants: [
|
|
35
37
|
{ layout: 'simple', align: 'center', class: { inner: 'md:flex-col md:justify-center' } },
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
{ "name": "consent-settings", "props": { "siteName": "Golden Agency", "copyright": "© 2026 Golden Agency", "consentLabel": "Cookie settings", "links": [{ "label": "Privacy", "href": "/privacy/" }] } },
|
|
7
7
|
{ "name": "columns-end", "props": { "siteName": "Golden Works", "tagline": "Websites for makers", "layout": "columns", "pack": "end", "packGap": "128px", "linkSize": "17.88px", "copyright": "© 2026 Golden Works", "columns": [{ "label": "Studio", "links": [{ "label": "About", "href": "/about/" }, { "label": "Work", "href": "/work/" }] }, { "label": "Contact", "links": [{ "label": "Email", "href": "mailto:hello@example.com" }, { "label": "Press", "href": "/press/" }] }] } },
|
|
8
8
|
{ "name": "columns-end-row", "props": { "siteName": "Golden Works", "layout": "columns", "pack": "end", "narrow": "row", "packGap": "128px", "packGapNarrow": "48px", "linkSize": "17.88px", "copyright": "© 2026 Golden Works", "columns": [{ "label": "Studio", "links": [{ "label": "About", "href": "/about/" }, { "label": "Work", "href": "/work/" }] }, { "label": "Contact", "links": [{ "label": "Email", "href": "mailto:hello@example.com" }] }] } },
|
|
9
|
-
{ "name": "columns-end-row-narrow-size", "props": { "siteName": "Golden Works", "layout": "columns", "pack": "end", "narrow": "row", "packGap": "128px", "packGapNarrow": "48px", "linkSize": "17.88px", "linkSizeNarrow": "16.4px", "copyright": "© 2026 Golden Works", "columns": [{ "label": "Studio", "links": [{ "label": "About", "href": "/about/" }, { "label": "Work", "href": "/work/" }] }, { "label": "Contact", "links": [{ "label": "Email", "href": "mailto:hello@example.com" }] }] } }
|
|
9
|
+
{ "name": "columns-end-row-narrow-size", "props": { "siteName": "Golden Works", "layout": "columns", "pack": "end", "narrow": "row", "packGap": "128px", "packGapNarrow": "48px", "linkSize": "17.88px", "linkSizeNarrow": "16.4px", "copyright": "© 2026 Golden Works", "columns": [{ "label": "Studio", "links": [{ "label": "About", "href": "/about/" }, { "label": "Work", "href": "/work/" }] }, { "label": "Contact", "links": [{ "label": "Email", "href": "mailto:hello@example.com" }] }] } },
|
|
10
|
+
{ "name": "columns-end-row-long-brand", "props": { "siteName": "Golden Works Engineering Consultancy", "tagline": "Websites, systems and signalling for the people who keep cities moving every single day", "layout": "columns", "pack": "end", "narrow": "row", "packGap": "128px", "packGapNarrow": "70px", "linkSize": "17.88px", "linkSizeNarrow": "16.14px", "copyright": "© 2026 Golden Works Engineering Consultancy, all rights reserved", "columns": [{ "label": "Studio", "links": [{ "label": "About", "href": "/about/" }, { "label": "Work", "href": "/work/" }] }, { "label": "Contact", "links": [{ "label": "Email", "href": "mailto:hello@example.com" }] }] } }
|
|
10
11
|
]
|
|
@@ -39,6 +39,8 @@ const hero = tv({
|
|
|
39
39
|
width: { full: {}, content: {} },
|
|
40
40
|
// The heading's size: the layout's own scale, or the site's size for its level (set inline, see ./hero).
|
|
41
41
|
headingScale: { default: {}, theme: {} },
|
|
42
|
+
// The level whose site size the heading takes when it is not the level it is written at (set inline, see ./hero).
|
|
43
|
+
headingSize: { own: {}, h1: {}, h2: {} },
|
|
42
44
|
},
|
|
43
45
|
compoundVariants: [
|
|
44
46
|
// After the layout's own heights, so a boxed cover keeps WordPress's 430px default.
|
|
@@ -48,7 +50,7 @@ const hero = tv({
|
|
|
48
50
|
{ leadAlign: 'start', class: { lead: 'mx-0 max-w-none self-stretch text-start' } },
|
|
49
51
|
{ actionsAlign: 'start', class: { actions: 'justify-start self-stretch' } },
|
|
50
52
|
],
|
|
51
|
-
defaultVariants: { layout: 'split', tone: 'default', align: 'center', leadAlign: 'inherit', actionsAlign: 'inherit', width: 'full', headingScale: 'default' },
|
|
53
|
+
defaultVariants: { layout: 'split', tone: 'default', align: 'center', leadAlign: 'inherit', actionsAlign: 'inherit', width: 'full', headingScale: 'default', headingSize: 'own' },
|
|
52
54
|
})
|
|
53
55
|
|
|
54
56
|
interface Props {
|
|
@@ -74,16 +76,18 @@ interface Props {
|
|
|
74
76
|
minHeight?: number | undefined
|
|
75
77
|
/** `theme`: the heading takes the site's size for its level (the source's own `h1` size), not the layout's scale. */
|
|
76
78
|
headingScale?: 'default' | 'theme' | undefined
|
|
79
|
+
/** The level whose site size the heading takes, when it is not the level it is written at (`h1` size on an `h2`: a page keeps one `h1`). `own` (absent): the heading's own level under `theme`, as before. */
|
|
80
|
+
headingSize?: 'own' | 'h1' | 'h2' | undefined
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
|
|
80
|
-
const { heading, level = 1, eyebrow, lead, actions = [], image, layout = 'split', align, leadAlign, actionsAlign, width = 'full', tone, id, minHeight, headingScale } = Astro.props
|
|
81
|
-
const s = hero({ layout, align, leadAlign, actionsAlign, width, tone, headingScale })
|
|
84
|
+
const { heading, level = 1, eyebrow, lead, actions = [], image, layout = 'split', align, leadAlign, actionsAlign, width = 'full', tone, id, minHeight, headingScale, headingSize } = Astro.props
|
|
85
|
+
const s = hero({ layout, align, leadAlign, actionsAlign, width, tone, headingScale, headingSize })
|
|
82
86
|
const Heading = level === 1 ? 'h1' : 'h2'
|
|
83
87
|
const headingId = id ? `${id}-title` : undefined
|
|
84
88
|
const cover = layout === 'cover' && image
|
|
85
89
|
const coverHeight = cover ? heightOf(minHeight) : undefined
|
|
86
|
-
const headingStyle = styleOf(headingScale, level)
|
|
90
|
+
const headingStyle = styleOf(headingScale, level, headingSize)
|
|
87
91
|
---
|
|
88
92
|
{cover && width === 'content'
|
|
89
93
|
? (
|
|
@@ -191,5 +191,53 @@
|
|
|
191
191
|
"minHeight": 520,
|
|
192
192
|
"headingScale": "theme"
|
|
193
193
|
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "cover-content-size-h1",
|
|
197
|
+
"props": {
|
|
198
|
+
"heading": "Independent cinema, a neighbourhood hall",
|
|
199
|
+
"lead": "A hundred and twenty seats, fresh popcorn.",
|
|
200
|
+
"layout": "cover",
|
|
201
|
+
"actions": [
|
|
202
|
+
{
|
|
203
|
+
"label": "This week's programme",
|
|
204
|
+
"href": "/programme/"
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"image": {
|
|
208
|
+
"src": "/kit-fixtures/photo-1.svg",
|
|
209
|
+
"alt": "",
|
|
210
|
+
"width": 1600,
|
|
211
|
+
"height": 900
|
|
212
|
+
},
|
|
213
|
+
"width": "content",
|
|
214
|
+
"level": 2,
|
|
215
|
+
"minHeight": 520,
|
|
216
|
+
"headingScale": "theme",
|
|
217
|
+
"headingSize": "h1"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "centered-size-h2",
|
|
222
|
+
"props": {
|
|
223
|
+
"heading": "Plan a calmer trip",
|
|
224
|
+
"lead": "Our guides pick fewer places and give each one more time.",
|
|
225
|
+
"layout": "centered",
|
|
226
|
+
"tone": "muted",
|
|
227
|
+
"level": 2,
|
|
228
|
+
"actions": [
|
|
229
|
+
{
|
|
230
|
+
"label": "Browse guides",
|
|
231
|
+
"href": "/category/guides/"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"image": {
|
|
235
|
+
"src": "/kit-fixtures/photo-2.svg",
|
|
236
|
+
"alt": "",
|
|
237
|
+
"width": 1600,
|
|
238
|
+
"height": 700
|
|
239
|
+
},
|
|
240
|
+
"headingSize": "h2"
|
|
241
|
+
}
|
|
194
242
|
}
|
|
195
243
|
]
|
package/components/hero/hero.ts
CHANGED
|
@@ -4,6 +4,12 @@ export const coverHeight = (value: number | undefined): string | undefined => (N
|
|
|
4
4
|
/**
|
|
5
5
|
* `theme`: the heading's size is the site's for its level, the one the source's own `h1`/`h2` has (`--text-heading-1`,
|
|
6
6
|
* fluid where the theme's is); the layout's scale is the fallback while the site declares none.
|
|
7
|
+
* `size` names the level whose size the heading takes when that is not the level it is written at: a page keeps one
|
|
8
|
+
* `h1`, so a source's second `h1` is written as an `h2` and still drawn at the `h1` size. A `size` alone is enough; with
|
|
9
|
+
* none, the result is what it was before (the heading's own level under `theme`, nothing otherwise).
|
|
7
10
|
*/
|
|
8
|
-
export const headingStyle = (scale: 'default' | 'theme' | undefined, level: 1 | 2): string | undefined =>
|
|
9
|
-
scale
|
|
11
|
+
export const headingStyle = (scale: 'default' | 'theme' | undefined, level: 1 | 2, size?: 'own' | 'h1' | 'h2' | undefined): string | undefined => {
|
|
12
|
+
if (scale !== 'theme' && (!size || size === 'own')) return undefined
|
|
13
|
+
const used = size === 'h1' ? 1 : size === 'h2' ? 2 : level
|
|
14
|
+
return `font-size: var(--text-heading-${used}, var(--text-5xl)); line-height: var(--leading-heading, 1.2)`
|
|
15
|
+
}
|
|
@@ -69,6 +69,15 @@
|
|
|
69
69
|
],
|
|
70
70
|
"default": "default",
|
|
71
71
|
"description": "default: the layout's own type scale. theme: the heading takes the site's size for its level (`--text-heading-1` for the page-opening hero, `-2` otherwise), as the source's own h1 does under a block theme."
|
|
72
|
+
},
|
|
73
|
+
"headingSize": {
|
|
74
|
+
"options": [
|
|
75
|
+
"own",
|
|
76
|
+
"h1",
|
|
77
|
+
"h2"
|
|
78
|
+
],
|
|
79
|
+
"default": "own",
|
|
80
|
+
"description": "The level whose site size the heading takes when it is not the level it is written at: h1 on an h2 heading keeps a source's second h1 at the h1 size under a page that keeps one h1. own: the heading's own level under headingScale theme, nothing otherwise. Any other value than own sets the size by itself."
|
|
72
81
|
}
|
|
73
82
|
},
|
|
74
83
|
"props": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentrain/astro-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Copy-in Astro components for Contentrain sites (shadcn model): typed props, tailwind-variants, zero JavaScript by default — with a machine-readable catalog",
|
|
6
6
|
"type": "module",
|