create-kitcms 0.0.0-stage → 0.1.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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -2
  3. package/bin/create.js +5 -0
  4. package/dist/args.d.ts +15 -0
  5. package/dist/args.js +72 -0
  6. package/dist/index.d.ts +30 -0
  7. package/dist/index.js +150 -0
  8. package/dist/scaffold.d.ts +25 -0
  9. package/dist/scaffold.js +98 -0
  10. package/dist/wrangler.d.ts +2 -0
  11. package/dist/wrangler.js +7 -0
  12. package/package.json +34 -3
  13. package/templates/blank/.dev.vars.example +1 -0
  14. package/templates/blank/README.md +39 -0
  15. package/templates/blank/_gitignore +7 -0
  16. package/templates/blank/package.json +37 -0
  17. package/templates/blank/pnpm-workspace.yaml +3 -0
  18. package/templates/blank/src/app.d.ts +22 -0
  19. package/templates/blank/src/app.html +11 -0
  20. package/templates/blank/src/hooks.server.ts +4 -0
  21. package/templates/blank/src/kitcms.admin.ts +14 -0
  22. package/templates/blank/src/kitcms.config.ts +32 -0
  23. package/templates/blank/src/kitcms.rpc.ts +6 -0
  24. package/templates/blank/src/lib/index.ts +1 -0
  25. package/templates/blank/src/routes/(kitcms)/admin/[...path]/+page.server.ts +2 -0
  26. package/templates/blank/src/routes/(kitcms)/admin/[...path]/+page.svelte +9 -0
  27. package/templates/blank/src/routes/(kitcms)/api/[...path]/+server.ts +2 -0
  28. package/templates/blank/src/routes/+page.server.ts +7 -0
  29. package/templates/blank/src/routes/+page.svelte +19 -0
  30. package/templates/blank/tsconfig.json +11 -0
  31. package/templates/blank/vite.config.ts +8 -0
  32. package/templates/blank/wrangler.jsonc +28 -0
  33. package/templates/website/.dev.vars.example +1 -0
  34. package/templates/website/README.md +105 -0
  35. package/templates/website/_gitignore +7 -0
  36. package/templates/website/package.json +42 -0
  37. package/templates/website/pnpm-workspace.yaml +3 -0
  38. package/templates/website/src/app.css +23 -0
  39. package/templates/website/src/app.d.ts +22 -0
  40. package/templates/website/src/app.html +11 -0
  41. package/templates/website/src/hooks.server.ts +4 -0
  42. package/templates/website/src/kitcms.admin.ts +19 -0
  43. package/templates/website/src/kitcms.config.ts +269 -0
  44. package/templates/website/src/kitcms.rpc.ts +6 -0
  45. package/templates/website/src/kitcms.seed.ts +232 -0
  46. package/templates/website/src/lib/Img.svelte +62 -0
  47. package/templates/website/src/lib/Link.svelte +10 -0
  48. package/templates/website/src/lib/PageView.svelte +30 -0
  49. package/templates/website/src/lib/PostList.svelte +169 -0
  50. package/templates/website/src/lib/RichText.svelte +13 -0
  51. package/templates/website/src/lib/Seo.svelte +31 -0
  52. package/templates/website/src/lib/blocks/AdminPreview.svelte +59 -0
  53. package/templates/website/src/lib/blocks/Cta.svelte +86 -0
  54. package/templates/website/src/lib/blocks/Features.svelte +147 -0
  55. package/templates/website/src/lib/blocks/Gallery.svelte +122 -0
  56. package/templates/website/src/lib/blocks/Hero.svelte +151 -0
  57. package/templates/website/src/lib/blocks/LatestPosts.svelte +36 -0
  58. package/templates/website/src/lib/blocks/RenderBlocks.svelte +38 -0
  59. package/templates/website/src/lib/blocks/ResolveMedia.svelte +27 -0
  60. package/templates/website/src/lib/blocks/RichTextBlock.svelte +47 -0
  61. package/templates/website/src/lib/blocks/TeamGrid.svelte +159 -0
  62. package/templates/website/src/lib/blocks/types.ts +47 -0
  63. package/templates/website/src/lib/content.ts +31 -0
  64. package/templates/website/src/lib/designs.ts +79 -0
  65. package/templates/website/src/lib/format.ts +3 -0
  66. package/templates/website/src/lib/icons.ts +13 -0
  67. package/templates/website/src/lib/image.ts +29 -0
  68. package/templates/website/src/lib/index.ts +1 -0
  69. package/templates/website/src/lib/media.ts +32 -0
  70. package/templates/website/src/lib/shell/Footer.svelte +146 -0
  71. package/templates/website/src/lib/shell/Header.svelte +121 -0
  72. package/templates/website/src/lib/shell/MobileMenu.svelte +142 -0
  73. package/templates/website/src/lib/shell/shell.ts +52 -0
  74. package/templates/website/src/lib/site.css +329 -0
  75. package/templates/website/src/routes/(kitcms)/admin/[...path]/+page.server.ts +2 -0
  76. package/templates/website/src/routes/(kitcms)/admin/[...path]/+page.svelte +9 -0
  77. package/templates/website/src/routes/(kitcms)/api/[...path]/+server.ts +2 -0
  78. package/templates/website/src/routes/(site)/+error.svelte +23 -0
  79. package/templates/website/src/routes/(site)/+layout.server.ts +12 -0
  80. package/templates/website/src/routes/(site)/+layout.svelte +63 -0
  81. package/templates/website/src/routes/(site)/+page.server.ts +7 -0
  82. package/templates/website/src/routes/(site)/+page.svelte +33 -0
  83. package/templates/website/src/routes/(site)/[slug]/+page.server.ts +11 -0
  84. package/templates/website/src/routes/(site)/[slug]/+page.svelte +9 -0
  85. package/templates/website/src/routes/(site)/blog/+page.server.ts +20 -0
  86. package/templates/website/src/routes/(site)/blog/+page.svelte +66 -0
  87. package/templates/website/src/routes/(site)/blog/[slug]/+page.server.ts +11 -0
  88. package/templates/website/src/routes/(site)/blog/[slug]/+page.svelte +231 -0
  89. package/templates/website/src/routes/(site)/legal/[slug]/+page.server.ts +8 -0
  90. package/templates/website/src/routes/(site)/legal/[slug]/+page.svelte +23 -0
  91. package/templates/website/tsconfig.json +11 -0
  92. package/templates/website/vite.config.ts +8 -0
  93. package/templates/website/wrangler.jsonc +28 -0
