@contentrain/astro-kit 0.4.0 → 0.5.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 CHANGED
@@ -66,6 +66,8 @@ theme applies them to the kit's markers, and only when the site sets them:
66
66
  - `--text-body`: `[data-kit-text]`, the lead and body paragraphs of hero, CTA
67
67
  and card grid.
68
68
  - `--text-nav`: the header navigation, `[data-cr-part="nav-header"]`.
69
+ - `--text-footer`: the footer's text and links, `[data-kit-footer]` (the kit's
70
+ own size is `text-sm`).
69
71
  - `--spacing-section`: the distance between two consecutive sections; each
70
72
  `[data-kit-section]` gets half of it as vertical padding, except
71
73
  where `data-kit-spacing="none"`.
package/catalog.json CHANGED
@@ -22,6 +22,7 @@
22
22
  "--radius-image",
23
23
  "--spacing-gutter",
24
24
  "--text-nav",
25
+ "--text-footer",
25
26
  "--text-heading-1",
26
27
  "--text-heading-2",
27
28
  "--text-heading-3",
@@ -563,7 +564,7 @@
563
564
  "plain"
564
565
  ],
565
566
  "default": "lines",
566
- "description": "lines: rows divided by rules. cards: each question in a rounded box. plain: the browser's own disclosure triangle without rules or boxes (WordPress's details block)."
567
+ "description": "lines: rows divided by rules. cards: each question in a rounded box. plain: the browser's own disclosure triangle without rules or boxes, questions at the body size (WordPress's details block)."
567
568
  },
568
569
  "tone": {
569
570
  "options": [
@@ -1236,6 +1237,14 @@
1236
1237
  ],
1237
1238
  "default": "compact",
1238
1239
  "description": "Gap and text size of the inline list."
1240
+ },
1241
+ "color": {
1242
+ "options": [
1243
+ "current",
1244
+ "link"
1245
+ ],
1246
+ "default": "current",
1247
+ "description": "current: the surrounding text, dimmed until hovered. link: the site's link colour (--color-link, else the accent) at full strength."
1239
1248
  }
1240
1249
  },
