@grove-dev/cli 1.3.1 → 1.4.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/dist/r/home.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "files": [
14
14
  {
15
15
  "path": "default/pages/index.astro",
16
- "content": "---\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getCollectionTeaserModel,\n getHomePageModel,\n loadCollections,\n recordsToCollectionEntries,\n} from '@grove-dev/astro/server';\nimport CategoryGrid from '../components/grove/category-grid.astro';\nimport CollectionTeaser from '../components/grove/collection-teaser.astro';\nimport ContributorsGrid from '../components/grove/contributors-grid.astro';\nimport FinalCta from '../components/grove/final-cta.astro';\nimport Hero from '../components/grove/hero.astro';\nimport HeroProof from '../components/grove/hero-proof.astro';\nimport OriginalCollection from '../components/grove/original-collection.astro';\nimport PipelineStrip from '../components/grove/pipeline-strip.astro';\nimport RecordSection from '../components/grove/record-section.astro';\nimport StackGrid from '../components/grove/stack-grid.astro';\nimport WhyThisExists from '../components/grove/why-this-exists.astro';\n/**\n * Home page — generic.\n *\n * Mirrors the openapps structure: Hero → WhyThisExists → three\n * lens sections (hot / new / mature) → StackGrid → CategoryGrid →\n * ContributorsGrid → OriginalCollection.\n *\n * All data derives from `data/generated/records.{index,full}.json`\n * and `data/generated/site-config.json`. Nothing here is hardcoded\n * to a specific blueprint — section copy uses singular/plural\n * labels from `itemLabel()`/`itemLabelPlural()`.\n */\nimport BaseLayout from '../layouts/base-layout.astro';\n\nconst home = getHomePageModel(siteConfig);\nconst { slug, itemSingular, itemPlural } = home;\n\n// ── Lens sectioning (Hot / New / Mature) ────────────────────────\nconst hotList = home.hot;\nconst newList = home.recentlyAdded;\nconst matureList = home.established;\n\nconst { stacks, categories } = home;\n\nconst { contributors, stats, title, description } = home;\n\n// ── Featured collections teaser ─────────────────────────────────\nconst allCollections = await loadCollections(process.cwd());\nconst teaserEntries = recordsToCollectionEntries(\n (records as { records: unknown[] }).records as never,\n siteConfig,\n);\nconst collectionTeaser = getCollectionTeaserModel(allCollections, teaserEntries, 3);\n---\n\n<BaseLayout title={title} description={description} image={home.seo.image} site={siteConfig}>\n <Hero\n name={`Find ${itemPlural} you can actually`}\n tagline=\"run, study, and contribute to.\"\n description={`Every listing is a YAML file in a public repository — Grove publishes those files as this site, a README, and machine-readable outputs, and keeps them in sync.`}\n eyebrow=\"Curated in plain files, published by Grove\"\n stats={{\n totalApps: stats.apps,\n totalCategories: stats.categories,\n totalStacks: stats.stacks,\n totalOwners: stats.owners,\n totalStars: stats.stars,\n }}\n itemsLabel={itemPlural}\n searchHref={`/${slug}`}\n searchPlaceholder={`Search ${itemPlural}, stacks, or categories...`}\n quickFilters={[\n { label: `Trending ${itemPlural}`, href: `/${slug}?label=hot` },\n { label: \"Recently added\", href: `/${slug}?sort=recently-added` },\n { label: \"How this site works\", href: \"#pipeline\" },\n ]}\n ctas={[\n { label: `Browse ${itemPlural}`, href: `/${slug}/`, variant: \"primary\" },\n ]}\n >\n {((siteConfig as { press?: unknown[] }).press?.length ?? 0) > 0 && (\n <HeroProof slot=\"eyebrow\" variant=\"pill\" />\n )}\n <HeroProof slot=\"proof\" variant=\"row\" contributors={contributors} />\n </Hero>\n\n <WhyThisExists />\n\n <PipelineStrip repoUrl={siteConfig.repoUrl} />\n\n <RecordSection\n id=\"hot\"\n title=\"Trending now\"\n description={`${itemPlural.charAt(0).toUpperCase() + itemPlural.slice(1)} gaining stars, activity, or attention recently.`}\n eyebrow=\"Hot\"\n items={hotList}\n hrefFor={(r) => `/${slug}/${r.slug}/`}\n viewAllHref={`/${slug}?label=hot`}\n viewAllLabel={`View all trending ${itemPlural}`}\n />\n\n <RecordSection\n id=\"new\"\n title=\"Recently added\"\n description={`${itemPlural.charAt(0).toUpperCase() + itemPlural.slice(1)} added to the directory in the last few weeks.`}\n eyebrow=\"New\"\n items={newList}\n hrefFor={(r) => `/${slug}/${r.slug}/`}\n viewAllHref={`/${slug}?sort=recently-added`}\n viewAllLabel={`View all recently added`}\n />\n\n <RecordSection\n id=\"mature\"\n title=\"Established\"\n description={`Long-running curated ${itemPlural} with strong history, active maintainers, and real-world usage.`}\n eyebrow=\"Mature\"\n items={matureList}\n hrefFor={(r) => `/${slug}/${r.slug}/`}\n viewAllHref={`/${slug}?label=mature`}\n viewAllLabel={`View all established`}\n />\n\n <StackGrid\n stacks={stacks}\n pathPrefix={`/${slug}`}\n itemLabelPlural={itemPlural}\n itemNoun={{ singular: itemSingular, plural: itemPlural }}\n hrefFor={(stackSlug: string) => `/stacks/${stackSlug}/`}\n />\n <CollectionTeaser\n model={collectionTeaser}\n countNoun={{ singular: itemSingular, plural: itemPlural }}\n />\n <CategoryGrid\n categories={categories}\n pathPrefix={`/${slug}`}\n itemLabelPlural={itemPlural}\n itemNoun={{ singular: itemSingular, plural: itemPlural }}\n hrefFor={(categorySlug: string) => `/categories/${categorySlug}/`}\n />\n\n <ContributorsGrid\n contributors={contributors}\n total={contributors.length || undefined}\n viewAllHref={`/contributors`}\n viewAllLabel=\"Meet the community\"\n showContributionCount={siteConfig.contributors?.showContributionCount ?? true}\n />\n\n {siteConfig.stats?.originalRepo && (\n <OriginalCollection\n repoUrl={siteConfig.stats.originalRepo}\n stats={{\n stars: siteConfig.stats.originalStars,\n forks: siteConfig.stats.originalForks,\n contributors: siteConfig.stats.originalContributors,\n }}\n />\n )}\n\n <FinalCta\n itemLabel={itemSingular}\n itemsLabel={itemPlural}\n browseHref={`/${slug}`}\n />\n</BaseLayout>\n",
16
+ "content": "---\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getCollectionTeaserModel,\n getHomePageModel,\n loadCollections,\n recordsToCollectionEntries,\n} from '@grove-dev/astro/server';\nimport CategoryGrid from '../components/grove/category-grid.astro';\nimport CollectionTeaser from '../components/grove/collection-teaser.astro';\nimport ContributorsGrid from '../components/grove/contributors-grid.astro';\nimport FinalCta from '../components/grove/final-cta.astro';\nimport Hero from '../components/grove/hero.astro';\nimport HeroProof from '../components/grove/hero-proof.astro';\nimport OriginalCollection from '../components/grove/original-collection.astro';\nimport PipelineStrip from '../components/grove/pipeline-strip.astro';\nimport RecordSection from '../components/grove/record-section.astro';\nimport StackGrid from '../components/grove/stack-grid.astro';\nimport WhyThisExists from '../components/grove/why-this-exists.astro';\n/**\n * Home page — generic.\n *\n * Mirrors the openapps structure: Hero → WhyThisExists → three\n * lens sections (hot / new / mature) → StackGrid → CategoryGrid →\n * ContributorsGrid → OriginalCollection.\n *\n * All data derives from `data/generated/records.{index,full}.json`\n * and `data/generated/site-config.json`. Nothing here is hardcoded\n * to a specific blueprint — section copy uses singular/plural\n * labels from `itemLabel()`/`itemLabelPlural()`.\n */\nimport BaseLayout from '../layouts/base-layout.astro';\n\nconst home = getHomePageModel(siteConfig);\nconst { slug, itemSingular, itemPlural } = home;\n\n// ── Lens sectioning (Hot / New / Mature) ────────────────────────\nconst hotList = home.hot;\nconst newList = home.recentlyAdded;\nconst matureList = home.established;\n\nconst { stacks, categories } = home;\n\nconst { contributors, stats, title, description } = home;\n\n// ── Featured collections teaser ─────────────────────────────────\nconst allCollections = await loadCollections(process.cwd());\nconst teaserEntries = recordsToCollectionEntries(\n (records as { records: unknown[] }).records as never,\n siteConfig,\n);\nconst collectionTeaser = getCollectionTeaserModel(allCollections, teaserEntries, 3);\n---\n\n<BaseLayout title={title} description={description} image={home.seo.image} site={siteConfig}>\n <Hero\n name={`Find ${itemPlural} you can actually`}\n tagline=\"run, study, and contribute to.\"\n description={`Every listing is a YAML file in a public repository — Grove publishes those files as this site, a README, and machine-readable outputs, and keeps them in sync.`}\n eyebrow=\"Curated in plain files, published by Grove\"\n stats={{\n totalApps: stats.apps,\n totalCategories: stats.categories,\n totalStacks: stats.stacks,\n totalOwners: stats.owners,\n totalStars: stats.stars,\n }}\n itemsLabel={itemPlural}\n searchHref={`/${slug}/`}\n searchPlaceholder={`Search ${itemPlural}, stacks, or categories...`}\n quickFilters={[\n { label: `Trending ${itemPlural}`, href: `/${slug}/?label=hot` },\n { label: \"Recently added\", href: `/${slug}/?sort=recently-added` },\n { label: \"How this site works\", href: \"#pipeline\" },\n ]}\n ctas={[\n { label: `Browse ${itemPlural}`, href: `/${slug}/`, variant: \"primary\" },\n ]}\n >\n {((siteConfig as { press?: unknown[] }).press?.length ?? 0) > 0 && (\n <HeroProof slot=\"eyebrow\" variant=\"pill\" />\n )}\n <HeroProof slot=\"proof\" variant=\"row\" contributors={contributors} />\n </Hero>\n\n <WhyThisExists />\n\n <PipelineStrip repoUrl={siteConfig.repoUrl} />\n\n <RecordSection\n id=\"hot\"\n title=\"Trending now\"\n description={`${itemPlural.charAt(0).toUpperCase() + itemPlural.slice(1)} gaining stars, activity, or attention recently.`}\n eyebrow=\"Hot\"\n items={hotList}\n hrefFor={(r) => `/${slug}/${r.slug}/`}\n viewAllHref={`/${slug}/?label=hot`}\n viewAllLabel={`View all trending ${itemPlural}`}\n />\n\n <RecordSection\n id=\"new\"\n title=\"Recently added\"\n description={`${itemPlural.charAt(0).toUpperCase() + itemPlural.slice(1)} added to the directory in the last few weeks.`}\n eyebrow=\"New\"\n items={newList}\n hrefFor={(r) => `/${slug}/${r.slug}/`}\n viewAllHref={`/${slug}/?sort=recently-added`}\n viewAllLabel={`View all recently added`}\n />\n\n <RecordSection\n id=\"mature\"\n title=\"Established\"\n description={`Long-running curated ${itemPlural} with strong history, active maintainers, and real-world usage.`}\n eyebrow=\"Mature\"\n items={matureList}\n hrefFor={(r) => `/${slug}/${r.slug}/`}\n viewAllHref={`/${slug}/?label=mature`}\n viewAllLabel={`View all established`}\n />\n\n <StackGrid\n stacks={stacks}\n pathPrefix={`/${slug}`}\n itemLabelPlural={itemPlural}\n itemNoun={{ singular: itemSingular, plural: itemPlural }}\n hrefFor={(stackSlug: string) => `/stacks/${stackSlug}/`}\n />\n <CollectionTeaser\n model={collectionTeaser}\n countNoun={{ singular: itemSingular, plural: itemPlural }}\n />\n <CategoryGrid\n categories={categories}\n pathPrefix={`/${slug}`}\n itemLabelPlural={itemPlural}\n itemNoun={{ singular: itemSingular, plural: itemPlural }}\n hrefFor={(categorySlug: string) => `/categories/${categorySlug}/`}\n />\n\n <ContributorsGrid\n contributors={contributors}\n total={contributors.length || undefined}\n viewAllHref={`/contributors/`}\n viewAllLabel=\"Meet the community\"\n showContributionCount={siteConfig.contributors?.showContributionCount ?? true}\n />\n\n {siteConfig.stats?.originalRepo && (\n <OriginalCollection\n repoUrl={siteConfig.stats.originalRepo}\n stats={{\n stars: siteConfig.stats.originalStars,\n forks: siteConfig.stats.originalForks,\n contributors: siteConfig.stats.originalContributors,\n }}\n />\n )}\n\n <FinalCta\n itemLabel={itemSingular}\n itemsLabel={itemPlural}\n browseHref={`/${slug}/`}\n />\n</BaseLayout>\n",
17
17
  "type": "registry:page",
18
18
  "target": "~/src/pages/index.astro"
19
19
  },
@@ -55,7 +55,7 @@
55
55
  },
56
56
  {
57
57
  "path": "default/components/grove/final-cta.astro",
58
- "content": "---\nimport { buttonClass } from '../../lib/classnames.ts';\n\ninterface Props {\n itemLabel?: string;\n itemsLabel?: string;\n browseHref?: string;\n submitHref?: string;\n class?: string;\n}\n\nconst {\n itemLabel = 'item',\n itemsLabel = 'items',\n browseHref = '/items',\n submitHref = '/submit',\n class: className = '',\n} = Astro.props;\n---\n\n<section class:list={[\"border-t border-ink-200 py-10 sm:py-12 dark:border-ink-800\", className]} aria-labelledby=\"grove-final-cta-heading\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <div class=\"rounded-[calc(var(--radius)+0.25rem)] border border-border bg-card px-6 py-7 sm:flex sm:items-center sm:justify-between sm:gap-10 sm:px-8 sm:py-8 dark:border-ink-800\">\n <div class=\"max-w-2xl\">\n <p class=\"m-0 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\">Keep the directory useful</p>\n <h2 id=\"grove-final-cta-heading\" class=\"m-0 mt-1.5 text-[1.5rem] font-semibold tracking-tight text-ink-900 sm:text-[1.75rem] dark:text-ink-100\">\n Know {itemLabel === \"app\" ? \"an\" : \"a\"} {itemLabel} that belongs here?\n </h2>\n <p class=\"m-0 mt-2 max-w-xl text-sm leading-relaxed text-ink-500 dark:text-ink-400\">\n Add a real, inspectable project or improve the metadata behind an existing listing.\n </p>\n </div>\n <div class=\"mt-5 flex shrink-0 flex-wrap items-center gap-2 sm:mt-0 sm:justify-end\">\n <a href={submitHref} class={buttonClass(\"primary\", \"md\", \"px-4\")}>\n Submit {itemLabel}\n </a>\n <a href={browseHref} class={buttonClass(\"outline\", \"md\", \"px-4\")}>\n Explore {itemsLabel}\n </a>\n </div>\n </div>\n </div>\n</section>\n",
58
+ "content": "---\nimport { buttonClass } from '../../lib/classnames.ts';\n\ninterface Props {\n itemLabel?: string;\n itemsLabel?: string;\n browseHref?: string;\n submitHref?: string;\n class?: string;\n}\n\nconst {\n itemLabel = 'item',\n itemsLabel = 'items',\n browseHref = '/items/',\n submitHref = '/submit/',\n class: className = '',\n} = Astro.props;\n---\n\n<section class:list={[\"border-t border-ink-200 py-10 sm:py-12 dark:border-ink-800\", className]} aria-labelledby=\"grove-final-cta-heading\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <div class=\"rounded-[calc(var(--radius)+0.25rem)] border border-border bg-card px-6 py-7 sm:flex sm:items-center sm:justify-between sm:gap-10 sm:px-8 sm:py-8 dark:border-ink-800\">\n <div class=\"max-w-2xl\">\n <p class=\"m-0 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\">Keep the directory useful</p>\n <h2 id=\"grove-final-cta-heading\" class=\"m-0 mt-1.5 text-[1.5rem] font-semibold tracking-tight text-ink-900 sm:text-[1.75rem] dark:text-ink-100\">\n Know {itemLabel === \"app\" ? \"an\" : \"a\"} {itemLabel} that belongs here?\n </h2>\n <p class=\"m-0 mt-2 max-w-xl text-sm leading-relaxed text-ink-500 dark:text-ink-400\">\n Add a real, inspectable project or improve the metadata behind an existing listing.\n </p>\n </div>\n <div class=\"mt-5 flex shrink-0 flex-wrap items-center gap-2 sm:mt-0 sm:justify-end\">\n <a href={submitHref} class={buttonClass(\"primary\", \"md\", \"px-4\")}>\n Submit {itemLabel}\n </a>\n <a href={browseHref} class={buttonClass(\"outline\", \"md\", \"px-4\")}>\n Explore {itemsLabel}\n </a>\n </div>\n </div>\n </div>\n</section>\n",
59
59
  "type": "registry:component",
60
60
  "target": "~/src/components/grove/final-cta.astro"
61
61
  },
