@grove-dev/cli 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -23
- package/dist/audit-cli.d.ts +1 -1
- package/dist/audit-cli.d.ts.map +1 -1
- package/dist/audit-cli.js +11 -11
- package/dist/audit-cli.js.map +1 -1
- package/dist/audit.d.ts +4 -4
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +99 -49
- package/dist/audit.js.map +1 -1
- package/dist/collection-cli.d.ts.map +1 -1
- package/dist/collection-cli.js +1 -1
- package/dist/collection-cli.js.map +1 -1
- package/dist/diff.d.ts +43 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +70 -0
- package/dist/diff.js.map +1 -0
- package/dist/hash.d.ts +36 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +82 -0
- package/dist/hash.js.map +1 -0
- package/dist/icons-cli.d.ts +1 -1
- package/dist/icons-cli.d.ts.map +1 -1
- package/dist/icons-cli.js +32 -14
- package/dist/icons-cli.js.map +1 -1
- package/dist/import-cli.d.ts +1 -1
- package/dist/import-cli.d.ts.map +1 -1
- package/dist/import-cli.js +6 -6
- package/dist/import-cli.js.map +1 -1
- package/dist/index.js +95 -58
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +37 -4
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +251 -57
- package/dist/init.js.map +1 -1
- package/dist/package.json +3 -2
- package/dist/r/about.json +22 -0
- package/dist/r/browse.json +89 -0
- package/dist/r/collections.json +59 -0
- package/dist/r/contributors.json +22 -0
- package/dist/r/default.json +438 -0
- package/dist/r/home.json +67 -0
- package/dist/r/not-found.json +22 -0
- package/dist/r/project-card.json +48 -0
- package/dist/r/record.json +59 -0
- package/dist/r/registry.json +903 -0
- package/dist/r/shell.json +75 -0
- package/dist/r/submit.json +28 -0
- package/dist/r/taxonomy.json +65 -0
- package/dist/r/ui.json +54 -0
- package/dist/readme-cli.d.ts +1 -1
- package/dist/readme-cli.d.ts.map +1 -1
- package/dist/readme-cli.js +84 -49
- package/dist/readme-cli.js.map +1 -1
- package/dist/registry.d.ts +74 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +180 -0
- package/dist/registry.js.map +1 -0
- package/dist/run.d.ts +7 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +20 -0
- package/dist/run.js.map +1 -0
- package/dist/unified-diff.d.ts +14 -0
- package/dist/unified-diff.d.ts.map +1 -0
- package/dist/unified-diff.js +103 -0
- package/dist/unified-diff.js.map +1 -0
- package/dist/update.d.ts +47 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +231 -0
- package/dist/update.js.map +1 -0
- package/package.json +5 -4
- package/dist/site/.github/ISSUE_TEMPLATE/bug_report.md +0 -33
- package/dist/site/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/dist/site/.github/ISSUE_TEMPLATE/record_submission.md +0 -48
- package/dist/site/.github/pull_request_template.md +0 -27
- package/dist/site/.github/workflows/ci.yml +0 -21
- package/dist/site/.github/workflows/cleanup.yml +0 -23
- package/dist/site/.github/workflows/deploy.yml +0 -36
- package/dist/site/.github/workflows/readme.yml +0 -41
- package/dist/site/.github/workflows/sync-contributors.yml +0 -28
- package/dist/site/.github/workflows/sync-github.yml +0 -31
- package/dist/site/README.md +0 -89
- package/dist/site/astro.config.mjs +0 -26
- package/dist/site/content/records/crewai.md +0 -898
- package/dist/site/content/records/dify.md +0 -35
- package/dist/site/content/records/flowise.md +0 -38
- package/dist/site/content/records/llamaindex.md +0 -45
- package/dist/site/content/records/ollama.md +0 -39
- package/dist/site/content/records/open-webui.md +0 -35
- package/dist/site/data/collections/top-ai-agents.yml +0 -14
- package/dist/site/data/collections/top-flutter.yml +0 -12
- package/dist/site/data/health.yml +0 -13
- package/dist/site/data/records/.gitkeep +0 -0
- package/dist/site/data/records/crewai.yml +0 -23
- package/dist/site/data/records/dify.yml +0 -23
- package/dist/site/data/records/flowise.yml +0 -23
- package/dist/site/data/records/llamaindex.yml +0 -23
- package/dist/site/data/records/ollama.yml +0 -30
- package/dist/site/data/records/open-webui.yml +0 -23
- package/dist/site/data/taxonomy/categories.yml +0 -10
- package/dist/site/data/taxonomy/distribution-channels.yml +0 -43
- package/dist/site/data/taxonomy/licenses.yml +0 -16
- package/dist/site/data/taxonomy/platforms.yml +0 -20
- package/dist/site/data/taxonomy/stacks.yml +0 -15
- package/dist/site/data/taxonomy/topics.yml +0 -29
- package/dist/site/grove.config.ts +0 -110
- package/dist/site/package.json +0 -34
- package/dist/site/public/icons/.grove-icons.json +0 -47
- package/dist/site/public/icons/platforms/android.svg +0 -1
- package/dist/site/public/icons/platforms/app.svg +0 -4
- package/dist/site/public/icons/platforms/chrome.svg +0 -1
- package/dist/site/public/icons/platforms/desktop.svg +0 -4
- package/dist/site/public/icons/platforms/embedded.svg +0 -5
- package/dist/site/public/icons/platforms/ios.svg +0 -1
- package/dist/site/public/icons/platforms/linux.svg +0 -1
- package/dist/site/public/icons/platforms/macos.svg +0 -1
- package/dist/site/public/icons/platforms/ubuntu.svg +0 -1
- package/dist/site/public/icons/platforms/web.svg +0 -5
- package/dist/site/public/icons/platforms/windows.svg +0 -1
- package/dist/site/public/icons/stacks/android.svg +0 -1
- package/dist/site/public/icons/stacks/apple.svg +0 -1
- package/dist/site/public/icons/stacks/bun.svg +0 -1
- package/dist/site/public/icons/stacks/capacitor.svg +0 -1
- package/dist/site/public/icons/stacks/clojure.svg +0 -1
- package/dist/site/public/icons/stacks/dart.svg +0 -1
- package/dist/site/public/icons/stacks/deno.svg +0 -1
- package/dist/site/public/icons/stacks/django.svg +0 -1
- package/dist/site/public/icons/stacks/docker.svg +0 -1
- package/dist/site/public/icons/stacks/firebase.svg +0 -1
- package/dist/site/public/icons/stacks/flutter.svg +0 -1
- package/dist/site/public/icons/stacks/go.svg +0 -1
- package/dist/site/public/icons/stacks/graphql.svg +0 -1
- package/dist/site/public/icons/stacks/ionic.svg +0 -1
- package/dist/site/public/icons/stacks/java.svg +0 -1
- package/dist/site/public/icons/stacks/javascript.svg +0 -1
- package/dist/site/public/icons/stacks/kotlin.svg +0 -1
- package/dist/site/public/icons/stacks/llm.svg +0 -4
- package/dist/site/public/icons/stacks/mongodb.svg +0 -1
- package/dist/site/public/icons/stacks/nodejs.svg +0 -1
- package/dist/site/public/icons/stacks/python.svg +0 -1
- package/dist/site/public/icons/stacks/rag.svg +0 -6
- package/dist/site/public/icons/stacks/react-native.svg +0 -1
- package/dist/site/public/icons/stacks/react.svg +0 -1
- package/dist/site/public/icons/stacks/rust.svg +0 -1
- package/dist/site/public/icons/stacks/solidity.svg +0 -1
- package/dist/site/public/icons/stacks/sveltekit.svg +0 -1
- package/dist/site/public/icons/stacks/swift.svg +0 -1
- package/dist/site/public/icons/stacks/tauri.svg +0 -1
- package/dist/site/public/icons/stacks/tensorflow.svg +0 -1
- package/dist/site/public/icons/stacks/typescript.svg +0 -1
- package/dist/site/public/icons/stacks/vue.svg +0 -1
- package/dist/site/public/logo.svg +0 -16
- package/dist/site/src/components/DirectoryBrowse.astro +0 -246
- package/dist/site/src/components/PipelineStrip.astro +0 -121
- package/dist/site/src/components/TaxonomyList.astro +0 -108
- package/dist/site/src/pages/404.astro +0 -63
- package/dist/site/src/pages/[slug]/[recordSlug].astro +0 -71
- package/dist/site/src/pages/[slug]/index.astro +0 -19
- package/dist/site/src/pages/[slug]/page/[page].astro +0 -32
- package/dist/site/src/pages/[slug]/page/cards.astro +0 -50
- package/dist/site/src/pages/[slug]/page/records.json.ts +0 -24
- package/dist/site/src/pages/about.astro +0 -130
- package/dist/site/src/pages/categories/[name].astro +0 -35
- package/dist/site/src/pages/categories/index.astro +0 -33
- package/dist/site/src/pages/collections/[slug].astro +0 -45
- package/dist/site/src/pages/collections/index.astro +0 -32
- package/dist/site/src/pages/contributors.astro +0 -115
- package/dist/site/src/pages/empty.astro +0 -24
- package/dist/site/src/pages/index.astro +0 -161
- package/dist/site/src/pages/licenses/[name].astro +0 -35
- package/dist/site/src/pages/stacks/[name].astro +0 -35
- package/dist/site/src/pages/stacks/index.astro +0 -35
- package/dist/site/src/pages/submit.astro +0 -183
- package/dist/site/src/styles/global.css +0 -21
- package/dist/site/tsconfig.json +0 -13
- /package/{dist/site/LICENSE → LICENSE} +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "browse",
|
|
4
|
+
"title": "Browse page",
|
|
5
|
+
"description": "The list/discovery page and its paginated routes: search and sort, facet filters, active-filter chips, curated lens tabs, the results grid, pagination, and the client controller that re-derives all of it from the query string.",
|
|
6
|
+
"registryDependencies": [
|
|
7
|
+
"@grove/shell",
|
|
8
|
+
"@grove/project-card",
|
|
9
|
+
"@grove/ui"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
{
|
|
13
|
+
"path": "default/pages/[slug]/index.astro",
|
|
14
|
+
"content": "---\n/**\n * List page — page 1 of the discovery / browse page.\n *\n * The body lives in `DirectoryBrowse` because two routes render it:\n * this one and `/{slug}/page/{n}/`. The URL slug (e.g. `/projects/`,\n * `/resources/`, `/entities/`) is derived from the blueprint, so the\n * same page works for every blueprint without per-blueprint forks.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport DirectoryBrowse from '../../components/grove/directory-browse.astro';\n\nexport function getStaticPaths() {\n const routeSlug = siteConfig.blueprintConfig?.routeSlug ?? 'projects';\n return [{ params: { slug: routeSlug } }];\n}\n---\n\n<DirectoryBrowse routePage={1} />\n",
|
|
15
|
+
"type": "registry:page",
|
|
16
|
+
"target": "~/src/pages/[slug]/index.astro"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"path": "default/pages/[slug]/page/[page].astro",
|
|
20
|
+
"content": "---\n/**\n * Browse pages 2..n — `/{slug}/page/2/`, `/{slug}/page/3/`, …\n *\n * Real prerendered paths rather than a `?page=` query, so every record\n * in a large directory is reachable by a crawler and by a visitor with\n * no JavaScript. The `/page/` segment keeps these clear of\n * `/{slug}/{recordSlug}`, which would otherwise claim `/projects/2/`\n * for a record slugged \"2\".\n *\n * Page 1 is the bare `/{slug}/` route — it is not duplicated here, so\n * there is one canonical URL for the first page.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport { getDirectoryIndexModel } from '@grove-dev/astro/server';\nimport DirectoryBrowse from '../../../components/grove/directory-browse.astro';\n\nexport function getStaticPaths() {\n const routeSlug = siteConfig.blueprintConfig?.routeSlug ?? 'projects';\n // Page count comes from the model, not from `stats.totalRecords` —\n // the browse list is scoped to the blueprint's own records.\n const { pages: count } = getDirectoryIndexModel(new URLSearchParams(), siteConfig);\n return Array.from({ length: Math.max(0, count - 1) }, (_, index) => ({\n params: { slug: routeSlug, page: String(index + 2) },\n props: { routePage: index + 2 },\n }));\n}\n\nconst { routePage } = Astro.props;\n---\n\n<DirectoryBrowse routePage={routePage} />\n",
|
|
21
|
+
"type": "registry:page",
|
|
22
|
+
"target": "~/src/pages/[slug]/page/[page].astro"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "default/pages/[slug]/page/cards.astro",
|
|
26
|
+
"content": "---\n/**\n * Card source for client-side filtering — `/{slug}/page/cards/`.\n *\n * Every record's card, rendered once by the same component the browse\n * page uses, as a bare fragment with no layout.\n *\n * Why it exists: browse pages prerender only their own 20 records, so\n * the page a visitor lands on is small and crawlable. Filtering happens\n * on the client and can surface any record in the directory, so the\n * controller needs cards it was not given. Fetching them from here —\n * lazily, once, after the page is interactive — keeps the card markup\n * to a single definition instead of a second one written in JavaScript.\n *\n * `noindex`: this is a machine surface. Every record it contains is\n * already indexable through the paginated browse pages and its own\n * detail page.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport { getDirectoryIndexModel } from '@grove-dev/astro/server';\nimport IndexRow from '../../../components/grove/index-row.astro';\n\nexport function getStaticPaths() {\n const routeSlug = siteConfig.blueprintConfig?.routeSlug ?? 'projects';\n return [{ params: { slug: routeSlug } }];\n}\n\nconst slug = siteConfig.blueprintConfig?.routeSlug ?? 'projects';\nconst { sorted } = getDirectoryIndexModel(new URLSearchParams(), siteConfig);\n---\n\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"robots\" content=\"noindex, nofollow\" />\n <title>{`${slug} card source`}</title>\n </head>\n <body>\n <ul id=\"grove-index-cards\">\n {sorted.map((item) => (\n <li class=\"m-0 p-0\" data-record-slug={item.slug}>\n <IndexRow\n record={item as Parameters<typeof IndexRow>[0][\"record\"]}\n detailHref={`/${slug}/${item.slug}`}\n />\n </li>\n ))}\n </ul>\n </body>\n</html>\n",
|
|
27
|
+
"type": "registry:page",
|
|
28
|
+
"target": "~/src/pages/[slug]/page/cards.astro"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"path": "default/pages/[slug]/page/records.json.ts",
|
|
32
|
+
"content": "/**\n * Record index for client-side filtering — `/{slug}/page/records.json`.\n *\n * The browse page used to inline this array in a `<script type=\n * \"application/json\">`. That put the entire directory into every\n * paginated page's HTML: at 300 records the browse page weighed over\n * 300 kB before a single card was read. Fetched instead, it arrives\n * once, on idle, and the browser caches it across every page of the\n * directory.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport { getDirectoryIndexModel } from '@grove-dev/astro/server';\n\nexport function getStaticPaths() {\n const routeSlug = siteConfig.blueprintConfig?.routeSlug ?? 'projects';\n return [{ params: { slug: routeSlug } }];\n}\n\nexport function GET() {\n const { clientItemsJson } = getDirectoryIndexModel(new URLSearchParams(), siteConfig);\n return new Response(clientItemsJson, {\n headers: { 'content-type': 'application/json; charset=utf-8' },\n });\n}\n",
|
|
33
|
+
"type": "registry:file",
|
|
34
|
+
"target": "~/src/pages/[slug]/page/records.json.ts"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"path": "default/components/grove/directory-browse.astro",
|
|
38
|
+
"content": "---\n/**\n * DirectoryBrowse — the browse page body, shared by the two routes\n * that render it: `/{slug}/` (page 1) and `/{slug}/page/{n}/`.\n *\n * Layout, top to bottom:\n * - PageHeader (the only place the page names itself)\n * - Search + Sort on one row\n * - Every facet filter on the next row\n * - Applied-filter chips + Clear all on their own row\n * - Result count / sort / page line\n * - Card grid, then pagination\n *\n * Navigation model: **pages are real paths.** Each route prerenders\n * only its own 20 records, so an unfiltered directory of any size is\n * crawlable, works without JavaScript, and never ships the whole\n * catalogue as DOM.\n *\n * Filtering stays client-side: these routes are PRERENDERED, so at\n * build time `Astro.url.searchParams` is empty. `DirectoryIndexClient`\n * re-reads `location.search` and re-derives the result list, chips,\n * pagination, and facet intersection counts with the same\n * `@grove-dev/core/directory` functions the server used. Filtered views\n * paginate with `?page=N` on the base route.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport { SORT_OPTIONS, sortDisplay } from '@grove-dev/astro';\nimport {\n getDirectoryIndexModel,\n itemLabel,\n itemLabelPlural,\n seoTitle,\n taxonomy,\n titleCaseFirst,\n} from '@grove-dev/astro/server';\nimport { formatCount } from '@grove-dev/core';\nimport BaseLayout from '../../layouts/base-layout.astro';\nimport { chipClass } from '../../lib/classnames.ts';\nimport Button from '../ui/button.astro';\nimport FilterDrawer from '../ui/filter-drawer.astro';\nimport PageHeader from '../ui/page-header.astro';\nimport SearchField from '../ui/search-field.astro';\nimport CardGrid from './card-grid.astro';\nimport DirectoryIndexClient from './directory-index-client.astro';\nimport IndexRow from './index-row.astro';\nimport Pagination from './pagination.astro';\nimport RefinePanel from './refine-panel.astro';\nimport SmartLensTabs from './smart-lens-tabs.astro';\n\ninterface Props {\n /** 1-based page this route renders. */\n routePage?: number;\n}\n\nconst { routePage = 1 } = Astro.props;\nconst slug = siteConfig.blueprintConfig?.routeSlug ?? 'projects';\nconst {\n total,\n filters,\n facetGroups,\n searchPlaceholder,\n sort,\n sorted,\n pageItems,\n pages,\n page,\n chips,\n clearFiltersHref,\n hrefForResultPage,\n seo,\n} = getDirectoryIndexModel(Astro.url.searchParams, siteConfig, { page: routePage });\n\n// Page 2+ gets a distinct title and skips the ItemList JSON-LD so the\n// list markup isn't duplicated across every paginated route. The\n// per-page description is built inside `getDirectoryIndexModel` so it\n// fits inside the 160-char cap; this view just forwards `seo.title`.\nconst title =\n page > 1\n ? seoTitle(`Browse ${titleCaseFirst(itemLabelPlural())} — Page ${page}`, siteConfig.name)\n : seo.title;\nconst description = seo.description;\n---\n\n<BaseLayout\n title={title}\n description={description}\n image={seo.image}\n jsonLd={page > 1 ? undefined : seo.jsonLd}\n site={siteConfig}\n submitHref=\"/submit\"\n submitLabel={`Submit ${itemLabel()}`}\n>\n <section class=\"border-b border-border bg-background\">\n <div class=\"mx-auto w-full max-w-container px-5 pt-10 sm:px-7 sm:pt-12\">\n <PageHeader\n eyebrow={slug}\n title={`Browse ${slug}`}\n description={`Search, filter, and explore ${formatCount(total, { singular: itemLabel(), plural: itemLabelPlural() })} in this directory.`}\n />\n\n {/* Curated views. Real links (not a JS-driven control) — the\n same server-and-client filter pipeline (@grove-dev/core's\n filtersFromSearchParams/filterRecords) already understands\n `?lens=`, so this works with JS disabled too. */}\n <SmartLensTabs\n currentParams={Astro.url.searchParams}\n pathPrefix={`/${slug}`}\n lensIds={[\"all\", \"hot\", \"new\", \"mature\"]}\n class=\"mt-6\"\n />\n\n {/* Row 1 — search and sort. Search filters as you type (see\n DirectoryIndexClient); the submit button is sr-only so Enter\n still works when JavaScript never arrives. */}\n <form\n method=\"get\"\n action={`/${slug}`}\n id=\"search-form\"\n class=\"mt-6 flex flex-col gap-2 sm:flex-row\"\n role=\"search\"\n >\n <SearchField\n class=\"flex-1\"\n label={`Search ${itemLabelPlural()}`}\n value={filters.q ?? \"\"}\n placeholder={searchPlaceholder}\n shortcut\n />\n <label class=\"relative\">\n <span class=\"sr-only\">{`Sort ${itemLabelPlural()}`}</span>\n <select\n id=\"sort-select\"\n name=\"sort\"\n class=\"h-10 w-full cursor-pointer appearance-none rounded-md border border-input bg-background py-1.5 pl-3 pr-8 text-sm font-medium text-foreground transition-colors hover:border-ring focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring/20 sm:w-auto\"\n >\n {SORT_OPTIONS.map((o) => (\n <option value={o.value} selected={o.value === sort}>{o.label}</option>\n ))}\n </select>\n <svg\n viewBox=\"0 0 16 16\"\n width=\"11\"\n height=\"11\"\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground\"\n fill=\"currentColor\"\n >\n <path d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\" />\n </svg>\n </label>\n <button type=\"submit\" class=\"sr-only\">Search</button>\n </form>\n\n {/* Row 2 — every filter on one line. On mobile they collapse into\n a full-width \"Filters (n)\" button opening a bottom sheet. */}\n <div class=\"mt-3\">\n <FilterDrawer label=\"Filters\" activeCount={chips.length} clearHref={clearFiltersHref}>\n <RefinePanel\n class=\"max-md:flex-col max-md:items-stretch\"\n groups={facetGroups}\n initial={filters}\n pathPrefix={`/${slug}`}\n hide={[\"sort\"]}\n />\n </FilterDrawer>\n </div>\n\n {/* Row 3 — what is currently narrowing the list, and one way out\n of all of it. Server-rendered empty on this prerendered route;\n the client fills it from the live query string. */}\n <div\n id=\"active-filters\"\n class:list={[\"mt-3 flex flex-wrap items-center gap-1.5 pb-6\", chips.length === 0 && \"hidden\"]}\n aria-label=\"Active filters\"\n >\n {chips.map((chip) => (\n <a href={chip.href} class={chipClass()} aria-label={`Remove filter: ${chip.label}`}>\n {chip.label} <span aria-hidden=\"true\">×</span>\n </a>\n ))}\n {chips.length > 0 && (\n <a\n href={clearFiltersHref}\n class=\"text-2xs font-medium text-ink-500 underline decoration-border underline-offset-2 hover:text-ink-900 dark:hover:text-ink-100\"\n aria-label=\"Clear all active filters\"\n >\n Clear all\n </a>\n )}\n </div>\n {chips.length === 0 && <div class=\"pb-6\"></div>}\n </div>\n </section>\n\n <section class=\"py-10 sm:py-12\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n {/* The count line IS the results heading — it carries a fact,\n which \"All projects / Every item in the directory\" did not,\n and it keeps the document's heading order intact above the\n cards' own h3s. */}\n <h2\n id=\"results-heading\"\n class=\"m-0 mb-5 text-2xs font-normal text-ink-500 dark:text-ink-400\"\n >\n <span id=\"results-count\" class=\"font-mono font-semibold text-ink-900 dark:text-ink-100\">\n {sorted.length} {sorted.length === 1 ? itemLabel() : itemLabelPlural()}\n </span>\n <span id=\"results-sort\">{` · sorted by ${sortDisplay(sort)}`}</span>\n <span id=\"results-page\">{pages > 1 ? ` · page ${page} of ${pages}` : \"\"}</span>\n </h2>\n\n <CardGrid id=\"results-list\">\n {pageItems.map((item, i) => (\n <li class=\"m-0 p-0\" data-record-slug={item.slug}>\n <IndexRow\n record={item as Parameters<typeof IndexRow>[0][\"record\"]}\n detailHref={`/${slug}/${item.slug}`}\n eager={i < 3}\n />\n </li>\n ))}\n </CardGrid>\n\n <div id=\"empty-state\" class:list={[\"py-12 text-center\", sorted.length > 0 && \"hidden\"]}>\n <p class=\"m-0 text-sm font-medium text-ink-700 dark:text-ink-200\">\n {`No ${itemLabelPlural()} match these filters.`}\n </p>\n <Button href={clearFiltersHref} variant=\"secondary\" size=\"sm\" class=\"mt-4\">Clear filters</Button>\n </div>\n {/* Plain div wrapper — Pagination renders its own\n <nav aria-label=\"Pagination\">, so a nav here would nest two\n identical landmarks. */}\n <div id=\"results-pagination\" class=\"mt-8 flex flex-wrap items-center justify-center gap-1.5\">\n <Pagination current={page} total={pages} hrefFor={hrefForResultPage} />\n </div>\n </div>\n </section>\n\n <section class=\"border-t border-ink-200 dark:border-ink-800\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <div class=\"flex flex-col items-center gap-3 py-12 text-center\">\n <h2 class=\"m-0 text-xl font-semibold tracking-tight text-ink-900 dark:text-ink-100\">\n {`Know a real ${itemLabel()} that belongs here?`}\n </h2>\n <p class=\"m-0 max-w-2xl text-sm text-ink-500 dark:text-ink-400\">\n {`Open a pull request with a YAML file. We review every submission against the bar — no marketing, no tutorials.`}\n </p>\n <Button href=\"/submit\" variant=\"primary\" size=\"sm\" class=\"mt-2\">\n {`Submit ${itemLabel()}`}\n </Button>\n\n </div>\n </div>\n </section>\n\n <DirectoryIndexClient\n slug={slug}\n singular={itemLabel()}\n plural={itemLabelPlural()}\n taxonomy={taxonomy}\n routePage={page}\n />\n</BaseLayout>\n",
|
|
39
|
+
"type": "registry:component",
|
|
40
|
+
"target": "~/src/components/grove/directory-browse.astro"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"path": "default/components/grove/directory-index-client.astro",
|
|
44
|
+
"content": "---\n/**\n * DirectoryIndexClient — the browse page's client controller.\n *\n * The browse routes are prerendered per page (`/{slug}/`,\n * `/{slug}/page/2/`), so the server never sees a query string. This\n * script re-reads `location.search` and re-derives results, chips,\n * facet counts, and pagination with the same `@grove-dev/core/directory`\n * functions the server used.\n *\n * Two modes, one list:\n * - **No filters** — the server-rendered page slice is already right.\n * Pagination links stay the real `/page/n/` paths.\n * - **Filtered** — the whole record set is filtered here, the page\n * re-renders from `clientItemsJson`, and pagination switches to\n * `?page=N` on the base route.\n */\ninterface Props {\n slug: string;\n singular: string;\n plural: string;\n taxonomy: Record<string, unknown>;\n /** Page this route prerendered; the client starts from it. */\n routePage?: number;\n}\n\nconst { slug, singular, plural, taxonomy, routePage = 1 } = Astro.props;\nconst clientConfigJson = JSON.stringify({ slug, singular, plural, taxonomy, routePage }).replace(\n /</g,\n '\\\\u003c',\n);\n---\n\n<script is:inline id=\"grove-index-config\" type=\"application/json\" set:html={clientConfigJson}></script>\n<script>\n import type { IndexRecord } from \"@grove-dev/core\";\n import type { DirectoryFilterGroupKey } from \"@grove-dev/core/directory\";\n import {\n PAGE_SIZE,\n activeFilterChips,\n applySort,\n buildFacets,\n DIRECTORY_FILTER_KEYS,\n DIRECTORY_FILTER_LABELS,\n DIRECTORY_TAXONOMY_KINDS,\n effectivePage,\n effectiveSort,\n filterRecords,\n filtersFromSearchParams,\n hasAnyFilter,\n isDirectoryFilterGroupKey,\n hrefForClearedFilters,\n hrefForFilters,\n pagePathHref,\n paginationPageList,\n searchParamsFromFilters,\n sortDisplay,\n totalPages,\n } from \"@grove-dev/core/directory\";\n import {\n PAGINATION_DISABLED,\n PAGINATION_EXTRA,\n buttonClass,\n chipClass,\n filterTriggerClass,\n } from \"../../lib/classnames.ts\";\n\n (() => {\n const configSource = document.querySelector(\"#grove-index-config\");\n const listNode = document.querySelector<HTMLElement>(\"#results-list\");\n if (!configSource || !listNode) return;\n // Closures below cannot see the guard above; bind the narrowed type once.\n const list = listNode;\n\n const { slug, singular, plural, taxonomy, routePage } = JSON.parse(\n configSource.textContent || \"{}\",\n );\n // Filled by `loadRecords()`. Until then the page shows what the\n // server rendered, which for an unfiltered view is already right.\n let items: IndexRecord[] = [];\n const pathPrefix = `/${slug}`;\n\n // Cards for this page came with the document. A filtered view can\n // surface any record in the directory, so the rest are fetched\n // once from `/{slug}/page/cards/` — rendered there by the same\n // server component, which is what keeps the card to a single\n // definition instead of a second one written in JavaScript.\n const nodes = new Map<string, HTMLElement>();\n for (const node of list.querySelectorAll(\":scope > [data-record-slug]\")) {\n const key = (node as HTMLElement).dataset.recordSlug;\n if (key) nodes.set(key, node as HTMLElement);\n }\n\n // The record index — everything filtering, sorting, and facet\n // counting reads. Fetched rather than inlined so a paginated page\n // does not carry the whole directory in its HTML.\n let recordSource: Promise<void> | null = null;\n let recordsSettled = false;\n function loadRecords(): Promise<void> {\n if (!recordSource) {\n recordSource = fetch(`${pathPrefix}/page/records.json`)\n .then((response) => (response.ok ? response.json() : []))\n .then((data) => {\n items = Array.isArray(data) ? data : [];\n })\n .catch(() => {\n items = [];\n })\n .then(() => {\n // Settled either way: a failed fetch must not leave the\n // page retrying forever behind a busy list.\n recordsSettled = true;\n });\n }\n return recordSource;\n }\n\n let cardSource: Promise<void> | null = null;\n let cardsSettled = false;\n function loadAllCards(): Promise<void> {\n if (!cardSource) {\n cardSource = fetch(`${pathPrefix}/page/cards/`)\n .then((response) => (response.ok ? response.text() : \"\"))\n .then((html) => {\n if (!html) return;\n const parsed = new DOMParser().parseFromString(html, \"text/html\");\n for (const node of parsed.querySelectorAll(\"#grove-index-cards > [data-record-slug]\")) {\n const key = (node as HTMLElement).dataset.recordSlug;\n if (key && !nodes.has(key)) nodes.set(key, document.adoptNode(node) as HTMLElement);\n }\n })\n .catch(() => {\n // Offline or a stale deploy: the page keeps working with\n // the records it already has.\n })\n .then(() => {\n cardsSettled = true;\n });\n }\n return cardSource;\n }\n /** Everything a filtered view needs: the index and the cards. */\n const loadAll = () => Promise.all([loadRecords(), loadAllCards()]);\n\n // Warm on the first sign of intent — a pointer or focus reaching\n // the controls — rather than on idle. Prefetching a whole\n // directory during load competes with the page itself for\n // bandwidth on a phone, and most visitors never filter at all.\n const controls = document.querySelector(\"#search-form\")?.parentElement ?? document;\n for (const type of [\"pointerdown\", \"focusin\", \"keydown\"]) {\n controls.addEventListener(type, () => loadAll(), { once: true, passive: true });\n }\n\n let params = new URLSearchParams(location.search);\n let filters = filtersFromSearchParams(params);\n let sort = effectiveSort(filters);\n\n /**\n * True when the URL asks for something the prerendered document\n * does not already show. `hasAnyFilter` deliberately ignores\n * `sort`, but a sorted view is just as much a client view: the\n * `/page/N/` documents are all built with the default sort, so\n * paging out of `?sort=most-starred` onto one of them would\n * silently re-sort the list mid-journey.\n */\n const isClientView = () => hasAnyFilter(filters) || Boolean(filters.sort);\n\n /** Client views own the page number; prerendered ones use the path. */\n const currentPage = () => (isClientView() ? effectivePage(filters) : routePage || 1);\n\n const hrefForResultPage = (target: number) =>\n isClientView()\n ? hrefForFilters({ ...filters, page: target }, pathPrefix)\n : pagePathHref(pathPrefix, target);\n\n /** Move the page's cards into the list, in result order. */\n function renderList(visible: { slug: string }[]) {\n const next: HTMLElement[] = [];\n let missing = false;\n for (const record of visible) {\n const node = nodes.get(record.slug);\n if (node) next.push(node);\n else missing = true;\n }\n list.replaceChildren(...next);\n // A record whose card has not arrived yet: render what we have\n // and finish the moment the card source lands. Only while the\n // fetch is still outstanding — once it has settled, a missing\n // card is missing, and retrying would spin.\n if (missing && !cardsSettled) loadAllCards().then(() => applyClientFilters());\n }\n\n function applyClientFilters() {\n const filtered = applySort(filterRecords(items, filters), sort);\n const pageCount = totalPages(filtered.length);\n const page = Math.min(Math.max(1, currentPage()), pageCount);\n renderList(filtered.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE));\n\n const count = document.querySelector(\"#results-count\");\n const pageLabel = document.querySelector(\"#results-page\");\n const empty = document.querySelector(\"#empty-state\");\n if (count) count.textContent = `${filtered.length} ${filtered.length === 1 ? singular : plural}`;\n const sortLabel = document.querySelector(\"#results-sort\");\n if (sortLabel) sortLabel.textContent = ` · sorted by ${sortDisplay(sort)}`;\n if (pageLabel) pageLabel.textContent = pageCount > 1 ? ` · page ${page} of ${pageCount}` : \"\";\n if (empty) empty.classList.toggle(\"hidden\", filtered.length > 0);\n\n // Rebuild the pagination controls, mirroring the server-rendered\n // `Pagination.astro` (Previous/Next + windowed page list via the\n // shared `paginationPageList`) so client filtering never degrades\n // the affordances of the initial render.\n const pagination = document.querySelector(\"#results-pagination\");\n if (pagination) {\n pagination.innerHTML = \"\";\n if (pageCount > 1) {\n const linkClass = buttonClass(\"secondary\", \"sm\", PAGINATION_EXTRA);\n const nav = document.createElement(\"nav\");\n nav.className = \"flex flex-wrap items-center justify-center gap-1.5\";\n nav.setAttribute(\"aria-label\", \"Pagination\");\n const control = (label: string, target: number | null, rel?: string) => {\n if (target === null) {\n const span = document.createElement(\"span\");\n span.className = `${linkClass} ${PAGINATION_DISABLED}`;\n span.textContent = label;\n return span;\n }\n const link = document.createElement(\"a\");\n link.href = hrefForResultPage(target);\n link.textContent = label;\n link.className = linkClass;\n if (rel) link.rel = rel;\n return link;\n };\n nav.append(control(\"Previous\", page > 1 ? page - 1 : null, \"prev\"));\n for (const entry of paginationPageList(page, pageCount)) {\n if (entry === \"ellipsis\") {\n const dots = document.createElement(\"span\");\n dots.className = \"px-1 text-2xs text-ink-400\";\n dots.setAttribute(\"aria-hidden\", \"true\");\n dots.textContent = \"...\";\n nav.append(dots);\n continue;\n }\n const link = control(String(entry), entry);\n link.setAttribute(\"aria-label\", `Page ${entry}`);\n if (entry === page) {\n link.setAttribute(\"aria-current\", \"page\");\n link.className = buttonClass(\"selected\", \"sm\", PAGINATION_EXTRA);\n }\n nav.append(link);\n }\n nav.append(control(\"Next\", page < pageCount ? page + 1 : null, \"next\"));\n pagination.append(nav);\n }\n }\n }\n\n const searchInput = document.querySelector(\"#search-input\");\n const searchClear = document.querySelector(\"[data-search-clear]\");\n if (searchInput instanceof HTMLInputElement) searchInput.value = filters.q || \"\";\n document.querySelectorAll('select[name=\"sort\"]').forEach((select) => {\n if (select instanceof HTMLSelectElement) select.value = sort;\n });\n\n const filterKeys = DIRECTORY_FILTER_KEYS;\n const filterLabels = DIRECTORY_FILTER_LABELS;\n const taxonomyKinds = DIRECTORY_TAXONOMY_KINDS;\n const taxonomyName = (groupKey: DirectoryFilterGroupKey, value: string) =>\n (taxonomy[taxonomyKinds[groupKey]] || []).find(\n (entry: { id: string; name: string }) => entry.id === value,\n )?.name ?? value;\n\n /** Chip labels and remove hrefs come from core — one definition. */\n function renderChips() {\n const activeFilters = document.querySelector(\"#active-filters\");\n const chips = activeFilterChips(filters, { taxonomy, pathPrefix });\n if (activeFilters) {\n activeFilters.innerHTML = \"\";\n for (const chip of chips) {\n const link = document.createElement(\"a\");\n link.href = chip.href;\n // The whole anchor is the remove control; the visible label\n // announces the filter value, and the aria-label spells out\n // the action for assistive tech.\n link.setAttribute(\"aria-label\", `Remove filter: ${chip.label}`);\n link.className = chipClass();\n link.append(document.createTextNode(`${chip.label} `));\n const close = document.createElement(\"span\");\n close.setAttribute(\"aria-hidden\", \"true\");\n close.textContent = \"×\";\n link.append(close);\n activeFilters.append(link);\n }\n if (chips.length) {\n const clear = document.createElement(\"a\");\n clear.href = hrefForClearedFilters(filters, pathPrefix);\n clear.className =\n \"text-2xs font-medium text-ink-500 underline decoration-border underline-offset-2 hover:text-ink-900 dark:hover:text-ink-100\";\n clear.setAttribute(\"aria-label\", \"Clear all active filters\");\n clear.textContent = \"Clear all\";\n activeFilters.append(clear);\n }\n activeFilters.classList.toggle(\"hidden\", chips.length === 0);\n }\n\n // Mobile filter-drawer badge + its clear-all mirror the chips.\n const drawerCount = document.querySelector(\"[data-drawer-count]\");\n if (drawerCount) {\n drawerCount.textContent = String(chips.length);\n drawerCount.classList.toggle(\"hidden\", chips.length === 0);\n }\n const drawerClear = document.querySelector(\"[data-drawer-clear]\");\n if (drawerClear instanceof HTMLAnchorElement) {\n drawerClear.href = hrefForClearedFilters(filters, pathPrefix);\n drawerClear.classList.toggle(\"hidden\", chips.length === 0);\n }\n }\n\n function renderFilterTriggers() {\n const values = (key: string) => params.getAll(key).filter(Boolean);\n document.querySelectorAll(\".grove-filter\").forEach((group) => {\n if (!(group instanceof HTMLElement)) return;\n const groupKey = group.dataset.filterGroupKey;\n if (!groupKey || !isDirectoryFilterGroupKey(groupKey)) return;\n const selected = values(filterKeys[groupKey]);\n group.querySelectorAll(\".grove-filter-input\").forEach((input) => {\n if (input instanceof HTMLInputElement) {\n input.checked = selected.includes(input.dataset.filterValue || \"\");\n }\n });\n const triggerButton = group.querySelector(\".grove-filter-trigger\");\n const trigger = triggerButton?.querySelector(\"span\");\n const label = filterLabels[groupKey];\n if (trigger) {\n trigger.textContent = selected.length\n ? `${label}: ${\n selected.length === 1\n ? taxonomyName(groupKey, selected[0] ?? \"\")\n : `${selected.length} selected`\n }`\n : `${label}: Any`;\n }\n if (triggerButton) {\n // Same builder the server render used — the class string is\n // reassigned wholesale so the two can never drift.\n triggerButton.className = filterTriggerClass(selected.length > 0);\n }\n group.querySelector(\".grove-filter-clear\")?.classList.toggle(\"hidden\", selected.length === 0);\n });\n }\n\n // Facet counts were rendered at build time from the UNFILTERED\n // record set (the route is prerendered, so the server never sees\n // the live query string). Recompute intersection counts against\n // the current filters and patch each count span in place —\n // never re-render the option lists, which would destroy\n // checkbox, focus, and scroll state.\n function renderFacetCounts() {\n const liveFacets: Record<string, { value: string; count: number }[]> = buildFacets(items, {\n filters,\n curatedTagIds: (taxonomy.topics || []).map((topic: { id: string }) => topic.id),\n });\n document.querySelectorAll(\"[data-facet-count]\").forEach((span) => {\n if (!(span instanceof HTMLElement)) return;\n const options = liveFacets[span.dataset.facet ?? \"\"] ?? [];\n const count = options.find((option) => option.value === span.dataset.value)?.count ?? 0;\n span.textContent = String(count);\n const row = span.closest(\"label\");\n const input = row?.querySelector(\".grove-filter-input\");\n const checked = input instanceof HTMLInputElement && input.checked;\n // A zero-count option can't narrow anything — dim and disable\n // it unless it's the currently selected value (which must stay\n // interactive so the user can un-select it).\n const inert = count === 0 && !checked;\n row?.classList.toggle(\"opacity-45\", inert);\n if (input instanceof HTMLInputElement) input.disabled = inert;\n });\n }\n\n function renderAll() {\n renderChips();\n renderFilterTriggers();\n if (searchClear instanceof HTMLElement) searchClear.hidden = !(filters.q || \"\").length;\n\n if (recordsSettled) {\n renderFacetCounts();\n applyClientFilters();\n return;\n }\n // Nothing to filter with yet. A plain view of this page is\n // already correct as the server rendered it; anything the URL\n // asks for beyond that — a filter, a search, a sort — waits for\n // the index and the cards, and says so while it does.\n if (!isClientView()) return;\n list.setAttribute(\"aria-busy\", \"true\");\n loadAll().then(() => {\n list.removeAttribute(\"aria-busy\");\n renderAll();\n });\n }\n\n /**\n * Adopt a URL without a navigation, then re-render from it.\n *\n * A URL with no query is a prerendered document — clearing the\n * last filter lands on `/{slug}/`, which on page 2+ is a\n * *different* document than the one on screen. Adopting it there\n * would leave records 21–40 rendered under the page-1 URL, so\n * that case navigates for real.\n */\n function adopt(url: string, mode: \"push\" | \"replace\") {\n const next = new URL(url, location.origin);\n const samePath =\n next.pathname.replace(/\\/$/, \"\") === location.pathname.replace(/\\/$/, \"\");\n if (!next.search && (!samePath || (routePage || 1) > 1)) {\n location.assign(next.toString());\n return;\n }\n const state = { grove: true, scrollY: window.scrollY };\n if (mode === \"push\") history.pushState(state, \"\", next);\n else history.replaceState(state, \"\", next);\n params = new URLSearchParams(next.search);\n filters = filtersFromSearchParams(params);\n sort = effectiveSort(filters);\n renderAll();\n }\n\n // Search filters as you type. `replaceState` keeps a search\n // session out of the history stack — Back should return to the\n // previous result set, not to the previous keystroke.\n let debounce = 0;\n searchInput?.addEventListener(\"input\", () => {\n window.clearTimeout(debounce);\n debounce = window.setTimeout(() => {\n const query = searchInput instanceof HTMLInputElement ? searchInput.value.trim() : \"\";\n adopt(hrefForFilters({ ...filters, q: query || undefined, page: 1 }, pathPrefix), \"replace\");\n if (searchInput instanceof HTMLInputElement) searchInput.focus();\n }, 150);\n });\n searchClear?.addEventListener(\"click\", () => {\n if (searchInput instanceof HTMLInputElement) {\n searchInput.value = \"\";\n searchInput.focus();\n }\n adopt(hrefForFilters({ ...filters, q: undefined, page: 1 }, pathPrefix), \"replace\");\n });\n document.querySelector(\"#search-form\")?.addEventListener(\"submit\", (event) => {\n // Enter already has its answer on screen; submitting would only\n // reload the same state.\n event.preventDefault();\n });\n\n // RefinePanel asks before it navigates; cancelling means \"this\n // page can apply the URL in place\".\n document.addEventListener(\"grove:navigate\", (event) => {\n const url = (event as CustomEvent<{ url: string }>).detail?.url;\n if (!url) return;\n event.preventDefault();\n adopt(url, \"push\");\n });\n\n // Filtered navigation is a real step: Back returns to the\n // previous result set and its scroll position.\n //\n // Only links that carry a query are adopted. Everything else that\n // points at this list — `/{slug}/` from \"Clear all\" or the \"1\"\n // pagination link, `/{slug}/page/2/`, the header's \"Browse\" nav —\n // is a prerendered document and must actually navigate;\n // swallowing those left page 2's records rendered under the\n // page-1 URL. Hash links (the skip link) are never ours.\n document.addEventListener(\"click\", (event) => {\n const link = (event.target as HTMLElement | null)?.closest(\"a\");\n if (!(link instanceof HTMLAnchorElement)) return;\n if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.shiftKey) return;\n if (link.target === \"_blank\" || !link.href.startsWith(location.origin)) return;\n const url = new URL(link.href);\n if (url.hash) return;\n const isListUrl = url.pathname === `${pathPrefix}/` || url.pathname === pathPrefix;\n if (!isListUrl || !url.search) return;\n event.preventDefault();\n history.replaceState({ grove: true, scrollY: window.scrollY }, \"\");\n adopt(url.toString(), \"push\");\n window.scrollTo({ top: 0, behavior: \"instant\" as ScrollBehavior });\n });\n\n window.addEventListener(\"popstate\", (event) => {\n params = new URLSearchParams(location.search);\n filters = filtersFromSearchParams(params);\n sort = effectiveSort(filters);\n if (searchInput instanceof HTMLInputElement) searchInput.value = filters.q || \"\";\n document.querySelectorAll('select[name=\"sort\"]').forEach((select) => {\n if (select instanceof HTMLSelectElement) select.value = sort;\n });\n renderAll();\n const state = event.state as { scrollY?: number } | null;\n if (typeof state?.scrollY === \"number\") {\n window.scrollTo({ top: state.scrollY, behavior: \"instant\" as ScrollBehavior });\n }\n });\n\n renderAll();\n })();\n</script>\n",
|
|
45
|
+
"type": "registry:component",
|
|
46
|
+
"target": "~/src/components/grove/directory-index-client.astro"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"path": "default/components/grove/refine-panel.astro",
|
|
50
|
+
"content": "---\nimport type { IndexFilters } from '@grove-dev/core';\n/**\n * RefinePanel — multi-select facet dropdowns.\n *\n * Renders the ordered `groups` view-model produced by\n * `getDirectoryIndexModel().facetGroups` — visibility, ORDER, display\n * label, and selection mode all come from `browse.facets` + the core\n * facet registry, never from this component. Option labels arrive\n * pre-resolved from the taxonomy YAML, so the server render and the\n * client script share one label source.\n *\n * The form is a GET to the list page base, with each facet as a\n * repeated key. Empty values are dropped, so the URL stays clean.\n */\nimport { DIRECTORY_FILTER_KEYS, SORT_OPTIONS } from '@grove-dev/core';\nimport FilterGroupMenu from './filter-group-menu.astro';\n\ninterface FacetValue {\n value: string;\n label?: string;\n count?: number;\n}\n\ninterface FacetGroupModel {\n id: string;\n filterKey: 'stacks' | 'platforms' | 'categories' | 'tags' | 'licenses';\n label: string;\n single?: boolean;\n options: FacetValue[];\n initial: string[];\n}\n\ninterface Props {\n /** Ordered filter groups (see `getDirectoryIndexModel`). */\n groups: FacetGroupModel[];\n /** Current URL filter state — used to preselect the sort. */\n initial: IndexFilters;\n pathPrefix?: string;\n class?: string;\n /**\n * Emit the default flex layout on the root. Pass `false` when the\n * caller owns the layout — e.g. `layout={false} class=\"contents\"` to\n * promote the filter triggers into the parent's flex row. Without\n * this the root's own `flex` would win over any display utility in\n * `class`, since Tailwind emits `.contents` before `.flex`.\n */\n layout?: boolean;\n /** Hide the sort select (e.g. when the page renders its own). */\n hide?: Array<'sort'>;\n}\n\nconst {\n groups: groupModels,\n initial,\n pathPrefix = '/',\n class: className = '',\n layout = true,\n hide = [],\n} = Astro.props;\n\nfunction triggerLabel(group: FacetGroupModel): string {\n if (group.initial.length === 0) return `${group.label}: Any`;\n if (group.initial.length === 1) {\n const selected = group.initial[0];\n const option = group.options.find((candidate) => candidate.value === selected);\n return `${group.label}: ${option?.label ?? selected}`;\n }\n return `${group.label}: ${group.initial.length} selected`;\n}\n\nconst groups = groupModels.map((group) => ({\n ...group,\n active: group.initial.length > 0,\n popoverId: `filter-popover-${group.filterKey}`,\n trigger: triggerLabel(group),\n}));\n---\n\n<div class:list={[layout && \"flex flex-wrap items-center gap-2\", className]} role=\"toolbar\" aria-label=\"Filter items\">\n {groups.map((group) => <FilterGroupMenu {...group} />)}\n\n {!hide.includes(\"sort\") && (\n <label class=\"relative\">\n <span class=\"sr-only\">Sort items</span>\n <select name=\"sort\" class=\"h-9 cursor-pointer appearance-none border py-1.5 pl-3 pr-8 text-[0.8125rem] font-medium\">\n {SORT_OPTIONS.map((option) => <option value={option.value} selected={(initial.sort ?? \"recently-updated\") === option.value}>{option.label}</option>)}\n </select>\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" class=\"pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-ink-400\" fill=\"currentColor\">\n <path d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\"/>\n </svg>\n </label>\n )}\n</div>\n\n<script is:inline define:vars={{ pathPrefix, filterKeys: DIRECTORY_FILTER_KEYS }}>\n (() => {\n const groups = document.querySelectorAll(\".grove-filter\");\n const keys = filterKeys;\n function closeAll(except) {\n groups.forEach((group) => {\n if (group === except) return;\n const popover = group.querySelector(\".grove-filter-popover\");\n const trigger = group.querySelector(\".grove-filter-trigger\");\n if (popover && trigger) {\n popover.hidden = true;\n popover.classList.add(\"hidden\");\n trigger.setAttribute(\"aria-expanded\", \"false\");\n }\n });\n }\n // A directory controller (DirectoryIndexClient) can adopt the URL\n // in place and re-render without a reload; it signals that by\n // cancelling the event. Anywhere else — a taxonomy page, no\n // controller on the page at all — this falls back to navigating,\n // so the panel keeps working on its own.\n function go(url) {\n const event = new CustomEvent(\"grove:navigate\", { detail: { url }, cancelable: true });\n if (document.dispatchEvent(event)) location.assign(url);\n }\n function navigate(group, values) {\n const params = new URLSearchParams(location.search);\n const key = keys[group.dataset.filterGroupKey];\n params.delete(key);\n params.delete(\"page\");\n values.forEach((value) => params.append(key, value));\n go(params.toString() ? `${pathPrefix}?${params}` : pathPrefix);\n }\n groups.forEach((group) => {\n const trigger = group.querySelector(\".grove-filter-trigger\");\n const popover = group.querySelector(\".grove-filter-popover\");\n trigger?.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n const opening = trigger.getAttribute(\"aria-expanded\") !== \"true\";\n closeAll(opening ? group : undefined);\n popover.hidden = !opening;\n popover.classList.toggle(\"hidden\", !opening);\n trigger.setAttribute(\"aria-expanded\", String(opening));\n });\n group.querySelector(\".grove-filter-apply\")?.addEventListener(\"click\", () => {\n navigate(group, [...group.querySelectorAll(\".grove-filter-input:checked\")].map((input) => input.dataset.filterValue));\n });\n group.querySelector(\".grove-filter-clear\")?.addEventListener(\"click\", () => navigate(group, []));\n if (group.dataset.filterSingle === \"true\") {\n group.querySelectorAll(\".grove-filter-input\").forEach((input) => input.addEventListener(\"change\", () => navigate(group, [input.dataset.filterValue])));\n }\n popover?.addEventListener(\"click\", (event) => event.stopPropagation());\n });\n document.addEventListener(\"click\", () => closeAll());\n document.addEventListener(\"keydown\", (event) => {\n if (event.key !== \"Escape\") return;\n // Restore focus to the trigger whose popover was open so\n // keyboard users don't lose their place.\n const openGroup = [...groups].find((group) =>\n group.querySelector('.grove-filter-trigger[aria-expanded=\"true\"]'),\n );\n closeAll();\n openGroup?.querySelector(\".grove-filter-trigger\")?.focus();\n });\n document.querySelector('select[name=\"sort\"]')?.addEventListener(\"change\", (event) => {\n const params = new URLSearchParams(location.search);\n params.set(\"sort\", event.target.value);\n params.delete(\"page\");\n go(params.toString() ? `${pathPrefix}?${params}` : pathPrefix);\n });\n })();\n</script>\n",
|
|
51
|
+
"type": "registry:component",
|
|
52
|
+
"target": "~/src/components/grove/refine-panel.astro"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"path": "default/components/grove/filter-group-menu.astro",
|
|
56
|
+
"content": "---\nimport { buttonClass, filterTriggerClass } from '../../lib/classnames.ts';\nimport FilterOptions from './filter-options.astro';\n\ninterface FacetValue {\n value: string;\n label?: string;\n count?: number;\n}\n\ninterface Props {\n label: string;\n filterKey: string;\n options: FacetValue[];\n initial: string[];\n single?: boolean;\n active: boolean;\n popoverId: string;\n trigger: string;\n}\n\nconst group = Astro.props;\n---\n\n<div class=\"grove-filter relative\" data-filter-group-key={group.filterKey} data-filter-single={group.single ? \"true\" : \"false\"}>\n <button\n type=\"button\"\n class={filterTriggerClass(group.active)}\n aria-expanded=\"false\"\n aria-controls={group.popoverId}\n >\n <span>{group.trigger}</span>\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" fill=\"currentColor\" class=\"opacity-70\">\n <path d=\"M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z\"/>\n </svg>\n </button>\n {/* A group of native checkboxes/radios — the old listbox role over\n label/input children had no valid accessibility tree. */}\n <div\n id={group.popoverId}\n class=\"rounded-[calc(var(--radius)+0.25rem)] border border-border bg-popover text-popover-foreground shadow-xl grove-filter-popover absolute left-0 top-full z-40 mt-1 hidden w-72 max-w-[calc(100vw-2rem)] p-1.5\"\n role=\"group\"\n aria-label={`${group.label} filters`}\n hidden\n >\n <FilterOptions filterKey={group.filterKey} options={group.options} initial={group.initial} single={group.single} />\n {/* Single-select groups navigate on change, so Apply would be a\n dead affordance — they keep only Clear, and the whole footer\n hides itself while Clear is hidden (the client script toggles\n Clear's `hidden` class from the live URL state). */}\n <div\n class:list={[\n \"mt-1 flex items-center justify-between border-t border-ink-100 px-2 pt-1.5 dark:border-ink-900\",\n group.single && \"has-[.grove-filter-clear.hidden]:hidden\",\n ]}\n >\n <button\n type=\"button\"\n class:list={[\n \"grove-filter-clear text-2xs font-medium text-ink-500 hover:text-ink-900 dark:text-ink-400 dark:hover:text-ink-100\",\n !group.active && \"hidden\",\n ]}\n >Clear {group.label.toLowerCase()}</button>\n {!group.single && (\n <button type=\"button\" class={buttonClass(\"primary\", \"sm\", \"grove-filter-apply ml-auto px-2.5 text-2xs\")}>Apply</button>\n )}\n </div>\n </div>\n</div>\n",
|
|
57
|
+
"type": "registry:component",
|
|
58
|
+
"target": "~/src/components/grove/filter-group-menu.astro"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"path": "default/components/grove/filter-options.astro",
|
|
62
|
+
"content": "---\ninterface FacetValue {\n value: string;\n label?: string;\n count?: number;\n}\n\ninterface Props {\n filterKey: string;\n options: FacetValue[];\n initial: string[];\n single?: boolean;\n}\n\nconst { filterKey, options, initial, single = false } = Astro.props;\n\nfunction pretty(value: string): string {\n return value\n .split(/[-_]/)\n .map((part) => (part ? part[0].toUpperCase() + part.slice(1) : part))\n .join(' ');\n}\n---\n\n<ul class=\"m-0 flex max-h-72 list-none flex-col gap-0.5 overflow-y-auto p-0\">\n {options.map((option) => (\n <li>\n <label class=\"flex cursor-pointer items-center justify-between gap-3 rounded-md px-2 py-1.5 text-[0.8125rem] text-ink-700 transition-colors hover:bg-ink-50 dark:text-ink-300 dark:hover:bg-ink-900/60\">\n <span class=\"flex min-w-0 items-center gap-2\">\n <input\n type={single ? \"radio\" : \"checkbox\"}\n name={single ? filterKey : undefined}\n class=\"grove-filter-input h-3.5 w-3.5 shrink-0 cursor-pointer accent-ink-900 dark:accent-ink-100\"\n data-filter-key={filterKey}\n data-filter-value={option.value}\n checked={initial.includes(option.value)}\n />\n <span class=\"truncate\">{option.label ?? pretty(option.value)}</span>\n </span>\n <span\n class=\"font-mono text-2xs tabular-nums text-ink-500 dark:text-ink-400\"\n data-facet-count\n data-facet={filterKey}\n data-value={option.value}\n >{option.count ?? 0}</span>\n </label>\n </li>\n ))}\n</ul>\n",
|
|
63
|
+
"type": "registry:component",
|
|
64
|
+
"target": "~/src/components/grove/filter-options.astro"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "default/components/grove/pagination.astro",
|
|
68
|
+
"content": "---\ninterface Props {\n current: number;\n total: number;\n hrefFor: (page: number) => string;\n class?: string;\n}\n\nimport { paginationPageList } from '@grove-dev/astro';\nimport { buttonClass, PAGINATION_DISABLED, PAGINATION_EXTRA } from '../../lib/classnames.ts';\n\nconst { current, total, hrefFor, class: className = '' } = Astro.props;\n\nconst pages = paginationPageList(current, total);\nconst linkClass = buttonClass('secondary', 'sm', PAGINATION_EXTRA);\nconst currentClass = buttonClass('selected', 'sm', PAGINATION_EXTRA);\n---\n\n{total > 1 && (\n <nav\n class:list={[\"flex flex-wrap items-center justify-center gap-1.5\", className]}\n aria-label=\"Pagination\"\n >\n {current > 1 ? (\n <a href={hrefFor(current - 1)} class={linkClass} rel=\"prev\">Previous</a>\n ) : (\n <span class={`${linkClass} ${PAGINATION_DISABLED}`}>Previous</span>\n )}\n\n {pages.map((page) =>\n page === \"ellipsis\" ? (\n <span class=\"px-1 text-2xs text-ink-400\" aria-hidden=\"true\">...</span>\n ) : (\n <a\n href={hrefFor(page)}\n class={page === current ? currentClass : linkClass}\n aria-current={page === current ? \"page\" : undefined}\n >\n {page}\n </a>\n ),\n )}\n\n {current < total ? (\n <a href={hrefFor(current + 1)} class={linkClass} rel=\"next\">Next</a>\n ) : (\n <span class={`${linkClass} ${PAGINATION_DISABLED}`}>Next</span>\n )}\n </nav>\n)}\n",
|
|
69
|
+
"type": "registry:component",
|
|
70
|
+
"target": "~/src/components/grove/pagination.astro"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"path": "default/components/grove/smart-lens-tabs.astro",
|
|
74
|
+
"content": "---\n/**\n * SmartLensTabs — curated single-select lens tabs.\n *\n * Renders configured curated lenses as a horizontal tab bar. Sort choices,\n * including Recently added, belong in the separate sort control.\n * Clicking a tab navigates to the same list page with the `lens=`\n * query param updated. Other filter params (q, stack, platform,\n * category, sort) are preserved.\n *\n * The current selection is computed from `currentParams`, so the\n * component is server-render-only — no client JS required.\n *\n * Generic: uses the `LENSES` registry from `lib/lenses.ts` and\n * takes the list-page base via `pathPrefix`.\n */\n\nimport { hrefForLens, isLensActive, LENSES, lensDisplay } from '@grove-dev/core';\nimport { lensTabClass } from '../../lib/classnames.ts';\n\ninterface Props {\n currentParams: URLSearchParams;\n pathPrefix?: string;\n class?: string;\n /**\n * Emit the default flex layout on the root. Pass `false` when the\n * caller owns the layout — e.g. `layout={false} class=\"contents\"` to\n * promote the tabs into the parent's flex row. Without this the\n * root's own `flex` would win over any display utility in `class`,\n * since Tailwind emits `.contents` before `.flex`.\n */\n layout?: boolean;\n /** Override the visible lens list (defaults to LENSES). */\n lensIds?: readonly string[];\n /** Consumer noun for the unfiltered lens, e.g. \"All apps\". */\n allLabel?: string;\n}\n\nconst {\n currentParams,\n pathPrefix = '/',\n class: className = '',\n layout = true,\n lensIds,\n allLabel,\n} = Astro.props;\n\n// If `lensIds` is provided, filter LENSES to those ids in that order.\nconst lenses =\n lensIds && lensIds.length > 0\n ? lensIds\n .map((id) => LENSES.find((l) => l.id === id))\n .filter((l): l is NonNullable<typeof l> => Boolean(l))\n : LENSES;\n---\n\n<nav\n class:list={[\n \"grove-lens-tabs\",\n layout && \"flex flex-wrap items-center gap-1.5\",\n className,\n ]}\n aria-label=\"Curated views\"\n>\n {lenses.map((lens) => {\n const active = isLensActive(lens.id, currentParams);\n return (\n <a\n href={hrefForLens(lens.id, currentParams, pathPrefix)}\n class={lensTabClass(active)}\n aria-current={active ? \"page\" : undefined}\n data-lens-id={lens.id}\n data-event=\"lens_tab_click\"\n data-event-source=\"smart_lens_tabs\"\n >\n {lens.id === \"all\" && allLabel ? allLabel : lensDisplay(lens.id)}\n </a>\n );\n })}\n</nav>\n",
|
|
75
|
+
"type": "registry:component",
|
|
76
|
+
"target": "~/src/components/grove/smart-lens-tabs.astro"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"path": "default/components/grove/index-row.astro",
|
|
80
|
+
"content": "---\nimport { buildProjectCardModel } from '@grove-dev/astro/server';\n/**\n * IndexRow — browse-page adapter around the canonical `ProjectCard`.\n *\n * Keeps the historical public props (`record`, `detailHref`,\n * `showChips`, `eager`) so consumer pages copied from earlier versions\n * keep working. The card itself is the same on every surface: a\n * record must not look like a different record depending on whether\n * you found it on the home page or in the browse list. The repository\n * is reached through the card's `owner/repo` line, so this adapter\n * adds nothing to the card at all.\n *\n * Builds the `ProjectCardModel` from `record` internally — `record`\n * stays this adapter's public contract (unaffected by `ProjectCard`'s\n * presentation-only rewrite).\n */\nimport type { IndexRecord } from '@grove-dev/core';\nimport ProjectCard from './project-card.astro';\n\ninterface Props {\n record: IndexRecord;\n detailHref: string;\n /** @deprecated Ignored — the card renders one fixed layout. */\n showChips?: boolean;\n /** Set true on the first 1-2 rows of a list to bypass lazy\n * loading for the above-the-fold avatars. Pair with\n * `fetchpriority=\"high\"`. */\n eager?: boolean;\n class?: string;\n}\n\nconst { record, detailHref, eager = false, class: className = '' } = Astro.props;\n\nconst model = buildProjectCardModel(record);\n---\n\n<ProjectCard\n model={model}\n href={detailHref}\n eager={eager}\n class={className}\n/>\n",
|
|
81
|
+
"type": "registry:component",
|
|
82
|
+
"target": "~/src/components/grove/index-row.astro"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"meta": {
|
|
86
|
+
"version": "1.0.0"
|
|
87
|
+
},
|
|
88
|
+
"type": "registry:block"
|
|
89
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "collections",
|
|
4
|
+
"title": "Collections",
|
|
5
|
+
"description": "Curated and generated collections: the index and detail routes, collection cards and rows, and the featured-collections teaser.",
|
|
6
|
+
"registryDependencies": [
|
|
7
|
+
"@grove/shell",
|
|
8
|
+
"@grove/project-card",
|
|
9
|
+
"@grove/ui"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
{
|
|
13
|
+
"path": "default/pages/collections/index.astro",
|
|
14
|
+
"content": "---\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getCollectionIndexModel,\n loadCollections,\n recordsToCollectionEntries,\n} from '@grove-dev/astro/server';\nimport CollectionIndex from '../../components/grove/collection-index.astro';\nimport BaseLayout from '../../layouts/base-layout.astro';\n\nconst collections = await loadCollections(process.cwd());\nconst entries = recordsToCollectionEntries(\n (records as { records: unknown[] }).records as never,\n siteConfig,\n);\nconst model = getCollectionIndexModel(collections, entries, siteConfig);\nconst countNoun = {\n singular: siteConfig.blueprintConfig?.labelSingular ?? 'item',\n plural: siteConfig.blueprintConfig?.labelPlural ?? 'items',\n};\nconst seo = model.seo;\n---\n<BaseLayout\n title={seo?.title ?? \"Collections\"}\n description={seo?.description ?? \"Curated and generated directories of related items.\"}\n image={seo?.image}\n jsonLd={seo?.jsonLd}\n site={siteConfig}\n>\n <CollectionIndex model={model} level={1} countNoun={countNoun} />\n</BaseLayout>\n",
|
|
15
|
+
"type": "registry:page",
|
|
16
|
+
"target": "~/src/pages/collections/index.astro"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"path": "default/pages/collections/[slug].astro",
|
|
20
|
+
"content": "---\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getCollectionPageModel,\n loadCollections,\n recordsToCollectionEntries,\n} from '@grove-dev/astro/server';\nimport CollectionPage from '../../components/grove/collection-page.astro';\nimport BaseLayout from '../../layouts/base-layout.astro';\n\nexport async function getStaticPaths() {\n const collections = await loadCollections(process.cwd());\n return collections.map((c) => ({ params: { slug: c.slug } }));\n}\n\nconst { slug } = Astro.params;\nconst collections = await loadCollections(process.cwd());\nconst collection = collections.find((c) => c.slug === slug);\nif (!collection) return Astro.redirect('/404');\n\nconst entries = recordsToCollectionEntries(\n (records as { records: unknown[] }).records as never,\n siteConfig,\n);\nconst model = getCollectionPageModel(collection, entries, collections, siteConfig);\n---\n<BaseLayout\n title={model.seo.title}\n description={model.seo.description}\n image={model.seo.image}\n imageAlt={model.seo.imageAlt}\n jsonLd={model.seo.jsonLd}\n noindex={model.seo.noindex}\n site={siteConfig}\n>\n <CollectionPage\n model={model}\n eyebrow={model.collection.kind === \"curated\" ? \"Curated collection\" : \"Generated collection\"}\n countNoun={{\n singular: siteConfig.blueprintConfig?.labelSingular ?? \"item\",\n plural: siteConfig.blueprintConfig?.labelPlural ?? \"items\",\n }}\n />\n</BaseLayout>\n",
|
|
21
|
+
"type": "registry:page",
|
|
22
|
+
"target": "~/src/pages/collections/[slug].astro"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "default/components/grove/collection-index.astro",
|
|
26
|
+
"content": "---\nimport type { CollectionIndexModel } from '@grove-dev/astro/server';\nimport Container from '../../layouts/container.astro';\nimport SectionHeader from '../../layouts/section-header.astro';\nimport EmptyState from '../ui/empty-state.astro';\n/**\n * CollectionIndex — renders a grid of every collection defined in\n * `data/collections/*.yml`. Each card links to the collection's\n * detail page and shows the entry count.\n *\n * Consumes a `CollectionIndexModel` produced by\n * `getCollectionIndexModel`. Pass `limit` (e.g. 3) for a teaser-style\n * subset; the framework also re-exports this component as\n * `CollectionTeaser` for the homepage use case.\n *\n * API parity with `RecordSection`:\n * - `id`, `eyebrow`, `title`, `description`\n * - `viewAllHref`, `viewAllLabel` — header CTA\n * - `emptyLabel` — copy when there are no collections\n * - `<slot name=\"header-actions\">` — custom buttons in header\n * - `class` — extra class on the outer <section>\n */\nimport CardGrid from './card-grid.astro';\nimport CollectionCard from './collection-card.astro';\n\ninterface Props {\n model: CollectionIndexModel;\n id?: string;\n eyebrow?: string;\n title?: string;\n description?: string;\n /** Header \"View all\" link. Hides when not provided. */\n viewAllHref?: string;\n viewAllLabel?: string;\n emptyLabel?: string;\n /** Cap the number of cards rendered. Omit for \"all\". */\n limit?: number;\n /**\n * Heading level for the section title. Pass 1 when this component\n * renders the page's title (the `/collections` index); the default\n * 2 fits embedded use (homepage teaser).\n */\n level?: 1 | 2;\n /** Noun pair for the per-card entry counts (blueprint labels). */\n countNoun?: { singular: string; plural: string };\n class?: string;\n}\n\nconst {\n model,\n id,\n eyebrow = 'Collections',\n title = 'Collections',\n description = 'Curated and generated directories of related items.',\n viewAllHref,\n viewAllLabel = 'View all',\n emptyLabel = 'No collections yet.',\n limit,\n level = 2,\n countNoun,\n class: className = '',\n} = Astro.props;\n\nconst cards = typeof limit === 'number' ? model.collections.slice(0, limit) : model.collections;\nconst headerActions = Astro.slots.has('header-actions');\n---\n\n<section id={id} class={`py-12 sm:py-16 ${className}`}>\n <Container>\n <div class=\"mb-6 flex flex-wrap items-end justify-between gap-3\">\n <SectionHeader eyebrow={eyebrow} title={title} description={description} level={level} />\n {(viewAllHref || headerActions) && (\n <div class=\"flex shrink-0 items-center gap-2 pb-2\">\n {viewAllHref && (\n <a\n href={viewAllHref}\n class=\"text-2xs font-medium text-ink-500 transition-colors hover:text-ink-900 sm:inline dark:text-ink-400 dark:hover:text-ink-100\"\n >\n {viewAllLabel} →\n </a>\n )}\n <slot name=\"header-actions\" />\n </div>\n )}\n </div>\n\n {cards.length === 0 ? (\n <EmptyState\n title={emptyLabel}\n description=\"Collections are defined in data/collections/*.yml — add a file there and it appears here on the next build.\"\n />\n ) : (\n <CardGrid>\n {cards.map((c) => (\n <li class=\"m-0 p-0\">\n <CollectionCard collection={c} countNoun={countNoun} />\n </li>\n ))}\n </CardGrid>\n )}\n </Container>\n</section>\n",
|
|
27
|
+
"type": "registry:component",
|
|
28
|
+
"target": "~/src/components/grove/collection-index.astro"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"path": "default/components/grove/collection-page.astro",
|
|
32
|
+
"content": "---\nimport type { CollectionPageModel } from '@grove-dev/astro/server';\n/**\n * CollectionPage — renders a single curated/generated collection.\n *\n * Consumes a `CollectionPageModel` produced by `getCollectionPageModel`.\n * Renders the header via `SectionHeader` (framework consistency),\n * the matched entries via `CollectionRow`, and a related-collections\n * section.\n *\n * Generic: no blueprint-specific copy. Consumers can override\n * `eyebrow`, `title`, `description`; the `<slot name=\"intro\">` is\n * the natural place for editorial intros (markdown rendered with\n * the consumer's content pipeline). `emptyLabel` matches\n * `RecordSection`'s API for empty-state copy.\n */\nimport { formatCount } from '@grove-dev/core';\nimport Container from '../../layouts/container.astro';\nimport SectionHeader from '../../layouts/section-header.astro';\nimport EmptyState from '../ui/empty-state.astro';\nimport CardGrid from './card-grid.astro';\nimport CollectionRow from './collection-row.astro';\n\ninterface Props {\n model: CollectionPageModel;\n /** Override the eyebrow text (default: derived from collection kind). */\n eyebrow?: string;\n /** Override the title (default: collection.title). */\n title?: string;\n /** Override the description (default: collection.description). */\n description?: string;\n /** Default copy when the collection has no matching entries. */\n emptyLabel?: string;\n /** Section id (deep link + stable key). */\n id?: string;\n /**\n * Heading level for the collection title. This component IS the\n * page on collection detail routes, so it defaults to 1.\n */\n level?: 1 | 2;\n /** Noun pair for the entry count (blueprint labels). */\n countNoun?: { singular: string; plural: string };\n class?: string;\n}\n\nconst {\n model,\n eyebrow,\n title,\n description,\n emptyLabel = 'This collection is currently empty.',\n id,\n level = 1,\n countNoun = { singular: 'item', plural: 'items' },\n class: className = '',\n} = Astro.props;\n\nconst finalTitle = title ?? model.collection.title;\nconst finalDescription = description ?? model.collection.description;\nconst finalEyebrow =\n eyebrow ?? (model.collection.kind === 'curated' ? 'Curated collection' : 'Generated collection');\n---\n\n<section id={id} class={`py-12 sm:py-16 ${className}`}>\n <Container>\n <SectionHeader eyebrow={finalEyebrow} title={finalTitle} description={finalDescription} level={level} />\n\n {/* Editorial context reads as a quiet callout, not metadata\n shouting in uppercase. */}\n {model.collection.selectionNote && (\n <aside class=\"mb-6 max-w-[64ch] rounded-[var(--radius-lg)] border-l-2 border-border bg-surface-sunken px-4 py-3\">\n <p class=\"m-0 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n Selection criteria\n </p>\n <p class=\"m-0 mt-1 text-[0.875rem] leading-relaxed text-foreground\">\n {model.collection.selectionNote}\n </p>\n </aside>\n )}\n\n <slot name=\"intro\" />\n\n {/* Bridges the heading outline: the page title is an h1 and the\n entry cards render h3 titles — without this h2 Lighthouse\n flags a heading-order skip. */}\n <h2 class=\"sr-only\">Entries</h2>\n <p class=\"m-0 mb-4 text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">\n {formatCount(model.total, countNoun)}\n </p>\n\n {model.isEmpty ? (\n <EmptyState\n title={emptyLabel}\n description=\"No records currently match this collection's query. The collection fills automatically as matching records are added.\"\n />\n ) : (\n <CardGrid>\n {model.entries.map((entry, i) => (\n <li class=\"m-0 p-0\">\n <CollectionRow entry={entry} eager={i < 3} />\n </li>\n ))}\n </CardGrid>\n )}\n\n {model.related.length > 0 && (\n <section class=\"mt-12 border-t border-ink-200 pt-8 dark:border-ink-800\">\n <SectionHeader\n eyebrow=\"Related\"\n title=\"Related collections\"\n description=\"Other curated groupings of related items.\"\n level={2}\n />\n <ul class=\"m-0 grid list-none grid-cols-1 gap-2 p-0 sm:grid-cols-2 lg:grid-cols-4\">\n {model.related.map((r) => (\n <li class=\"m-0 p-0\">\n <a\n href={r.url}\n class=\"group flex h-full flex-col gap-1 rounded-md border border-ink-200 bg-white px-3 py-2.5 no-underline transition-colors hover:border-ink-400 dark:border-ink-800 dark:bg-ink-950 dark:hover:border-ink-600\"\n >\n <span class=\"text-sm font-medium text-ink-900 group-hover:underline dark:text-ink-100\">{r.title}</span>\n </a>\n </li>\n ))}\n </ul>\n </section>\n )}\n </Container>\n</section>\n",
|
|
33
|
+
"type": "registry:component",
|
|
34
|
+
"target": "~/src/components/grove/collection-page.astro"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"path": "default/components/grove/collection-card.astro",
|
|
38
|
+
"content": "---\n/**\n * CollectionCard — card for one collection (not a record): kind\n * eyebrow, title, description, entry count.\n *\n * Extracted from `CollectionIndex` so the collection tile shares the\n * `ProjectCard` visual language (border, radius, hover lift, tokens)\n * and stays in sync with the record cards as the design evolves.\n * Follows the `CardGrid` sizing contract (`h-full flex flex-col`).\n */\nimport { formatCount } from '@grove-dev/core';\n\ninterface Props {\n collection: {\n slug: string;\n url: string;\n kind: string;\n title: string;\n description?: string;\n count: number;\n };\n /** Analytics source emitted with `collection_card_click`. */\n eventSource?: string;\n /** Noun pair for the entry count (blueprint labels). */\n countNoun?: { singular: string; plural: string };\n class?: string;\n}\n\nconst {\n collection: c,\n eventSource = 'collection_index',\n countNoun = { singular: 'item', plural: 'items' },\n class: className = '',\n} = Astro.props;\n---\n\n<a\n href={c.url}\n data-event=\"collection_card_click\"\n data-event-source={eventSource}\n data-event-item={c.slug}\n class={`group relative flex h-full min-w-0 flex-col gap-2 rounded-xl border border-ink-200 bg-card p-5 no-underline outline-none transition-[border-color,background-color,transform] duration-150 hover:-translate-y-0.5 hover:border-ink-300 hover:bg-ink-50 focus-visible:border-ink-500 focus-visible:ring-2 focus-visible:ring-ink-900/15 dark:border-ink-800 dark:hover:border-ink-700 dark:hover:bg-ink-900 dark:focus-visible:border-ink-500 dark:focus-visible:ring-ink-100/15 ${className}`}\n>\n <span class=\"text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">\n {c.kind === \"curated\" ? \"Curated\" : \"Generated\"}\n </span>\n <span class=\"text-[1.0625rem] font-semibold tracking-tight text-ink-900 dark:text-ink-100\">\n {c.title}\n </span>\n <span class=\"line-clamp-2 text-[0.875rem] text-ink-500 dark:text-ink-400\">\n {c.description}\n </span>\n <span class=\"mt-auto pt-2 text-2xs font-medium text-ink-500 transition-colors group-hover:text-ink-900 dark:text-ink-400 dark:group-hover:text-ink-100\">\n {formatCount(c.count, countNoun)} →\n </span>\n</a>\n",
|
|
39
|
+
"type": "registry:component",
|
|
40
|
+
"target": "~/src/components/grove/collection-card.astro"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"path": "default/components/grove/collection-row.astro",
|
|
44
|
+
"content": "---\nimport type { ProjectCardModel } from '@grove-dev/astro/server';\n/**\n * CollectionRow — collection-page adapter around the canonical\n * `ProjectCard`.\n *\n * Consumes the lightweight `CollectionEntry` shape directly and maps\n * it onto `ProjectCard`'s explicit props, so a collection page sitting\n * next to the directory index reads as the same site. The historical\n * public props are preserved:\n *\n * - `entry` — the collection entry (slug, title, description, …)\n * - `href` — full detail URL; wins over `routeSlug`\n * - `routeSlug` — blueprint slug (e.g. \"projects\"); details derived\n * as `/${routeSlug}/${slug}` when `href` is not provided\n * - `showChips`, `showLabel` — deprecated no-ops. The card renders\n * one fixed layout everywhere, so a record cannot look like a\n * different record depending on the page it appears on.\n * - `showMeta` — still honoured: it controls whether the *data*\n * (stars, last-updated) is passed in at all, not how it is drawn\n * - `class` — extra class on the card root\n * - `eager` — bypass lazy loading for above-the-fold avatars\n *\n * The repository is reached through the card's `owner/repo` line;\n * there is no separate footer link button.\n *\n * `CollectionEntry` isn't a `CardRecord`, so this adapter can't call\n * `buildProjectCardModel()` — it builds the `ProjectCardModel` object\n * literal directly from its own already-computed fields, reusing the\n * same `formatStars`/`formatRelative`/`getOwnerAndRepoFromRepoUrl`/\n * `nameInitials` helpers `buildProjectCardModel` uses internally so\n * the two stay in lockstep.\n *\n * Analytics: emits `data-event=\"collection_item_click\"` /\n * `data-event-source=\"collection_row\"` on the card root, so sites wire\n * one handler in BaseLayout.\n */\nimport type { CollectionEntry } from '@grove-dev/core';\nimport {\n formatRelative,\n formatStars,\n getOwnerAndRepoFromRepoUrl,\n getOwnerAvatarUrl,\n nameInitials,\n} from '@grove-dev/core';\nimport ProjectCard from './project-card.astro';\n\ninterface Props {\n entry: CollectionEntry;\n /** Full detail-page URL. Wins over `routeSlug`. */\n href?: string;\n /** Blueprint route slug; detail URL = `/${routeSlug}/${slug}`. */\n routeSlug?: string;\n /** @deprecated Ignored — the card renders one fixed layout. */\n showChips?: boolean;\n /** Pass stars / last-updated through to the card. Default true. */\n showMeta?: boolean;\n /** @deprecated Ignored — see `showChips`. */\n showLabel?: boolean;\n eager?: boolean;\n class?: string;\n}\n\nconst {\n entry,\n href: hrefProp,\n routeSlug,\n showMeta = true,\n eager = false,\n class: className = '',\n} = Astro.props;\n\nconst slug = entry.slug;\nconst base = (routeSlug ?? '').replace(/^\\/+|\\/+$/g, '');\nconst detailHref =\n typeof hrefProp === 'string' && hrefProp.length > 0\n ? hrefProp\n : entry.url || (base ? `/${base}/${slug}` : `/${slug}`);\n\nconst repoHref = entry.repoHref;\nconst stars = showMeta ? entry.stars : undefined;\nconst pushedAt = showMeta ? entry.pushedAt : undefined;\nconst stackIds = entry.stack ? [entry.stack] : [];\nconst { owner, repo } = getOwnerAndRepoFromRepoUrl(repoHref ?? '');\nconst starsLabel = formatStars(stars);\nconst updatedLabel = formatRelative(pushedAt);\nconst visibleStacks = stackIds.slice(0, 4);\n\nconst model: ProjectCardModel = {\n name: entry.title,\n slug,\n description: entry.description ?? '',\n initials: nameInitials(entry.title),\n avatarUrl: getOwnerAvatarUrl(owner, 80) ?? undefined,\n repoHref,\n owner: owner ?? undefined,\n repo: repo ?? undefined,\n isArticle: Boolean(repoHref && owner && repo),\n stars,\n starsLabel,\n hasStars: starsLabel !== null && typeof stars === 'number' && stars > 0,\n pushedAt,\n updatedLabel,\n hasUpdated: Boolean(pushedAt),\n stackIds,\n visibleStacks,\n stackOverflow: stackIds.length - visibleStacks.length,\n hasStacks: visibleStacks.length > 0,\n};\n---\n\n<ProjectCard\n href={detailHref}\n model={model}\n eager={eager}\n event=\"collection_item_click\"\n eventSource=\"collection_row\"\n class={className}\n/>\n",
|
|
45
|
+
"type": "registry:component",
|
|
46
|
+
"target": "~/src/components/grove/collection-row.astro"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"path": "default/components/grove/collection-teaser.astro",
|
|
50
|
+
"content": "---\nimport type { CollectionIndexModel } from '@grove-dev/astro/server';\n/**\n * CollectionTeaser — homepage-friendly subset of `CollectionIndex`.\n *\n * Thin wrapper that defaults `limit` to 3 and sets homepage-friendly\n * \"View all collections\" link + copy. For custom card counts or\n * different copy, use `CollectionIndex` directly with explicit\n * `limit` and `viewAllHref` props.\n */\nimport CollectionIndex from './collection-index.astro';\n\ninterface Props {\n model: CollectionIndexModel;\n title?: string;\n description?: string;\n viewAllHref?: string;\n viewAllLabel?: string;\n /** Cap the number of cards rendered. Default: 3. */\n limit?: number;\n /** Noun pair for the per-card entry counts (blueprint labels). */\n countNoun?: { singular: string; plural: string };\n class?: string;\n}\n\nconst {\n model,\n title = 'Featured collections',\n description = 'Hand-picked and auto-generated groupings of related items.',\n viewAllHref = '/collections/',\n viewAllLabel = 'View all collections',\n limit = 3,\n countNoun,\n class: className,\n} = Astro.props;\n---\n\n<CollectionIndex\n model={model}\n title={title}\n description={description}\n viewAllHref={viewAllHref}\n viewAllLabel={viewAllLabel}\n limit={limit}\n countNoun={countNoun}\n class={className}\n/>\n",
|
|
51
|
+
"type": "registry:component",
|
|
52
|
+
"target": "~/src/components/grove/collection-teaser.astro"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"meta": {
|
|
56
|
+
"version": "1.0.0"
|
|
57
|
+
},
|
|
58
|
+
"type": "registry:block"
|
|
59
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
3
|
+
"name": "contributors",
|
|
4
|
+
"title": "Contributors page",
|
|
5
|
+
"description": "The full contributors route with per-user contribution counts, read from the synced contributors data.",
|
|
6
|
+
"registryDependencies": [
|
|
7
|
+
"@grove/shell",
|
|
8
|
+
"@grove/ui"
|
|
9
|
+
],
|
|
10
|
+
"files": [
|
|
11
|
+
{
|
|
12
|
+
"path": "default/pages/contributors.astro",
|
|
13
|
+
"content": "---\n/**\n * Contributors page — full list with per-user contribution counts.\n *\n * Generic: works for any blueprint (project-directory, resource-hub,\n * ecosystem-map) and any source of contributors. Reads from\n * `data/generated/contributors.json` if present, otherwise renders\n * a graceful empty state. The file is produced by the\n * `sync-contributors` GitHub Action (see `.github/workflows/`).\n *\n * The list represents contributors to the directory's own source\n * repository. Project owners in the directory are a separate metric.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport { getContributorsPageModel } from '@grove-dev/astro/server';\nimport EmptyState from '../components/ui/empty-state.astro';\nimport BaseLayout from '../layouts/base-layout.astro';\n\nconst {\n contributors: sorted,\n total,\n seo,\n contributorsGraphHref,\n showContributionCount,\n} = getContributorsPageModel(siteConfig);\n---\n\n<BaseLayout title={seo.title} description={seo.description} image={seo.image} jsonLd={seo.jsonLd} site={siteConfig}>\n <section class=\"py-12 sm:py-16\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">\n Community\n </span>\n <h1 class=\"m-0 mt-2 text-[2rem] sm:text-[2.5rem] font-semibold leading-[1.05] tracking-tight text-ink-900 dark:text-ink-100\">\n {total > 0 ? `${total} community contributors` : \"Community\"}\n </h1>\n <p class=\"m-0 mt-3 max-w-2xl text-base leading-relaxed text-ink-700 dark:text-ink-200\">\n {total > 0\n ? `People who have improved ${siteConfig.name} through code, curation, and review.`\n : `Community profiles will appear after ${siteConfig.name} syncs its source repository metadata.`}\n </p>\n\n {contributorsGraphHref && (\n <p class=\"m-0 mt-3 text-sm text-ink-500 dark:text-ink-400\">\n <a\n href={contributorsGraphHref}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"font-medium underline decoration-ink-300 underline-offset-2 hover:decoration-ink-500 dark:decoration-ink-700 dark:hover:decoration-ink-400\"\n >\n GitHub contributors graph →\n </a>\n </p>\n )}\n </div>\n </section>\n\n {sorted.length === 0 ? (\n <section class=\"pb-12 sm:pb-16\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <EmptyState\n title=\"No contributors synced yet\"\n description={`Contributor profiles come from data/generated/contributors.json, written by the weekly sync-contributors workflow. Run \"grove sync contributors\" (or wait for the scheduled sync) and every contributor avatar lands here.`}\n action={contributorsGraphHref\n ? { label: \"View contributors on GitHub\", href: contributorsGraphHref }\n : undefined}\n />\n </div>\n </section>\n ) : (\n <section class=\"py-12 sm:py-16\" aria-label=\"Contributors list\">\n <div class=\"mx-auto w-full max-w-container px-5 pb-16 sm:px-7\">\n <ul\n class=\"m-0 grid list-none grid-cols-2 gap-3 p-0 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6\"\n aria-label=\"Contributors\"\n >\n {sorted.map((c) => {\n const href = c.profileUrl ?? `https://github.com/${c.username}`;\n const avatar =\n c.avatarUrl ??\n `https://avatars.githubusercontent.com/${c.username}?v=4&s=80`;\n return (\n <li class=\"m-0 p-0\">\n <a\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"group rounded-[calc(var(--radius)+0.25rem)] border border-border bg-card shadow-none transition-colors flex flex-col items-center gap-2 p-3 text-center no-underline hover:border-ink-300 dark:hover:border-ink-700\"\n data-event=\"contributor_click\"\n data-event-source=\"contributors_page\"\n >\n <img\n src={avatar}\n alt={c.name ?? c.username}\n width=\"56\"\n height=\"56\"\n loading=\"lazy\"\n decoding=\"async\"\n class=\"h-14 w-14 rounded-full border border-ink-200 object-cover dark:border-ink-800\"\n />\n <span class=\"line-clamp-1 text-sm font-medium text-ink-700 group-hover:text-ink-900 dark:text-ink-300 dark:group-hover:text-ink-100\">\n {c.name ?? c.username}\n </span>\n <span class=\"text-2xs text-ink-500 dark:text-ink-400\">\n @{c.username}\n </span>\n {showContributionCount && typeof c.contributions === \"number\" && (\n <span class=\"font-mono text-2xs text-ink-400\">\n {c.contributions.toLocaleString()} contributions\n </span>\n )}\n </a>\n </li>\n );\n })}\n </ul>\n </div>\n </section>\n )}\n</BaseLayout>\n",
|
|
14
|
+
"type": "registry:page",
|
|
15
|
+
"target": "~/src/pages/contributors.astro"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"meta": {
|
|
19
|
+
"version": "1.0.0"
|
|
20
|
+
},
|
|
21
|
+
"type": "registry:block"
|
|
22
|
+
}
|