1241
1250
  "props": {
@@ -26,7 +26,7 @@ const faq = tv({
26
26
  lines: { list: 'divide-y divide-line border-y border-line' },
27
27
  cards: { list: 'gap-3', item: 'rounded-card border border-line px-5', summary: 'py-5' },
28
28
  // WordPress's details block: the browser's own disclosure triangle, no rules or box.
29
- plain: { list: 'gap-2', summary: 'list-item list-[revert] py-1 text-base [font-weight:inherit] [&::-webkit-details-marker]:inline', marker: 'hidden', answer: 'pt-2 pl-5' },
29
+ plain: { list: 'gap-2', summary: 'list-item list-[revert] py-1 text-[length:var(--text-body,1rem)] [font-weight:inherit] [&::-webkit-details-marker]:inline', marker: 'hidden', answer: 'pt-2 pl-5' },
30
30
  },
31
31
  tone: { default: {}, muted: { item: 'bg-surface' }, inverse: { answer: 'prose-invert' }, accent: { answer: 'prose-invert' } },
32
32
  },
@@ -6,7 +6,7 @@
6
6
  "uses": [],
7
7
  "shared": ["Section.astro"],
8
8
  "variants": {
9
- "style": { "options": ["lines", "cards", "plain"], "default": "lines", "description": "lines: rows divided by rules. cards: each question in a rounded box. plain: the browser's own disclosure triangle without rules or boxes (WordPress's details block)." },
9
+ "style": { "options": ["lines", "cards", "plain"], "default": "lines", "description": "lines: rows divided by rules. cards: each question in a rounded box. plain: the browser's own disclosure triangle without rules or boxes, questions at the body size (WordPress's details block)." },
10
10
  "tone": { "options": ["default", "muted", "inverse", "accent"], "default": "default", "description": "Section background." }
11
11
  },
12
12
  "props": {
@@ -47,7 +47,7 @@ const year = String(new Date().getFullYear())
47
47
  const line = copyright?.replaceAll('{year}', year) ?? `© ${year} ${siteName}`
48
48
  ---
49
49
  <footer class={root()}>
50
- <div class={inner()} style={layout === 'columns' ? `--footer-columns: ${Math.max(columns.length, 1)}` : undefined}>
50
+ <div class={inner()} data-kit-footer style={layout === 'columns' ? `--footer-columns: ${Math.max(columns.length, 1)}` : undefined}>
51
51
  <div class="flex flex-col gap-3">
52
52
  <p class="text-base font-semibold" data-kit-brand>{siteName}</p>
53
53
  {tagline && <p class={muted()} data-kit-tagline>{tagline}</p>}
@@ -56,24 +56,15 @@ const { root, inner, brand } = header({ layout, tone, position })
56
56
  ---
57
57
  <header class={root()}>
58
58
  <div class={inner()}>
59
- {tagline
60
- ? (
61
- <div class="flex flex-col gap-1">
62
- <a href={homeHref} class={brand()} aria-label={showName ? undefined : siteName} style={brandSize ? `font-size: ${brandSize}` : undefined} data-kit-brand>
63
- {logo && <KitImage image={logo} priority class="h-8 w-auto" sizes="160px" />}
64
- {showName && <span>{siteName}</span>}
65
- </a>
66
- <p class="opacity-75" data-kit-tagline>{tagline}</p>
67
- </div>
68
- )
69
- : (
70
- <a href={homeHref} class={brand()} aria-label={showName ? undefined : siteName} style={brandSize ? `font-size: ${brandSize}` : undefined} data-kit-brand>
71
- {logo && <KitImage image={logo} priority class="h-8 w-auto" sizes="160px" />}
72
- {showName && <span>{siteName}</span>}
73
- </a>
74
- )}
75
- <div class:list={['flex items-center gap-4', layout === 'centered' ? 'justify-center' : 'ml-auto', linkNav && 'text-[color:var(--color-link,var(--color-accent))]']}>
76
- <Nav items={items} label={navLabel} menuLabel={menuLabel} closeLabel={closeLabel} part="nav-header" align={layout === 'centered' ? 'center' : 'end'} />
59
+ <div class="flex flex-col gap-1">
60
+ <a href={homeHref} class={brand()} aria-label={showName ? undefined : siteName} style={brandSize ? `font-size: ${brandSize}` : undefined} data-kit-brand>
61
+ {logo && <KitImage image={logo} priority class="h-8 w-auto" sizes="160px" />}
62
+ {showName && <span>{siteName}</span>}
63
+ </a>
64
+ {tagline && <p class="opacity-75" data-kit-tagline>{tagline}</p>}
65
+ </div>
66
+ <div class:list={['flex items-center gap-4', layout === 'centered' ? 'justify-center' : 'ml-auto']}>
67
+ <Nav items={items} label={navLabel} menuLabel={menuLabel} closeLabel={closeLabel} part="nav-header" color={linkNav ? 'link' : 'current'} align={layout === 'centered' ? 'center' : 'end'} />
77
68
  {action && <Button action={action} size="sm" class="hidden md:inline-flex" />}
78
69
  </div>
79
70
  </div>
@@ -8,7 +8,7 @@ import type { NavItem } from '../_shared/types'
8
8
  const nav = tv({
9
9
  slots: {
10
10
  list: 'hidden items-center md:flex',
11
- link: 'text-current no-underline opacity-80 hover:opacity-100 aria-[current=page]:font-semibold aria-[current=page]:opacity-100',
11
+ link: 'no-underline aria-[current=page]:font-semibold',
12
12
  // hidden, not invisible: a closed submenu takes no space, so one under the last item cannot widen the page.
13
13
  sub: 'absolute top-full z-30 hidden min-w-48 rounded-lg border border-line bg-surface p-2 text-ink shadow-lg group-hover:block group-focus-within:block',
14
14
  toggle: 'inline-flex cursor-pointer list-none items-center gap-2 rounded-md px-3 py-2 text-sm font-medium hover:bg-current/10 md:hidden [&::-webkit-details-marker]:hidden',
@@ -17,8 +17,14 @@ const nav = tv({
17
17
  // Submenus open towards the page: leftwards under an end-aligned menu.
18
18
  align: { start: { list: 'justify-start', sub: 'left-0' }, end: { list: 'justify-end', sub: 'right-0' }, center: { list: 'justify-center', sub: 'left-0' } },
19
19
  density: { compact: { list: 'gap-5 text-sm' }, comfortable: { list: 'gap-8 text-base' } },
20
+ // current: the surrounding text, dimmed until hovered. link: the site's link colour at full strength, as themes that
21
+ // colour every link draw their menu; the toggle keeps the surrounding text.
22
+ color: {
23
+ current: { link: 'text-current opacity-80 hover:opacity-100 aria-[current=page]:opacity-100' },
24
+ link: { link: 'text-[color:var(--color-link,var(--color-accent))]' },
25
+ },
20
26
  },
21
- defaultVariants: { align: 'end', density: 'compact' },
27
+ defaultVariants: { align: 'end', density: 'compact', color: 'current' },
22
28
  })
23
29
 
24
30
  interface Props {
@@ -32,14 +38,15 @@ interface Props {
32
38
  mobile?: 'popover' | 'details' | undefined
33
39
  align?: 'start' | 'end' | 'center' | undefined
34
40
  density?: 'compact' | 'comfortable' | undefined
41
+ color?: 'current' | 'link' | undefined
35
42
  /** Unique per page when a page has two navigations. */
36
43
  id?: string | undefined
37
44
  /** What the navigation is, for checks that find a page's parts (`data-cr-part`, e.g. "nav-header"). */
38
45
  part?: string | undefined
39
46
  }
40
47
 
41
- const { items, label = 'Main', menuLabel = 'Menu', closeLabel = 'Close', mobile = 'popover', align, density, id = 'site-nav', part } = Astro.props
42
- const { list, link, sub, toggle } = nav({ align, density })
48
+ const { items, label = 'Main', menuLabel = 'Menu', closeLabel = 'Close', mobile = 'popover', align, density, color, id = 'site-nav', part } = Astro.props
49
+ const { list, link, sub, toggle } = nav({ align, density, color })
43
50
  const current = Astro.url.pathname
44
51
  const drawer = `${id}-drawer`
45
52
  ---
@@ -61,6 +61,7 @@
61
61
  "props": {
62
62
  "id": "fx-nav-c",
63
63
  "align": "center",
64
+ "color": "link",
64
65
  "items": [
65
66
  {
66
67
  "label": "Work",
@@ -32,6 +32,14 @@
32
32
  ],
33
33
  "default": "compact",
34
34
  "description": "Gap and text size of the inline list."
35
+ },
36
+ "color": {
37
+ "options": [
38
+ "current",
39
+ "link"
40
+ ],
41
+ "default": "current",
42
+ "description": "current: the surrounding text, dimmed until hovered. link: the site's link colour (--color-link, else the accent) at full strength."
35
43
  }
36
44
  },
37
45
  "props": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentrain/astro-kit",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
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",
@@ -42,7 +42,7 @@
42
42
  "mapping"
43
43
  ],
44
44
  "dependencies": {
45
- "@contentrain/types": "1.28.0"
45
+ "@contentrain/types": "1.29.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/node": "^22.10.0",