@@ -68,7 +68,7 @@
68
68
  ],
69
69
  "meta": {
70
70
  "version": "1.6.0",
71
- "requiresGrove": "1.3.1"
71
+ "requiresGrove": "1.4.0"
72
72
  },
73
73
  "type": "registry:block"
74
74
  }
@@ -10,14 +10,14 @@
10
10
  "files": [
11
11
  {
12
12
  "path": "default/pages/404.astro",
13
- "content": "---\n/**\n * 404 — generic fallback page.\n *\n * Renders the normal shell (header / footer / theme toggle) with a\n * short message and a search form pointing at the list page. Stays\n * on-brand regardless of blueprint.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport { indexSlug } from '@grove-dev/astro/server';\nimport SearchField from '../components/ui/search-field.astro';\nimport BaseLayout from '../layouts/base-layout.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\nconst slug = indexSlug();\nconst title = `Page not found | ${siteConfig.name}`;\nconst description = `That page doesn't exist on ${siteConfig.name}. Search the directory or browse from the home page.`;\n---\n\n<BaseLayout\n title={title}\n description={description}\n site={siteConfig}\n noindex\n>\n {/* One recovery hierarchy: search is the primary tool, Browse the\n single button action, home a quiet text link — no three\n competing primary CTAs. Centered so the wide viewport doesn't\n pin everything into the top-left corner. */}\n <section class=\"py-12 sm:py-16\">\n <div class=\"mx-auto w-full max-w-narrow px-5 py-16 text-center sm:px-7 sm:py-24\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n 404\n </span>\n <h1 class=\"m-0 mt-2 text-[2.25rem] font-semibold leading-[1.05] tracking-tight text-foreground sm:text-[3rem]\">\n Page not found\n </h1>\n <p class=\"mx-auto m-0 mt-4 max-w-xl text-lg leading-relaxed text-muted-foreground\">\n The page you're looking for doesn't exist on {siteConfig.name}.\n It may have been moved, renamed, or never existed.\n </p>\n\n <form\n class=\"mx-auto mt-8 flex max-w-xl flex-col gap-2 sm:flex-row sm:items-center\"\n role=\"search\"\n action={`/${slug}`}\n method=\"get\"\n >\n <SearchField class=\"flex-1\" label=\"Search\" placeholder={`Search ${slug}...`} id=\"not-found-search\" />\n <button type=\"submit\" class={buttonClass(\"primary\", \"bare\", \"h-10 px-4 text-sm max-sm:min-h-11\")}>\n Search\n </button>\n </form>\n\n <div class=\"mt-6 flex flex-wrap items-center justify-center gap-4\">\n <a href={`/${slug}/`} class={buttonClass(\"secondary\", \"sm\")}>Browse {slug}</a>\n <a href=\"/\" class=\"text-sm font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground\">\n Back to home\n </a>\n </div>\n </div>\n </section>\n</BaseLayout>\n",
13
+ "content": "---\n/**\n * 404 — generic fallback page.\n *\n * Renders the normal shell (header / footer / theme toggle) with a\n * short message and a search form pointing at the list page. Stays\n * on-brand regardless of blueprint.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport { indexSlug } from '@grove-dev/astro/server';\nimport SearchField from '../components/ui/search-field.astro';\nimport BaseLayout from '../layouts/base-layout.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\nconst slug = indexSlug();\nconst title = `Page not found | ${siteConfig.name}`;\nconst description = `That page doesn't exist on ${siteConfig.name}. Search the directory or browse from the home page.`;\n---\n\n<BaseLayout\n title={title}\n description={description}\n site={siteConfig}\n noindex\n>\n {/* One recovery hierarchy: search is the primary tool, Browse the\n single button action, home a quiet text link — no three\n competing primary CTAs. Centered so the wide viewport doesn't\n pin everything into the top-left corner. */}\n <section class=\"py-12 sm:py-16\">\n <div class=\"mx-auto w-full max-w-narrow px-5 py-16 text-center sm:px-7 sm:py-24\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n 404\n </span>\n <h1 class=\"m-0 mt-2 text-[2.25rem] font-semibold leading-[1.05] tracking-tight text-foreground sm:text-[3rem]\">\n Page not found\n </h1>\n <p class=\"mx-auto m-0 mt-4 max-w-xl text-lg leading-relaxed text-muted-foreground\">\n The page you're looking for doesn't exist on {siteConfig.name}.\n It may have been moved, renamed, or never existed.\n </p>\n\n <form\n class=\"mx-auto mt-8 flex max-w-xl flex-col gap-2 sm:flex-row sm:items-center\"\n role=\"search\"\n action={`/${slug}/`}\n method=\"get\"\n >\n <SearchField class=\"flex-1\" label=\"Search\" placeholder={`Search ${slug}...`} id=\"not-found-search\" />\n <button type=\"submit\" class={buttonClass(\"primary\", \"bare\", \"h-10 px-4 text-sm max-sm:min-h-11\")}>\n Search\n </button>\n </form>\n\n <div class=\"mt-6 flex flex-wrap items-center justify-center gap-4\">\n <a href={`/${slug}/`} class={buttonClass(\"secondary\", \"sm\")}>Browse {slug}</a>\n <a href=\"/\" class=\"text-sm font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground\">\n Back to home\n </a>\n </div>\n </div>\n </section>\n</BaseLayout>\n",
14
14
  "type": "registry:page",
15
15
  "target": "~/src/pages/404.astro"
16
16
  }
17
17
  ],
18
18
  "meta": {
19
19
  "version": "1.6.0",
20
- "requiresGrove": "1.3.1"
20
+ "requiresGrove": "1.4.0"
21
21
  },
22
22
  "type": "registry:block"
23
23
  }
@@ -43,7 +43,7 @@
43
43
  ],
44
44
  "meta": {
45
45
  "version": "1.6.0",
46
- "requiresGrove": "1.3.1"
46
+ "requiresGrove": "1.4.0"
47
47
  },
48
48
  "type": "registry:block"
49
49
  }
@@ -11,7 +11,7 @@
11
11
  "files": [
12
12
  {
13
13
  "path": "default/pages/[slug]/[recordSlug].astro",
14
- "content": "---\n/**\n * Detail page — thin consumer wiring up the package's\n * RecordHeader, EditorialSummary, TableOfContents, MarkdownBody,\n * and RecordSidebar components. All rendering logic, prose\n * styling, sidebar visibility, and activity-badge rules live in\n * `@grove-dev/astro`; this file only composes them.\n */\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getRecordContextModel,\n getRecordDetailModel,\n loadCollections,\n recordDetailPaths,\n recordsToCollectionEntries,\n} from '@grove-dev/astro/server';\nimport EditorialSummary from '../../components/grove/editorial-summary.astro';\nimport MarkdownBody from '../../components/grove/markdown-body.astro';\nimport RecordHeader from '../../components/grove/record-header.astro';\nimport RecordRelations from '../../components/grove/record-relations.astro';\nimport RecordSidebar from '../../components/grove/record-sidebar.astro';\nimport RelatedRecords from '../../components/grove/related-records.astro';\nimport TableOfContents from '../../components/grove/table-of-contents.astro';\nimport BaseLayout from '../../layouts/base-layout.astro';\n\nexport function getStaticPaths() {\n return recordDetailPaths(siteConfig);\n}\n\nconst dirSlug = siteConfig.blueprintConfig?.routeSlug ?? 'projects';\nconst detail = getRecordDetailModel(\n Astro.params.recordSlug ?? '',\n siteConfig,\n Astro.params.slug ?? dirSlug,\n);\nif (!detail) return Astro.redirect(`/${dirSlug}`);\nconst { record, itemSingular, seo } = detail;\n\n// Where this page links out to: subject hubs, sibling records, and the\n// collections the record appears in.\nconst context = getRecordContextModel(record, {\n collections: await loadCollections(process.cwd()),\n entries: recordsToCollectionEntries(\n (records as { records: unknown[] }).records as never,\n siteConfig,\n ),\n subjects: siteConfig.taxonomy?.subjects ?? [],\n});\n---\n\n<BaseLayout\n title={seo.title}\n description={seo.description}\n image={seo.image}\n imageAlt={seo.imageAlt}\n site={siteConfig}\n type=\"article\"\n jsonLd={seo.jsonLd}\n noindex={seo.noindex}\n robots={seo.robots}\n submitHref=\"/submit\"\n submitLabel={`Submit ${itemSingular}`}\n>\n <article class=\"py-8 sm:py-10\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <RecordHeader detail={detail} />\n <RecordRelations relations={context.relations} />\n\n <div\n class=\"grid grid-cols-1 gap-10 lg:grid-cols-[minmax(0,1fr)_300px] lg:gap-12\"\n >\n {/* Reading column: editorial context, then the article —\n no TOC panel pushing the body down. */}\n <div class=\"min-w-0\">\n <EditorialSummary\n bestFor={detail.bestFor}\n caveats={detail.caveats}\n whyListed={detail.whyListed}\n />\n <MarkdownBody\n recordSlug={record.slug}\n fallback={record.content ? \"This record doesn't have notes yet.\" : undefined}\n />\n </div>\n {/* Right rail: the TOC and nothing else. */}\n <div class=\"min-w-0 lg:sticky lg:top-20 lg:max-h-[calc(100vh-5rem)] lg:self-start lg:overflow-y-auto\">\n <TableOfContents items={detail.toc} />\n </div>\n </div>\n\n <RelatedRecords context={context} />\n\n {/* Metadata panels — full width below the article. */}\n <section class=\"mt-12 border-t border-border pt-8\" aria-label=\"Project details\">\n <RecordSidebar detail={detail} sticky={false} layout=\"grid\" />\n </section>\n </div>\n </article>\n</BaseLayout>\n",
14
+ "content": "---\n/**\n * Detail page — thin consumer wiring up the package's\n * RecordHeader, EditorialSummary, TableOfContents, MarkdownBody,\n * and RecordSidebar components. All rendering logic, prose\n * styling, sidebar visibility, and activity-badge rules live in\n * `@grove-dev/astro`; this file only composes them.\n */\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getRecordContextModel,\n getRecordDetailModel,\n loadCollections,\n recordDetailPaths,\n recordsToCollectionEntries,\n} from '@grove-dev/astro/server';\nimport EditorialSummary from '../../components/grove/editorial-summary.astro';\nimport MarkdownBody from '../../components/grove/markdown-body.astro';\nimport RecordHeader from '../../components/grove/record-header.astro';\nimport RecordRelations from '../../components/grove/record-relations.astro';\nimport RecordSidebar from '../../components/grove/record-sidebar.astro';\nimport RelatedRecords from '../../components/grove/related-records.astro';\nimport TableOfContents from '../../components/grove/table-of-contents.astro';\nimport BaseLayout from '../../layouts/base-layout.astro';\n\nexport function getStaticPaths() {\n return recordDetailPaths(siteConfig);\n}\n\nconst dirSlug = siteConfig.blueprintConfig?.routeSlug ?? 'projects';\nconst detail = getRecordDetailModel(\n Astro.params.recordSlug ?? '',\n siteConfig,\n Astro.params.slug ?? dirSlug,\n);\nif (!detail) return Astro.redirect(`/${dirSlug}/`);\nconst { record, itemSingular, seo } = detail;\n\n// Where this page links out to: subject hubs, sibling records, and the\n// collections the record appears in.\nconst context = getRecordContextModel(record, {\n collections: await loadCollections(process.cwd()),\n entries: recordsToCollectionEntries(\n (records as { records: unknown[] }).records as never,\n siteConfig,\n ),\n subjects: siteConfig.taxonomy?.subjects ?? [],\n});\n---\n\n<BaseLayout\n title={seo.title}\n description={seo.description}\n image={seo.image}\n imageAlt={seo.imageAlt}\n site={siteConfig}\n type=\"article\"\n jsonLd={seo.jsonLd}\n noindex={seo.noindex}\n robots={seo.robots}\n submitHref=\"/submit/\"\n submitLabel={`Submit ${itemSingular}`}\n>\n <article class=\"py-8 sm:py-10\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <RecordHeader detail={detail} />\n <RecordRelations relations={context.relations} />\n\n <div\n class=\"grid grid-cols-1 gap-10 lg:grid-cols-[minmax(0,1fr)_300px] lg:gap-12\"\n >\n {/* Reading column: editorial context, then the article —\n no TOC panel pushing the body down. */}\n <div class=\"min-w-0\">\n <EditorialSummary\n bestFor={detail.bestFor}\n caveats={detail.caveats}\n whyListed={detail.whyListed}\n />\n <MarkdownBody\n recordSlug={record.slug}\n fallback={record.content ? \"This record doesn't have notes yet.\" : undefined}\n />\n </div>\n {/* Right rail: the TOC and nothing else. */}\n <div class=\"min-w-0 lg:sticky lg:top-20 lg:max-h-[calc(100vh-5rem)] lg:self-start lg:overflow-y-auto\">\n <TableOfContents items={detail.toc} />\n </div>\n </div>\n\n <RelatedRecords context={context} />\n\n {/* Metadata panels — full width below the article. */}\n <section class=\"mt-12 border-t border-border pt-8\" aria-label=\"Project details\">\n <RecordSidebar detail={detail} sticky={false} layout=\"grid\" />\n </section>\n </div>\n </article>\n</BaseLayout>\n",
15
15
  "type": "registry:page",
16
16
  "target": "~/src/pages/[slug]/[recordSlug].astro"
17
17
  },
@@ -23,7 +23,7 @@
23
23
  },