@@ -0,0 +1,32 @@
1
+ // Upload fields hold a media document when the read used `depth: 1`, and an id string otherwise
2
+ // (or when the target is not readable). These helpers narrow `unknown` to what the UI needs.
3
+
4
+ export interface Media {
5
+ id: string;
6
+ url: string;
7
+ alt?: string | null;
8
+ width?: number | null;
9
+ height?: number | null;
10
+ mimeType?: string;
11
+ }
12
+
13
+ function isRecord(v: unknown): v is Record<string, unknown> {
14
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
15
+ }
16
+
17
+ /** The media document, or null for ids, empty values and anything without a `url`. */
18
+ export function asMedia(value: unknown): Media | null {
19
+ if (!isRecord(value) || typeof value.url !== 'string' || typeof value.id !== 'string')
20
+ return null;
21
+ return value as unknown as Media;
22
+ }
23
+
24
+ /** A `hasMany` upload field as media documents (ids are skipped). */
25
+ export function asMediaList(value: unknown): Media[] {
26
+ return Array.isArray(value) ? value.map(asMedia).filter((m): m is Media => m !== null) : [];
27
+ }
28
+
29
+ /** A populated relationship document (`{ id, ... }`), or null for ids and empty values. */
30
+ export function asDoc<T extends { id: string }>(value: unknown): T | null {
31
+ return isRecord(value) && typeof value.id === 'string' ? (value as unknown as T) : null;
32
+ }
@@ -0,0 +1,146 @@
1
+ <script lang="ts">
2
+ // Three footers (registry: `designs.ts`). A "Simple": name and text, links, one row.
3
+ // B "Columns": name and text, then the pages, then social and legal links, on a tinted ground.
4
+ // C "Statement": the site name set large on a dark ground, links under it.
5
+ import Link from '../Link.svelte';
6
+ import type { DesignId } from '../designs';
7
+ import type { Shell } from './shell';
8
+
9
+ let { shell, design }: { shell: Shell; design: DesignId } = $props();
10
+ const year = new Date().getFullYear();
11
+ </script>
12
+
13
+ <footer data-design={design}>
14
+ <div class="container">
15
+ {#if design === 'c'}
16
+ <p class="statement">{shell.siteName}</p>
17
+ {#if shell.footerText}<p class="text lead">{shell.footerText}</p>{/if}
18
+ <nav aria-label="Footer" class="links">
19
+ {#each shell.nav as item (item.id)}<Link href={item.href}>{item.label}</Link>{/each}
20
+ {#each shell.social as link (link.id)}<Link href={link.url}>{link.label}</Link>{/each}
21
+ {#each shell.legal as doc (doc.slug)}<Link href={`/legal/${doc.slug}`}>{doc.title}</Link>{/each}
22
+ </nav>
23
+ {:else if design === 'b'}
24
+ <div class="cols">
25
+ <div>
26
+ <p class="name">{shell.siteName}</p>
27
+ {#if shell.footerText}<p class="text">{shell.footerText}</p>{/if}
28
+ </div>
29
+ <nav aria-label="Footer, pages">
30
+ <h2>Pages</h2>
31
+ {#each shell.nav as item (item.id)}<Link href={item.href}>{item.label}</Link>{/each}
32
+ </nav>
33
+ <nav aria-label="Footer, more">
34
+ <h2>More</h2>
35
+ {#each shell.social as link (link.id)}<Link href={link.url}>{link.label}</Link>{/each}
36
+ {#each shell.legal as doc (doc.slug)}<Link href={`/legal/${doc.slug}`}>{doc.title}</Link>{/each}
37
+ </nav>
38
+ </div>
39
+ {:else}
40
+ <div class="row">
41
+ <div>
42
+ <p class="name">{shell.siteName}</p>
43
+ {#if shell.footerText}<p class="text">{shell.footerText}</p>{/if}
44
+ </div>
45
+ <nav aria-label="Footer" class="links">
46
+ {#each shell.social as link (link.id)}<Link href={link.url}>{link.label}</Link>{/each}
47
+ {#each shell.legal as doc (doc.slug)}<Link href={`/legal/${doc.slug}`}>{doc.title}</Link>{/each}
48
+ </nav>
49
+ </div>
50
+ {/if}
51
+ <p class="copy">&copy; {year} {shell.siteName}</p>
52
+ </div>
53
+ </footer>
54
+
55
+ <style>
56
+ footer {
57
+ padding-block: var(--s-6) var(--s-5);
58
+ background: var(--surface);
59
+ color: var(--ink);
60
+ font-size: var(--step-small);
61
+ }
62
+ footer[data-design='c'] {
63
+ background: var(--ink);
64
+ color: var(--bg);
65
+ --focus: var(--bg);
66
+ padding-block: var(--section) var(--s-5);
67
+ }
68
+ p {
69
+ margin: 0;
70
+ }
71
+ .name {
72
+ font: 700 1.25rem/1.2 var(--font-display);
73
+ letter-spacing: -0.02em;
74
+ }
75
+ .text {
76
+ margin-top: var(--s-1);
77
+ max-width: 30rem;
78
+ color: var(--muted);
79
+ }
80
+ footer[data-design='c'] .text {
81
+ color: color-mix(in srgb, var(--bg) 75%, var(--ink));
82
+ max-width: 36rem;
83
+ font-size: var(--step-lead);
84
+ }
85
+ h2 {
86
+ margin: 0 0 var(--s-1);
87
+ font: 650 var(--step-small) var(--font-sans);
88
+ letter-spacing: 0;
89
+ color: var(--muted);
90
+ }
91
+ nav :global(a),
92
+ .links :global(a) {
93
+ display: inline-flex;
94
+ align-items: center;
95
+ min-height: 2.75rem;
96
+ text-decoration: none;
97
+ }
98
+ nav :global(a:hover) {
99
+ text-decoration: underline;
100
+ }
101
+ .row {
102
+ display: flex;
103
+ flex-direction: column;
104
+ gap: var(--s-4);
105
+ }
106
+ .links {
107
+ display: flex;
108
+ flex-wrap: wrap;
109
+ gap: 0 var(--s-4);
110
+ }
111
+ .cols {
112
+ display: grid;
113
+ gap: var(--s-5);
114
+ }
115
+ .cols nav {
116
+ display: flex;
117
+ flex-direction: column;
118
+ }
119
+ .statement {
120
+ font: 700 clamp(3rem, 1rem + 11vw, 9.5rem) / 0.95 var(--font-display);
121
+ letter-spacing: -0.04em;
122
+ margin-bottom: var(--s-5);
123
+ overflow-wrap: anywhere;
124
+ }
125
+ footer[data-design='c'] .links {
126
+ margin-top: var(--s-5);
127
+ font-size: var(--step-body);
128
+ }
129
+ .copy {
130
+ margin-top: var(--s-5);
131
+ color: var(--muted);
132
+ }
133
+ footer[data-design='c'] .copy {
134
+ color: color-mix(in srgb, var(--bg) 65%, var(--ink));
135
+ }
136
+ @media (min-width: 48rem) {
137
+ .row {
138
+ flex-direction: row;
139
+ justify-content: space-between;
140
+ align-items: flex-start;
141
+ }
142
+ .cols {
143
+ grid-template-columns: 2fr 1fr 1fr;
144
+ }
145
+ }
146
+ </style>
@@ -0,0 +1,121 @@
1
+ <script lang="ts">
2
+ // Three headers (registry: `designs.ts`). A "Bar": brand left, links right, sticky.
3
+ // B "Centred": brand centred with the links under it (a plain bar on phones).
4
+ // C "Band": a full-width field of the accent colour, brand left, links right, sticky.
5
+ import { page } from '$app/state';
6
+ import Img from '../Img.svelte';
7
+ import Link from '../Link.svelte';
8
+ import type { DesignId } from '../designs';
9
+ import MobileMenu from './MobileMenu.svelte';
10
+ import { isActive, type Shell } from './shell';
11
+
12
+ let { shell, design }: { shell: Shell; design: DesignId } = $props();
13
+ </script>
14
+
15
+ <header data-design={design}>
16
+ <div class="container bar">
17
+ <Link href="/" class="brand" aria-label={`${shell.siteName}, home`}>
18
+ {#if shell.logo}<Img media={shell.logo} widths={[80, 160, 240]} sizes="2.5rem" eager alt="" />{/if}
19
+ <span>{shell.siteName}</span>
20
+ </Link>
21
+ <nav aria-label="Main" class="desktop">
22
+ {#each shell.nav as item (item.id)}
23
+ <Link href={item.href} aria-current={isActive(item.href, page.url.pathname) ? 'page' : undefined}>
24
+ {item.label}
25
+ </Link>
26
+ {/each}
27
+ </nav>
28
+ <div class="mobile"><MobileMenu nav={shell.nav} /></div>
29
+ </div>
30
+ </header>
31
+
32
+ <style>
33
+ header {
34
+ position: sticky;
35
+ top: 0;
36
+ z-index: 10;
37
+ background: var(--bg);
38
+ color: var(--ink);
39
+ }
40
+ .bar {
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: space-between;
44
+ gap: var(--s-4);
45
+ min-height: var(--header-h);
46
+ }
47
+ .bar :global(.brand) {
48
+ display: inline-flex;
49
+ align-items: center;
50
+ gap: var(--s-2);
51
+ min-height: 2.75rem;
52
+ font: 700 1.25rem/1.1 var(--font-display);
53
+ letter-spacing: -0.02em;
54
+ text-decoration: none;
55
+ }
56
+ .bar :global(.brand img) {
57
+ width: 2.5rem;
58
+ height: 2.5rem;
59
+ object-fit: contain;
60
+ }
61
+ .desktop {
62
+ display: none;
63
+ }
64
+ nav.desktop {
65
+ gap: 0.25rem var(--s-4);
66
+ }
67
+ nav :global(a) {
68
+ display: inline-flex;
69
+ align-items: center;
70
+ min-height: 2.75rem;
71
+ font-weight: 550;
72
+ text-decoration: none;
73
+ color: var(--muted);
74
+ transition: color 0.2s var(--ease);
75
+ }
76
+ nav :global(a:hover) {
77
+ color: var(--ink);
78
+ }
79
+ nav :global(a[aria-current]) {
80
+ color: var(--ink);
81
+ text-decoration: underline;
82
+ text-decoration-thickness: 2px;
83
+ text-underline-offset: 0.45em;
84
+ }
85
+
86
+ /* B: centred. */
87
+ header[data-design='b'] {
88
+ position: static;
89
+ }
90
+ /* C: band. */
91
+ header[data-design='c'] {
92
+ background: var(--accent);
93
+ color: var(--accent-ink);
94
+ --focus: var(--accent-ink);
95
+ }
96
+ header[data-design='c'] nav :global(a) {
97
+ color: color-mix(in srgb, var(--accent-ink) 82%, var(--accent));
98
+ }
99
+ header[data-design='c'] nav :global(a:hover),
100
+ header[data-design='c'] nav :global(a[aria-current]) {
101
+ color: var(--accent-ink);
102
+ }
103
+
104
+ @media (min-width: 48rem) {
105
+ .desktop {
106
+ display: flex;
107
+ }
108
+ .mobile {
109
+ display: none;
110
+ }
111
+ header[data-design='b'] .bar {
112
+ flex-direction: column;
113
+ justify-content: center;
114
+ gap: var(--s-1);
115
+ padding-block: var(--s-3) var(--s-2);
116
+ }
117
+ header[data-design='b'] .bar :global(.brand) {
118
+ font-size: 1.75rem;
119
+ }
120
+ }
121
+ </style>
@@ -0,0 +1,142 @@
1
+ <script lang="ts">
2
+ // The mobile menu: a native modal <dialog>, so the platform handles the focus trap, Escape and
3
+ // returning focus to the button. `aria-expanded` mirrors the state; it closes on navigation and
4
+ // on a click outside the panel.
5
+ import { page } from '$app/state';
6
+ import Link from '../Link.svelte';
7
+ import { isActive, type NavItem } from './shell';
8
+
9
+ let { nav, label = 'Menu' }: { nav: NavItem[]; label?: string } = $props();
10
+ let dialog = $state<HTMLDialogElement>();
11
+ let open = $state(false);
12
+
13
+ const show = () => {
14
+ dialog?.showModal();
15
+ open = true;
16
+ };
17
+ const hide = () => dialog?.close();
18
+ $effect(() => {
19
+ void page.url.pathname;
20
+ if (dialog?.open) dialog.close();
21
+ });
22
+ </script>
23
+
24
+ <button type="button" class="trigger" aria-expanded={open} aria-controls="site-menu" onclick={show}>
25
+ <svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path d="M4 7h16M4 12h16M4 17h16" /></svg>
26
+ <span>{label}</span>
27
+ </button>
28
+
29
+ <dialog
30
+ id="site-menu"
31
+ bind:this={dialog}
32
+ aria-label={label}
33
+ onclose={() => (open = false)}
34
+ onclick={(e) => e.target === dialog && hide()}
35
+ >
36
+ <div class="panel">
37
+ <button type="button" class="close" onclick={hide}>
38
+ <svg viewBox="0 0 24 24" width="22" height="22" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18" /></svg>
39
+ <span>Close</span>
40
+ </button>
41
+ <nav aria-label="Main">
42
+ {#each nav as item (item.id)}
43
+ <Link href={item.href} aria-current={isActive(item.href, page.url.pathname) ? 'page' : undefined}>
44
+ {item.label}
45
+ </Link>
46
+ {/each}
47
+ </nav>
48
+ </div>
49
+ </dialog>
50
+
51
+ <style>
52
+ svg {
53
+ fill: none;
54
+ stroke: currentColor;
55
+ stroke-width: 2;
56
+ stroke-linecap: round;
57
+ }
58
+ .trigger,
59
+ .close {
60
+ display: inline-flex;
61
+ align-items: center;
62
+ gap: 0.5rem;
63
+ min-height: 2.75rem;
64
+ min-width: 2.75rem;
65
+ padding: 0 0.75rem;
66
+ margin-right: -0.75rem;
67
+ border: 0;
68
+ background: none;
69
+ color: inherit;
70
+ font: 600 1rem var(--font-sans);
71
+ cursor: pointer;
72
+ }
73
+ .close {
74
+ align-self: flex-end;
75
+ }
76
+ dialog {
77
+ inset: 0;
78
+ width: 100%;
79
+ max-width: none;
80
+ height: 100%;
81
+ max-height: none;
82
+ margin: 0;
83
+ padding: 0;
84
+ border: 0;
85
+ background: transparent;
86
+ color: var(--ink);
87
+ font-family: var(--font-sans);
88
+ --focus: var(--ink);
89
+ }
90
+ dialog::backdrop {
91
+ background: var(--scrim);
92
+ }
93
+ .panel {
94
+ position: absolute;
95
+ inset: 0 0 0 auto;
96
+ width: min(100%, 26rem);
97
+ display: flex;
98
+ flex-direction: column;
99
+ gap: var(--s-4);
100
+ padding: var(--s-2) var(--gutter) var(--s-5);
101
+ overflow-y: auto;
102
+ background: var(--bg);
103
+ }
104
+ nav {
105
+ display: flex;
106
+ flex-direction: column;
107
+ }
108
+ nav :global(a) {
109
+ display: flex;
110
+ align-items: center;
111
+ min-height: 3.25rem;
112
+ padding: 0.35rem 0;
113
+ font: 650 1.625rem/1.2 var(--font-display);
114
+ letter-spacing: -0.02em;
115
+ text-decoration: none;
116
+ }
117
+ nav :global(a[aria-current]) {
118
+ color: var(--accent);
119
+ text-decoration: underline;
120
+ text-decoration-thickness: 2px;
121
+ text-underline-offset: 0.3em;
122
+ }
123
+ @media (prefers-reduced-motion: no-preference) {
124
+ dialog[open] .panel {
125
+ animation: slide 0.3s var(--ease);
126
+ }
127
+ dialog[open]::backdrop {
128
+ animation: fade 0.3s var(--ease);
129
+ }
130
+ }
131
+ @keyframes slide {
132
+ from {
133
+ transform: translateX(2rem);
134
+ opacity: 0;
135
+ }
136
+ }
137
+ @keyframes fade {
138
+ from {
139
+ opacity: 0;
140
+ }
141
+ }
142
+ </style>
@@ -0,0 +1,52 @@
1
+ // The site "shell": what the header and footer need, derived once from the `site` global and the
2
+ // legal pages. Pure (no server code).
3
+ import { asDoc, asMedia, type Media } from '../media';
4
+
5
+ export interface NavItem {
6
+ id: string;
7
+ label: string;
8
+ href: string;
9
+ }
10
+ export interface Shell {
11
+ siteName: string;
12
+ tagline: string;
13
+ logo: Media | null;
14
+ nav: NavItem[];
15
+ footerText: string;
16
+ social: { id: string; label: string; url: string }[];
17
+ legal: { title: string; slug: string }[];
18
+ }
19
+
20
+ /** The part of the `site` global the shell reads (loosely typed: upload and relationship fields are ids or documents). */
21
+ interface SiteLike {
22
+ siteName?: string | null;
23
+ tagline?: string | null;
24
+ logo?: unknown;
25
+ nav?: { id: string; label: string; page?: unknown; href?: string | null }[] | null;
26
+ footer?: {
27
+ text?: string | null;
28
+ social?: { id: string; label: string; url: string }[] | null;
29
+ } | null;
30
+ }
31
+
32
+ export function buildShell(site: SiteLike, legal: { title: string; slug: string }[]): Shell {
33
+ // A nav item points to a page (populated at depth 1) or, without one, to a path like `/blog`.
34
+ const nav = (site.nav ?? []).flatMap((item): NavItem[] => {
35
+ const target = asDoc<{ id: string; slug: string }>(item.page);
36
+ const href = target ? (target.slug === 'home' ? '/' : `/${target.slug}`) : item.href;
37
+ return href ? [{ id: item.id, label: item.label, href }] : [];
38
+ });
39
+ return {
40
+ siteName: site.siteName ?? 'My site',
41
+ tagline: site.tagline ?? '',
42
+ logo: asMedia(site.logo),
43
+ nav,
44
+ footerText: site.footer?.text ?? '',
45
+ social: (site.footer?.social ?? []).map((s) => ({ id: s.id, label: s.label, url: s.url })),
46
+ legal,
47
+ };
48
+ }
49
+
50
+ /** Is `href` the current page (or a section of it)? Used for `aria-current`. */
51
+ export const isActive = (href: string, pathname: string) =>
52
+ href === '/' ? pathname === '/' : pathname === href || pathname.startsWith(`${href}/`);