24
24
  {
25
25
  "path": "default/components/grove/record-sidebar.astro",
26
- "content": "---\nimport siteConfig from '@grove/generated/site-config.json';\nimport type { RecordDetailModel } from '@grove-dev/astro/server';\nimport { taxonomyLabel } from '@grove-dev/astro/server';\n/**\n * RecordSidebar.astro\n *\n * Sticky right-hand column on the record detail page. Renders\n * up to four cards, each conditional on the model's `sidebar`\n * visibility flags:\n *\n * - Activity — repo facts (stars, forks, language, license, …)\n * - Freshness — last commit / last fetch / maintenance status\n * - Ecosystem — stack, platforms, category, tags, hygiene files\n * - Source — curation metadata + reading-time summary\n *\n * Empty rows are suppressed entirely — the sidebar never shows \"—\"\n * or \"0\" placeholders that confuse \"no data\" with \"zero\".\n *\n * Sticky on lg+ (`lg:sticky lg:top-20 lg:max-h-calc(100vh-5rem)\n * lg:overflow-y-auto`) so the cards stay in view while the user\n * scrolls the body. Cards are individually rendered so the\n * sticky container's height is bounded by the actual content.\n */\nimport { licenseDisplay, withRef } from '@grove-dev/core';\nimport FeaturedBadge from '../site/featured-badge.astro';\nimport Badge from '../ui/badge.astro';\nimport Icon from './icon.astro';\nimport LanguageBreakdown from './language-breakdown.astro';\n\ninterface Props {\n detail: RecordDetailModel;\n /**\n * Pass false when a parent wrapper owns the sticky behavior (e.g.\n * the detail page stacks the TOC above this sidebar inside one\n * sticky column).\n */\n sticky?: boolean;\n /**\n * \"column\" (default) stacks the cards vertically for a rail;\n * \"grid\" lays them out in responsive columns for full-width\n * placement below the article.\n */\n layout?: 'column' | 'grid';\n}\n\nconst { detail, sticky = true, layout = 'column' } = Astro.props;\nconst {\n sidebar,\n github,\n stars,\n forks,\n language,\n licenseSpdx,\n pushedLabel,\n repoUrl,\n ownerRepo,\n healthLabel,\n activityBadge,\n stacks,\n platforms,\n tags,\n category,\n contributionSignals,\n languages,\n totalLanguageBytes,\n readingMetrics,\n record,\n firstCommitYear,\n lastFetchedLabel,\n reviewedAtLabel,\n addedAtLabel,\n} = detail;\nconst alsoIn: Array<{ url: string; title: string }> = detail.collectionMembership ?? [];\n\n// Visibility helpers for individual rows inside the Activity card.\n// `hasRepo` is the discriminator between \"GitHub data synced\" and\n// \"no data fetched yet\" — without it the card would show \"Stars 0\"\n// even when the field was never populated.\nconst repo = github;\nconst hasRepo = !!repo;\nconst starsNumber = typeof stars === 'number' && stars > 0 ? stars : null;\nconst forksNumber = typeof forks === 'number' && forks > 0 ? forks : null;\n// `repo` is a loosely-typed passthrough of the raw GitHub API response\n// (see `@grove-dev/astro/server`'s `getRecordDetailModel`) — `releases`\n// isn't in the normalized `githubMetadataSchema`, so it arrives as\n// `unknown` and needs a local shape for the three fields read below.\nconst recentReleases = (\n (repo?.releases as Array<{ html_url?: string; tag_name?: string; name?: string }> | undefined) ??\n []\n).slice(0, 1);\nconst isArchived = !!repo?.archived;\n\n// Render a kv row only when both the label and value have content.\nfunction row(label: string, value: unknown) {\n if (value === null || value === undefined || value === '') return null;\n return { label, value };\n}\nconst outbound =\n (siteConfig as { outbound?: { ref?: string | false; skipHosts?: string[] } }).outbound ?? {};\nconst siteOrigin = new URL((siteConfig as { siteUrl?: string }).siteUrl ?? 'https://example.com')\n .origin;\n---\n\n<aside\n class:list={[\n layout === \"grid\"\n ? // Full width under the article: a flat band of columns, not a wall of\n // boxes of uneven height. Cards lose their frame here; the badge and\n // source notes sit on their own row below.\n \"grove-sidebar grid grid-cols-1 items-start gap-x-10 gap-y-8 sm:grid-cols-2 xl:grid-cols-4 [&>.grove-card]:rounded-none [&>.grove-card]:border-0 [&>.grove-card]:bg-transparent [&>.grove-card]:p-0\"\n : \"grove-sidebar flex flex-col gap-4\",\n layout === \"column\" &&\n sticky &&\n \"lg:sticky lg:top-20 lg:max-h-[calc(100vh-5rem)] lg:self-start lg:overflow-y-auto\",\n ]}\n aria-label=\"Record metadata\"\n>\n\n {/* ── Activity card ──────────────────────────────────────── */}\n {sidebar.showActivity && (\n <section\n class=\"grove-card rounded-[var(--radius-lg)] border border-ink-200 bg-card p-4 dark:border-ink-800\"\n aria-labelledby=\"sidebar-activity-title\"\n >\n <h2\n id=\"sidebar-activity-title\"\n class=\"grove-card-title m-0 mb-3 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\"\n >\n Activity\n </h2>\n <dl class=\"grove-kv m-0 flex flex-col gap-2.5 text-sm\">\n {row(\"Stars\", starsNumber !== null ? starsNumber : null) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Stars</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{starsNumber!.toLocaleString()}</dd>\n </div>\n )}\n {row(\"Forks\", forksNumber !== null ? forksNumber.toLocaleString() : null) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Forks</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{forksNumber!.toLocaleString()}</dd>\n </div>\n )}\n {row(\"Contributors\", repo?.contributors_count) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Contributors</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{Number(repo!.contributors_count).toLocaleString()}</dd>\n </div>\n )}\n {row(\"Open issues\", repo?.open_issues_count) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Open issues</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{Number(repo!.open_issues_count).toLocaleString()}</dd>\n </div>\n )}\n {row(\"Watchers\", repo?.subscribers_count) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Watchers</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{Number(repo!.subscribers_count).toLocaleString()}</dd>\n </div>\n )}\n {row(\"Language\", language) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Language</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">{language}</dd>\n </div>\n )}\n {row(\"License\", licenseSpdx) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">License</dt>\n <dd class=\"font-mono text-ink-900 dark:text-ink-100\">{licenseDisplay(licenseSpdx)}</dd>\n </div>\n )}\n {row(\"Default branch\", repo?.default_branch) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Default branch</dt>\n <dd class=\"font-mono text-ink-900 dark:text-ink-100\">{repo!.default_branch}</dd>\n </div>\n )}\n {row(\"First commit\", firstCommitYear) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">First commit</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <time datetime={String(repo!.created_at)}>{firstCommitYear}</time>\n </dd>\n </div>\n )}\n {recentReleases[0] && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Latest release</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <a\n href={recentReleases[0].html_url ?? repoUrl}\n target=\"_blank\"\n rel=\"noopener\"\n class=\"no-underline hover:underline\"\n >\n {recentReleases[0].tag_name ?? recentReleases[0].name ?? \"—\"}\n </a>\n </dd>\n </div>\n )}\n </dl>\n\n <LanguageBreakdown languages={languages} totalBytes={totalLanguageBytes} />\n </section>\n )}\n\n {/* ── Freshness card ─────────────────────────────────────── */}\n {sidebar.showFreshness && (\n <section\n class=\"grove-card rounded-[var(--radius-lg)] border border-ink-200 bg-card p-4 dark:border-ink-800\"\n aria-labelledby=\"sidebar-freshness-title\"\n >\n <h2\n id=\"sidebar-freshness-title\"\n class=\"grove-card-title m-0 mb-3 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\"\n >\n Freshness\n </h2>\n <dl class=\"grove-kv m-0 flex flex-col gap-2.5 text-sm\">\n {pushedLabel && pushedLabel !== \"—\" && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Last commit</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">{pushedLabel}</dd>\n </div>\n )}\n {/* Two clocks, named apart: when a person last reviewed the page,\n and when the repository numbers were last synced. */}\n {reviewedAtLabel && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Editorial review</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <time datetime={String(record.curation?.reviewedAt)}>{reviewedAtLabel}</time>\n </dd>\n </div>\n )}\n {repo?.updated_at && lastFetchedLabel && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Repository data</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <time datetime={String(repo.updated_at)}>{lastFetchedLabel}</time>\n </dd>\n </div>\n )}\n {activityBadge && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Maintenance</dt>\n <dd>\n <span data-activity-tone={activityBadge.tone} class=\"grove-pill grove-pill--activity inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] font-medium\">\n {activityBadge.label}\n </span>\n </dd>\n </div>\n )}\n {healthLabel && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Health</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">{healthLabel}</dd>\n </div>\n )}\n {isArchived && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Status</dt>\n <dd><Badge variant=\"warning\">Archived</Badge></dd>\n </div>\n )}\n {repo?.homepage && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Docs</dt>\n <dd class=\"truncate text-ink-900 dark:text-ink-100\">\n <a href={withRef(String(repo.homepage), outbound)} target=\"_blank\" rel=\"noopener\" class=\"no-underline hover:underline\">\n {new URL(String(repo.homepage)).hostname}\n </a>\n </dd>\n </div>\n )}\n {repoUrl && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Source</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <a href={repoUrl} target=\"_blank\" rel=\"noopener\" class=\"no-underline hover:underline\">\n {ownerRepo ? `${ownerRepo.owner}/${ownerRepo.repo}` : repoUrl}\n </a>\n </dd>\n </div>\n )}\n </dl>\n </section>\n )}\n\n {/* ── Ecosystem card ─────────────────────────────────────── */}\n {sidebar.showEcosystem && (\n <section\n class=\"grove-card rounded-[var(--radius-lg)] border border-ink-200 bg-card p-4 dark:border-ink-800\"\n aria-labelledby=\"sidebar-ecosystem-title\"\n >\n <h2\n id=\"sidebar-ecosystem-title\"\n class=\"grove-card-title m-0 mb-3 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\"\n >\n Ecosystem\n </h2>\n\n {stacks.length > 0 && (\n <div class=\"mb-3\">\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Stack</h3>\n <ul class=\"m-0 flex list-none flex-wrap gap-1.5 p-0\">\n {stacks.map((s) => (\n <li>\n <a href={`/stacks/${s}/`} class=\"inline-flex items-center gap-1.5 rounded-full bg-secondary py-0.5 pl-1.5 pr-2 text-2xs font-medium text-secondary-foreground no-underline\">\n <Icon name={s} category=\"stack\" size={12} />\n {taxonomyLabel(\"stacks\", s)}\n </a>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {platforms.length > 0 && (\n <div class=\"mb-3\">\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Platforms</h3>\n <ul class=\"m-0 flex list-none flex-wrap gap-1.5 p-0\">\n {platforms.map((p) => (\n <li class=\"inline-flex items-center gap-1.5 rounded-full border border-ink-200 py-0.5 pl-1.5 pr-2 text-2xs font-medium text-ink-700 dark:border-ink-800 dark:text-ink-300\">\n <Icon name={p} category=\"platform\" size={12} />\n {taxonomyLabel(\"platforms\", p)}\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {category && (\n <div class=\"mb-3\">\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Category</h3>\n <a href={`/categories/${category}/`} class=\"rounded-full bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground no-underline\">\n {taxonomyLabel(\"categories\", category)}\n </a>\n </div>\n )}\n\n {tags.length > 0 && (\n <div class=\"mb-3\">\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Tags</h3>\n <ul class=\"m-0 flex list-none flex-wrap gap-1.5 p-0\">\n {tags.map((t) => (\n <li>\n <a href={`/${detail.slug}?tag=${encodeURIComponent(t)}`} rel=\"nofollow\" class=\"rounded-full border border-ink-200 px-2 py-0.5 text-2xs font-medium text-ink-700 no-underline dark:border-ink-800 dark:text-ink-300\">\n {taxonomyLabel(\"topics\", t)}\n </a>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {contributionSignals.length > 0 && (\n <div>\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Repository hygiene</h3>\n <ul class=\"m-0 flex list-none flex-col gap-1 p-0 text-sm\">\n {contributionSignals.map((s) => (\n <li class=\"inline-flex items-center gap-1.5 text-ink-700 dark:text-ink-200\">\n {s.ok ? (\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-emerald-600 dark:text-emerald-400\">\n <path d=\"M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.75.75 0 0 1 1.06-1.06L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z\" />\n </svg>\n ) : (\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-ink-400\">\n <path d=\"M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z\" />\n </svg>\n )}\n {s.label}\n </li>\n ))}\n </ul>\n </div>\n )}\n </section>\n )}\n\n <div class:list={[layout === \"grid\" && \"border-t border-border pt-6 sm:col-start-1 xl:col-span-2 [&>.grove-card]:rounded-none [&>.grove-card]:border-0 [&>.grove-card]:bg-transparent [&>.grove-card]:p-0\"]}>\n <FeaturedBadge\n pageUrl={`${siteOrigin}/${detail.slug}/${record.slug}/`}\n origin={siteOrigin}\n siteName={String((siteConfig as { name?: string }).name ?? '')}\n name={String((record as { name?: string }).name ?? record.slug)}\n outboundRef={outbound.ref}\n />\n </div>\n\n {/* ── Source card (small) ────────────────────────────────── */}\n {sidebar.showSource && (\n <section\n class:list={[layout === \"grid\" && \"!border-t !border-solid !border-border !pt-6 xl:col-span-2\", \"grove-card grove-card--muted rounded-[var(--radius-lg)] border border-dashed border-ink-200 bg-card/50 p-4 text-2xs text-ink-500 dark:border-ink-800 dark:text-ink-400\"]}\n aria-labelledby=\"sidebar-source-title\"\n >\n <h2\n id=\"sidebar-source-title\"\n class=\"grove-card-title m-0 mb-1.5 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\"\n >\n Source\n </h2>\n {addedAtLabel && (\n <p class=\"m-0 leading-relaxed\">\n Added on <time datetime={String(record.addedAt)}>{addedAtLabel}</time>.\n </p>\n )}\n {/* Only when a curator actually reviewed the record. This line\n used to render unconditionally with an em dash where the date\n belongs, and gated the whole card besides. */}\n {reviewedAtLabel && (\n <p class:list={[\"m-0 leading-relaxed\", addedAtLabel && \"mt-1.5\"]}>\n Reviewed by {record.curation?.reviewedBy ?? \"grove\"}{\" \"}\n on <time datetime={String(record.curation?.reviewedAt)}>\n {reviewedAtLabel}\n </time>.\n </p>\n )}\n {alsoIn.length > 0 && (\n <p class=\"m-0 mt-1.5 leading-relaxed\">\n <span class=\"font-semibold\">Also in: </span>\n {alsoIn.map((c, i) => (\n <>\n <a href={c.url} class=\"text-inherit no-underline hover:underline\">{c.title}</a>{i < alsoIn.length - 1 ? \", \" : \"\"}\n </>\n ))}\n </p>\n )}\n {readingMetrics.wordCount > 0 && (\n <p class=\"m-0 mt-1 leading-relaxed\">\n Notes: {readingMetrics.wordCount.toLocaleString()} words · {readingMetrics.minutes} min read.\n </p>\n )}\n </section>\n )}\n</aside>",
26
+ "content": "---\nimport siteConfig from '@grove/generated/site-config.json';\nimport type { RecordDetailModel } from '@grove-dev/astro/server';\nimport { taxonomyLabel } from '@grove-dev/astro/server';\n/**\n * RecordSidebar.astro\n *\n * Sticky right-hand column on the record detail page. Renders\n * up to four cards, each conditional on the model's `sidebar`\n * visibility flags:\n *\n * - Activity — repo facts (stars, forks, language, license, …)\n * - Freshness — last commit / last fetch / maintenance status\n * - Ecosystem — stack, platforms, category, tags, hygiene files\n * - Source — curation metadata + reading-time summary\n *\n * Empty rows are suppressed entirely — the sidebar never shows \"—\"\n * or \"0\" placeholders that confuse \"no data\" with \"zero\".\n *\n * Sticky on lg+ (`lg:sticky lg:top-20 lg:max-h-calc(100vh-5rem)\n * lg:overflow-y-auto`) so the cards stay in view while the user\n * scrolls the body. Cards are individually rendered so the\n * sticky container's height is bounded by the actual content.\n */\nimport { hrefForFilters, licenseDisplay, withRef } from '@grove-dev/core';\nimport FeaturedBadge from '../site/featured-badge.astro';\nimport Badge from '../ui/badge.astro';\nimport Icon from './icon.astro';\nimport LanguageBreakdown from './language-breakdown.astro';\n\ninterface Props {\n detail: RecordDetailModel;\n /**\n * Pass false when a parent wrapper owns the sticky behavior (e.g.\n * the detail page stacks the TOC above this sidebar inside one\n * sticky column).\n */\n sticky?: boolean;\n /**\n * \"column\" (default) stacks the cards vertically for a rail;\n * \"grid\" lays them out in responsive columns for full-width\n * placement below the article.\n */\n layout?: 'column' | 'grid';\n}\n\nconst { detail, sticky = true, layout = 'column' } = Astro.props;\nconst {\n sidebar,\n github,\n stars,\n forks,\n language,\n licenseSpdx,\n pushedLabel,\n repoUrl,\n ownerRepo,\n healthLabel,\n activityBadge,\n stacks,\n platforms,\n tags,\n category,\n contributionSignals,\n languages,\n totalLanguageBytes,\n readingMetrics,\n record,\n firstCommitYear,\n lastFetchedLabel,\n reviewedAtLabel,\n addedAtLabel,\n} = detail;\nconst alsoIn: Array<{ url: string; title: string }> = detail.collectionMembership ?? [];\n\n// Visibility helpers for individual rows inside the Activity card.\n// `hasRepo` is the discriminator between \"GitHub data synced\" and\n// \"no data fetched yet\" — without it the card would show \"Stars 0\"\n// even when the field was never populated.\nconst repo = github;\nconst hasRepo = !!repo;\nconst starsNumber = typeof stars === 'number' && stars > 0 ? stars : null;\nconst forksNumber = typeof forks === 'number' && forks > 0 ? forks : null;\n// `repo` is a loosely-typed passthrough of the raw GitHub API response\n// (see `@grove-dev/astro/server`'s `getRecordDetailModel`) — `releases`\n// isn't in the normalized `githubMetadataSchema`, so it arrives as\n// `unknown` and needs a local shape for the three fields read below.\nconst recentReleases = (\n (repo?.releases as Array<{ html_url?: string; tag_name?: string; name?: string }> | undefined) ??\n []\n).slice(0, 1);\nconst isArchived = !!repo?.archived;\n\n// Render a kv row only when both the label and value have content.\nfunction row(label: string, value: unknown) {\n if (value === null || value === undefined || value === '') return null;\n return { label, value };\n}\nconst outbound =\n (siteConfig as { outbound?: { ref?: string | false; skipHosts?: string[] } }).outbound ?? {};\nconst siteOrigin = new URL((siteConfig as { siteUrl?: string }).siteUrl ?? 'https://example.com')\n .origin;\n---\n\n<aside\n class:list={[\n layout === \"grid\"\n ? // Full width under the article: a flat band of columns, not a wall of\n // boxes of uneven height. Cards lose their frame here; the badge and\n // source notes sit on their own row below.\n \"grove-sidebar grid grid-cols-1 items-start gap-x-10 gap-y-8 sm:grid-cols-2 xl:grid-cols-4 [&>.grove-card]:rounded-none [&>.grove-card]:border-0 [&>.grove-card]:bg-transparent [&>.grove-card]:p-0\"\n : \"grove-sidebar flex flex-col gap-4\",\n layout === \"column\" &&\n sticky &&\n \"lg:sticky lg:top-20 lg:max-h-[calc(100vh-5rem)] lg:self-start lg:overflow-y-auto\",\n ]}\n aria-label=\"Record metadata\"\n>\n\n {/* ── Activity card ──────────────────────────────────────── */}\n {sidebar.showActivity && (\n <section\n class=\"grove-card rounded-[var(--radius-lg)] border border-ink-200 bg-card p-4 dark:border-ink-800\"\n aria-labelledby=\"sidebar-activity-title\"\n >\n <h2\n id=\"sidebar-activity-title\"\n class=\"grove-card-title m-0 mb-3 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\"\n >\n Activity\n </h2>\n <dl class=\"grove-kv m-0 flex flex-col gap-2.5 text-sm\">\n {row(\"Stars\", starsNumber !== null ? starsNumber : null) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Stars</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{starsNumber!.toLocaleString()}</dd>\n </div>\n )}\n {row(\"Forks\", forksNumber !== null ? forksNumber.toLocaleString() : null) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Forks</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{forksNumber!.toLocaleString()}</dd>\n </div>\n )}\n {row(\"Contributors\", repo?.contributors_count) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Contributors</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{Number(repo!.contributors_count).toLocaleString()}</dd>\n </div>\n )}\n {row(\"Open issues\", repo?.open_issues_count) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Open issues</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{Number(repo!.open_issues_count).toLocaleString()}</dd>\n </div>\n )}\n {row(\"Watchers\", repo?.subscribers_count) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Watchers</dt>\n <dd class=\"font-mono tabular-nums text-ink-900 dark:text-ink-100\">{Number(repo!.subscribers_count).toLocaleString()}</dd>\n </div>\n )}\n {row(\"Language\", language) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Language</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">{language}</dd>\n </div>\n )}\n {row(\"License\", licenseSpdx) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">License</dt>\n <dd class=\"font-mono text-ink-900 dark:text-ink-100\">{licenseDisplay(licenseSpdx)}</dd>\n </div>\n )}\n {row(\"Default branch\", repo?.default_branch) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Default branch</dt>\n <dd class=\"font-mono text-ink-900 dark:text-ink-100\">{repo!.default_branch}</dd>\n </div>\n )}\n {row(\"First commit\", firstCommitYear) && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">First commit</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <time datetime={String(repo!.created_at)}>{firstCommitYear}</time>\n </dd>\n </div>\n )}\n {recentReleases[0] && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Latest release</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <a\n href={recentReleases[0].html_url ?? repoUrl}\n target=\"_blank\"\n rel=\"noopener\"\n class=\"no-underline hover:underline\"\n >\n {recentReleases[0].tag_name ?? recentReleases[0].name ?? \"—\"}\n </a>\n </dd>\n </div>\n )}\n </dl>\n\n <LanguageBreakdown languages={languages} totalBytes={totalLanguageBytes} />\n </section>\n )}\n\n {/* ── Freshness card ─────────────────────────────────────── */}\n {sidebar.showFreshness && (\n <section\n class=\"grove-card rounded-[var(--radius-lg)] border border-ink-200 bg-card p-4 dark:border-ink-800\"\n aria-labelledby=\"sidebar-freshness-title\"\n >\n <h2\n id=\"sidebar-freshness-title\"\n class=\"grove-card-title m-0 mb-3 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\"\n >\n Freshness\n </h2>\n <dl class=\"grove-kv m-0 flex flex-col gap-2.5 text-sm\">\n {pushedLabel && pushedLabel !== \"—\" && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Last commit</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">{pushedLabel}</dd>\n </div>\n )}\n {/* Two clocks, named apart: when a person last reviewed the page,\n and when the repository numbers were last synced. */}\n {reviewedAtLabel && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Editorial review</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <time datetime={String(record.curation?.reviewedAt)}>{reviewedAtLabel}</time>\n </dd>\n </div>\n )}\n {repo?.updated_at && lastFetchedLabel && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Repository data</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <time datetime={String(repo.updated_at)}>{lastFetchedLabel}</time>\n </dd>\n </div>\n )}\n {activityBadge && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Maintenance</dt>\n <dd>\n <span data-activity-tone={activityBadge.tone} class=\"grove-pill grove-pill--activity inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[10px] font-medium\">\n {activityBadge.label}\n </span>\n </dd>\n </div>\n )}\n {healthLabel && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Health</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">{healthLabel}</dd>\n </div>\n )}\n {isArchived && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Status</dt>\n <dd><Badge variant=\"warning\">Archived</Badge></dd>\n </div>\n )}\n {repo?.homepage && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Docs</dt>\n <dd class=\"truncate text-ink-900 dark:text-ink-100\">\n <a href={withRef(String(repo.homepage), outbound)} target=\"_blank\" rel=\"noopener\" class=\"no-underline hover:underline\">\n {new URL(String(repo.homepage)).hostname}\n </a>\n </dd>\n </div>\n )}\n {repoUrl && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Source</dt>\n <dd class=\"text-ink-900 dark:text-ink-100\">\n <a href={repoUrl} target=\"_blank\" rel=\"noopener\" class=\"no-underline hover:underline\">\n {ownerRepo ? `${ownerRepo.owner}/${ownerRepo.repo}` : repoUrl}\n </a>\n </dd>\n </div>\n )}\n </dl>\n </section>\n )}\n\n {/* ── Ecosystem card ─────────────────────────────────────── */}\n {sidebar.showEcosystem && (\n <section\n class=\"grove-card rounded-[var(--radius-lg)] border border-ink-200 bg-card p-4 dark:border-ink-800\"\n aria-labelledby=\"sidebar-ecosystem-title\"\n >\n <h2\n id=\"sidebar-ecosystem-title\"\n class=\"grove-card-title m-0 mb-3 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\"\n >\n Ecosystem\n </h2>\n\n {stacks.length > 0 && (\n <div class=\"mb-3\">\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Stack</h3>\n <ul class=\"m-0 flex list-none flex-wrap gap-1.5 p-0\">\n {stacks.map((s) => (\n <li>\n <a href={`/stacks/${s}/`} class=\"inline-flex items-center gap-1.5 rounded-full bg-secondary py-0.5 pl-1.5 pr-2 text-2xs font-medium text-secondary-foreground no-underline\">\n <Icon name={s} category=\"stack\" size={12} />\n {taxonomyLabel(\"stacks\", s)}\n </a>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {platforms.length > 0 && (\n <div class=\"mb-3\">\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Platforms</h3>\n <ul class=\"m-0 flex list-none flex-wrap gap-1.5 p-0\">\n {platforms.map((p) => (\n <li class=\"inline-flex items-center gap-1.5 rounded-full border border-ink-200 py-0.5 pl-1.5 pr-2 text-2xs font-medium text-ink-700 dark:border-ink-800 dark:text-ink-300\">\n <Icon name={p} category=\"platform\" size={12} />\n {taxonomyLabel(\"platforms\", p)}\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {category && (\n <div class=\"mb-3\">\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Category</h3>\n <a href={`/categories/${category}/`} class=\"rounded-full bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground no-underline\">\n {taxonomyLabel(\"categories\", category)}\n </a>\n </div>\n )}\n\n {tags.length > 0 && (\n <div class=\"mb-3\">\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Tags</h3>\n <ul class=\"m-0 flex list-none flex-wrap gap-1.5 p-0\">\n {tags.map((t) => (\n <li>\n <a href={hrefForFilters({ tags: [t] }, `/${detail.slug}`)} rel=\"nofollow\" class=\"rounded-full border border-ink-200 px-2 py-0.5 text-2xs font-medium text-ink-700 no-underline dark:border-ink-800 dark:text-ink-300\">\n {taxonomyLabel(\"topics\", t)}\n </a>\n </li>\n ))}\n </ul>\n </div>\n )}\n\n {contributionSignals.length > 0 && (\n <div>\n <h3 class=\"m-0 mb-1.5 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">Repository hygiene</h3>\n <ul class=\"m-0 flex list-none flex-col gap-1 p-0 text-sm\">\n {contributionSignals.map((s) => (\n <li class=\"inline-flex items-center gap-1.5 text-ink-700 dark:text-ink-200\">\n {s.ok ? (\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-emerald-600 dark:text-emerald-400\">\n <path d=\"M13.78 4.22a.75.75 0 0 1 0 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L2.22 9.28a.75.75 0 0 1 1.06-1.06L6 10.94l6.72-6.72a.75.75 0 0 1 1.06 0Z\" />\n </svg>\n ) : (\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-ink-400\">\n <path d=\"M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 0 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z\" />\n </svg>\n )}\n {s.label}\n </li>\n ))}\n </ul>\n </div>\n )}\n </section>\n )}\n\n <div class:list={[layout === \"grid\" && \"border-t border-border pt-6 sm:col-start-1 xl:col-span-2 [&>.grove-card]:rounded-none [&>.grove-card]:border-0 [&>.grove-card]:bg-transparent [&>.grove-card]:p-0\"]}>\n <FeaturedBadge\n pageUrl={`${siteOrigin}/${detail.slug}/${record.slug}/`}\n origin={siteOrigin}\n siteName={String((siteConfig as { name?: string }).name ?? '')}\n name={String((record as { name?: string }).name ?? record.slug)}\n outboundRef={outbound.ref}\n />\n </div>\n\n {/* ── Source card (small) ────────────────────────────────── */}\n {sidebar.showSource && (\n <section\n class:list={[layout === \"grid\" && \"!border-t !border-solid !border-border !pt-6 xl:col-span-2\", \"grove-card grove-card--muted rounded-[var(--radius-lg)] border border-dashed border-ink-200 bg-card/50 p-4 text-2xs text-ink-500 dark:border-ink-800 dark:text-ink-400\"]}\n aria-labelledby=\"sidebar-source-title\"\n >\n <h2\n id=\"sidebar-source-title\"\n class=\"grove-card-title m-0 mb-1.5 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\"\n >\n Source\n </h2>\n {addedAtLabel && (\n <p class=\"m-0 leading-relaxed\">\n Added on <time datetime={String(record.addedAt)}>{addedAtLabel}</time>.\n </p>\n )}\n {/* Only when a curator actually reviewed the record. This line\n used to render unconditionally with an em dash where the date\n belongs, and gated the whole card besides. */}\n {reviewedAtLabel && (\n <p class:list={[\"m-0 leading-relaxed\", addedAtLabel && \"mt-1.5\"]}>\n Reviewed by {record.curation?.reviewedBy ?? \"grove\"}{\" \"}\n on <time datetime={String(record.curation?.reviewedAt)}>\n {reviewedAtLabel}\n </time>.\n </p>\n )}\n {alsoIn.length > 0 && (\n <p class=\"m-0 mt-1.5 leading-relaxed\">\n <span class=\"font-semibold\">Also in: </span>\n {alsoIn.map((c, i) => (\n <>\n <a href={c.url} class=\"text-inherit no-underline hover:underline\">{c.title}</a>{i < alsoIn.length - 1 ? \", \" : \"\"}\n </>\n ))}\n </p>\n )}\n {readingMetrics.wordCount > 0 && (\n <p class=\"m-0 mt-1 leading-relaxed\">\n Notes: {readingMetrics.wordCount.toLocaleString()} words · {readingMetrics.minutes} min read.\n </p>\n )}\n </section>\n )}\n</aside>",
27
27
  "type": "registry:component",
28
28
  "target": "~/src/components/grove/record-sidebar.astro"
29
29
  },
@@ -72,7 +72,7 @@
72
72
  ],
73
73
  "meta": {
74
74
  "version": "1.6.0",
75
- "requiresGrove": "1.3.1"
75
+ "requiresGrove": "1.4.0"
76
76
  },
77
77
  "type": "registry:block"
78
78
  }
@@ -47,7 +47,7 @@
47
47
  ],
48
48
  "meta": {
49
49
  "version": "1.6.0",
50
- "requiresGrove": "1.3.1"
50
+ "requiresGrove": "1.4.0"
51
51
  }
52
52
  },
53
53
  {
@@ -113,7 +113,7 @@
113
113
  ],
114
114
  "meta": {
115
115
  "version": "1.6.0",
116
- "requiresGrove": "1.3.1"
116
+ "requiresGrove": "1.4.0"
117
117
  }
118
118
  },
119
119
  {
@@ -155,7 +155,7 @@
155
155
  ],
156
156
  "meta": {
157
157
  "version": "1.6.0",
158
- "requiresGrove": "1.3.1"
158
+ "requiresGrove": "1.4.0"
159
159
  }
160
160
  },
161
161
  {
@@ -213,7 +213,7 @@
213
213
  ],
214
214
  "meta": {
215
215
  "version": "1.6.0",
216
- "requiresGrove": "1.3.1"
216
+ "requiresGrove": "1.4.0"
217
217
  }
218
218
  },
219
219
  {
@@ -290,7 +290,7 @@
290
290
  ],
291
291
  "meta": {
292
292
  "version": "1.6.0",
293
- "requiresGrove": "1.3.1"
293
+ "requiresGrove": "1.4.0"
294
294
  }
295
295
  },
296
296
  {
@@ -354,7 +354,7 @@
354
354
  ],
355
355
  "meta": {
356
356
  "version": "1.6.0",
357
- "requiresGrove": "1.3.1"
357
+ "requiresGrove": "1.4.0"
358
358
  }
359
359
  },
360
360
  {
@@ -441,7 +441,7 @@
441
441
  ],
442
442
  "meta": {
443
443
  "version": "1.6.0",
444
- "requiresGrove": "1.3.1"
444
+ "requiresGrove": "1.4.0"
445
445
  }
446
446
  },
447
447
  {
@@ -508,7 +508,7 @@
508
508
  ],
509
509
  "meta": {
510
510
  "version": "1.6.0",
511
- "requiresGrove": "1.3.1"
511
+ "requiresGrove": "1.4.0"
512
512
  }
513
513
  },
514
514
  {
@@ -534,7 +534,7 @@
534
534
  ],
535
535
  "meta": {
536
536
  "version": "1.6.0",
537
- "requiresGrove": "1.3.1"
537
+ "requiresGrove": "1.4.0"
538
538
  }
539
539
  },
540
540
  {
@@ -555,7 +555,7 @@
555
555
  ],
556
556
  "meta": {
557
557
  "version": "1.6.0",
558
- "requiresGrove": "1.3.1"
558
+ "requiresGrove": "1.4.0"
559
559
  }
560
560
  },
561
561
  {
@@ -576,7 +576,7 @@
576
576
  ],
577
577
  "meta": {
578
578
  "version": "1.6.0",
579
- "requiresGrove": "1.3.1"
579
+ "requiresGrove": "1.4.0"
580
580
  }
581
581
  },
582
582
  {
@@ -597,7 +597,7 @@
597
597
  ],
598
598
  "meta": {
599
599
  "version": "1.6.0",
600
- "requiresGrove": "1.3.1"
600
+ "requiresGrove": "1.4.0"
601
601
  }
602
602
  },
603
603
  {
@@ -1020,7 +1020,7 @@
1020
1020
  ],
1021
1021
  "meta": {
1022
1022
  "version": "1.6.0",
1023
- "requiresGrove": "1.3.1"
1023
+ "requiresGrove": "1.4.0"
1024
1024
  }
1025
1025
  }
1026
1026
  ]
package/dist/r/shell.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "files": [
16
16
  {
17
17
  "path": "default/layouts/base-layout.astro",
18
- "content": "---\n/**\n * BaseLayout — wraps every page. Owns the theme-detection inline\n * script and the global shell (Header, Footer). Per-page SEO\n * (title, description, OG, JSON-LD) is delegated to `<Seo />` so\n * each page can declare what it needs without polluting the layout\n * file.\n *\n * Generic: takes a `site` prop with brand + nav + stats. No\n * `siteConfig` import — consumers compose the props from their\n * own config (typically `data/generated/site-config.json` for the\n * showcase).\n *\n * GA4 can be configured once through `site.analytics.googleAnalyticsId`\n * or overridden per page with `gaId`. Omit both for privacy-first deployments.\n */\nimport '../styles/system.css';\nimport { derivePrimaryPalette } from '@grove-dev/astro/server';\nimport Footer from './footer.astro';\nimport Header from './header.astro';\nimport Seo from './seo.astro';\n\ninterface NavItem {\n label: string;\n href: string;\n}\n\ninterface SiteStats {\n totalApps?: number;\n totalCategories?: number;\n totalStacks?: number;\n totalOwners?: number;\n totalStars?: number;\n repositoryStars?: number;\n repositoryForks?: number;\n repositoryContributors?: number;\n originalRepo?: string;\n originalStars?: number;\n originalForks?: number;\n originalContributors?: number;\n}\n\ninterface Site {\n name: string;\n tagline?: string;\n description?: string;\n nav: NavItem[];\n footer?: {\n columns?: Array<{\n heading: string;\n items: Array<{ label: string; href: string; external?: boolean }>;\n }>;\n copyright?: string;\n license?: string;\n };\n submission?: {\n eyebrow?: string;\n title?: string;\n description?: string;\n good?: string[];\n avoid?: string[];\n };\n repoUrl?: string;\n url?: string;\n /** Header logo path under `public/` (e.g. `/logo.svg`). */\n logo?: string;\n /** Favicon path under `public/` (e.g. `/favicon.svg`). */\n favicon?: string;\n /** BCP-47 language tag (e.g. \"en\"). Drives `<html lang>` and og:locale. */\n locale?: string;\n /** Twitter/X handle (e.g. \"@grove\") — emitted as twitter:site. */\n twitter?: string;\n analytics?: {\n googleAnalyticsId?: string;\n };\n /** Optional directory-level stats — populated from site-config.json\n * at generate time. Components use it to render hero counts,\n * origin card stats, and footer summary lines. */\n stats?: SiteStats;\n /** Theme knobs from grove.config.ts — resolved into CSS custom\n * properties on `<html>` so the package stylesheet picks them up.\n * Values are plain strings because the prop usually arrives from a\n * JSON import; unknown values fall back to the package defaults. */\n theme?: {\n primaryColor?: string;\n /** \"none\" | \"soft\" | \"round\" */\n radius?: string;\n /** \"compact\" | \"comfortable\" | \"spacious\" */\n density?: string;\n containerWidth?: string;\n };\n blueprintConfig?: {\n routeSlug?: string;\n labelSingular?: string;\n labelPlural?: string;\n };\n}\n\ninterface Props {\n title: string;\n description: string;\n site: Site;\n type?: 'website' | 'article' | 'profile';\n noindex?: boolean;\n /** Exact robots meta value (e.g. a page model's `seo.robots`); wins over `noindex`. */\n robots?: string;\n jsonLd?: Record<string, unknown> | Record<string, unknown>[];\n /** Open Graph / Twitter image path (e.g. \"/og/records/foo.png\").\n * Defaults to the site-wide /og-image.svg inside <Seo />. */\n image?: string;\n /** Alt text for the OG/Twitter image. */\n imageAlt?: string;\n /** Optional Google Analytics 4 Measurement ID (e.g. \"G-XXXXXX\"). */\n gaId?: string;\n /** Directory browse path for \"Browse all\" links. Defaults to the blueprint route. */\n searchPath?: string;\n /** Submit button label rendered in the header. Omit to hide. */\n submitLabel?: string;\n /** Submit button href rendered in the header. */\n submitHref?: string;\n}\n\nconst {\n title,\n description,\n site,\n type,\n noindex,\n robots,\n jsonLd,\n image,\n imageAlt,\n gaId,\n searchPath,\n submitLabel,\n submitHref,\n} = Astro.props;\nconst directoryPath = searchPath ?? `/${site.blueprintConfig?.routeSlug ?? 'items'}`;\nconst effectiveGaId = gaId ?? site.analytics?.googleAnalyticsId;\n\n// ── Theme wiring ─────────────────────────────────────────────────\n// `theme.*` from grove.config.ts resolves to CSS custom properties\n// on the <html> style attribute. An attribute (not an inline\n// <style>) so the override wins over the bundled stylesheet\n// regardless of how Vite orders the CSS output.\nconst RADIUS_PRESETS: Record<string, [string, string, string]> = {\n none: ['0rem', '0rem', '0rem'],\n soft: ['0.625rem', '0.5rem', '0.75rem'],\n round: ['0.875rem', '0.75rem', '1rem'],\n};\nconst DENSITY_SPACING: Record<string, string> = {\n compact: '0.225rem',\n comfortable: '0.25rem',\n spacious: '0.28rem',\n};\n\n// Brand fill and text derive from ONE WCAG computation (contrast.ts)\n// so background and foreground can never drift apart across themes.\n\nconst themeConfig = site.theme;\nconst themeStyleParts: string[] = [];\nif (themeConfig) {\n const radius = RADIUS_PRESETS[themeConfig.radius ?? 'soft'];\n if (radius && themeConfig.radius && themeConfig.radius !== 'soft') {\n themeStyleParts.push(\n `--grove-radius: ${radius[0]}`,\n `--grove-radius-lg: ${radius[1]}`,\n `--grove-radius-xl: ${radius[2]}`,\n );\n }\n const spacing = DENSITY_SPACING[themeConfig.density ?? 'comfortable'];\n if (spacing && themeConfig.density && themeConfig.density !== 'comfortable') {\n themeStyleParts.push(`--spacing: ${spacing}`);\n }\n if (themeConfig.containerWidth) {\n themeStyleParts.push(`--grove-container: ${themeConfig.containerWidth}`);\n }\n const primary = themeConfig.primaryColor;\n if (typeof primary === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(primary)) {\n const palette = derivePrimaryPalette(primary);\n if (palette) {\n themeStyleParts.push(\n `--grove-theme-primary: ${palette.solid}`,\n `--grove-theme-primary-foreground: ${palette.solidForeground}`,\n `--grove-theme-primary-dark: ${palette.dark}`,\n `--grove-theme-primary-dark-foreground: ${palette.darkForeground}`,\n );\n }\n }\n}\nconst themeStyle = themeStyleParts.length > 0 ? `${themeStyleParts.join('; ')};` : undefined;\n\n// `site.favicon` points at a file the consumer owns under `public/`.\n// The fallback is a generated square — tinted with the configured\n// brand color rather than a hardcoded near-black, so an unconfigured\n// site still gets a tab mark that is recognisably its own.\nconst faviconFill = (site.theme?.primaryColor ?? '#18181b').trim();\nconst favicon =\n site.favicon ??\n `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='${encodeURIComponent(faviconFill)}'/%3E%3C/svg%3E`;\n---\n\n<!doctype html>\n<html lang={site.locale ?? 'en'} style={themeStyle}>\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta name=\"generator\" content={Astro.generator} />\n <meta name=\"theme-color\" content=\"#0a0a0c\" media=\"(prefers-color-scheme: dark)\" />\n <meta name=\"theme-color\" content=\"#fafafa\" media=\"(prefers-color-scheme: light)\" />\n <link rel=\"icon\" href={favicon} />\n <link rel=\"sitemap\" href=\"/sitemap.xml\" />\n {/* Preconnect to GitHub's avatar CDN — most pages render at least\n one avatar (record list cards, detail page logo) and the\n connection is reusable across cards. Cross-origin only, no\n document fetch, so the cost is one TLS handshake per page. */}\n <link rel=\"preconnect\" href=\"https://avatars.githubusercontent.com\" crossorigin=\"anonymous\" />\n <link\n rel=\"alternate\"\n type=\"text/plain\"\n href=\"/llms.txt\"\n title=\"LLM usage guidance\"\n />\n\n {effectiveGaId && (\n <>\n <script\n is:inline\n async\n src={`https://www.googletagmanager.com/gtag/js?id=${effectiveGaId}`}\n />\n <script is:inline define:vars={{ gaId: effectiveGaId }}>\n window.dataLayer = window.dataLayer || [];\n // define:vars wraps this script in a function, so a plain\n // `function gtag` would stay local; the Back/Forward handler at\n // the end of <body> needs it on window.\n window.gtag = function gtag() {\n dataLayer.push(arguments);\n };\n gtag(\"js\", new Date());\n gtag(\"config\", gaId, {\n page_path: window.location.pathname + window.location.search,\n page_title: document.title,\n });\n </script>\n </>\n )}\n\n <Seo\n title={title}\n description={description}\n type={type}\n noindex={noindex}\n robots={robots}\n jsonLd={jsonLd}\n {...(image ? { image } : {})}\n imageAlt={imageAlt}\n site={site}\n />\n\n <slot name=\"head\" />\n\n <script is:inline>\n // THEME_INIT — runs before paint so the user never sees a\n // flash of the wrong theme. State is persisted in localStorage\n // under the key \"grove-theme\" (matching ThemeToggle.astro).\n (function () {\n var STORAGE_KEY = \"grove-theme\";\n function getMode() {\n try {\n var stored = localStorage.getItem(STORAGE_KEY);\n if (stored === \"light\" || stored === \"dark\" || stored === \"system\")\n return stored;\n } catch (e) {\n // localStorage may be blocked (private mode, etc.) —\n // fall through to the system default.\n }\n return \"system\";\n }\n function apply(mode) {\n var resolved =\n mode === \"system\"\n ? (window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\")\n : mode;\n var root = document.documentElement;\n if (resolved === \"dark\") root.classList.add(\"dark\");\n else root.classList.remove(\"dark\");\n root.dataset.theme = mode;\n root.dataset.resolvedTheme = resolved;\n }\n apply(getMode());\n window.addEventListener(\"theme:set\", function (e) {\n apply(e.detail);\n });\n var mq = window.matchMedia(\"(prefers-color-scheme: dark)\");\n mq.addEventListener(\"change\", function () {\n if (getMode() === \"system\") apply(\"system\");\n });\n })();\n </script>\n </head>\n <body class=\"min-h-screen bg-background text-foreground\">\n <a\n href=\"#main\"\n class=\"sr-only z-50 rounded-md bg-background px-3 py-2 text-sm font-medium text-foreground outline-none ring-2 ring-ring focus:not-sr-only focus:fixed focus:left-3 focus:top-3\"\n >\n Skip to content\n </a>\n <slot name=\"header\">\n <Header\n site={site}\n submitLabel={submitLabel ?? (site.blueprintConfig ? `Submit ${site.blueprintConfig.labelSingular ?? \"item\"}` : undefined)}\n submitHref={submitHref ?? (site.blueprintConfig ? \"/submit\" : undefined)}\n />\n </slot>\n\n <main id=\"main\">\n <slot />\n </main>\n\n <slot name=\"footer\">\n <Footer\n site={site}\n stats={{\n totalApps: site.stats?.totalApps,\n totalCategories: site.stats?.totalCategories,\n totalStacks: site.stats?.totalStacks,\n totalOwners: site.stats?.totalOwners,\n }}\n itemsLabel={site.blueprintConfig?.labelPlural ?? \"items\"}\n discover={{\n heading: \"Discover\",\n items: [\n ...(site.stats?.totalApps\n ? [{ label: \"Browse all\", href: directoryPath }]\n : []),\n { label: \"Community\", href: \"/contributors\" },\n ...(site.stats?.originalRepo\n ? [{ label: \"View on GitHub\", href: site.stats.originalRepo, external: true }]\n : []),\n ],\n }}\n contribute={{\n heading: \"Contribute\",\n items: [\n ...(site.repoUrl\n ? [\n {\n label: \"Submit via GitHub\",\n href: `${site.repoUrl}/blob/main/CONTRIBUTING.md`,\n external: true,\n },\n ]\n : []),\n ...(site.repoUrl\n ? [\n {\n label: \"Report an issue\",\n href: `${site.repoUrl}/issues`,\n external: true,\n },\n ]\n : []),\n ],\n }}\n project={{\n heading: \"Project\",\n items: [\n ...(site.repoUrl\n ? [\n {\n label: \"Source on GitHub\",\n href: site.repoUrl,\n external: true,\n },\n ]\n : []),\n ...(site.repoUrl\n ? [\n {\n label: \"Changelog\",\n href: `${site.repoUrl}/blob/main/CHANGELOG.md`,\n external: true,\n },\n ]\n : []),\n ],\n }}\n />\n </slot>\n\n <slot name=\"body-end\" />\n\n {effectiveGaId && (\n <script is:inline define:vars={{ gaId: effectiveGaId }}>\n (function () {\n // GA4's `gtag('config', id)` call in the <head> already auto-pings\n // `page_view` on full navigations, so this block only needs to\n // catch history changes (back/forward). No history.pushState /\n // replaceState wrap: the package does not install\n // @astrojs/transitions' ClientRouter, and those wraps\n // double-fired page_view events on every navigation.\n var last = location.pathname + location.search;\n function report() {\n var next = location.pathname + location.search;\n if (next === last || typeof window.gtag !== \"function\") return;\n last = next;\n window.gtag(\"event\", \"page_view\", {\n page_path: next,\n page_title: document.title,\n page_location: location.href,\n });\n }\n window.addEventListener(\"popstate\", report);\n\n // Links and cards carry `data-event` (+ optional\n // `data-event-source` / `data-event-item`); send each click as a\n // GA event so installs and outbound clicks per record are counted.\n document.addEventListener(\"click\", function (e) {\n var el = e.target instanceof Element ? e.target.closest(\"[data-event]\") : null;\n if (!el || typeof window.gtag !== \"function\") return;\n window.gtag(\"event\", el.getAttribute(\"data-event\"), {\n event_source: el.getAttribute(\"data-event-source\") || undefined,\n event_item: el.getAttribute(\"data-event-item\") || undefined,\n link_url: el.getAttribute(\"href\") || undefined,\n transport_type: \"beacon\",\n });\n });\n })();\n </script>\n )}\n </body>\n</html>\n",
18
+ "content": "---\n/**\n * BaseLayout — wraps every page. Owns the theme-detection inline\n * script and the global shell (Header, Footer). Per-page SEO\n * (title, description, OG, JSON-LD) is delegated to `<Seo />` so\n * each page can declare what it needs without polluting the layout\n * file.\n *\n * Generic: takes a `site` prop with brand + nav + stats. No\n * `siteConfig` import — consumers compose the props from their\n * own config (typically `data/generated/site-config.json` for the\n * showcase).\n *\n * GA4 can be configured once through `site.analytics.googleAnalyticsId`\n * or overridden per page with `gaId`. Omit both for privacy-first deployments.\n */\nimport '../styles/system.css';\nimport { derivePrimaryPalette } from '@grove-dev/astro/server';\nimport Footer from './footer.astro';\nimport Header from './header.astro';\nimport Seo from './seo.astro';\n\ninterface NavItem {\n label: string;\n href: string;\n}\n\ninterface SiteStats {\n totalApps?: number;\n totalCategories?: number;\n totalStacks?: number;\n totalOwners?: number;\n totalStars?: number;\n repositoryStars?: number;\n repositoryForks?: number;\n repositoryContributors?: number;\n originalRepo?: string;\n originalStars?: number;\n originalForks?: number;\n originalContributors?: number;\n}\n\ninterface Site {\n name: string;\n tagline?: string;\n description?: string;\n nav: NavItem[];\n footer?: {\n columns?: Array<{\n heading: string;\n items: Array<{ label: string; href: string; external?: boolean }>;\n }>;\n copyright?: string;\n license?: string;\n };\n submission?: {\n eyebrow?: string;\n title?: string;\n description?: string;\n good?: string[];\n avoid?: string[];\n };\n repoUrl?: string;\n url?: string;\n /** Header logo path under `public/` (e.g. `/logo.svg`). */\n logo?: string;\n /** Favicon path under `public/` (e.g. `/favicon.svg`). */\n favicon?: string;\n /** BCP-47 language tag (e.g. \"en\"). Drives `<html lang>` and og:locale. */\n locale?: string;\n /** Twitter/X handle (e.g. \"@grove\") — emitted as twitter:site. */\n twitter?: string;\n analytics?: {\n googleAnalyticsId?: string;\n };\n /** Optional directory-level stats — populated from site-config.json\n * at generate time. Components use it to render hero counts,\n * origin card stats, and footer summary lines. */\n stats?: SiteStats;\n /** Theme knobs from grove.config.ts — resolved into CSS custom\n * properties on `<html>` so the package stylesheet picks them up.\n * Values are plain strings because the prop usually arrives from a\n * JSON import; unknown values fall back to the package defaults. */\n theme?: {\n primaryColor?: string;\n /** \"none\" | \"soft\" | \"round\" */\n radius?: string;\n /** \"compact\" | \"comfortable\" | \"spacious\" */\n density?: string;\n containerWidth?: string;\n };\n blueprintConfig?: {\n routeSlug?: string;\n labelSingular?: string;\n labelPlural?: string;\n };\n}\n\ninterface Props {\n title: string;\n description: string;\n site: Site;\n type?: 'website' | 'article' | 'profile';\n noindex?: boolean;\n /** Exact robots meta value (e.g. a page model's `seo.robots`); wins over `noindex`. */\n robots?: string;\n jsonLd?: Record<string, unknown> | Record<string, unknown>[];\n /** Open Graph / Twitter image path (e.g. \"/og/records/foo.png\").\n * Defaults to the site-wide /og-image.svg inside <Seo />. */\n image?: string;\n /** Alt text for the OG/Twitter image. */\n imageAlt?: string;\n /** Optional Google Analytics 4 Measurement ID (e.g. \"G-XXXXXX\"). */\n gaId?: string;\n /** Directory browse path for \"Browse all\" links. Defaults to the blueprint route. */\n searchPath?: string;\n /** Submit button label rendered in the header. Omit to hide. */\n submitLabel?: string;\n /** Submit button href rendered in the header. */\n submitHref?: string;\n}\n\nconst {\n title,\n description,\n site,\n type,\n noindex,\n robots,\n jsonLd,\n image,\n imageAlt,\n gaId,\n searchPath,\n submitLabel,\n submitHref,\n} = Astro.props;\nconst directoryPath = searchPath ?? `/${site.blueprintConfig?.routeSlug ?? 'items'}/`;\nconst effectiveGaId = gaId ?? site.analytics?.googleAnalyticsId;\n\n// ── Theme wiring ─────────────────────────────────────────────────\n// `theme.*` from grove.config.ts resolves to CSS custom properties\n// on the <html> style attribute. An attribute (not an inline\n// <style>) so the override wins over the bundled stylesheet\n// regardless of how Vite orders the CSS output.\nconst RADIUS_PRESETS: Record<string, [string, string, string]> = {\n none: ['0rem', '0rem', '0rem'],\n soft: ['0.625rem', '0.5rem', '0.75rem'],\n round: ['0.875rem', '0.75rem', '1rem'],\n};\nconst DENSITY_SPACING: Record<string, string> = {\n compact: '0.225rem',\n comfortable: '0.25rem',\n spacious: '0.28rem',\n};\n\n// Brand fill and text derive from ONE WCAG computation (contrast.ts)\n// so background and foreground can never drift apart across themes.\n\nconst themeConfig = site.theme;\nconst themeStyleParts: string[] = [];\nif (themeConfig) {\n const radius = RADIUS_PRESETS[themeConfig.radius ?? 'soft'];\n if (radius && themeConfig.radius && themeConfig.radius !== 'soft') {\n themeStyleParts.push(\n `--grove-radius: ${radius[0]}`,\n `--grove-radius-lg: ${radius[1]}`,\n `--grove-radius-xl: ${radius[2]}`,\n );\n }\n const spacing = DENSITY_SPACING[themeConfig.density ?? 'comfortable'];\n if (spacing && themeConfig.density && themeConfig.density !== 'comfortable') {\n themeStyleParts.push(`--spacing: ${spacing}`);\n }\n if (themeConfig.containerWidth) {\n themeStyleParts.push(`--grove-container: ${themeConfig.containerWidth}`);\n }\n const primary = themeConfig.primaryColor;\n if (typeof primary === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(primary)) {\n const palette = derivePrimaryPalette(primary);\n if (palette) {\n themeStyleParts.push(\n `--grove-theme-primary: ${palette.solid}`,\n `--grove-theme-primary-foreground: ${palette.solidForeground}`,\n `--grove-theme-primary-dark: ${palette.dark}`,\n `--grove-theme-primary-dark-foreground: ${palette.darkForeground}`,\n );\n }\n }\n}\nconst themeStyle = themeStyleParts.length > 0 ? `${themeStyleParts.join('; ')};` : undefined;\n\n// `site.favicon` points at a file the consumer owns under `public/`.\n// The fallback is a generated square — tinted with the configured\n// brand color rather than a hardcoded near-black, so an unconfigured\n// site still gets a tab mark that is recognisably its own.\nconst faviconFill = (site.theme?.primaryColor ?? '#18181b').trim();\nconst favicon =\n site.favicon ??\n `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3' fill='${encodeURIComponent(faviconFill)}'/%3E%3C/svg%3E`;\n---\n\n<!doctype html>\n<html lang={site.locale ?? 'en'} style={themeStyle}>\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta name=\"generator\" content={Astro.generator} />\n <meta name=\"theme-color\" content=\"#0a0a0c\" media=\"(prefers-color-scheme: dark)\" />\n <meta name=\"theme-color\" content=\"#fafafa\" media=\"(prefers-color-scheme: light)\" />\n <link rel=\"icon\" href={favicon} />\n <link rel=\"sitemap\" href=\"/sitemap.xml\" />\n {/* Preconnect to GitHub's avatar CDN — most pages render at least\n one avatar (record list cards, detail page logo) and the\n connection is reusable across cards. Cross-origin only, no\n document fetch, so the cost is one TLS handshake per page. */}\n <link rel=\"preconnect\" href=\"https://avatars.githubusercontent.com\" crossorigin=\"anonymous\" />\n <link\n rel=\"alternate\"\n type=\"text/plain\"\n href=\"/llms.txt\"\n title=\"LLM usage guidance\"\n />\n\n {effectiveGaId && (\n <>\n <script\n is:inline\n async\n src={`https://www.googletagmanager.com/gtag/js?id=${effectiveGaId}`}\n />\n <script is:inline define:vars={{ gaId: effectiveGaId }}>\n window.dataLayer = window.dataLayer || [];\n // define:vars wraps this script in a function, so a plain\n // `function gtag` would stay local; the Back/Forward handler at\n // the end of <body> needs it on window.\n window.gtag = function gtag() {\n dataLayer.push(arguments);\n };\n gtag(\"js\", new Date());\n gtag(\"config\", gaId, {\n page_path: window.location.pathname + window.location.search,\n page_title: document.title,\n });\n </script>\n </>\n )}\n\n <Seo\n title={title}\n description={description}\n type={type}\n noindex={noindex}\n robots={robots}\n jsonLd={jsonLd}\n {...(image ? { image } : {})}\n imageAlt={imageAlt}\n site={site}\n />\n\n <slot name=\"head\" />\n\n <script is:inline>\n // THEME_INIT — runs before paint so the user never sees a\n // flash of the wrong theme. State is persisted in localStorage\n // under the key \"grove-theme\" (matching ThemeToggle.astro).\n (function () {\n var STORAGE_KEY = \"grove-theme\";\n function getMode() {\n try {\n var stored = localStorage.getItem(STORAGE_KEY);\n if (stored === \"light\" || stored === \"dark\" || stored === \"system\")\n return stored;\n } catch (e) {\n // localStorage may be blocked (private mode, etc.) —\n // fall through to the system default.\n }\n return \"system\";\n }\n function apply(mode) {\n var resolved =\n mode === \"system\"\n ? (window.matchMedia(\"(prefers-color-scheme: dark)\").matches\n ? \"dark\"\n : \"light\")\n : mode;\n var root = document.documentElement;\n if (resolved === \"dark\") root.classList.add(\"dark\");\n else root.classList.remove(\"dark\");\n root.dataset.theme = mode;\n root.dataset.resolvedTheme = resolved;\n }\n apply(getMode());\n window.addEventListener(\"theme:set\", function (e) {\n apply(e.detail);\n });\n var mq = window.matchMedia(\"(prefers-color-scheme: dark)\");\n mq.addEventListener(\"change\", function () {\n if (getMode() === \"system\") apply(\"system\");\n });\n })();\n </script>\n </head>\n <body class=\"min-h-screen bg-background text-foreground\">\n <a\n href=\"#main\"\n class=\"sr-only z-50 rounded-md bg-background px-3 py-2 text-sm font-medium text-foreground outline-none ring-2 ring-ring focus:not-sr-only focus:fixed focus:left-3 focus:top-3\"\n >\n Skip to content\n </a>\n <slot name=\"header\">\n <Header\n site={site}\n submitLabel={submitLabel ?? (site.blueprintConfig ? `Submit ${site.blueprintConfig.labelSingular ?? \"item\"}` : undefined)}\n submitHref={submitHref ?? (site.blueprintConfig ? \"/submit/\" : undefined)}\n />\n </slot>\n\n <main id=\"main\">\n <slot />\n </main>\n\n <slot name=\"footer\">\n <Footer\n site={site}\n stats={{\n totalApps: site.stats?.totalApps,\n totalCategories: site.stats?.totalCategories,\n totalStacks: site.stats?.totalStacks,\n totalOwners: site.stats?.totalOwners,\n }}\n itemsLabel={site.blueprintConfig?.labelPlural ?? \"items\"}\n discover={{\n heading: \"Discover\",\n items: [\n ...(site.stats?.totalApps\n ? [{ label: \"Browse all\", href: directoryPath }]\n : []),\n { label: \"Community\", href: \"/contributors/\" },\n ...(site.stats?.originalRepo\n ? [{ label: \"View on GitHub\", href: site.stats.originalRepo, external: true }]\n : []),\n ],\n }}\n contribute={{\n heading: \"Contribute\",\n items: [\n ...(site.repoUrl\n ? [\n {\n label: \"Submit via GitHub\",\n href: `${site.repoUrl}/blob/main/CONTRIBUTING.md`,\n external: true,\n },\n ]\n : []),\n ...(site.repoUrl\n ? [\n {\n label: \"Report an issue\",\n href: `${site.repoUrl}/issues`,\n external: true,\n },\n ]\n : []),\n ],\n }}\n project={{\n heading: \"Project\",\n items: [\n ...(site.repoUrl\n ? [\n {\n label: \"Source on GitHub\",\n href: site.repoUrl,\n external: true,\n },\n ]\n : []),\n ...(site.repoUrl\n ? [\n {\n label: \"Changelog\",\n href: `${site.repoUrl}/blob/main/CHANGELOG.md`,\n external: true,\n },\n ]\n : []),\n ],\n }}\n />\n </slot>\n\n <slot name=\"body-end\" />\n\n {effectiveGaId && (\n <script is:inline define:vars={{ gaId: effectiveGaId }}>\n (function () {\n // GA4's `gtag('config', id)` call in the <head> already auto-pings\n // `page_view` on full navigations, so this block only needs to\n // catch history changes (back/forward). No history.pushState /\n // replaceState wrap: the package does not install\n // @astrojs/transitions' ClientRouter, and those wraps\n // double-fired page_view events on every navigation.\n var last = location.pathname + location.search;\n function report() {\n var next = location.pathname + location.search;\n if (next === last || typeof window.gtag !== \"function\") return;\n last = next;\n window.gtag(\"event\", \"page_view\", {\n page_path: next,\n page_title: document.title,\n page_location: location.href,\n });\n }\n window.addEventListener(\"popstate\", report);\n\n // Links and cards carry `data-event` (+ optional\n // `data-event-source` / `data-event-item`); send each click as a\n // GA event so installs and outbound clicks per record are counted.\n document.addEventListener(\"click\", function (e) {\n var el = e.target instanceof Element ? e.target.closest(\"[data-event]\") : null;\n if (!el || typeof window.gtag !== \"function\") return;\n window.gtag(\"event\", el.getAttribute(\"data-event\"), {\n event_source: el.getAttribute(\"data-event-source\") || undefined,\n event_item: el.getAttribute(\"data-event-item\") || undefined,\n link_url: el.getAttribute(\"href\") || undefined,\n transport_type: \"beacon\",\n });\n });\n })();\n </script>\n )}\n </body>\n</html>\n",
19
19
  "type": "registry:component",
20
20
  "target": "~/src/layouts/base-layout.astro"
21
21
  },
@@ -33,7 +33,7 @@
33
33
  },
34
34
  {
35
35
  "path": "default/layouts/header.astro",
36
- "content": "---\n/**\n * Header — sticky brand + nav + theme toggle.\n *\n * Generic: takes a `site` prop with brand + nav. No `siteConfig`\n * import — consumers compose the props from their own config.\n *\n * Optional `submit` button renders a \"Submit app\" / \"Submit project\"\n * call-to-action on the right side of the nav. Set `submitHref` /\n * `submitLabel` to enable, leave them undefined for a clean header.\n *\n * Optional `repoUrl` adds a \"View source\" GitHub button. Set\n * `repoLabel` to change the visible text.\n *\n * A nav item with `children` opens a menu panel; `menu: \"collections\"`\n * fills the panel from the collection files. The item whose `href` (or\n * a child's) prefixes the current path is marked `aria-current`.\n */\n\nimport { loadCollections } from '@grove-dev/astro/server';\nimport { compact } from '@grove-dev/core';\nimport ThemeToggle from '../components/site/theme-toggle.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\ninterface NavLink {\n label: string;\n href: string;\n description?: string;\n}\n\ninterface NavItem extends NavLink {\n children?: NavLink[];\n menu?: 'collections';\n /** Collection slugs the collections menu shows, in order. */\n featured?: string[];\n}\n\ninterface NavGroup {\n label: string;\n items: NavLink[];\n}\n\ninterface Site {\n name: string;\n tagline?: string;\n nav: NavItem[];\n description?: string;\n repoUrl?: string;\n url?: string;\n /** Logo path under `public/` (e.g. `/logo.svg`). */\n logo?: string;\n stats?: {\n /** Stars on this site's own source repository. */\n repositoryStars?: number;\n };\n blueprintConfig?: {\n routeSlug?: string;\n };\n /** Subjects name alternatives hubs in the collections menu (\"Notion\"). */\n taxonomy?: {\n subjects?: { id: string; name: string }[];\n };\n}\n\ninterface Props {\n site: Site;\n /** Submit button label, e.g. \"Submit app\". Omit to hide. */\n submitLabel?: string;\n /** Submit button href, e.g. \"/submit\". Omit to hide. */\n submitHref?: string;\n /** GitHub button label, e.g. \"View source\". */\n repoLabel?: string;\n /** Extra class for the outer header element. */\n class?: string;\n}\n\nconst { site, submitLabel, submitHref, repoLabel = 'Star', class: className = '' } = Astro.props;\nconst directoryPath = `/${site.blueprintConfig?.routeSlug ?? 'items'}`;\nconst defaultNavItems = site.blueprintConfig\n ? [\n { label: 'Recently added', href: `${directoryPath}?sort=recently-added` },\n { label: 'Trending', href: `${directoryPath}?label=hot` },\n { label: 'Categories', href: '/categories' },\n { label: 'Stacks', href: '/stacks' },\n { label: 'About', href: '/about' },\n ]\n : [];\nconst navItems: NavItem[] = site.nav?.length ? site.nav : defaultNavItems;\n\n// Resolve menus: explicit children, or the collection files for\n// `menu: \"collections\"` (loaded only when a nav item asks for them).\nconst collections = navItems.some((item) => item.menu === 'collections')\n ? await loadCollections(process.cwd())\n : [];\n// The collections menu is a shortcut, not the index: `featured` slugs (or\n// the first ten by title), titles only, and a footer link to all of them.\n// An alternatives hub (a collection with a `subject`) is named by the\n// product alone (\"Notion\") and grouped apart from the other lists.\nconst MENU_COLLECTIONS = 10;\nconst subjectNames = new Map((site.taxonomy?.subjects ?? []).map((s) => [s.id, s.name]));\nconst collectionGroups = (featured?: string[]): NavGroup[] => {\n const all = collections as { slug: string; title: string; subject?: string }[];\n const picked = featured?.length\n ? featured.flatMap((slug) => all.filter((c) => c.slug === slug))\n : [...all].sort((a, b) => a.title.localeCompare(b.title)).slice(0, MENU_COLLECTIONS);\n const hubs: NavLink[] = [];\n const lists: NavLink[] = [];\n for (const c of picked) {\n const href = `/collections/${c.slug}/`;\n const name = c.subject ? subjectNames.get(c.subject) : undefined;\n if (name) hubs.push({ label: name, href });\n else lists.push({ label: c.title, href });\n }\n return [\n { label: 'Alternatives to', items: hubs },\n { label: 'Curated lists', items: lists },\n ].filter((g) => g.items.length > 0);\n};\nconst menus = navItems.map((item) => {\n const groups = item.menu === 'collections' ? collectionGroups(item.featured) : undefined;\n const children: NavLink[] = groups ? groups.flatMap((g) => g.items) : (item.children ?? []);\n return {\n ...item,\n children,\n groups,\n footer:\n item.menu === 'collections'\n ? { label: `All ${collections.length} collections`, href: item.href }\n : undefined,\n };\n});\nconst withSlash = (path: string) => (path.endsWith('/') ? path : `${path}/`);\nconst pathname = withSlash(Astro.url.pathname);\nconst isCurrent = (item: (typeof menus)[number]) =>\n [item.href, ...item.children.map((c) => c.href)]\n .map((href) => withSlash(href.split('?')[0] ?? ''))\n .some((href) => href !== '/' && pathname.startsWith(href));\nconst stars = site.stats?.repositoryStars;\nconst starsLabel = typeof stars === 'number' ? compact(stars) : null;\n---\n\n<header\n class:list={[\n \"border-border bg-background/85 sticky top-0 z-50 border-b backdrop-blur\",\n className,\n ]}\n>\n <div\n class=\"mx-auto flex w-full max-w-container items-center gap-3 px-5 py-3 sm:gap-6 sm:px-7\"\n >\n <a\n href=\"/\"\n class=\"inline-flex min-w-0 shrink items-center gap-2 text-[0.95rem] font-semibold tracking-tight text-ink-900 dark:text-ink-100\"\n >\n {site.logo ? (\n <img\n src={site.logo}\n alt=\"\"\n aria-hidden=\"true\"\n width=\"18\"\n height=\"18\"\n class=\"inline-block h-[18px] w-[18px] shrink-0 object-contain\"\n />\n ) : (\n /* No logo configured — a neutral mark is the honest default.\n Set `site.logo` in grove.config.ts to replace it. */\n <span\n aria-hidden=\"true\"\n class=\"inline-block h-[18px] w-[18px] rounded bg-ink-900 dark:bg-ink-100\"\n ></span>\n )}\n <span class=\"truncate\">{site.name}</span>\n </a>\n\n <nav class=\"hidden flex-1 md:block\" aria-label=\"Primary\">\n <ul class=\"m-0 flex list-none items-center gap-1 p-0\">\n {menus.map((menu) => {\n const current = isCurrent(menu);\n const itemClass = [\n \"relative inline-flex h-8 cursor-pointer list-none items-center gap-1 rounded-[var(--radius)] px-2.5 text-[0.875rem] font-medium no-underline outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/35 [&::-webkit-details-marker]:hidden\",\n current ? \"text-foreground after:absolute after:inset-x-2.5 after:-bottom-[0.8125rem] after:h-0.5 after:rounded-full after:bg-foreground after:content-['']\" : \"text-muted-foreground\",\n ].join(\" \");\n return (\n <li class=\"relative\">\n {menu.children.length > 0 ? (\n <details class=\"group\" data-nav-menu>\n <summary class={itemClass} aria-current={current ? \"page\" : undefined}>\n {menu.label}\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"opacity-60 transition-transform group-open:rotate-180\"><path d=\"m4 6 4 4 4-4\"></path></svg>\n </summary>\n <div class:list={[\n \"absolute left-0 top-[calc(100%+0.625rem)] z-50 rounded-[var(--radius-lg)] border border-border bg-popover p-2 shadow-lg\",\n menu.groups ? \"w-[30rem]\" : menu.children.length > 5 ? \"w-[34rem]\" : \"w-80\",\n ]}>\n {menu.groups ? (\n menu.groups.map((group) => (\n <div class=\"px-1 pb-1 pt-1.5\">\n <p class=\"m-0 px-2 pb-1 text-2xs font-medium uppercase tracking-wide text-muted-foreground\">{group.label}</p>\n <ul class:list={[\"m-0 grid list-none gap-0 p-0\", group.items.length > 3 ? \"grid-cols-2\" : \"grid-cols-1\"]}>\n {group.items.map((item) => (\n <li>\n <a href={item.href} aria-current={pathname === item.href ? \"page\" : undefined} class=\"block truncate rounded-[var(--radius)] px-2 py-1.5 text-sm text-foreground no-underline outline-none hover:bg-accent focus-visible:bg-accent aria-[current=page]:bg-accent\">{item.label}</a>\n </li>\n ))}\n </ul>\n </div>\n ))\n ) : (\n <ul class:list={[\"m-0 grid list-none gap-0.5 p-0\", menu.children.length > 5 && \"grid-cols-2\"]}>\n {menu.children.map((item) => (\n <li>\n <a href={item.href} class=\"block rounded-[var(--radius)] px-3 py-2 no-underline outline-none hover:bg-accent focus-visible:bg-accent\">\n <span class=\"block text-sm font-medium text-foreground\">{item.label}</span>\n {item.description && <span class=\"mt-0.5 line-clamp-2 block text-2xs leading-snug text-muted-foreground\">{item.description}</span>}\n </a>\n </li>\n ))}\n </ul>\n )}\n {menu.footer && (\n <a href={menu.footer.href} class=\"mt-1 flex items-center justify-between rounded-[var(--radius)] border-t border-border px-3 pb-1 pt-2.5 text-sm font-medium text-foreground no-underline hover:underline\">\n {menu.footer.label}<span aria-hidden=\"true\">→</span>\n </a>\n )}\n </div>\n </details>\n ) : (\n <a href={menu.href} class={itemClass} aria-current={current ? \"page\" : undefined}>{menu.label}</a>\n )}\n </li>\n );\n })}\n </ul>\n </nav>\n\n <div class=\"ml-auto flex items-center gap-2\">\n <details class=\"group relative md:hidden\" data-nav-menu>\n <summary class=\"inline-flex h-9 cursor-pointer list-none items-center justify-center gap-1.5 rounded-[var(--radius)] border border-border bg-secondary px-2.5 text-sm font-medium text-foreground hover:bg-accent focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/35 [&::-webkit-details-marker]:hidden\">\n <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\"><path d=\"M2.5 4.5h11M2.5 8h11M2.5 11.5h11\"></path></svg>\n Menu\n </summary>\n <nav aria-label=\"Mobile primary\" class=\"fixed inset-x-3 top-[3.75rem] z-50 max-h-[calc(100dvh-5rem)] overflow-y-auto rounded-[var(--radius-lg)] border border-border bg-popover p-3 shadow-lg\">\n <ul class=\"m-0 flex list-none flex-col gap-3 p-0\">\n {menus.map((menu) => (\n <li>\n <a href={menu.href} aria-current={isCurrent(menu) ? \"page\" : undefined} class=\"block rounded-md px-2 py-1.5 text-sm font-semibold text-foreground no-underline hover:bg-accent aria-[current=page]:bg-accent\">{menu.label}</a>\n {menu.children.length > 0 && (\n <ul class=\"m-0 mt-1 grid list-none grid-cols-2 gap-0.5 p-0\">\n {menu.children.map((item) => (\n <li><a href={item.href} class=\"block truncate rounded-md px-2 py-1.5 text-sm text-muted-foreground no-underline hover:bg-accent hover:text-foreground\">{item.label}</a></li>\n ))}\n </ul>\n )}\n </li>\n ))}\n {submitHref && (\n <li class=\"border-t border-border pt-3\">\n <a href={submitHref} class={buttonClass(\"primary\", \"md\", \"w-full justify-center\")}>{submitLabel ?? \"Submit\"}</a>\n </li>\n )}\n </ul>\n </nav>\n </details>\n\n {submitHref && (\n <a\n href={submitHref}\n class={buttonClass(\"primary\", \"sm\", \"max-sm:!hidden\")}\n >\n <svg\n viewBox=\"0 0 16 16\"\n width=\"13\"\n height=\"13\"\n aria-hidden=\"true\"\n fill=\"currentColor\"\n >\n <path d=\"M7.75 2a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 7.75 2Z\"></path>\n </svg>\n <span>{submitLabel ?? \"Submit\"}</span>\n </a>\n )}\n\n {site.repoUrl && (\n <a\n href={site.repoUrl}\n target=\"_blank\"\n rel=\"noopener\"\n aria-label={`${repoLabel} on GitHub${starsLabel ? ` — ${starsLabel} stars` : \"\"}`}\n title={`${repoLabel} on GitHub`}\n class={buttonClass(\"secondary\", \"bare\", \"h-8 overflow-hidden p-0 text-sm\")}\n >\n <span class=\"flex items-center gap-1.5 px-2.5 py-1.5 text-ink-900 dark:text-ink-100\">\n <svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" aria-hidden=\"true\" fill=\"currentColor\">\n <path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38v-1.33c-2.22.48-2.69-1.07-2.69-1.07-.36-.92-.89-1.17-.89-1.17-.73-.5.05-.49.05-.49.8.06 1.23.83 1.23.83.72 1.22 1.87.87 2.33.67.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48v2.19c0 .21.15.46.55.38A8 8 0 0 0 8 0Z\"></path>\n </svg>\n <span class=\"hidden lg:inline\">{repoLabel}</span>\n </span>\n {starsLabel && <span class=\"hidden items-center gap-1 border-s border-border bg-secondary px-2 py-1.5 text-secondary-foreground sm:flex\">\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-warning\">\n <path d=\"M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z\"></path>\n </svg>\n <span class=\"font-mono\">{starsLabel}</span>\n </span>}\n </a>\n )}\n\n <ThemeToggle />\n </div>\n </div>\n</header>\n\n<script>\n // Nav menus are <details>: one open at a time, closed by Escape,\n // an outside click, or following a link inside the panel.\n const menus = [...document.querySelectorAll<HTMLDetailsElement>(\"[data-nav-menu]\")];\n const closeAll = (except?: HTMLDetailsElement) =>\n menus.forEach((menu) => { if (menu !== except) menu.open = false; });\n menus.forEach((menu) => {\n menu.addEventListener(\"toggle\", () => { if (menu.open) closeAll(menu); });\n menu.addEventListener(\"click\", (e) => {\n if ((e.target as HTMLElement).closest(\"a\")) menu.open = false;\n });\n });\n document.addEventListener(\"click\", (e) => {\n if (!(e.target as HTMLElement).closest(\"[data-nav-menu]\")) closeAll();\n });\n document.addEventListener(\"keydown\", (e) => {\n if (e.key !== \"Escape\") return;\n const open = menus.find((menu) => menu.open);\n if (!open) return;\n open.open = false;\n open.querySelector(\"summary\")?.focus();\n });\n\n // Smooth-scroll for in-page anchor links (Header nav + Hero CTA).\n // Works on any <a href=\"#…\"> that points to an existing element on\n // the current page. External links (e.g. /about, /projects?…) are\n // skipped because they don't start with \"#\". Modifier-clicks\n // (Cmd/Ctrl/Shift/middle) let the browser handle the anchor\n // normally so users can open the same section in a new tab.\n document.addEventListener(\"click\", (e) => {\n if (e.defaultPrevented) return;\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n if (e.button !== 0) return;\n const link = (e.target as HTMLElement).closest<HTMLAnchorElement>(\n 'a[href^=\"#\"]',\n );\n if (!link) return;\n const id = link.getAttribute(\"href\")!;\n if (id.length <= 1) return;\n const target = document.querySelector(id);\n if (!target) return;\n e.preventDefault();\n target.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n history.replaceState(null, \"\", id);\n });\n</script>\n",
36
+ "content": "---\n/**\n * Header — sticky brand + nav + theme toggle.\n *\n * Generic: takes a `site` prop with brand + nav. No `siteConfig`\n * import — consumers compose the props from their own config.\n *\n * Optional `submit` button renders a \"Submit app\" / \"Submit project\"\n * call-to-action on the right side of the nav. Set `submitHref` /\n * `submitLabel` to enable, leave them undefined for a clean header.\n *\n * Optional `repoUrl` adds a \"View source\" GitHub button. Set\n * `repoLabel` to change the visible text.\n *\n * A nav item with `children` opens a menu panel; `menu: \"collections\"`\n * fills the panel from the collection files. The item whose `href` (or\n * a child's) prefixes the current path is marked `aria-current`.\n */\n\nimport { loadCollections } from '@grove-dev/astro/server';\nimport { compact } from '@grove-dev/core';\nimport ThemeToggle from '../components/site/theme-toggle.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\ninterface NavLink {\n label: string;\n href: string;\n description?: string;\n}\n\ninterface NavItem extends NavLink {\n children?: NavLink[];\n menu?: 'collections';\n /** Collection slugs the collections menu shows, in order. */\n featured?: string[];\n}\n\ninterface NavGroup {\n label: string;\n items: NavLink[];\n}\n\ninterface Site {\n name: string;\n tagline?: string;\n nav: NavItem[];\n description?: string;\n repoUrl?: string;\n url?: string;\n /** Logo path under `public/` (e.g. `/logo.svg`). */\n logo?: string;\n stats?: {\n /** Stars on this site's own source repository. */\n repositoryStars?: number;\n };\n blueprintConfig?: {\n routeSlug?: string;\n };\n /** Subjects name alternatives hubs in the collections menu (\"Notion\"). */\n taxonomy?: {\n subjects?: { id: string; name: string }[];\n };\n}\n\ninterface Props {\n site: Site;\n /** Submit button label, e.g. \"Submit app\". Omit to hide. */\n submitLabel?: string;\n /** Submit button href, e.g. \"/submit\". Omit to hide. */\n submitHref?: string;\n /** GitHub button label, e.g. \"View source\". */\n repoLabel?: string;\n /** Extra class for the outer header element. */\n class?: string;\n}\n\nconst { site, submitLabel, submitHref, repoLabel = 'Star', class: className = '' } = Astro.props;\nconst directoryPath = `/${site.blueprintConfig?.routeSlug ?? 'items'}/`;\nconst defaultNavItems = site.blueprintConfig\n ? [\n { label: 'Recently added', href: `${directoryPath}?sort=recently-added` },\n { label: 'Trending', href: `${directoryPath}?label=hot` },\n { label: 'Categories', href: '/categories/' },\n { label: 'Stacks', href: '/stacks/' },\n { label: 'About', href: '/about/' },\n ]\n : [];\nconst navItems: NavItem[] = site.nav?.length ? site.nav : defaultNavItems;\n\n// Resolve menus: explicit children, or the collection files for\n// `menu: \"collections\"` (loaded only when a nav item asks for them).\nconst collections = navItems.some((item) => item.menu === 'collections')\n ? await loadCollections(process.cwd())\n : [];\n// The collections menu is a shortcut, not the index: `featured` slugs (or\n// the first ten by title), titles only, and a footer link to all of them.\n// An alternatives hub (a collection with a `subject`) is named by the\n// product alone (\"Notion\") and grouped apart from the other lists.\nconst MENU_COLLECTIONS = 10;\nconst subjectNames = new Map((site.taxonomy?.subjects ?? []).map((s) => [s.id, s.name]));\nconst collectionGroups = (featured?: string[]): NavGroup[] => {\n const all = collections as { slug: string; title: string; subject?: string }[];\n const picked = featured?.length\n ? featured.flatMap((slug) => all.filter((c) => c.slug === slug))\n : [...all].sort((a, b) => a.title.localeCompare(b.title)).slice(0, MENU_COLLECTIONS);\n const hubs: NavLink[] = [];\n const lists: NavLink[] = [];\n for (const c of picked) {\n const href = `/collections/${c.slug}/`;\n const name = c.subject ? subjectNames.get(c.subject) : undefined;\n if (name) hubs.push({ label: name, href });\n else lists.push({ label: c.title, href });\n }\n return [\n { label: 'Alternatives to', items: hubs },\n { label: 'Curated lists', items: lists },\n ].filter((g) => g.items.length > 0);\n};\nconst menus = navItems.map((item) => {\n const groups = item.menu === 'collections' ? collectionGroups(item.featured) : undefined;\n const children: NavLink[] = groups ? groups.flatMap((g) => g.items) : (item.children ?? []);\n return {\n ...item,\n children,\n groups,\n footer:\n item.menu === 'collections'\n ? { label: `All ${collections.length} collections`, href: item.href }\n : undefined,\n };\n});\nconst withSlash = (path: string) => (path.endsWith('/') ? path : `${path}/`);\nconst pathname = withSlash(Astro.url.pathname);\nconst isCurrent = (item: (typeof menus)[number]) =>\n [item.href, ...item.children.map((c) => c.href)]\n .map((href) => withSlash(href.split('?')[0] ?? ''))\n .some((href) => href !== '/' && pathname.startsWith(href));\nconst stars = site.stats?.repositoryStars;\nconst starsLabel = typeof stars === 'number' ? compact(stars) : null;\n---\n\n<header\n class:list={[\n \"border-border bg-background/85 sticky top-0 z-50 border-b backdrop-blur\",\n className,\n ]}\n>\n <div\n class=\"mx-auto flex w-full max-w-container items-center gap-3 px-5 py-3 sm:gap-6 sm:px-7\"\n >\n <a\n href=\"/\"\n class=\"inline-flex min-w-0 shrink items-center gap-2 text-[0.95rem] font-semibold tracking-tight text-ink-900 dark:text-ink-100\"\n >\n {site.logo ? (\n <img\n src={site.logo}\n alt=\"\"\n aria-hidden=\"true\"\n width=\"18\"\n height=\"18\"\n class=\"inline-block h-[18px] w-[18px] shrink-0 object-contain\"\n />\n ) : (\n /* No logo configured — a neutral mark is the honest default.\n Set `site.logo` in grove.config.ts to replace it. */\n <span\n aria-hidden=\"true\"\n class=\"inline-block h-[18px] w-[18px] rounded bg-ink-900 dark:bg-ink-100\"\n ></span>\n )}\n <span class=\"truncate\">{site.name}</span>\n </a>\n\n <nav class=\"hidden flex-1 md:block\" aria-label=\"Primary\">\n <ul class=\"m-0 flex list-none items-center gap-1 p-0\">\n {menus.map((menu) => {\n const current = isCurrent(menu);\n const itemClass = [\n \"relative inline-flex h-8 cursor-pointer list-none items-center gap-1 rounded-[var(--radius)] px-2.5 text-[0.875rem] font-medium no-underline outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/35 [&::-webkit-details-marker]:hidden\",\n current ? \"text-foreground after:absolute after:inset-x-2.5 after:-bottom-[0.8125rem] after:h-0.5 after:rounded-full after:bg-foreground after:content-['']\" : \"text-muted-foreground\",\n ].join(\" \");\n return (\n <li class=\"relative\">\n {menu.children.length > 0 ? (\n <details class=\"group\" data-nav-menu>\n <summary class={itemClass} aria-current={current ? \"page\" : undefined}>\n {menu.label}\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"opacity-60 transition-transform group-open:rotate-180\"><path d=\"m4 6 4 4 4-4\"></path></svg>\n </summary>\n <div class:list={[\n \"absolute left-0 top-[calc(100%+0.625rem)] z-50 rounded-[var(--radius-lg)] border border-border bg-popover p-2 shadow-lg\",\n menu.groups ? \"w-[30rem]\" : menu.children.length > 5 ? \"w-[34rem]\" : \"w-80\",\n ]}>\n {menu.groups ? (\n menu.groups.map((group) => (\n <div class=\"px-1 pb-1 pt-1.5\">\n <p class=\"m-0 px-2 pb-1 text-2xs font-medium uppercase tracking-wide text-muted-foreground\">{group.label}</p>\n <ul class:list={[\"m-0 grid list-none gap-0 p-0\", group.items.length > 3 ? \"grid-cols-2\" : \"grid-cols-1\"]}>\n {group.items.map((item) => (\n <li>\n <a href={item.href} aria-current={pathname === item.href ? \"page\" : undefined} class=\"block truncate rounded-[var(--radius)] px-2 py-1.5 text-sm text-foreground no-underline outline-none hover:bg-accent focus-visible:bg-accent aria-[current=page]:bg-accent\">{item.label}</a>\n </li>\n ))}\n </ul>\n </div>\n ))\n ) : (\n <ul class:list={[\"m-0 grid list-none gap-0.5 p-0\", menu.children.length > 5 && \"grid-cols-2\"]}>\n {menu.children.map((item) => (\n <li>\n <a href={item.href} class=\"block rounded-[var(--radius)] px-3 py-2 no-underline outline-none hover:bg-accent focus-visible:bg-accent\">\n <span class=\"block text-sm font-medium text-foreground\">{item.label}</span>\n {item.description && <span class=\"mt-0.5 line-clamp-2 block text-2xs leading-snug text-muted-foreground\">{item.description}</span>}\n </a>\n </li>\n ))}\n </ul>\n )}\n {menu.footer && (\n <a href={menu.footer.href} class=\"mt-1 flex items-center justify-between rounded-[var(--radius)] border-t border-border px-3 pb-1 pt-2.5 text-sm font-medium text-foreground no-underline hover:underline\">\n {menu.footer.label}<span aria-hidden=\"true\">→</span>\n </a>\n )}\n </div>\n </details>\n ) : (\n <a href={menu.href} class={itemClass} aria-current={current ? \"page\" : undefined}>{menu.label}</a>\n )}\n </li>\n );\n })}\n </ul>\n </nav>\n\n <div class=\"ml-auto flex items-center gap-2\">\n <details class=\"group relative md:hidden\" data-nav-menu>\n <summary class=\"inline-flex h-9 cursor-pointer list-none items-center justify-center gap-1.5 rounded-[var(--radius)] border border-border bg-secondary px-2.5 text-sm font-medium text-foreground hover:bg-accent focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/35 [&::-webkit-details-marker]:hidden\">\n <svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\"><path d=\"M2.5 4.5h11M2.5 8h11M2.5 11.5h11\"></path></svg>\n Menu\n </summary>\n <nav aria-label=\"Mobile primary\" class=\"fixed inset-x-3 top-[3.75rem] z-50 max-h-[calc(100dvh-5rem)] overflow-y-auto rounded-[var(--radius-lg)] border border-border bg-popover p-3 shadow-lg\">\n <ul class=\"m-0 flex list-none flex-col gap-3 p-0\">\n {menus.map((menu) => (\n <li>\n <a href={menu.href} aria-current={isCurrent(menu) ? \"page\" : undefined} class=\"block rounded-md px-2 py-1.5 text-sm font-semibold text-foreground no-underline hover:bg-accent aria-[current=page]:bg-accent\">{menu.label}</a>\n {menu.children.length > 0 && (\n <ul class=\"m-0 mt-1 grid list-none grid-cols-2 gap-0.5 p-0\">\n {menu.children.map((item) => (\n <li><a href={item.href} class=\"block truncate rounded-md px-2 py-1.5 text-sm text-muted-foreground no-underline hover:bg-accent hover:text-foreground\">{item.label}</a></li>\n ))}\n </ul>\n )}\n </li>\n ))}\n {submitHref && (\n <li class=\"border-t border-border pt-3\">\n <a href={submitHref} class={buttonClass(\"primary\", \"md\", \"w-full justify-center\")}>{submitLabel ?? \"Submit\"}</a>\n </li>\n )}\n </ul>\n </nav>\n </details>\n\n {submitHref && (\n <a\n href={submitHref}\n class={buttonClass(\"primary\", \"sm\", \"max-sm:!hidden\")}\n >\n <svg\n viewBox=\"0 0 16 16\"\n width=\"13\"\n height=\"13\"\n aria-hidden=\"true\"\n fill=\"currentColor\"\n >\n <path d=\"M7.75 2a.75.75 0 0 1 .75.75v3.5h3.5a.75.75 0 0 1 0 1.5h-3.5v3.5a.75.75 0 0 1-1.5 0v-3.5h-3.5a.75.75 0 0 1 0-1.5h3.5v-3.5A.75.75 0 0 1 7.75 2Z\"></path>\n </svg>\n <span>{submitLabel ?? \"Submit\"}</span>\n </a>\n )}\n\n {site.repoUrl && (\n <a\n href={site.repoUrl}\n target=\"_blank\"\n rel=\"noopener\"\n aria-label={`${repoLabel} on GitHub${starsLabel ? ` — ${starsLabel} stars` : \"\"}`}\n title={`${repoLabel} on GitHub`}\n class={buttonClass(\"secondary\", \"bare\", \"h-8 overflow-hidden p-0 text-sm\")}\n >\n <span class=\"flex items-center gap-1.5 px-2.5 py-1.5 text-ink-900 dark:text-ink-100\">\n <svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" aria-hidden=\"true\" fill=\"currentColor\">\n <path d=\"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38v-1.33c-2.22.48-2.69-1.07-2.69-1.07-.36-.92-.89-1.17-.89-1.17-.73-.5.05-.49.05-.49.8.06 1.23.83 1.23.83.72 1.22 1.87.87 2.33.67.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48v2.19c0 .21.15.46.55.38A8 8 0 0 0 8 0Z\"></path>\n </svg>\n <span class=\"hidden lg:inline\">{repoLabel}</span>\n </span>\n {starsLabel && <span class=\"hidden items-center gap-1 border-s border-border bg-secondary px-2 py-1.5 text-secondary-foreground sm:flex\">\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-warning\">\n <path d=\"M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z\"></path>\n </svg>\n <span class=\"font-mono\">{starsLabel}</span>\n </span>}\n </a>\n )}\n\n <ThemeToggle />\n </div>\n </div>\n</header>\n\n<script>\n // Nav menus are <details>: one open at a time, closed by Escape,\n // an outside click, or following a link inside the panel.\n const menus = [...document.querySelectorAll<HTMLDetailsElement>(\"[data-nav-menu]\")];\n const closeAll = (except?: HTMLDetailsElement) =>\n menus.forEach((menu) => { if (menu !== except) menu.open = false; });\n menus.forEach((menu) => {\n menu.addEventListener(\"toggle\", () => { if (menu.open) closeAll(menu); });\n menu.addEventListener(\"click\", (e) => {\n if ((e.target as HTMLElement).closest(\"a\")) menu.open = false;\n });\n });\n document.addEventListener(\"click\", (e) => {\n if (!(e.target as HTMLElement).closest(\"[data-nav-menu]\")) closeAll();\n });\n document.addEventListener(\"keydown\", (e) => {\n if (e.key !== \"Escape\") return;\n const open = menus.find((menu) => menu.open);\n if (!open) return;\n open.open = false;\n open.querySelector(\"summary\")?.focus();\n });\n\n // Smooth-scroll for in-page anchor links (Header nav + Hero CTA).\n // Works on any <a href=\"#…\"> that points to an existing element on\n // the current page. External links (e.g. /about, /projects?…) are\n // skipped because they don't start with \"#\". Modifier-clicks\n // (Cmd/Ctrl/Shift/middle) let the browser handle the anchor\n // normally so users can open the same section in a new tab.\n document.addEventListener(\"click\", (e) => {\n if (e.defaultPrevented) return;\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n if (e.button !== 0) return;\n const link = (e.target as HTMLElement).closest<HTMLAnchorElement>(\n 'a[href^=\"#\"]',\n );\n if (!link) return;\n const id = link.getAttribute(\"href\")!;\n if (id.length <= 1) return;\n const target = document.querySelector(id);\n if (!target) return;\n e.preventDefault();\n target.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n history.replaceState(null, \"\", id);\n });\n</script>\n",
37
37
  "type": "registry:component",
38
38
  "target": "~/src/layouts/header.astro"
39
39
  },
@@ -70,7 +70,7 @@
70
70
  ],
71
71
  "meta": {
72
72
  "version": "1.6.0",
73
- "requiresGrove": "1.3.1"
73
+ "requiresGrove": "1.4.0"
74
74
  },
75
75
  "type": "registry:block"
76
76
  }