@grove-dev/cli 0.18.0 → 1.0.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/package.json +1 -1
- package/dist/r/about.json +3 -3
- package/dist/r/browse.json +2 -2
- package/dist/r/collections.json +35 -5
- package/dist/r/contributors.json +3 -3
- package/dist/r/default.json +65 -23
- package/dist/r/home.json +13 -7
- package/dist/r/not-found.json +2 -2
- package/dist/r/project-card.json +4 -4
- package/dist/r/record.json +10 -4
- package/dist/r/registry.json +96 -26
- package/dist/r/shell.json +7 -7
- package/dist/r/submit.json +4 -4
- package/dist/r/taxonomy.json +2 -2
- package/dist/r/ui.json +2 -2
- package/dist/registry.d.ts +1 -1
- package/dist/registry.js +1 -1
- package/package.json +3 -3
package/dist/r/default.json
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
56
|
"path": "default/layouts/base-layout.astro",
|
|
57
|
-
"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 /** Path used for JSON-LD `SearchAction` target. Defaults to \"/items\". */\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 searchPath={directoryPath}\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 </script>\n )}\n </body>\n</html>\n",
|
|
57
|
+
"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 /** Path used for JSON-LD `SearchAction` target. Defaults to \"/items\". */\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 searchPath={directoryPath}\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",
|
|
58
58
|
"type": "registry:component",
|
|
59
59
|
"target": "~/src/layouts/base-layout.astro"
|
|
60
60
|
},
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
"path": "default/layouts/footer.astro",
|
|
69
|
-
"content": "---\n/**\n * Footer — 4-column grid (brand + Discover + Contribute + Project) plus\n * a thin bar at the bottom with copyright + repo link.\n *\n * Generic: takes a `site` prop with brand + repoUrl + stats, plus\n * pre-computed column data. No `siteConfig` import — consumers\n * compose props from their own config (or from\n * `data/generated/site-config.json` for the showcase).\n *\n * Each column's links are passed in as a `{ heading, items[] }` shape\n * so consumers can customize the order and copy. Defaults are\n * provided so the footer still renders if no extra data is supplied.\n */\nimport PoweredBy from '../components/grove/powered-by.astro';\n\ninterface NavItem {\n label: string;\n href: string;\n /** When true, opens in a new tab (external). */\n external?: boolean;\n}\n\ninterface FooterColumn {\n heading: string;\n items: NavItem[];\n}\n\ninterface Site {\n name: string;\n tagline?: string;\n description?: string;\n repoUrl?: string;\n footer?: {\n columns?: FooterColumn[];\n copyright?: string;\n license?: string;\n /** \"Powered by Grove\" under the brand block. Defaults to on. */\n poweredBy?: boolean;\n };\n stats?: {\n totalApps?: number;\n totalCategories?: number;\n totalStacks?: number;\n totalOwners?: number;\n };\n}\n\ninterface Props {\n site: Site;\n /** Discover links — first content column. */\n discover?: FooterColumn;\n /** Contribute links — second content column. */\n contribute?: FooterColumn;\n /** Project links — third content column. */\n project?: FooterColumn;\n /** Stats line under brand blurb. */\n stats?: {\n totalApps?: number;\n totalCategories?: number;\n totalStacks?: number;\n totalOwners?: number;\n };\n /**\n * Plural label for the primary count stat. Default \"items\" so the\n * footer reads naturally regardless of blueprint.\n */\n itemsLabel?: string;\n /** Copyright suffix. Defaults to site.name. */\n copyrightHolder?: string;\n /** License line under the bar (e.g. \"Content under CC BY-SA 4.0.\"). */\n licenseLine?: string;\n /**\n * \"Powered by Grove\" under the brand block. Falls back to\n * `site.footer.poweredBy`, which defaults to on.\n */\n poweredBy?: boolean;\n /** Extra class for the outer footer element. */\n class?: string;\n}\n\nconst {\n site,\n discover = { heading: 'Discover', items: [] },\n contribute = { heading: 'Contribute', items: [] },\n project = { heading: 'Project', items: [] },\n stats,\n itemsLabel = 'items',\n copyrightHolder,\n licenseLine,\n poweredBy,\n class: className = '',\n} = Astro.props;\n\nconst showPoweredBy = poweredBy ?? site.footer?.poweredBy ?? true;\n\nconst year = new Date().getFullYear();\nconst holder = copyrightHolder ?? site.footer?.copyright ?? site.name;\nconst gh = site.repoUrl;\nconst showOwners = (stats?.totalOwners ?? 0) > 0;\n\nconst defaultDiscover: NavItem[] = gh\n ? [\n { label: 'Source on GitHub', href: gh, external: true },\n { label: 'Latest release', href: `${gh}/releases`, external: true },\n ]\n : [];\nconst defaultContribute: NavItem[] = gh\n ? [\n { label: 'Submit via GitHub', href: `${gh}/blob/main/CONTRIBUTING.md`, external: true },\n { label: 'Report an issue', href: `${gh}/issues`, external: true },\n { label: 'Contributing guide', href: `${gh}/blob/main/CONTRIBUTING.md`, external: true },\n ]\n : [];\nconst defaultProject: NavItem[] = gh\n ? [\n { label: 'README', href: `${gh}/blob/main/README.md`, external: true },\n { label: 'Changelog', href: `${gh}/blob/main/CHANGELOG.md`, external: true },\n ]\n : [];\n\nconst discoverItems = discover.items.length ? discover.items : defaultDiscover;\nconst contributeItems = contribute.items.length ? contribute.items : defaultContribute;\nconst projectItems = project.items.length ? project.items : defaultProject;\nconst configuredColumns = site.footer?.columns ?? [];\nconst columns = configuredColumns.length\n ? configuredColumns\n : [\n { heading: discover.heading, items: discoverItems },\n { heading: contribute.heading, items: contributeItems },\n { heading: project.heading, items: projectItems },\n ].filter((column) => column.items.length > 0);\nconst resolvedLicenseLine = licenseLine ?? site.footer?.license;\n---\n\n<footer\n class:list={[\n \"border-border bg-background mt-16 border-t text-ink-500 dark:text-ink-400\",\n className,\n ]}\n>\n <div\n class=\"mx-auto grid w-full max-w-container grid-cols-2 gap-8 px-5 py-12 md:grid-cols-4 sm:px-7\"\n >\n <div class=\"col-span-2 md:col-span-1\">\n <div\n class=\"mb-2 inline-flex items-center gap-2 text-[0.95rem] font-semibold text-ink-900 dark:text-ink-100\"\n >\n <span\n aria-hidden=\"true\"\n class=\"inline-block h-3.5 w-3.5 rounded bg-ink-900 dark:bg-ink-100\"\n ></span>\n <span>{site.name}</span>\n </div>\n {site.tagline && (\n <p class=\"m-0 max-w-[36ch] text-[0.8125rem] leading-relaxed text-ink-500 dark:text-ink-400\">\n {site.tagline}\n </p>\n )}\n {stats && (\n <p class=\"mt-3 m-0 text-2xs text-ink-500 dark:text-ink-400\">\n {stats.totalApps !== undefined && (\n <>\n <span class=\"font-mono\">{stats.totalApps}</span> {itemsLabel}\n </>\n )}\n {stats.totalApps !== undefined && (stats.totalCategories !== undefined || showOwners) && (\n <span class=\"mx-1 text-ink-300 dark:text-ink-700\">·</span>\n )}\n {stats.totalCategories !== undefined && (\n <>\n <span class=\"font-mono\">{stats.totalCategories}</span> categories\n </>\n )}\n {stats.totalCategories !== undefined && showOwners && (\n <span class=\"mx-1 text-ink-300 dark:text-ink-700\">·</span>\n )}\n {showOwners && (\n <>\n <span class=\"font-mono\">{stats.totalOwners}</span> project owners\n </>\n )}\n </p>\n )}\n {showPoweredBy && (\n <p class=\"mt-4 m-0 text-[0.8125rem] text-ink-500 dark:text-ink-400\">\n <PoweredBy size={16} />\n </p>\n )}\n </div>\n\n {columns.map((column) => (\n <div>\n <h2 class=\"mb-3 text-2xs font-semibold uppercase tracking-wider text-ink-900 dark:text-ink-100\">\n {column.heading}\n </h2>\n <ul class=\"m-0 flex list-none flex-col gap-2 p-0\">\n {column.items.map((item) => (\n <li>\n <a\n href={item.href}\n class=\"text-sm transition-colors hover:text-ink-900 dark:hover:text-ink-100\"\n {...(item.external\n ? { target: \"_blank\", rel: \"noopener
|
|
69
|
+
"content": "---\n/**\n * Footer — 4-column grid (brand + Discover + Contribute + Project) plus\n * a thin bar at the bottom with copyright + repo link.\n *\n * Generic: takes a `site` prop with brand + repoUrl + stats, plus\n * pre-computed column data. No `siteConfig` import — consumers\n * compose props from their own config (or from\n * `data/generated/site-config.json` for the showcase).\n *\n * Each column's links are passed in as a `{ heading, items[] }` shape\n * so consumers can customize the order and copy. Defaults are\n * provided so the footer still renders if no extra data is supplied.\n */\nimport PoweredBy from '../components/grove/powered-by.astro';\n\ninterface NavItem {\n label: string;\n href: string;\n /** When true, opens in a new tab (external). */\n external?: boolean;\n}\n\ninterface FooterColumn {\n heading: string;\n items: NavItem[];\n}\n\ninterface Site {\n name: string;\n tagline?: string;\n description?: string;\n repoUrl?: string;\n footer?: {\n columns?: FooterColumn[];\n copyright?: string;\n license?: string;\n /** \"Powered by Grove\" under the brand block. Defaults to on. */\n poweredBy?: boolean;\n };\n stats?: {\n totalApps?: number;\n totalCategories?: number;\n totalStacks?: number;\n totalOwners?: number;\n };\n}\n\ninterface Props {\n site: Site;\n /** Discover links — first content column. */\n discover?: FooterColumn;\n /** Contribute links — second content column. */\n contribute?: FooterColumn;\n /** Project links — third content column. */\n project?: FooterColumn;\n /** Stats line under brand blurb. */\n stats?: {\n totalApps?: number;\n totalCategories?: number;\n totalStacks?: number;\n totalOwners?: number;\n };\n /**\n * Plural label for the primary count stat. Default \"items\" so the\n * footer reads naturally regardless of blueprint.\n */\n itemsLabel?: string;\n /** Copyright suffix. Defaults to site.name. */\n copyrightHolder?: string;\n /** License line under the bar (e.g. \"Content under CC BY-SA 4.0.\"). */\n licenseLine?: string;\n /**\n * \"Powered by Grove\" under the brand block. Falls back to\n * `site.footer.poweredBy`, which defaults to on.\n */\n poweredBy?: boolean;\n /** Extra class for the outer footer element. */\n class?: string;\n}\n\nconst {\n site,\n discover = { heading: 'Discover', items: [] },\n contribute = { heading: 'Contribute', items: [] },\n project = { heading: 'Project', items: [] },\n stats,\n itemsLabel = 'items',\n copyrightHolder,\n licenseLine,\n poweredBy,\n class: className = '',\n} = Astro.props;\n\nconst showPoweredBy = poweredBy ?? site.footer?.poweredBy ?? true;\n\nconst year = new Date().getFullYear();\nconst holder = copyrightHolder ?? site.footer?.copyright ?? site.name;\nconst gh = site.repoUrl;\nconst showOwners = (stats?.totalOwners ?? 0) > 0;\n\nconst defaultDiscover: NavItem[] = gh\n ? [\n { label: 'Source on GitHub', href: gh, external: true },\n { label: 'Latest release', href: `${gh}/releases`, external: true },\n ]\n : [];\nconst defaultContribute: NavItem[] = gh\n ? [\n { label: 'Submit via GitHub', href: `${gh}/blob/main/CONTRIBUTING.md`, external: true },\n { label: 'Report an issue', href: `${gh}/issues`, external: true },\n { label: 'Contributing guide', href: `${gh}/blob/main/CONTRIBUTING.md`, external: true },\n ]\n : [];\nconst defaultProject: NavItem[] = gh\n ? [\n { label: 'README', href: `${gh}/blob/main/README.md`, external: true },\n { label: 'Changelog', href: `${gh}/blob/main/CHANGELOG.md`, external: true },\n ]\n : [];\n\nconst discoverItems = discover.items.length ? discover.items : defaultDiscover;\nconst contributeItems = contribute.items.length ? contribute.items : defaultContribute;\nconst projectItems = project.items.length ? project.items : defaultProject;\nconst configuredColumns = site.footer?.columns ?? [];\nconst columns = configuredColumns.length\n ? configuredColumns\n : [\n { heading: discover.heading, items: discoverItems },\n { heading: contribute.heading, items: contributeItems },\n { heading: project.heading, items: projectItems },\n ].filter((column) => column.items.length > 0);\nconst resolvedLicenseLine = licenseLine ?? site.footer?.license;\n---\n\n<footer\n class:list={[\n \"border-border bg-background mt-16 border-t text-ink-500 dark:text-ink-400\",\n className,\n ]}\n>\n <div\n class=\"mx-auto grid w-full max-w-container grid-cols-2 gap-8 px-5 py-12 md:grid-cols-4 sm:px-7\"\n >\n <div class=\"col-span-2 md:col-span-1\">\n <div\n class=\"mb-2 inline-flex items-center gap-2 text-[0.95rem] font-semibold text-ink-900 dark:text-ink-100\"\n >\n <span\n aria-hidden=\"true\"\n class=\"inline-block h-3.5 w-3.5 rounded bg-ink-900 dark:bg-ink-100\"\n ></span>\n <span>{site.name}</span>\n </div>\n {site.tagline && (\n <p class=\"m-0 max-w-[36ch] text-[0.8125rem] leading-relaxed text-ink-500 dark:text-ink-400\">\n {site.tagline}\n </p>\n )}\n {stats && (\n <p class=\"mt-3 m-0 text-2xs text-ink-500 dark:text-ink-400\">\n {stats.totalApps !== undefined && (\n <>\n <span class=\"font-mono\">{stats.totalApps}</span> {itemsLabel}\n </>\n )}\n {stats.totalApps !== undefined && (stats.totalCategories !== undefined || showOwners) && (\n <span class=\"mx-1 text-ink-300 dark:text-ink-700\">·</span>\n )}\n {stats.totalCategories !== undefined && (\n <>\n <span class=\"font-mono\">{stats.totalCategories}</span> categories\n </>\n )}\n {stats.totalCategories !== undefined && showOwners && (\n <span class=\"mx-1 text-ink-300 dark:text-ink-700\">·</span>\n )}\n {showOwners && (\n <>\n <span class=\"font-mono\">{stats.totalOwners}</span> project owners\n </>\n )}\n </p>\n )}\n {showPoweredBy && (\n <p class=\"mt-4 m-0 text-[0.8125rem] text-ink-500 dark:text-ink-400\">\n <PoweredBy size={16} />\n </p>\n )}\n </div>\n\n {columns.map((column) => (\n <div>\n <h2 class=\"mb-3 text-2xs font-semibold uppercase tracking-wider text-ink-900 dark:text-ink-100\">\n {column.heading}\n </h2>\n <ul class=\"m-0 flex list-none flex-col gap-2 p-0\">\n {column.items.map((item) => (\n <li>\n <a\n href={item.href}\n class=\"text-sm transition-colors hover:text-ink-900 dark:hover:text-ink-100\"\n {...(item.external\n ? { target: \"_blank\", rel: \"noopener\" }\n : {})}\n >\n {item.label}\n </a>\n </li>\n ))}\n </ul>\n </div>\n ))}\n </div>\n\n <div class=\"border-t border-ink-200 dark:border-ink-800\">\n <div\n class=\"mx-auto flex w-full max-w-container flex-wrap items-center gap-3 px-5 py-4 text-2xs text-ink-500 sm:px-7 dark:text-ink-400\"\n >\n <span>© {year} {holder}{resolvedLicenseLine ? `. ${resolvedLicenseLine}` : \".\"}</span>\n {gh && (\n <>\n <span class=\"text-ink-300 dark:text-ink-700\">·</span>\n <a\n href={gh}\n target=\"_blank\"\n rel=\"noopener\"\n class=\"transition-colors hover:text-ink-900 dark:hover:text-ink-100\"\n >\n View source on GitHub\n </a>\n </>\n )}\n </div>\n </div>\n</footer>\n",
|
|
70
70
|
"type": "registry:component",
|
|
71
71
|
"target": "~/src/layouts/footer.astro"
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"path": "default/layouts/header.astro",
|
|
75
|
-
"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\nimport { compact } from '@grove-dev/core';\nimport ThemeToggle from '../components/site/theme-toggle.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\ninterface NavItem {\n label: string;\n href: string;\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}\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 = site.nav?.length ? site.nav : defaultNavItems;\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 gap-5 p-0\">\n {navItems.map((item) => (\n <li>\n <a\n href={item.href}\n class=\"text-[0.875rem] font-medium text-ink-500 transition-colors hover:text-ink-900 dark:text-ink-400 dark:hover:text-ink-100\"\n >\n {item.label}\n </a>\n </li>\n ))}\n </ul>\n </nav>\n\n <div class=\"ml-auto flex items-center gap-2\">\n <details class=\"group relative md:hidden\">\n <summary class=\"inline-flex h-9 cursor-pointer list-none items-center justify-center 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\">\n Menu\n </summary>\n <nav aria-label=\"Mobile primary\" class=\"absolute right-0 top-[calc(100%+0.5rem)] z-50 w-56 rounded-[var(--radius)] border border-border bg-background p-2 shadow-lg\">\n <ul class=\"m-0 flex list-none flex-col gap-1 p-0\">\n {navItems.map((item) => (\n <li><a href={item.href} class=\"block rounded-md px-3 py-2 text-sm font-medium text-foreground no-underline hover:bg-accent\">{item.label}</a></li>\n ))}\n {submitHref && (\n <li class=\"border-t border-border pt-1\"><a href={submitHref} class=\"block rounded-md px-3 py-2 text-sm font-medium text-foreground no-underline hover:bg-accent\">{submitLabel ?? \"Submit\"}</a></li>\n )}\n </ul>\n </nav>\n </details>\n\n {submitHref && (\n <a\n href={submitHref}\n class={buttonClass(\"secondary\", \"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 noreferrer\"\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 // 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",
|
|
75
|
+
"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}\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}\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 : [];\nconst menus = navItems.map((item) => {\n const children: NavLink[] =\n item.menu === 'collections'\n ? collections\n .map((c) => ({\n label: c.title,\n href: `/collections/${c.slug}/`,\n description: c.description,\n }))\n .sort((a, b) => a.label.localeCompare(b.label))\n : (item.children ?? []);\n return {\n ...item,\n children,\n footer: item.menu === 'collections' ? { label: 'All collections', href: item.href } : 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.children.length > 5 ? \"w-[34rem]\" : \"w-80\",\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 {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",
|
|
76
76
|
"type": "registry:component",
|
|
77
77
|
"target": "~/src/layouts/header.astro"
|
|
78
78
|
},
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
"path": "default/layouts/seo.astro",
|
|
87
|
-
"content": "---\n// SPDX-License-Identifier: MIT\n\n/**\n * Per-page SEO: <title>, description, canonical, Open Graph, Twitter Card,\n * and JSON-LD structured data. Designed to be used inside <head> by the\n * BaseLayout. Pages pass the rich props they care about; everything else\n * has a sensible default derived from the site config and the Astro URL.\n *\n * Renders:\n * - <title>, meta description, canonical link, robots\n * - Open Graph (og:*) for Facebook, LinkedIn, Discord, Slack, etc.\n * - Twitter Card (twitter:*) for X / Twitter\n * - JSON-LD WebSite+Organization identity graph on every page\n * (built by @grove-dev/core's `siteSchema`, with a SearchAction\n * pointing at the directory's browse page)\n * - Per-page JSON-LD nodes when `jsonLd` is provided (SoftwareApplication\n * on record pages, CollectionPage/ItemList/BreadcrumbList on\n * collection and taxonomy pages, ...)\n *\n * Noindex is opt-in via the `noindex` prop. By default everything is\n * indexable; noindex targets today are /submit, /404, and /empty.\n * `robots` sets the exact value instead — page models pass\n * `noindex,follow` for pages the index policy (`seo.*IndexPolicy`)\n * excludes, so their links are still followed.\n *\n * Any URL with a query string (`?q=`, `?sort=`, facet filters) is a\n * filtered view of a static page: the server sends the base page's\n * HTML, canonical included. A small inline script switches the robots\n * meta to `noindex,follow` on those URLs so the variant itself is not\n * indexed; Google renders JavaScript and honours a robots meta the page\n * sets at runtime. A server-side `X-Robots-Tag` is stronger where the\n * host allows it (see the SEO docs).\n */\nimport { type JsonLdNode, siteSchema, validateJsonLd } from '@grove-dev/core';\n\ninterface Props {\n title: string;\n description: string;\n site: {\n name: string;\n description?: string;\n repoUrl?: string;\n /** Header logo path under `public/` — used as Organization logo when set. */\n logo?: string;\n /** BCP-47 language tag (e.g. \"en\"). Drives og:locale + JSON-LD inLanguage. */\n locale?: string;\n /** Twitter/X handle (e.g. \"@grove\") — emitted as twitter:site. */\n twitter?: string;\n };\n searchPath?: string;\n /** Open Graph / Twitter image. Default: /og-image.svg. Should be absolute or root-relative. */\n image?: string;\n /** Alt text for the OG/Twitter image. Default: \"<site name> social preview\". */\n imageAlt?: string;\n /** og:type. Default: \"website\". Use \"article\" for blog posts / changelog. */\n type?: 'website' | 'article' | 'profile';\n /** Set true to add noindex,nofollow. */\n noindex?: boolean;\n /** Exact robots meta value (e.g. \"noindex,follow\"); wins over `noindex`. */\n robots?: string;\n /** Extra JSON-LD payload (object) — typically SoftwareSourceCode on item pages. */\n jsonLd?: Record<string, unknown> | Record<string, unknown>[];\n}\n\nconst {\n title,\n description,\n site: siteConfig,\n searchPath = '/items',\n image = '/og-image.svg',\n imageAlt,\n type = 'website',\n noindex = false,\n robots,\n jsonLd,\n} = Astro.props;\nconst robotsContent =\n robots ?? (noindex ? 'noindex,nofollow' : 'index,follow,max-image-preview:large');\n\n// `Astro.site` is required for canonical / OG / Twitter / JSON-LD URLs to\n// resolve to the consumer's domain. Failing the build (rather than silently\n// emitting `https://example.com/...`) is the right call: every canonical,\n// OG, and JSON-LD URL would otherwise leak to a domain the consumer doesn't\n// own, which search engines either ignore or treat as canonical to the\n// wrong host.\nif (!Astro.site) {\n throw new Error(\n \"Seo: `site` is not set on the Astro config. Add `site: 'https://your-domain'` to astro.config.mjs so canonical / Open Graph / Twitter / JSON-LD URLs resolve correctly.\",\n );\n}\nconst siteUrl = Astro.site;\nconst canonical = new URL(Astro.url.pathname, siteUrl).toString();\nconst ogImage = new URL(image, siteUrl).toString();\nconst ogImageAlt = imageAlt ?? `${siteConfig.name} social preview`;\nconst locale = siteConfig.locale ?? 'en';\n\n// Truncate description for OG/Twitter where longer is worse (160–200 chars).\nfunction truncate(s: string, max: number): string {\n if (s.length <= max) return s;\n return s.slice(0, max - 1).trimEnd()
|
|
87
|
+
"content": "---\n// SPDX-License-Identifier: MIT\n\n/**\n * Per-page SEO: <title>, description, canonical, Open Graph, Twitter Card,\n * and JSON-LD structured data. Designed to be used inside <head> by the\n * BaseLayout. Pages pass the rich props they care about; everything else\n * has a sensible default derived from the site config and the Astro URL.\n *\n * Renders:\n * - <title>, meta description, canonical link, robots\n * - Open Graph (og:*) for Facebook, LinkedIn, Discord, Slack, etc.\n * - Twitter Card (twitter:*) for X / Twitter\n * - JSON-LD WebSite+Organization identity graph on every page\n * (built by @grove-dev/core's `siteSchema`, with a SearchAction\n * pointing at the directory's browse page)\n * - Per-page JSON-LD nodes when `jsonLd` is provided (SoftwareApplication\n * on record pages, CollectionPage/ItemList/BreadcrumbList on\n * collection and taxonomy pages, ...)\n *\n * Noindex is opt-in via the `noindex` prop. By default everything is\n * indexable; noindex targets today are /submit, /404, and /empty.\n * `robots` sets the exact value instead — page models pass\n * `noindex,follow` for pages the index policy (`seo.*IndexPolicy`)\n * excludes, so their links are still followed.\n *\n * Any URL with a query string (`?q=`, `?sort=`, facet filters) is a\n * filtered view of a static page: the server sends the base page's\n * HTML, canonical included. A small inline script switches the robots\n * meta to `noindex,follow` on those URLs so the variant itself is not\n * indexed; Google renders JavaScript and honours a robots meta the page\n * sets at runtime. A server-side `X-Robots-Tag` is stronger where the\n * host allows it (see the SEO docs).\n */\nimport { type JsonLdNode, siteSchema, validateJsonLd } from '@grove-dev/core';\n\ninterface Props {\n title: string;\n description: string;\n site: {\n name: string;\n description?: string;\n repoUrl?: string;\n /** Header logo path under `public/` — used as Organization logo when set. */\n logo?: string;\n /** BCP-47 language tag (e.g. \"en\"). Drives og:locale + JSON-LD inLanguage. */\n locale?: string;\n /** Twitter/X handle (e.g. \"@grove\") — emitted as twitter:site. */\n twitter?: string;\n };\n searchPath?: string;\n /** Open Graph / Twitter image. Default: /og-image.svg. Should be absolute or root-relative. */\n image?: string;\n /** Alt text for the OG/Twitter image. Default: \"<site name> social preview\". */\n imageAlt?: string;\n /** og:type. Default: \"website\". Use \"article\" for blog posts / changelog. */\n type?: 'website' | 'article' | 'profile';\n /** Set true to add noindex,nofollow. */\n noindex?: boolean;\n /** Exact robots meta value (e.g. \"noindex,follow\"); wins over `noindex`. */\n robots?: string;\n /** Extra JSON-LD payload (object) — typically SoftwareSourceCode on item pages. */\n jsonLd?: Record<string, unknown> | Record<string, unknown>[];\n}\n\nconst {\n title,\n description,\n site: siteConfig,\n searchPath = '/items',\n image = '/og-image.svg',\n imageAlt,\n type = 'website',\n noindex = false,\n robots,\n jsonLd,\n} = Astro.props;\nconst robotsContent =\n robots ?? (noindex ? 'noindex,nofollow' : 'index,follow,max-image-preview:large');\n\n// `Astro.site` is required for canonical / OG / Twitter / JSON-LD URLs to\n// resolve to the consumer's domain. Failing the build (rather than silently\n// emitting `https://example.com/...`) is the right call: every canonical,\n// OG, and JSON-LD URL would otherwise leak to a domain the consumer doesn't\n// own, which search engines either ignore or treat as canonical to the\n// wrong host.\nif (!Astro.site) {\n throw new Error(\n \"Seo: `site` is not set on the Astro config. Add `site: 'https://your-domain'` to astro.config.mjs so canonical / Open Graph / Twitter / JSON-LD URLs resolve correctly.\",\n );\n}\nconst siteUrl = Astro.site;\nconst canonical = new URL(Astro.url.pathname, siteUrl).toString();\nconst ogImage = new URL(image, siteUrl).toString();\nconst ogImageAlt = imageAlt ?? `${siteConfig.name} social preview`;\nconst locale = siteConfig.locale ?? 'en';\n\n// Truncate description for OG/Twitter where longer is worse (160–200 chars).\nfunction truncate(s: string, max: number): string {\n if (s.length <= max) return s;\n return `${s.slice(0, max - 1).trimEnd()}…`;\n}\nconst shortDescription = truncate(description, 200);\n\n// WebSite+Organization identity graph — site-wide signals that appear on\n// every page (Google uses them for site links and the knowledge panel).\n// Built by core's `siteSchema` so the @id graph shape is shared with the\n// rest of the JSON-LD registry; the SearchAction is appended here because\n// the browse path is an adapter concern, not a core one.\nconst bareSiteUrl = siteUrl.toString().replace(/\\/$/, '');\nconst [siteLd] = siteSchema({\n url: bareSiteUrl,\n name: siteConfig.name,\n description: siteConfig.description ?? description,\n inLanguage: locale,\n orgName: siteConfig.name,\n orgUrl: bareSiteUrl,\n ...(siteConfig.logo ? { orgLogo: new URL(siteConfig.logo, siteUrl).toString() } : {}),\n ...(siteConfig.repoUrl ? { sameAs: [siteConfig.repoUrl] } : {}),\n});\nsiteLd.potentialAction = {\n '@type': 'SearchAction',\n target: `${bareSiteUrl}${searchPath}?q={search_term_string}`,\n 'query-input': 'required name=search_term_string',\n};\n\nconst perPageNodes = jsonLd ? (Array.isArray(jsonLd) ? jsonLd : [jsonLd]) : null;\n\n// Dev-only well-formedness check — surfaces malformed nodes (relative\n// URLs, missing @context, duplicate @ids) in the terminal during\n// `astro dev` without ever failing or slowing a production build.\nif (import.meta.env.DEV && perPageNodes) {\n const issues = validateJsonLd(perPageNodes as JsonLdNode[]);\n for (const issue of issues) {\n console.warn(`[grove seo] ${Astro.url.pathname}: ${issue.message}`);\n }\n}\n\n// Pre-stringify the JSON-LD payloads in the frontmatter so the\n// template body just interpolates the resulting strings. For SSR\n// this saves the JSON.stringify call on every render; for static\n// builds the cost is unchanged but the template reads cleaner.\nconst siteLdJson = JSON.stringify(siteLd);\nconst perPageLdJson = perPageNodes ? JSON.stringify(perPageNodes) : null;\n---\n\n<!-- Primary meta -->\n<title>{title}</title>\n<meta name=\"description\" content={description} />\n<link rel=\"canonical\" href={canonical} />\n<meta name=\"robots\" content={robotsContent} />\n<!-- Filtered / parameter URLs: noindex the variant, canonical stays the base page. -->\n<script is:inline data-grove-param-robots>\n if (location.search) {\n document.querySelector('meta[name=\"robots\"]')?.setAttribute('content', 'noindex,follow');\n }\n</script>\n\n<!-- Open Graph -->\n<meta property=\"og:type\" content={type} />\n<meta property=\"og:url\" content={canonical} />\n<meta property=\"og:title\" content={title} />\n<meta property=\"og:description\" content={shortDescription} />\n<meta property=\"og:image\" content={ogImage} />\n<meta property=\"og:image:width\" content=\"1200\" />\n<meta property=\"og:image:height\" content=\"630\" />\n<meta property=\"og:image:alt\" content={ogImageAlt} />\n<meta property=\"og:site_name\" content={siteConfig.name} />\n<meta property=\"og:locale\" content={locale} />\n\n<!-- Twitter Card -->\n<meta name=\"twitter:card\" content=\"summary_large_image\" />\n{siteConfig.twitter && <meta name=\"twitter:site\" content={siteConfig.twitter} />}\n<meta name=\"twitter:title\" content={title} />\n<meta name=\"twitter:description\" content={shortDescription} />\n<meta name=\"twitter:image\" content={ogImage} />\n<meta name=\"twitter:image:alt\" content={ogImageAlt} />\n\n<!-- JSON-LD: site-wide identity graph -->\n<script is:inline type=\"application/ld+json\" set:html={siteLdJson} />\n\n<!-- JSON-LD: per-page (SoftwareApplication, CollectionPage, BreadcrumbList, ...) -->\n{perPageLdJson && (\n <script\n is:inline\n type=\"application/ld+json\"\n set:html={perPageLdJson}\n />\n)}\n",
|
|
88
88
|
"type": "registry:component",
|
|
89
89
|
"target": "~/src/layouts/seo.astro"
|
|
90
90
|
},
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
"path": "default/components/grove/powered-by.astro",
|
|
99
|
-
"content": "---\n/**\n * PoweredBy — \"Powered by Grove\" attribution.\n *\n * The mark is **inlined**, not loaded through `<img src>`: an SVG\n * served as its own document cannot see page CSS, so `currentColor`\n * never resolves there (the bug that cost the packaged icon set both\n * themes before 0.5.3). Inlined, the mark simply inherits the\n * surrounding text colour and follows the site's theme toggle — no\n * second file, no script.\n *\n * Generic: no `siteConfig` import. `Footer` renders it under the brand\n * block when `footer.poweredBy` is on; consumers can also drop it\n * anywhere themselves — e.g. into `Hero`'s `eyebrow` slot.\n */\n\ninterface Props {\n /** Where the link points. Override only for a staging/docs mirror. */\n href?: string;\n /** Mark size in px. Default 16 — sized for 13px text. */\n size?: number;\n /** Extra class on the link. */\n class?: string;\n}\n\nconst { href = 'https://withgrove.dev', size = 16, class: className = '' } = Astro.props;\n---\n\n<a\n href={href}\n target=\"_blank\"\n rel=\"noopener
|
|
99
|
+
"content": "---\n/**\n * PoweredBy — \"Powered by Grove\" attribution.\n *\n * The mark is **inlined**, not loaded through `<img src>`: an SVG\n * served as its own document cannot see page CSS, so `currentColor`\n * never resolves there (the bug that cost the packaged icon set both\n * themes before 0.5.3). Inlined, the mark simply inherits the\n * surrounding text colour and follows the site's theme toggle — no\n * second file, no script.\n *\n * Generic: no `siteConfig` import. `Footer` renders it under the brand\n * block when `footer.poweredBy` is on; consumers can also drop it\n * anywhere themselves — e.g. into `Hero`'s `eyebrow` slot.\n */\n\ninterface Props {\n /** Where the link points. Override only for a staging/docs mirror. */\n href?: string;\n /** Mark size in px. Default 16 — sized for 13px text. */\n size?: number;\n /** Extra class on the link. */\n class?: string;\n}\n\nconst { href = 'https://withgrove.dev', size = 16, class: className = '' } = Astro.props;\n---\n\n<a\n href={href}\n target=\"_blank\"\n rel=\"noopener\"\n class:list={[\n \"inline-flex items-center gap-1.5 transition-colors hover:text-ink-900 dark:hover:text-ink-100\",\n className,\n ]}\n>\n <span>Powered by</span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 32 32\"\n width={size}\n height={size}\n style={`width:${size}px;height:${size}px`}\n fill=\"none\"\n aria-hidden=\"true\"\n class=\"shrink-0 align-middle\"\n >\n <path d=\"M16 28V14\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"></path>\n <path d=\"M16 14C16 14 16 8 22 6C22 6 22 12 16 14Z\" fill=\"currentColor\" fill-opacity=\"0.85\"></path>\n <path d=\"M16 14C16 14 16 8 10 6C10 6 10 12 16 14Z\" fill=\"currentColor\" fill-opacity=\"0.6\"></path>\n <path d=\"M16 18C16 18 16 22 20 23\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path>\n <path d=\"M16 21C16 21 16 24 12 25\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path>\n </svg>\n <span class=\"font-semibold\">Grove</span>\n</a>\n",
|
|
100
100
|
"type": "registry:component",
|
|
101
101
|
"target": "~/src/components/grove/powered-by.astro"
|
|
102
102
|
},
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
"path": "default/components/grove/project-card.astro",
|
|
111
|
-
"content": "---\n/**\n * ProjectCard — the canonical card for one directory record.\n *\n * V1 (v0.5.0) refined design for the three-column grid, now shared by\n * every listing surface (home sections, browse results, collection\n * entries, taxonomy pages) through thin adapters (`IndexRow`,\n * `CollectionRow`):\n *\n * - Default mode: the whole card is one clickable `<a>` (cursor:\n * pointer, subtle border + surface lift on hover, no more than\n * 1–2px vertical motion).\n * - When the record has a repository the root becomes an\n * `<article>` with a stretched title link, because nesting `<a>`\n * inside `<a>` is invalid HTML. The `owner/repo` line is a real\n * link to the repository and sits above the stretched overlay\n * (`relative z-10`).\n * - App icon top-left (48px), app name + clickable owner/repo,\n * two-line description with reserved vertical space.\n * - Footer row: stack logos on the left, stars and last-updated on\n * the right, navigation arrow anchored bottom-right.\n *\n * **The layout is fixed.** Earlier versions let list pages opt into a\n * curated badge, a license tag, a `category · status` line and\n * labelled chip rows, so the same record rendered differently\n * depending on where a visitor found it. Platform support is\n * likewise off the card: it is reference detail and belongs on the\n * record page (`RecordSidebar`).\n *\n * Presentation only: this component takes a pre-built\n * `ProjectCardModel` (see `@grove-dev/astro/server`'s\n * `buildProjectCardModel`) and renders it — no record shapes, casts,\n * or formatting live here. Callers that render a raw record (or a\n * lightweight adapter shape like `CollectionEntry`) build the model\n * themselves before reaching this component.\n *\n * Uses the package's design-system tokens plus the standard `dark:`\n * variant. Equal-height cards in the row are achieved at the grid\n * level (`CardGrid`: `grid` + `items-stretch`).\n */\nimport type { ProjectCardModel } from '@grove-dev/astro/server';\nimport CardIcon from './card-icon.astro';\nimport Icon from './icon.astro';\n\ninterface Props {\n /** Pre-built view-model — see `buildProjectCardModel`. */\n model: ProjectCardModel;\n /** Full detail-page URL. */\n href: string;\n /** Eager-load the avatar (above-the-fold rows). */\n eager?: boolean;\n /** Analytics data-event attributes on the card root. */\n event?: string;\n eventSource?: string;\n class?: string;\n}\n\nconst { model, href, eager = false, event, eventSource, class: className = '' } = Astro.props;\n\nconst {\n name,\n slug,\n description,\n initials,\n avatarUrl,\n repoHref,\n owner,\n repo,\n isArticle,\n stars,\n starsLabel,\n hasStars,\n pushedAt,\n updatedLabel,\n hasUpdated,\n visibleStacks,\n stackOverflow,\n hasStacks,\n} = model;\n\nconst Root = isArticle ? 'article' : 'a';\nconst rootAttrs = isArticle ? {} : { href, 'aria-label': `Open ${name}` };\n---\n\n<Root\n {...rootAttrs}\n class={`group relative flex h-full min-w-0 flex-col gap-3 rounded-xl border border-ink-200 bg-card p-5 outline-none transition-[border-color,background-color,transform] duration-150 hover:-translate-y-0.5 hover:border-ink-400 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-600 dark:hover:bg-ink-900 dark:focus-visible:border-ink-500 dark:focus-visible:ring-ink-100/15 ${className}`}\n data-record-slug={slug}\n data-event={event}\n data-event-source={eventSource}\n data-event-item={event ? slug : undefined}\n>\n {/* Header: icon + name + owner.\n\n The initials chip is always in the DOM, `hidden` behind the image,\n and unhidden by the image's own `onerror` — the same pattern\n `Icon.astro` uses. Rendering it only when `avatarUrl` is falsy made\n it unreachable for every record with a GitHub owner, so a dead\n logo URL or a renamed org showed the browser's broken-image glyph\n instead of a fallback. */}\n <header class=\"flex items-start gap-3\">\n {avatarUrl && (\n <img\n src={avatarUrl}\n alt=\"\"\n width=\"48\"\n height=\"48\"\n loading={eager ? \"eager\" : \"lazy\"}\n fetchpriority={eager ? \"high\" : undefined}\n decoding=\"async\"\n onerror=\"this.hidden=true;this.nextElementSibling.hidden=false\"\n class=\"h-12 w-12 shrink-0 rounded-lg bg-white object-contain p-1\"\n />\n )}\n <span\n aria-hidden=\"true\"\n hidden={Boolean(avatarUrl)}\n data-grove-card-fallback-initials\n class=\"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-ink-100 text-base font-semibold uppercase text-ink-700 dark:bg-ink-800 dark:text-ink-200\"\n >\n {initials}\n </span>\n\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <h3 class=\"m-0 truncate text-[17px] font-semibold leading-snug tracking-tight text-ink-900 sm:text-[18px] dark:text-ink-100\">\n {isArticle ? (\n <a\n href={href}\n class=\"text-inherit no-underline before:absolute before:inset-0 before:z-0 before:content-['']\"\n >\n {name}\n </a>\n ) : (\n name\n )}\n </h3>\n {owner && repo && (\n <p class=\"m-0 truncate font-mono text-[13px] text-ink-500 dark:text-ink-400\">\n {repoHref ? (\n <a\n href={repoHref}\n target=\"_blank\"\n rel=\"noopener
|
|
111
|
+
"content": "---\n/**\n * ProjectCard — the canonical card for one directory record.\n *\n * V1 (v0.5.0) refined design for the three-column grid, now shared by\n * every listing surface (home sections, browse results, collection\n * entries, taxonomy pages) through thin adapters (`IndexRow`,\n * `CollectionRow`):\n *\n * - Default mode: the whole card is one clickable `<a>` (cursor:\n * pointer, subtle border + surface lift on hover, no more than\n * 1–2px vertical motion).\n * - When the record has a repository the root becomes an\n * `<article>` with a stretched title link, because nesting `<a>`\n * inside `<a>` is invalid HTML. The `owner/repo` line is a real\n * link to the repository and sits above the stretched overlay\n * (`relative z-10`).\n * - App icon top-left (48px), app name + clickable owner/repo,\n * two-line description with reserved vertical space.\n * - Footer row: stack logos on the left, stars and last-updated on\n * the right, navigation arrow anchored bottom-right.\n *\n * **The layout is fixed.** Earlier versions let list pages opt into a\n * curated badge, a license tag, a `category · status` line and\n * labelled chip rows, so the same record rendered differently\n * depending on where a visitor found it. Platform support is\n * likewise off the card: it is reference detail and belongs on the\n * record page (`RecordSidebar`).\n *\n * Presentation only: this component takes a pre-built\n * `ProjectCardModel` (see `@grove-dev/astro/server`'s\n * `buildProjectCardModel`) and renders it — no record shapes, casts,\n * or formatting live here. Callers that render a raw record (or a\n * lightweight adapter shape like `CollectionEntry`) build the model\n * themselves before reaching this component.\n *\n * Uses the package's design-system tokens plus the standard `dark:`\n * variant. Equal-height cards in the row are achieved at the grid\n * level (`CardGrid`: `grid` + `items-stretch`).\n */\nimport type { ProjectCardModel } from '@grove-dev/astro/server';\nimport CardIcon from './card-icon.astro';\nimport Icon from './icon.astro';\n\ninterface Props {\n /** Pre-built view-model — see `buildProjectCardModel`. */\n model: ProjectCardModel;\n /** Full detail-page URL. */\n href: string;\n /** Eager-load the avatar (above-the-fold rows). */\n eager?: boolean;\n /** Analytics data-event attributes on the card root. */\n event?: string;\n eventSource?: string;\n class?: string;\n}\n\nconst { model, href, eager = false, event, eventSource, class: className = '' } = Astro.props;\n\nconst {\n name,\n slug,\n description,\n initials,\n avatarUrl,\n repoHref,\n owner,\n repo,\n isArticle,\n stars,\n starsLabel,\n hasStars,\n pushedAt,\n updatedLabel,\n hasUpdated,\n visibleStacks,\n stackOverflow,\n hasStacks,\n} = model;\n\nconst Root = isArticle ? 'article' : 'a';\nconst rootAttrs = isArticle ? {} : { href, 'aria-label': `Open ${name}` };\n---\n\n<Root\n {...rootAttrs}\n class={`group relative flex h-full min-w-0 flex-col gap-3 rounded-xl border border-ink-200 bg-card p-5 outline-none transition-[border-color,background-color,transform] duration-150 hover:-translate-y-0.5 hover:border-ink-400 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-600 dark:hover:bg-ink-900 dark:focus-visible:border-ink-500 dark:focus-visible:ring-ink-100/15 ${className}`}\n data-record-slug={slug}\n data-event={event}\n data-event-source={eventSource}\n data-event-item={event ? slug : undefined}\n>\n {/* Header: icon + name + owner.\n\n The initials chip is always in the DOM, `hidden` behind the image,\n and unhidden by the image's own `onerror` — the same pattern\n `Icon.astro` uses. Rendering it only when `avatarUrl` is falsy made\n it unreachable for every record with a GitHub owner, so a dead\n logo URL or a renamed org showed the browser's broken-image glyph\n instead of a fallback. */}\n <header class=\"flex items-start gap-3\">\n {avatarUrl && (\n <img\n src={avatarUrl}\n alt=\"\"\n width=\"48\"\n height=\"48\"\n loading={eager ? \"eager\" : \"lazy\"}\n fetchpriority={eager ? \"high\" : undefined}\n decoding=\"async\"\n onerror=\"this.hidden=true;this.nextElementSibling.hidden=false\"\n class=\"h-12 w-12 shrink-0 rounded-lg bg-white object-contain p-1\"\n />\n )}\n <span\n aria-hidden=\"true\"\n hidden={Boolean(avatarUrl)}\n data-grove-card-fallback-initials\n class=\"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-ink-100 text-base font-semibold uppercase text-ink-700 dark:bg-ink-800 dark:text-ink-200\"\n >\n {initials}\n </span>\n\n <div class=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <h3 class=\"m-0 truncate text-[17px] font-semibold leading-snug tracking-tight text-ink-900 sm:text-[18px] dark:text-ink-100\">\n {isArticle ? (\n <a\n href={href}\n class=\"text-inherit no-underline before:absolute before:inset-0 before:z-0 before:content-['']\"\n >\n {name}\n </a>\n ) : (\n name\n )}\n </h3>\n {owner && repo && (\n <p class=\"m-0 truncate font-mono text-[13px] text-ink-500 dark:text-ink-400\">\n {repoHref ? (\n <a\n href={repoHref}\n target=\"_blank\"\n rel=\"noopener\"\n title={`${owner}/${repo} on GitHub`}\n data-event=\"external_repo_click\"\n data-event-source=\"project_card_repo\"\n data-event-item={slug}\n class=\"relative z-10 text-inherit no-underline transition-colors hover:text-ink-900 hover:underline dark:hover:text-ink-100\"\n >\n {owner}<span class=\"opacity-60\">/</span>{repo}\n </a>\n ) : (\n <Fragment>{owner}<span class=\"opacity-60\">/</span>{repo}</Fragment>\n )}\n </p>\n )}\n </div>\n </header>\n\n {/* Description — two-line clamp with reserved vertical space */}\n <p\n class=\"m-0 line-clamp-2 min-h-[42px] text-[14px] leading-[1.5] text-ink-500 dark:text-ink-400\"\n >\n {description}\n </p>\n\n {/* Footer: stack logos · stars/updated · arrow */}\n <footer class=\"mt-auto flex items-center justify-between gap-3 text-[12px] sm:text-[13px]\">\n {hasStacks ? (\n <div class=\"flex min-w-0 items-center gap-2 text-ink-500 dark:text-ink-400\">\n {visibleStacks.map((stack) => (\n <Icon name={stack} category=\"stack\" size={16} title={stack} />\n ))}\n {stackOverflow > 0 && (\n <span class=\"text-[12px] text-ink-500 dark:text-ink-400\">+{stackOverflow}</span>\n )}\n </div>\n ) : (\n /* Keeps the footer's stars/updated block right-aligned without\n shipping an empty flex container on every stackless card. */\n <span></span>\n )}\n\n <div class=\"flex min-w-0 shrink-0 items-center gap-3 text-ink-500 dark:text-ink-400\">\n {hasStars && (\n <span class=\"inline-flex items-center gap-1\" title={`${stars ?? 0} stars on GitHub`}>\n <span class=\"inline-flex text-warning\"><CardIcon name=\"star\" /></span>\n <span class=\"font-mono\">{starsLabel}</span>\n </span>\n )}\n {hasUpdated && (\n <span class=\"whitespace-nowrap\" title={`Last updated ${pushedAt}`}>\n Updated {updatedLabel}\n </span>\n )}\n <CardIcon\n name=\"arrow\"\n class=\"shrink-0 text-ink-400 transition-colors group-hover:text-ink-700 dark:text-ink-500 dark:group-hover:text-ink-100\"\n />\n </div>\n </footer>\n</Root>\n",
|
|
112
112
|
"type": "registry:component",
|
|
113
113
|
"target": "~/src/components/grove/project-card.astro"
|
|
114
114
|
},
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
"path": "default/components/grove/icon.astro",
|
|
129
|
-
"content": "---\nimport type { IconKind } from '../../lib/icon-kinds';\n/**\n * Icon — brand icon registry.\n *\n * Resolves a registry name to `/icons/{stacks|platforms|brands}/{name}.svg`\n * and renders it. The Astro integration syncs the packaged set into the\n * consumer's `public/icons/` on every build; consumers can ship their own\n * SVGs under the same paths (or override the `base` prop) without forking\n * this component.\n *\n * The component is **generic** — it does not import any consumer-side\n * `siteConfig`, `item`, or blueprint-specific module.\n *\n * `category` selects the subfolder:\n *\n * - \"stack\" → `/icons/stacks/{name}.svg`\n * - \"platform\" → `/icons/platforms/{name}.svg`\n * - \"brand\" → `/icons/brands/{name}.svg` (consumer-supplied)\n *\n * ## Theming\n *\n * `ICON_KINDS` (generated by `scripts/sync-icons.mjs`) classifies each\n * packaged icon:\n *\n * - **color** — the default. Any brand with a color mark keeps it,\n * rendered as `<img>` with an `onerror` fallback to an initials\n * chip.\n * - **mono** — marks with no color to lose (Apple, Rust, Tauri,\n * Solidity, Deno) plus the concept glyphs. Rendered as a CSS-masked\n * `<span>` painted from `--grove-foreground`, which reproduces how\n * those brands are actually used: solid black on light, solid white\n * on dark, with no script and no second file. See\n * `.grove-icon-mask` in `styles.css`.\n *\n * The map CLASSIFIES; it does not gate availability. A name it has never\n * heard of — a consumer's own SVG — takes the `<img>` path, exactly as\n * before. Pass `kind=\"mono\"` to opt a custom mark into `currentColor`\n * tinting.\n *\n * Aliases: a tiny `aliases` map (e.g. `rn → react-native`) lets the\n * registry accept multiple ids for the same asset. Lookup falls through\n * `aliases` → the built-in stack aliases → the raw slug, then fails over\n * to the initials placeholder.\n */\nimport { ICON_KINDS } from '../../lib/icon-kinds';\nimport type { IconCategory } from '../../lib/icon-registry';\nimport { resolveIconAsset, slugifyIconName } from '../../lib/icon-registry';\n\nexport type { IconCategory, IconKind };\n\
|
|
129
|
+
"content": "---\nimport type { IconKind } from '../../lib/icon-kinds';\n/**\n * Icon — brand icon registry.\n *\n * Resolves a registry name to `/icons/{stacks|platforms|brands}/{name}.svg`\n * and renders it. The Astro integration syncs the packaged set into the\n * consumer's `public/icons/` on every build; consumers can ship their own\n * SVGs under the same paths (or override the `base` prop) without forking\n * this component.\n *\n * The component is **generic** — it does not import any consumer-side\n * `siteConfig`, `item`, or blueprint-specific module.\n *\n * `category` selects the subfolder:\n *\n * - \"stack\" → `/icons/stacks/{name}.svg`\n * - \"platform\" → `/icons/platforms/{name}.svg`\n * - \"brand\" → `/icons/brands/{name}.svg` (consumer-supplied)\n *\n * ## Theming\n *\n * `ICON_KINDS` (generated by `scripts/sync-icons.mjs`) classifies each\n * packaged icon:\n *\n * - **color** — the default. Any brand with a color mark keeps it,\n * rendered as `<img>` with an `onerror` fallback to an initials\n * chip.\n * - **mono** — marks with no color to lose (Apple, Rust, Tauri,\n * Solidity, Deno) plus the concept glyphs. Rendered as a CSS-masked\n * `<span>` painted from `--grove-foreground`, which reproduces how\n * those brands are actually used: solid black on light, solid white\n * on dark, with no script and no second file. See\n * `.grove-icon-mask` in `styles.css`.\n *\n * The map CLASSIFIES; it does not gate availability. A name it has never\n * heard of — a consumer's own SVG — takes the `<img>` path, exactly as\n * before. Pass `kind=\"mono\"` to opt a custom mark into `currentColor`\n * tinting.\n *\n * Aliases: a tiny `aliases` map (e.g. `rn → react-native`) lets the\n * registry accept multiple ids for the same asset. Lookup falls through\n * `aliases` → the built-in stack aliases → the raw slug, then fails over\n * to the initials placeholder.\n */\nimport { ICON_KINDS } from '../../lib/icon-kinds';\nimport type { IconCategory } from '../../lib/icon-registry';\nimport { resolveIconAsset, slugifyIconName } from '../../lib/icon-registry';\n\nexport type { IconCategory, IconKind };\n\ninterface Props {\n /**\n * Registry id. Resolved through `aliases` first, then matched\n * against the SVG file name (case-insensitive, slug-normalized).\n */\n name: string;\n /** Subfolder under `/icons/`. */\n category: IconCategory;\n /** Pixel size (square). Defaults to 16. */\n size?: number;\n /** Extra class for the outer wrapper. */\n class?: string;\n /** Tooltip / aria-label. */\n title?: string;\n /**\n * Override the packaged kind classification. Pass `\"mono\"` for a\n * consumer-supplied single-color mark so it is painted black on\n * light and white on dark instead of shipping two files.\n */\n kind?: IconKind;\n /**\n * Optional id → id remap. Lookup goes `name → aliases[name] →\n * {name}.svg` (case-insensitive).\n */\n aliases?: Record<string, string>;\n /**\n * Optional complete asset registry supplied by a consumer. When omitted,\n * Grove attempts the configured asset path and falls back on image error.\n */\n available?: string[];\n /**\n * Initials to render when the icon file is missing. Defaults to\n * the first 1–2 characters of `name`.\n */\n fallbackInitials?: string;\n /**\n * Base path for icon files. Defaults to `/icons` (matches the\n * synced `public/icons/`).\n */\n base?: string;\n}\n\nconst {\n name,\n category,\n size = 16,\n class: className = '',\n title,\n kind,\n aliases,\n available,\n fallbackInitials,\n base = '/icons',\n} = Astro.props;\n\nconst asset = resolveIconAsset(name, category, aliases);\nconst resolved = asset.name;\nconst availableIcons = available?.map(slugifyIconName);\nconst hasAsset =\n category === 'brand' || availableIcons === undefined || availableIcons.includes(resolved);\nconst src = `${base.replace(/\\/$/, '')}/${asset.folder}/${resolved}.svg`;\n\n// Initials fallback: first 1–2 alphanumerics, uppercased.\nconst init = (fallbackInitials ?? name ?? '')\n .replace(/[^a-z0-9]/gi, '')\n .slice(0, 2)\n .toUpperCase();\nconst showFallback = !resolved || !hasAsset || asset.textOnly;\n\n// Unknown names fall through to `<img>`, never to `mono` — a mask has\n// no `onerror`, so a missing file would render an invisible blank.\nconst effectiveKind: IconKind = kind ?? ICON_KINDS[asset.key] ?? 'color';\n\n// `name` reaches the mask branch as part of a CSS `url()` token, and\n// slugifying does not remove the characters that would close it. Astro\n// escapes the attribute; this escapes the CSS inside it.\nconst cssUrl = src.replace(/['\"()\\\\\\s]/g, encodeURIComponent);\n\n// Build aria-label.\nconst ariaLabel = title ?? name;\nconst a11y: Record<string, string> = title\n ? { 'aria-label': ariaLabel, role: 'img' }\n : { 'aria-hidden': 'true', focusable: 'false' };\n\nconst fallbackClass = [\n 'inline-flex shrink-0 select-none items-center justify-center rounded-sm bg-ink-100 align-middle font-semibold uppercase leading-none text-ink-700 dark:bg-ink-800 dark:text-ink-200',\n className,\n];\nconst fallbackStyle = `width:${size}px;height:${size}px;font-size:${Math.max(10, size - 6)}px;`;\n---\n\n{\n showFallback ? (\n <span class:list={fallbackClass} style={fallbackStyle} {...a11y}>\n {init || \"·\"}\n </span>\n ) : effectiveKind === \"mono\" ? (\n <span\n class:list={[\"grove-icon-mask\", className]}\n style={`width:${size}px;height:${size}px;--grove-icon-url:url('${cssUrl}');`}\n {...a11y}\n />\n ) : (\n <>\n {/* The `width`/`height` attributes below are only presentational\n hints. These SVGs carry a `viewBox` and no intrinsic size, so\n once one loads the browser re-derives the box and the row\n reflows — Lighthouse reports it as \"media element lacking an\n explicit size\" and it cost the browse page 0.115 CLS. The\n `style` attribute's explicit CSS size pins the box before\n the first byte arrives. */}\n <img\n src={src}\n width={size}\n height={size}\n style={`width:${size}px;height:${size}px`}\n alt=\"\"\n class:list={[\"inline-block shrink-0 align-middle\", className]}\n loading=\"lazy\"\n decoding=\"async\"\n onerror=\"this.hidden=true;this.nextElementSibling.hidden=false\"\n {...a11y}\n />\n <span hidden data-grove-icon-fallback-initials class:list={fallbackClass} style={fallbackStyle} {...a11y}>\n {init || \"·\"}\n </span>\n </>\n )\n}\n",
|
|
130
130
|
"type": "registry:component",
|
|
131
131
|
"target": "~/src/components/grove/icon.astro"
|
|
132
132
|
},
|
|
@@ -192,13 +192,13 @@
|
|
|
192
192
|
},
|
|
193
193
|
{
|
|
194
194
|
"path": "default/pages/collections/index.astro",
|
|
195
|
-
"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
|
|
195
|
+
"content": "---\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getCollectionIndexModel,\n getCollectionTiles,\n loadCollections,\n recordsToCollectionEntries,\n} from '@grove-dev/astro/server';\nimport { runCollection } from '@grove-dev/core';\nimport CollectionDirectory from '../../components/grove/collection-directory.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 tiles = getCollectionTiles(collections, entries, siteConfig);\nconst covered = new Set(\n collections.flatMap((c) => runCollection(c, entries).entries.map((e) => e.slug)),\n).size;\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 <CollectionDirectory\n tiles={tiles}\n covered={covered}\n itemsLabel={siteConfig.blueprintConfig?.labelPlural ?? \"items\"}\n />\n</BaseLayout>\n",
|
|
196
196
|
"type": "registry:page",
|
|
197
197
|
"target": "~/src/pages/collections/index.astro"
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
200
|
"path": "default/pages/collections/[slug].astro",
|
|
201
|
-
"content": "---\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getCollectionBodyHtml,\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);\nconst bodyHtml = getCollectionBodyHtml(collection.content);\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 robots={model.seo.robots}\n site={siteConfig}\n>\n <CollectionPage\n model={model}\n bodyHtml={bodyHtml}\n
|
|
201
|
+
"content": "---\nimport records from '@grove/generated/records.json';\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getCollectionBodyHtml,\n getCollectionPageModel,\n getCollectionTiles,\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);\nconst bodyHtml = getCollectionBodyHtml(collection.content);\nconst relatedTiles = getCollectionTiles(\n model.related.flatMap((r) => collections.filter((c) => c.slug === r.slug)),\n entries,\n siteConfig,\n);\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 robots={model.seo.robots}\n site={siteConfig}\n>\n <CollectionPage\n model={model}\n bodyHtml={bodyHtml}\n relatedTiles={relatedTiles}\n countNoun={{\n singular: siteConfig.blueprintConfig?.labelSingular ?? \"item\",\n plural: siteConfig.blueprintConfig?.labelPlural ?? \"items\",\n }}\n />\n</BaseLayout>\n",
|
|
202
202
|
"type": "registry:page",
|
|
203
203
|
"target": "~/src/pages/collections/[slug].astro"
|
|
204
204
|
},
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
212
|
"path": "default/components/grove/collection-page.astro",
|
|
213
|
-
"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 * Editorial layers, each rendered only when the collection has it:\n * `editorial.introduction` (lead paragraph), the selection criteria,\n * the Markdown body (`bodyHtml`, from `getCollectionBodyHtml`), and the\n * `faq`. When the curator wrote per-entry notes the entries render as a\n * numbered verdict list — a card clamps its description to two lines,\n * which is no place for a 40-word verdict — and otherwise as the card\n * grid.\n *\n * Generic: no blueprint-specific copy. Consumers can override\n * `eyebrow`, `title`, `description`; `<slot name=\"intro\">` takes any\n * extra markup. `emptyLabel` matches `RecordSection`'s API for\n * empty-state copy.\n */\nimport { formatCount, formatStars } 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 /** Sanitized HTML of the collection's Markdown body, if it has one. */\n bodyHtml?: string | null;\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 bodyHtml = null,\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 hasNotes = model.entries.some((entry) => entry.note);\nconst reviewedLabel = model.collection.lastReviewedAt\n ? new Date(model.collection.lastReviewedAt).toLocaleDateString('en', {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n timeZone: 'UTC',\n })\n : null;\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 {model.collection.introduction && (\n <p class=\"m-0 mb-6 max-w-[68ch] text-[1.0625rem] leading-relaxed text-foreground\">\n {model.collection.introduction}\n </p>\n )}\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 ) : hasNotes ? (\n <ol class=\"m-0 flex list-none flex-col gap-3 p-0\">\n {model.entries.map((entry, i) => (\n <li class=\"m-0 rounded-[var(--radius-lg)] border border-border bg-card p-4 sm:p-5\">\n <h3 class=\"m-0 text-[1.0625rem] font-semibold leading-snug text-foreground\">\n <span class=\"mr-2 tabular-nums text-muted-foreground\">{i + 1}.</span>\n <a href={entry.url} class=\"text-foreground no-underline hover:underline\">{entry.title}</a>\n </h3>\n <p class=\"m-0 mt-2 max-w-[72ch] text-[0.9375rem] leading-relaxed text-foreground\">\n {entry.note ?? entry.description}\n </p>\n <p class=\"m-0 mt-3 flex flex-wrap gap-x-4 gap-y-1 text-2xs text-muted-foreground\">\n {typeof entry.stars === 'number' && entry.stars > 0 && (\n <span>{formatStars(entry.stars)} stars</span>\n )}\n {(entry.licenses?.[0] ?? entry.license) && <span>{entry.licenses?.[0] ?? entry.license}</span>}\n {entry.stack && <span>{entry.stack}</span>}\n {entry.repoHref && (\n <a href={entry.repoHref} rel=\"noopener noreferrer\" target=\"_blank\" class=\"text-muted-foreground underline\">\n Source\n </a>\n )}\n </p>\n </li>\n ))}\n </ol>\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 {bodyHtml && <div class=\"grove-prose mt-12 max-w-[72ch]\" set:html={bodyHtml} />}\n\n {model.faq.length > 0 && (\n <section class=\"mt-12 max-w-[72ch]\">\n <h2 class=\"m-0 mb-4 text-[1.375rem] font-semibold tracking-tight text-foreground\">\n Frequently asked questions\n </h2>\n <dl class=\"m-0 flex flex-col gap-5\">\n {model.faq.map((item) => (\n <div>\n <dt class=\"m-0 text-[1rem] font-semibold text-foreground\">{item.q}</dt>\n <dd class=\"m-0 mt-1 text-[0.9375rem] leading-relaxed text-foreground\">{item.a}</dd>\n </div>\n ))}\n </dl>\n </section>\n )}\n\n {reviewedLabel && (\n <p class=\"m-0 mt-8 text-2xs text-muted-foreground\">\n Last reviewed <time datetime={model.collection.lastReviewedAt}>{reviewedLabel}</time>\n </p>\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",
|
|
213
|
+
"content": "---\nimport siteConfig from '@grove/generated/site-config.json';\nimport type { CollectionPageModel, CollectionTile as Tile } from '@grove-dev/astro/server';\n/**\n * CollectionPage — renders a single curated/generated collection.\n *\n * Consumes a `CollectionPageModel` produced by `getCollectionPageModel`.\n *\n * First screen: a header band with the kind (editor's picks when the\n * curator wrote per-entry notes, otherwise a live view), the title, the\n * verdict (`editorial.introduction`, falling back to the description),\n * faces of the entries, the count and the review date.\n *\n * Entries: editor's picks render as numbered cards with the note, tags,\n * stars / last push / licence and Website (with `ref`) and Source\n * links; live views render as a two-column grid of ranked cards. A\n * sticky rail on wide screens holds the page outline and a submit\n * prompt. Below: the Markdown body (`bodyHtml`), \"How we picked\"\n * (`selectionNote`), the FAQ and related collections — as cards when\n * `relatedTiles` is passed.\n *\n * Generic: no blueprint-specific copy. Consumers can override\n * `eyebrow`, `title`, `description`; `<slot name=\"intro\">` takes any\n * extra markup.\n */\nimport { formatCount, withRef } from '@grove-dev/core';\nimport Container from '../../layouts/container.astro';\nimport SectionHeader from '../../layouts/section-header.astro';\nimport { buttonClass } from '../../lib/classnames.ts';\nimport EmptyState from '../ui/empty-state.astro';\nimport CollectionTile from './collection-tile.astro';\nimport Avatar from './entry-avatar.astro';\nimport Chips from './entry-chips.astro';\nimport Metrics from './entry-metrics.astro';\n\ninterface Props {\n model: CollectionPageModel;\n /** Sanitized HTML of the collection's Markdown body, if it has one. */\n bodyHtml?: string | null;\n /** Override the eyebrow text (default: \"Editor's picks\" / \"Live view\"). */\n eyebrow?: string;\n /** Override the title (default: collection.title). */\n title?: string;\n /** Override the lead (default: introduction, else 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 /** Heading level for the collection title (the page's h1 by default). */\n level?: 1 | 2;\n /** Noun pair for the entry count (blueprint labels). */\n countNoun?: { singular: string; plural: string };\n /** Cards for related collections (`getCollectionTiles`); plain links otherwise. */\n relatedTiles?: Tile[];\n /** Where the rail's \"Know one that fits?\" prompt points. Empty hides it. */\n submitHref?: string;\n class?: string;\n}\n\nconst {\n model,\n bodyHtml = null,\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 relatedTiles = [],\n submitHref = '/submit/',\n class: className = '',\n} = Astro.props;\n\nconst Heading = `h${level}` as 'h1' | 'h2';\nconst editorial = model.entries.some((entry) => entry.note);\nconst finalTitle = title ?? model.collection.title;\nconst verdict = description ?? model.collection.introduction ?? model.collection.description;\nconst finalEyebrow = eyebrow ?? (editorial ? \"Editor's picks\" : 'Live view');\nconst countText = formatCount(model.total, countNoun);\nconst reviewedText = model.collection.lastReviewedAt\n ? new Date(model.collection.lastReviewedAt).toLocaleDateString('en', {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n timeZone: 'UTC',\n })\n : null;\nconst outbound =\n (siteConfig as { outbound?: { ref?: string | false; skipHosts?: string[] } }).outbound ?? {};\nconst faces = model.entries.filter((e) => e.avatarUrl).slice(0, 6);\nconst jumpLinks = [\n model.isEmpty\n ? null\n : { href: '#entries', label: editorial ? `The ${countText}` : `All ${countText}` },\n model.collection.selectionNote ? { href: '#how-we-picked', label: 'How we picked' } : null,\n model.faq.length > 0 ? { href: '#faq', label: 'Questions' } : null,\n model.related.length > 0 ? { href: '#related', label: 'Related collections' } : null,\n].filter((link): link is { href: string; label: string } => link !== null);\n---\n\n<section id={id} class={className}>\n <div class=\"border-b border-border bg-surface-sunken/60\">\n <Container>\n <header class=\"max-w-[76ch] py-10 sm:py-14\">\n <nav aria-label=\"Breadcrumb\" class=\"flex items-center gap-2 text-2xs text-muted-foreground\">\n <a href=\"/collections/\" class=\"text-muted-foreground no-underline hover:text-foreground hover:underline\">Collections</a>\n <span aria-hidden=\"true\">/</span>\n {editorial ? (\n <span class=\"inline-flex items-center rounded-full bg-emerald-500/10 px-2 py-0.5 font-semibold text-emerald-700 dark:text-emerald-300\">{finalEyebrow}</span>\n ) : (\n <span class=\"inline-flex items-center gap-1.5 rounded-full bg-secondary px-2 py-0.5 font-semibold text-secondary-foreground\"><span class=\"h-1.5 w-1.5 rounded-full bg-success\" aria-hidden=\"true\"></span>{finalEyebrow}</span>\n )}\n </nav>\n <Heading class=\"m-0 mt-4 text-[2rem] font-semibold leading-[1.1] tracking-tight text-foreground sm:text-[2.625rem]\">{finalTitle}</Heading>\n {verdict && <p class=\"m-0 mt-4 text-[1.0625rem] leading-relaxed text-foreground sm:text-[1.125rem]\">{verdict}</p>}\n <div class=\"mt-5 flex flex-wrap items-center gap-x-4 gap-y-2 text-sm text-muted-foreground\">\n {faces.length > 0 && (\n <span class=\"flex -space-x-2\" aria-hidden=\"true\">\n {faces.map((e) => (\n <img src={e.avatarUrl} alt=\"\" width=\"28\" height=\"28\" decoding=\"async\" class=\"h-7 w-7 rounded-full border-2 border-background bg-secondary object-cover\" />\n ))}\n </span>\n )}\n <span class=\"font-medium text-foreground\">{countText}</span>\n {reviewedText && <span>Reviewed <time datetime={model.collection.lastReviewedAt}>{reviewedText}</time></span>}\n </div>\n </header>\n </Container>\n </div>\n\n <Container>\n <div class=\"grid gap-10 py-10 lg:grid-cols-[minmax(0,1fr)_15rem] lg:gap-12\">\n <div class=\"min-w-0\">\n {jumpLinks.length > 1 && (\n <nav aria-label=\"On this page\" class=\"mb-8 lg:hidden\">\n <ul class=\"m-0 flex list-none flex-wrap gap-2 p-0\">\n {jumpLinks.map((link) => (\n <li class=\"m-0\"><a href={link.href} class={buttonClass('outline', 'sm')}>{link.label}</a></li>\n ))}\n </ul>\n </nav>\n )}\n\n <slot name=\"intro\" />\n\n <section id=\"entries\" aria-labelledby=\"entries-heading\" class=\"scroll-mt-20\">\n <h2 id=\"entries-heading\" class=\"m-0 mb-4 text-[1.375rem] font-semibold tracking-tight text-foreground\">\n {editorial ? `The ${countText}` : `All ${countText}, ranked`}\n </h2>\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 ) : editorial ? (\n <ol class=\"m-0 flex list-none flex-col gap-4 p-0\">\n {model.entries.map((entry, i) => {\n const website = withRef(entry.homepageHref, outbound);\n return (\n <li id={`pick-${entry.slug}`} class=\"m-0 scroll-mt-20 rounded-[var(--radius-lg)] border border-border bg-card p-5 sm:p-6\">\n <div class=\"flex items-start gap-4\">\n <Avatar src={entry.avatarUrl} title={entry.title} size=\"lg\" />\n <div class=\"min-w-0 flex-1\">\n <h3 class=\"m-0 flex flex-wrap items-baseline gap-x-2 text-[1.1875rem] font-semibold leading-snug text-foreground\">\n <span class=\"tabular-nums text-muted-foreground\">{i + 1}.</span>\n <a href={entry.url} class=\"text-foreground no-underline hover:underline\">{entry.title}</a>\n </h3>\n <Metrics stars={entry.stars} pushedAt={entry.pushedAt} license={entry.licenses?.[0]} />\n </div>\n </div>\n <p class=\"m-0 mt-4 max-w-[72ch] text-[0.9375rem] leading-relaxed text-foreground\">{entry.note ?? entry.description}</p>\n <Chips items={(entry.tags ?? []).slice(0, 4)} />\n <div class=\"mt-4 flex flex-wrap items-center gap-2 border-t border-border pt-4\">\n {website && (\n <a href={website} rel=\"noopener\" target=\"_blank\" class={buttonClass('secondary', 'sm')} data-event=\"homepage_click\" data-event-source=\"collection_pick\" data-event-item={entry.slug}>\n Website<span class=\"sr-only\"> of {entry.title}</span>\n </a>\n )}\n {entry.repoHref && (\n <a href={entry.repoHref} rel=\"noopener\" target=\"_blank\" class={buttonClass('ghost', 'sm')} data-event=\"external_repo_click\" data-event-source=\"collection_pick\" data-event-item={entry.slug}>\n Source<span class=\"sr-only\"> code of {entry.title}</span>\n </a>\n )}\n <a href={entry.url} class=\"ml-auto text-sm font-medium text-muted-foreground no-underline hover:text-foreground hover:underline\">Full page →</a>\n </div>\n </li>\n );\n })}\n </ol>\n ) : (\n <ol class=\"m-0 grid list-none grid-cols-1 gap-3 p-0 md:grid-cols-2\">\n {model.entries.map((entry, i) => (\n <li id={`pick-${entry.slug}`} class=\"group relative m-0 flex scroll-mt-20 flex-col rounded-[var(--radius-lg)] border border-border bg-card p-4 transition-[border-color,box-shadow] focus-within:border-ring hover:border-ink-300 hover:shadow-md dark:hover:border-ink-700\">\n <div class=\"flex items-start gap-3\">\n <Avatar src={entry.avatarUrl} title={entry.title} />\n <div class=\"min-w-0 flex-1\">\n <h3 class=\"m-0 text-[1rem] font-semibold leading-snug text-foreground\">\n <a href={entry.url} class=\"text-foreground no-underline outline-none after:absolute after:inset-0 after:content-[''] group-hover:underline\">{entry.title}</a>\n </h3>\n {entry.stack && <p class=\"m-0 mt-0.5 text-2xs text-muted-foreground\">{entry.stack}</p>}\n </div>\n <span class=\"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-2xs font-semibold tabular-nums text-secondary-foreground\" aria-label={`Rank ${i + 1}`}>#{i + 1}</span>\n </div>\n <p class=\"m-0 mt-3 line-clamp-2 text-sm leading-relaxed text-muted-foreground\">{entry.description}</p>\n <Chips items={(entry.tags ?? []).slice(0, 3)} />\n <div class=\"mt-auto pt-3\">\n <Metrics stars={entry.stars} pushedAt={entry.pushedAt} license={entry.licenses?.[0]} bordered />\n </div>\n </li>\n ))}\n </ol>\n )}\n </section>\n\n {bodyHtml && <div class=\"grove-prose mt-12 max-w-[76ch]\" set:html={bodyHtml} />}\n\n {model.collection.selectionNote && (\n <details id=\"how-we-picked\" class=\"group mt-12 max-w-[76ch] scroll-mt-20 rounded-[var(--radius-lg)] border border-border bg-surface-sunken\">\n <summary class=\"flex cursor-pointer list-none items-center justify-between gap-3 rounded-[var(--radius-lg)] px-4 py-3 outline-none focus-visible:ring-3 focus-visible:ring-ring/35 [&::-webkit-details-marker]:hidden\">\n <h2 class=\"m-0 text-[1rem] font-semibold text-foreground\">How we picked</h2>\n <span aria-hidden=\"true\" class=\"text-muted-foreground transition-transform group-open:rotate-45\">+</span>\n </summary>\n <p class=\"m-0 px-4 pb-4 text-[0.9375rem] leading-relaxed text-foreground\">\n {model.collection.selectionNote.trim().replace(/\\s*\\n\\s*/g, ' ')}\n </p>\n </details>\n )}\n\n {model.faq.length > 0 && (\n <section id=\"faq\" class=\"mt-12 max-w-[76ch] scroll-mt-20\">\n <h2 class=\"m-0 mb-4 text-[1.375rem] font-semibold tracking-tight text-foreground\">Frequently asked questions</h2>\n <dl class=\"m-0 flex flex-col gap-5\">\n {model.faq.map((item) => (\n <div>\n <dt class=\"m-0 text-[1rem] font-semibold text-foreground\">{item.q}</dt>\n <dd class=\"m-0 mt-1 text-[0.9375rem] leading-relaxed text-foreground\">{item.a}</dd>\n </div>\n ))}\n </dl>\n </section>\n )}\n </div>\n\n <aside class=\"hidden lg:block\" data-pagefind-ignore>\n <div class=\"sticky top-20 flex flex-col gap-4\">\n {jumpLinks.length > 1 && (\n <nav aria-label=\"On this page\" class=\"rounded-[var(--radius-lg)] border border-border bg-card p-3\">\n <p class=\"m-0 px-2 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">On this page</p>\n <ul class=\"m-0 mt-2 flex list-none flex-col p-0\">\n {jumpLinks.map((link) => (\n <li class=\"m-0\"><a href={link.href} class=\"block rounded-[var(--radius)] px-2 py-1.5 text-sm text-foreground no-underline hover:bg-accent\">{link.label}</a></li>\n ))}\n </ul>\n </nav>\n )}\n {submitHref && (\n <div class=\"rounded-[var(--radius-lg)] border border-dashed border-border p-4\">\n <p class=\"m-0 text-sm font-semibold text-foreground\">Know one that fits?</p>\n <p class=\"m-0 mt-1 text-2xs leading-relaxed text-muted-foreground\">Submit it with one pull request. The page credits you.</p>\n <a href={submitHref} class={buttonClass('secondary', 'sm', 'mt-3 w-full justify-center')}>Submit {countNoun.singular === 'item' ? 'an entry' : `a ${countNoun.singular}`}</a>\n </div>\n )}\n </div>\n </aside>\n </div>\n\n {model.related.length > 0 && (\n <section id=\"related\" data-pagefind-ignore class=\"scroll-mt-20 border-t border-border pb-16 pt-10\">\n <SectionHeader eyebrow=\"Related\" title=\"Related collections\" level={2} />\n {relatedTiles.length > 0 ? (\n <ul class=\"m-0 grid list-none grid-cols-1 gap-4 p-0 sm:grid-cols-2 lg:grid-cols-3\">\n {relatedTiles.map((tile) => <li class=\"m-0 p-0\"><CollectionTile tile={tile} eventSource=\"collection_related\" /></li>)}\n </ul>\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\"><a href={r.url} class=\"flex h-full rounded-md border border-border bg-card px-3 py-2.5 text-sm font-medium text-foreground no-underline hover:underline\">{r.title}</a></li>\n ))}\n </ul>\n )}\n </section>\n )}\n </Container>\n</section>\n",
|
|
214
214
|
"type": "registry:component",
|
|
215
215
|
"target": "~/src/components/grove/collection-page.astro"
|
|
216
216
|
},
|
|
@@ -232,15 +232,45 @@
|
|
|
232
232
|
"type": "registry:component",
|
|
233
233
|
"target": "~/src/components/grove/collection-teaser.astro"
|
|
234
234
|
},
|
|
235
|
+
{
|
|
236
|
+
"path": "default/components/grove/collection-directory.astro",
|
|
237
|
+
"content": "---\n/**\n * CollectionDirectory — the /collections/ page.\n *\n * A short header with the two kinds of collection as a legend, one\n * featured editor's-picks collection with its first picks, then every\n * other collection as a card. Tiles come from `getCollectionTiles`.\n * The featured slot goes to the most recently reviewed non-empty\n * collection with curator notes; with none, every tile is in the grid.\n */\nimport type { CollectionTile as Tile } from '@grove-dev/astro/server';\nimport { formatStars } from '@grove-dev/core';\nimport Container from '../../layouts/container.astro';\nimport { buttonClass } from '../../lib/classnames.ts';\nimport EmptyState from '../ui/empty-state.astro';\nimport CollectionTile from './collection-tile.astro';\n\ninterface Props {\n tiles: Tile[];\n /** Distinct entries across all collections, for the header line. */\n covered?: number;\n itemsLabel?: string;\n title?: string;\n description?: string;\n}\n\nconst {\n tiles,\n covered,\n itemsLabel = 'items',\n title = 'Collections',\n description = 'Shortlists for a question you already have, and live views that re-rank as the directory changes.',\n} = Astro.props;\n\nconst featured = tiles\n .filter((t) => t.editorial && !t.isEmpty && t.reviewedAt)\n .sort((a, b) => Date.parse(b.reviewedAt ?? '') - Date.parse(a.reviewedAt ?? ''))[0];\nconst rest = tiles.filter((t) => t !== featured);\nconst reviewedText = (date?: string) =>\n date\n ? new Date(date).toLocaleDateString('en', {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n timeZone: 'UTC',\n })\n : undefined;\n---\n\n<section class=\"border-b border-border pb-10 pt-12 sm:pb-12 sm:pt-16\">\n <Container>\n <div class=\"flex flex-col gap-6 lg:flex-row lg:items-end lg:justify-between\">\n <div class=\"max-w-[60ch]\">\n <p class=\"m-0 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n {tiles.length} collections{typeof covered === 'number' && covered > 0 ? ` · ${covered} ${itemsLabel} covered` : ''}\n </p>\n <h1 class=\"m-0 mt-2 text-[2rem] font-semibold leading-tight tracking-tight text-foreground sm:text-[2.625rem]\">{title}</h1>\n <p class=\"m-0 mt-3 text-[1.0625rem] leading-relaxed text-muted-foreground\">{description}</p>\n </div>\n <dl class=\"m-0 grid gap-2 text-sm sm:grid-cols-2 lg:w-[30rem]\">\n <div class=\"rounded-[var(--radius-lg)] border border-border bg-card p-3\">\n <dt class=\"inline-flex items-center gap-1.5 rounded-full bg-emerald-500/10 px-2 py-0.5 text-2xs font-semibold text-emerald-700 dark:text-emerald-300\">Editor's picks</dt>\n <dd class=\"m-0 mt-2 text-2xs leading-relaxed text-muted-foreground\">A person chose each entry and wrote down why. Dated reviews.</dd>\n </div>\n <div class=\"rounded-[var(--radius-lg)] border border-border bg-card p-3\">\n <dt class=\"inline-flex items-center gap-1.5 rounded-full bg-secondary px-2 py-0.5 text-2xs font-semibold text-secondary-foreground\">\n <span class=\"h-1.5 w-1.5 rounded-full bg-success\" aria-hidden=\"true\"></span>Live view\n </dt>\n <dd class=\"m-0 mt-2 text-2xs leading-relaxed text-muted-foreground\">Fixed rules over the directory, re-ranked on every sync.</dd>\n </div>\n </dl>\n </div>\n </Container>\n</section>\n\n{tiles.length === 0 && (\n <section class=\"py-12\">\n <Container>\n <EmptyState title=\"No collections yet\" description=\"Add a YAML file to data/collections/ and it appears here.\" />\n </Container>\n </section>\n)}\n\n{featured && (\n <section aria-labelledby=\"featured-heading\" class=\"pt-10 sm:pt-12\">\n <Container>\n <article class=\"grid overflow-hidden rounded-[var(--radius-lg)] border border-border bg-card lg:grid-cols-2\">\n <div class=\"flex min-w-0 flex-col p-6 sm:p-8\">\n <p class=\"m-0 flex items-center gap-2 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n <span class=\"inline-flex items-center rounded-full bg-emerald-500/10 px-2 py-0.5 font-semibold normal-case tracking-normal text-emerald-700 dark:text-emerald-300\">Featured</span>\n Editor's picks\n </p>\n <h2 id=\"featured-heading\" class=\"m-0 mt-4 text-[1.625rem] font-semibold leading-tight tracking-tight text-foreground sm:text-[2rem]\">\n <a href={featured.url} class=\"text-foreground no-underline hover:underline\">{featured.title}</a>\n </h2>\n {featured.takeaway && <p class=\"m-0 mt-4 max-w-[58ch] text-[0.9375rem] leading-relaxed text-foreground\">{featured.takeaway}</p>}\n <div class=\"mt-auto flex flex-wrap items-center gap-x-4 gap-y-2 pt-6\">\n <a href={featured.url} class={buttonClass('primary', 'md')} data-event=\"collection_card_click\" data-event-source=\"collection_featured\" data-event-item={featured.slug}>See the picks →</a>\n <span class=\"text-2xs text-muted-foreground\">\n {featured.countLabel}\n {reviewedText(featured.reviewedAt) && <> · Reviewed <time datetime={featured.reviewedAt}>{reviewedText(featured.reviewedAt)}</time></>}\n </span>\n </div>\n </div>\n {featured.examples.length > 0 && (\n <div class=\"min-w-0 border-t border-border bg-surface-sunken p-4 sm:p-6 lg:border-l lg:border-t-0\">\n <h3 class=\"m-0 px-2 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">Quick picks</h3>\n <ol class=\"m-0 mt-2 flex list-none flex-col p-0\">\n {featured.examples.map((ex, i) => (\n <li class=\"m-0\">\n <a href={`${featured.url}#pick-${ex.slug}`} class=\"group flex items-start gap-3 rounded-[var(--radius)] px-2 py-2.5 no-underline hover:bg-accent\">\n {ex.avatarUrl ? (\n <img src={ex.avatarUrl} alt=\"\" width=\"36\" height=\"36\" loading=\"lazy\" decoding=\"async\" class=\"h-9 w-9 shrink-0 rounded-lg border border-border bg-background object-cover\" />\n ) : (\n <span class=\"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border bg-background text-xs font-semibold text-muted-foreground\">{i + 1}</span>\n )}\n <span class=\"min-w-0 flex-1\">\n <span class=\"flex items-baseline justify-between gap-3\">\n <span class=\"text-[0.9375rem] font-semibold text-foreground group-hover:underline\">{ex.title}</span>\n {typeof ex.stars === 'number' && ex.stars > 0 && <span class=\"shrink-0 text-2xs tabular-nums text-muted-foreground\">★ {formatStars(ex.stars)}</span>}\n </span>\n {ex.note && <span class=\"mt-0.5 line-clamp-2 block text-sm leading-snug text-muted-foreground\">{ex.note}</span>}\n </span>\n </a>\n </li>\n ))}\n </ol>\n </div>\n )}\n </article>\n </Container>\n </section>\n)}\n\n{rest.length > 0 && (\n <section aria-labelledby=\"all-collections\" class=\"pb-16 pt-12\">\n <Container>\n <h2 id=\"all-collections\" class=\"m-0 mb-4 text-[1.25rem] font-semibold tracking-tight text-foreground\">\n {featured ? 'More collections' : 'All collections'}\n </h2>\n <ul class=\"m-0 grid list-none grid-cols-1 gap-4 p-0 sm:grid-cols-2 lg:grid-cols-3\">\n {rest.map((tile) => <li class=\"m-0 p-0\"><CollectionTile tile={tile} /></li>)}\n </ul>\n </Container>\n </section>\n)}\n",
|
|
238
|
+
"type": "registry:component",
|
|
239
|
+
"target": "~/src/components/grove/collection-directory.astro"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"path": "default/components/grove/collection-tile.astro",
|
|
243
|
+
"content": "---\n/**\n * CollectionTile — one collection as a card: kind, title, a one-line\n * takeaway, faces of the entries inside and the review date. Used on\n * /collections/ and for \"Related collections\" on a collection page.\n * Takes a tile from `getCollectionTiles`.\n */\nimport type { CollectionTile } from '@grove-dev/astro/server';\n\ninterface Props {\n tile: CollectionTile;\n headingLevel?: 'h2' | 'h3';\n /** Small label above the title, e.g. the reader's intent. */\n label?: string;\n eventSource?: string;\n}\n\nconst { tile, headingLevel: Heading = 'h3', label, eventSource = 'collection_index' } = Astro.props;\nconst faces = tile.faces.slice(0, 5);\nconst extra = Math.max(0, tile.count - faces.length);\nconst names = tile.examples.slice(0, 2).map((e) => e.title);\nconst namesText = names.length\n ? `${names.join(', ')}${tile.count > names.length ? ` and ${tile.count - names.length} more` : ''}`\n : '';\nconst reviewedText = tile.reviewedAt\n ? new Date(tile.reviewedAt).toLocaleDateString('en', {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n timeZone: 'UTC',\n })\n : undefined;\n---\n\n<a\n href={tile.url}\n data-event=\"collection_card_click\"\n data-event-source={eventSource}\n data-event-item={tile.slug}\n class=\"group flex h-full min-w-0 flex-col rounded-[var(--radius-lg)] border border-border bg-card p-5 no-underline outline-none transition-[border-color,box-shadow,transform] hover:-translate-y-0.5 hover:border-ink-300 hover:shadow-md focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35 dark:hover:border-ink-700\"\n>\n <div class=\"flex items-center justify-between gap-3\">\n {tile.editorial ? (\n <span class=\"inline-flex items-center gap-1.5 rounded-full bg-emerald-500/10 px-2 py-0.5 text-2xs font-semibold text-emerald-700 dark:text-emerald-300\">\n <svg viewBox=\"0 0 16 16\" width=\"10\" height=\"10\" aria-hidden=\"true\" fill=\"currentColor\"><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></svg>\n Editor's picks\n </span>\n ) : (\n <span class=\"inline-flex items-center gap-1.5 rounded-full bg-secondary px-2 py-0.5 text-2xs font-semibold text-secondary-foreground\">\n <span class=\"h-1.5 w-1.5 rounded-full bg-success\" aria-hidden=\"true\"></span>\n Live view\n </span>\n )}\n <span class=\"text-2xs tabular-nums text-muted-foreground\">{tile.countLabel}</span>\n </div>\n\n {label && <p class=\"m-0 mt-4 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">{label}</p>}\n <Heading class:list={[\"m-0 text-[1.125rem] font-semibold leading-snug tracking-tight text-foreground group-hover:underline\", label ? \"mt-1\" : \"mt-4\"]}>\n {tile.title}\n </Heading>\n {tile.takeaway && (\n <p class=\"m-0 mt-2 line-clamp-2 text-sm leading-relaxed text-muted-foreground\">{tile.takeaway}</p>\n )}\n\n <div class=\"mt-auto flex items-center gap-3 pt-5\">\n {faces.length > 0 && (\n <span class=\"flex shrink-0 -space-x-2\" aria-hidden=\"true\">\n {faces.map((face) => (\n <img src={face.avatarUrl} alt=\"\" width=\"28\" height=\"28\" loading=\"lazy\" decoding=\"async\" class=\"h-7 w-7 rounded-full border-2 border-card bg-secondary object-cover\" />\n ))}\n {extra > 0 && (\n <span class=\"inline-flex h-7 min-w-7 items-center justify-center rounded-full border-2 border-card bg-secondary px-1 text-[10px] font-semibold tabular-nums text-secondary-foreground\">+{extra}</span>\n )}\n </span>\n )}\n <span class=\"min-w-0 flex-1 truncate text-2xs text-muted-foreground\">{namesText}</span>\n </div>\n {reviewedText && (\n <p class=\"m-0 mt-3 flex items-center justify-between border-t border-border pt-3 text-2xs text-muted-foreground\">\n <span>Reviewed <time datetime={tile.reviewedAt}>{reviewedText}</time></span>\n <span aria-hidden=\"true\" class=\"transition-transform group-hover:translate-x-0.5\">→</span>\n </p>\n )}\n</a>\n",
|
|
244
|
+
"type": "registry:component",
|
|
245
|
+
"target": "~/src/components/grove/collection-tile.astro"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"path": "default/components/grove/entry-avatar.astro",
|
|
249
|
+
"content": "---\n/** App icon: the record's logo or the GitHub owner's avatar, else initials. */\ninterface Props {\n src?: string;\n title: string;\n size?: 'md' | 'lg';\n}\nconst { src, title, size = 'md' } = Astro.props;\nconst box = size === 'lg' ? 'h-12 w-12 rounded-xl' : 'h-10 w-10 rounded-lg';\nconst initials =\n title\n .replace(/[^A-Za-z0-9 ]/g, '')\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((w) => w[0])\n .join('')\n .toUpperCase() || title.slice(0, 2).toUpperCase();\n---\n{src ? (\n <img src={src} alt=\"\" width={size === 'lg' ? 48 : 40} height={size === 'lg' ? 48 : 40} loading=\"lazy\" decoding=\"async\" class={`${box} shrink-0 border border-border bg-background object-cover`} />\n) : (\n <span aria-hidden=\"true\" class={`${box} inline-flex shrink-0 items-center justify-center border border-border bg-secondary text-sm font-semibold text-secondary-foreground`}>{initials}</span>\n)}\n",
|
|
250
|
+
"type": "registry:component",
|
|
251
|
+
"target": "~/src/components/grove/entry-avatar.astro"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"path": "default/components/grove/entry-chips.astro",
|
|
255
|
+
"content": "---\n/** Small neutral chips (platforms, tags). */\ninterface Props {\n items: string[];\n}\nconst items = [...new Set(Astro.props.items.filter(Boolean))];\n---\n{items.length > 0 && (\n <ul class=\"m-0 mt-3 flex list-none flex-wrap gap-1.5 p-0\">\n {items.map((item) => (\n <li class=\"m-0 rounded-full border border-border px-2 py-0.5 text-2xs font-medium text-muted-foreground\">{item}</li>\n ))}\n </ul>\n)}\n",
|
|
256
|
+
"type": "registry:component",
|
|
257
|
+
"target": "~/src/components/grove/entry-chips.astro"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"path": "default/components/grove/entry-metrics.astro",
|
|
261
|
+
"content": "---\n/** Stars · last push · licence, with icons. Renders nothing when all are missing. */\nimport { formatRelative, formatStars, isDetectedLicense, licenseDisplay } from '@grove-dev/core';\n\ninterface Props {\n stars?: number;\n pushedAt?: string;\n /** SPDX id or a display label; placeholders are dropped. */\n license?: string;\n /** Top border, for the foot of a card. */\n bordered?: boolean;\n}\nconst { stars, pushedAt, bordered = false } = Astro.props;\n// GitHub's placeholders (NOASSERTION, OTHER…) say nothing useful here.\nconst license = isDetectedLicense(Astro.props.license)\n ? licenseDisplay(Astro.props.license)\n : undefined;\nconst starsText = typeof stars === 'number' && stars > 0 ? formatStars(stars) : undefined;\nconst pushedText = pushedAt ? formatRelative(pushedAt) : undefined;\n---\n{(starsText || pushedText || license) && (\n <p class:list={[\"m-0 mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-2xs text-muted-foreground\", bordered && \"border-t border-border pt-3\"]}>\n {starsText && (\n <span class=\"inline-flex items-center gap-1 tabular-nums\" title={`${stars?.toLocaleString('en')} GitHub stars`}>\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-warning\"><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></svg>\n {starsText}<span class=\"sr-only\"> stars</span>\n </span>\n )}\n {pushedText && (\n <span class=\"inline-flex items-center gap-1\" title=\"Last push to the repository\">\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\"><circle cx=\"8\" cy=\"8\" r=\"6.25\"></circle><path d=\"M8 4.75V8l2.25 1.5\"></path></svg>\n <span><span class=\"sr-only\">Last commit </span>{pushedText}</span>\n </span>\n )}\n {license && (\n <span class=\"inline-flex items-center gap-1\">\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M8 1.75v12.5M3.25 4.25h9.5M4.75 4.25 2.5 9a2.25 2.25 0 0 0 4.5 0L4.75 4.25ZM11.25 4.25 9 9a2.25 2.25 0 0 0 4.5 0l-2.25-4.75ZM5.5 14.25h5\"></path></svg>\n {license}\n </span>\n )}\n </p>\n)}\n",
|
|
262
|
+
"type": "registry:component",
|
|
263
|
+
"target": "~/src/components/grove/entry-metrics.astro"
|
|
264
|
+
},
|
|
235
265
|
{
|
|
236
266
|
"path": "default/pages/index.astro",
|
|
237
|
-
"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 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\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",
|
|
267
|
+
"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",
|
|
238
268
|
"type": "registry:page",
|
|
239
269
|
"target": "~/src/pages/index.astro"
|
|
240
270
|
},
|
|
241
271
|
{
|
|
242
272
|
"path": "default/components/grove/hero.astro",
|
|
243
|
-
"content": "---\nimport { compact } from '@grove-dev/core';\n/**\n * Hero — the home page banner.\n *\n * Mirrors the openapps layout: trust-stats row across the top,\n * big two-line headline with a gradient accent on the second\n * line, descriptive paragraph, search form with a Filters\n * shortcut, quick-filter chips, and up to 3 CTAs.\n *\n * Generic: every value comes through props (or `siteConfig` for\n * the trust stats). The label next to the count is blueprint-\n * driven via `itemsLabel` — so a project-directory renders\n * \"apps indexed\", a resource-hub renders \"resources indexed\",\n * an ecosystem-map renders \"entities indexed\".\n */\nimport Container from '../../layouts/container.astro';\n\ninterface CTA {\n label: string;\n href: string;\n variant?: 'primary' | 'outline' | 'ghost';\n external?: boolean;\n}\n\ninterface Props {\n /** Site/brand name. */\n name: string;\n /** Short tagline — usually pulled from siteConfig.tagline. */\n tagline: string;\n /** Longer descriptive paragraph. */\n description?: string;\n /** Trust stats: items count, categories, stacks, owners, stars. */\n stats?: {\n totalApps?: number;\n totalCategories?: number;\n totalStacks?: number;\n totalOwners?: number;\n totalStars?: number;\n };\n /** Search form target — the list page. */\n searchHref?: string;\n /** Search input placeholder. */\n searchPlaceholder?: string;\n /**\n * Plural noun for the primary count (e.g. \"apps\", \"resources\",\n * \"entities\"). Used in the trust-stats label and CTA copy.\n */\n itemsLabel?: string;\n /** Quick filter chips under the search bar. */\n quickFilters?: Array<{ label: string; href: string }>;\n /** CTAs rendered below the form. */\n ctas?: CTA[];\n /** Extra class. */\n class?: string;\n /** Eyebrow text rendered above the title. */\n eyebrow?: string;\n /** Optional badge content rendered next to the eyebrow. */\n eyebrowBadge?: string;\n}\n\nconst {\n name,\n tagline,\n description,\n stats = {},\n searchHref = '/',\n searchPlaceholder = 'Search the directory...',\n itemsLabel = 'items',\n quickFilters = [],\n ctas = [],\n class: className = '',\n eyebrow = 'A directory of curated knowledge',\n eyebrowBadge,\n} = Astro.props;\n\n// One compact stats line: \"6 projects indexed · 5 categories · 3 stacks\".\n// Every entry is guarded so a fresh directory never renders a zero-value.\nconst statParts: string[] = [\n ...(stats.totalApps !== undefined && stats.totalApps > 0\n ? [`${compact(stats.totalApps)} ${itemsLabel} indexed`]\n : []),\n ...(stats.totalCategories !== undefined && stats.totalCategories > 0\n ? [`${stats.totalCategories} categories`]\n : []),\n ...(stats.totalStacks !== undefined && stats.totalStacks > 0\n ? [`${stats.totalStacks} stacks`]\n : []),\n ...(stats.totalOwners !== undefined && stats.totalOwners > 0\n ? [`${compact(stats.totalOwners)} owners`]\n : []),\n ...(stats.totalStars !== undefined && stats.totalStars > 0\n ? [`${compact(stats.totalStars)} stars`]\n : []),\n];\n\n// One primary CTA only — Submit already lives in the navbar\n// (BaseLayout → Header submitHref), so the hero never duplicates it.\nconst primaryCta: CTA | undefined = ctas.find((c) => c.variant === 'primary') ??\n ctas[0] ?? { label: `Browse ${itemsLabel}`, href: searchHref, variant: 'primary' };\n---\n\n<section\n class:list={[\n \"relative overflow-hidden border-b border-ink-200 dark:border-ink-800\",\n className,\n ]}\n>\n {/* Dark mode only: a barely-there radial lift behind the headline. */}\n <div\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 hidden dark:block\"\n style=\"background: radial-gradient(60% 55% at 50% 0%, color-mix(in oklab, var(--grove-foreground) 5%, transparent) 0%, transparent 70%);\"\n ></div>\n\n <Container>\n <div class=\"relative mx-auto flex max-w-[900px] flex-col items-center py-[88px] text-center lg:py-[104px]\">\n {/* Eyebrow. The `eyebrow` slot replaces the whole line — dot\n included — so a consumer can put richer content here (a\n `PoweredBy` link, a release badge) without forking the Hero. */}\n <span class=\"inline-flex animate-fade-in items-center gap-2 text-[13px] font-medium text-ink-500 dark:text-ink-400\">\n <slot name=\"eyebrow\">\n <span aria-hidden=\"true\" class=\"inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-success\"></span>\n {eyebrow}\n {eyebrowBadge && (\n <span\n class=\"inline-flex items-center rounded-full border border-warning/30 bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-warning\"\n aria-label={eyebrowBadge}\n >\n {eyebrowBadge}\n </span>\n )}\n </slot>\n </span>\n\n {/* Headline */}\n <h1\n class=\"m-0 mt-5 max-w-[820px] animate-fade-in-up text-balance text-[clamp(44px,5vw,64px)] font-[650] leading-[1.08] tracking-[-0.035em] text-ink-900 dark:text-ink-100\"\n style=\"animation-delay: 0.05s;\"\n >\n <span class=\"block\">{name}</span>\n <span class=\"block\">{tagline}</span>\n </h1>\n\n {description && (\n <p\n class=\"m-0 mt-5 max-w-[640px] animate-fade-in-up text-[16px] leading-[1.6] text-ink-500 dark:text-ink-400\"\n style=\"animation-delay: 0.1s;\"\n >\n {description}\n </p>\n )}\n\n {/* Search — primary interaction. The FORM is the visual control:\n it owns the border, radius, and the single focus treatment\n (focus-within border + soft ring). The inner input opts out\n of the global input styling (`grove-input-unstyled`) so it\n stays a transparent, chrome-free text slot — no second box\n or ring appearing inside the pill on focus. */}\n <form\n class=\"mt-8 flex h-[58px] w-full max-w-[840px] animate-fade-in-up items-center gap-3 rounded-xl border border-ink-200 bg-background p-1.5 pl-4 transition-[border-color,box-shadow] focus-within:border-ink-400 focus-within:ring-3 focus-within:ring-ring/15 dark:border-ink-800 dark:focus-within:border-ink-600\"\n style=\"animation-delay: 0.15s;\"\n role=\"search\"\n action={searchHref}\n method=\"get\"\n >\n <label class=\"flex min-w-0 flex-1 items-center gap-3\">\n <span class=\"sr-only\">Search {itemsLabel}, stacks, and categories</span>\n <svg viewBox=\"0 0 16 16\" width=\"20\" height=\"20\" aria-hidden=\"true\" class=\"shrink-0 text-ink-400 dark:text-ink-500\" fill=\"currentColor\">\n <path d=\"M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z\"></path>\n </svg>\n <input\n type=\"search\"\n name=\"q\"\n placeholder={searchPlaceholder}\n class=\"grove-input-unstyled h-full w-full min-w-0 rounded-none border-0 bg-transparent px-0 text-[16px] text-ink-900 outline-none placeholder:text-ink-400 dark:text-ink-100 dark:placeholder:text-ink-500\"\n />\n </label>\n <button\n type=\"submit\"\n class=\"inline-flex h-[46px] shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent bg-primary px-5 text-[15px] font-medium leading-none text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\"\n >\n Search\n </button>\n </form>\n\n {quickFilters.length > 0 && (\n <p class=\"m-0 mt-4 text-[13px] text-ink-500 dark:text-ink-400\">\n Try{\" \"}\n {quickFilters.map((f, i) => (\n <>\n <a href={f.href} class=\"font-mono text-ink-700 underline-offset-2 hover:underline dark:text-ink-300\">{f.label}</a>\n {i < quickFilters.length - 1 && <span aria-hidden=\"true\" class=\"mx-1\">·</span>}\n </>\n ))}\n </p>\n )}\n\n {/* Inline stats — single compact line, middle-dot separators */}\n {statParts.length > 0 && (\n <p class=\"m-0 mt-5 text-[13px] text-ink-500 dark:text-ink-400\">\n {statParts.map((part, i) => (\n <>\n {i > 0 && <span aria-hidden=\"true\" class=\"mx-2 opacity-60\">·</span>}\n <span>{part}</span>\n </>\n ))}\n </p>\n )}\n\n {/* Primary CTA only */}\n {primaryCta && (\n <div class=\"mt-8\">\n <a\n href={primaryCta.href}\n class=\"inline-flex h-11 cursor-pointer items-center justify-center gap-2 rounded-[var(--radius)] border border-transparent bg-primary px-5 text-[15px] font-medium leading-none text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\"\n {...(primaryCta.external ? { target: \"_blank\", rel: \"noopener
|
|
273
|
+
"content": "---\nimport { compact } from '@grove-dev/core';\n/**\n * Hero — the home page banner.\n *\n * Mirrors the openapps layout: trust-stats row across the top,\n * big two-line headline with a gradient accent on the second\n * line, descriptive paragraph, search form with a Filters\n * shortcut, quick-filter chips, and up to 3 CTAs.\n *\n * Generic: every value comes through props (or `siteConfig` for\n * the trust stats). The label next to the count is blueprint-\n * driven via `itemsLabel` — so a project-directory renders\n * \"apps indexed\", a resource-hub renders \"resources indexed\",\n * an ecosystem-map renders \"entities indexed\".\n */\nimport Container from '../../layouts/container.astro';\n\ninterface CTA {\n label: string;\n href: string;\n variant?: 'primary' | 'outline' | 'ghost';\n external?: boolean;\n}\n\ninterface Props {\n /** Site/brand name. */\n name: string;\n /** Short tagline — usually pulled from siteConfig.tagline. */\n tagline: string;\n /** Longer descriptive paragraph. */\n description?: string;\n /** Trust stats: items count, categories, stacks, owners, stars. */\n stats?: {\n totalApps?: number;\n totalCategories?: number;\n totalStacks?: number;\n totalOwners?: number;\n totalStars?: number;\n };\n /** Search form target — the list page. */\n searchHref?: string;\n /** Search input placeholder. */\n searchPlaceholder?: string;\n /**\n * Plural noun for the primary count (e.g. \"apps\", \"resources\",\n * \"entities\"). Used in the trust-stats label and CTA copy.\n */\n itemsLabel?: string;\n /** Quick filter chips under the search bar. */\n quickFilters?: Array<{ label: string; href: string }>;\n /** CTAs rendered below the form. */\n ctas?: CTA[];\n /** Extra class. */\n class?: string;\n /** Eyebrow text rendered above the title. */\n eyebrow?: string;\n /** Optional badge content rendered next to the eyebrow. */\n eyebrowBadge?: string;\n}\n\nconst {\n name,\n tagline,\n description,\n stats = {},\n searchHref = '/',\n searchPlaceholder = 'Search the directory...',\n itemsLabel = 'items',\n quickFilters = [],\n ctas = [],\n class: className = '',\n eyebrow = 'A directory of curated knowledge',\n eyebrowBadge,\n} = Astro.props;\n\n// One compact stats line: \"6 projects indexed · 5 categories · 3 stacks\".\n// Every entry is guarded so a fresh directory never renders a zero-value.\nconst statParts: string[] = [\n ...(stats.totalApps !== undefined && stats.totalApps > 0\n ? [`${compact(stats.totalApps)} ${itemsLabel} indexed`]\n : []),\n ...(stats.totalCategories !== undefined && stats.totalCategories > 0\n ? [`${stats.totalCategories} categories`]\n : []),\n ...(stats.totalStacks !== undefined && stats.totalStacks > 0\n ? [`${stats.totalStacks} stacks`]\n : []),\n ...(stats.totalOwners !== undefined && stats.totalOwners > 0\n ? [`${compact(stats.totalOwners)} owners`]\n : []),\n ...(stats.totalStars !== undefined && stats.totalStars > 0\n ? [`${compact(stats.totalStars)} stars`]\n : []),\n];\n\n// One primary CTA only — Submit already lives in the navbar\n// (BaseLayout → Header submitHref), so the hero never duplicates it.\nconst primaryCta: CTA | undefined = ctas.find((c) => c.variant === 'primary') ??\n ctas[0] ?? { label: `Browse ${itemsLabel}`, href: searchHref, variant: 'primary' };\n---\n\n<section\n class:list={[\n \"relative overflow-hidden border-b border-ink-200 dark:border-ink-800\",\n className,\n ]}\n>\n {/* Dark mode only: a barely-there radial lift behind the headline. */}\n <div\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute inset-0 hidden dark:block\"\n style=\"background: radial-gradient(60% 55% at 50% 0%, color-mix(in oklab, var(--grove-foreground) 5%, transparent) 0%, transparent 70%);\"\n ></div>\n\n <Container>\n <div class=\"relative mx-auto flex max-w-[900px] flex-col items-center py-[88px] text-center lg:py-[104px]\">\n {/* Eyebrow. The `eyebrow` slot replaces the whole line — dot\n included — so a consumer can put richer content here (a\n `PoweredBy` link, a release badge) without forking the Hero. */}\n <span class=\"inline-flex animate-fade-in items-center gap-2 text-[13px] font-medium text-ink-500 dark:text-ink-400\">\n <slot name=\"eyebrow\">\n <span aria-hidden=\"true\" class=\"inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-success\"></span>\n {eyebrow}\n {eyebrowBadge && (\n <span\n class=\"inline-flex items-center rounded-full border border-warning/30 bg-warning/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-warning\"\n aria-label={eyebrowBadge}\n >\n {eyebrowBadge}\n </span>\n )}\n </slot>\n </span>\n\n {/* Headline */}\n <h1\n class=\"m-0 mt-5 max-w-[820px] animate-fade-in-up text-balance text-[clamp(44px,5vw,64px)] font-[650] leading-[1.08] tracking-[-0.035em] text-ink-900 dark:text-ink-100\"\n style=\"animation-delay: 0.05s;\"\n >\n <span class=\"block\">{name}</span>\n <span class=\"block\">{tagline}</span>\n </h1>\n\n {description && (\n <p\n class=\"m-0 mt-5 max-w-[640px] animate-fade-in-up text-[16px] leading-[1.6] text-ink-500 dark:text-ink-400\"\n style=\"animation-delay: 0.1s;\"\n >\n {description}\n </p>\n )}\n\n {/* Search — primary interaction. The FORM is the visual control:\n it owns the border, radius, and the single focus treatment\n (focus-within border + soft ring). The inner input opts out\n of the global input styling (`grove-input-unstyled`) so it\n stays a transparent, chrome-free text slot — no second box\n or ring appearing inside the pill on focus. */}\n <form\n class=\"mt-8 flex h-[58px] w-full max-w-[840px] animate-fade-in-up items-center gap-3 rounded-xl border border-ink-200 bg-background p-1.5 pl-4 transition-[border-color,box-shadow] focus-within:border-ink-400 focus-within:ring-3 focus-within:ring-ring/15 dark:border-ink-800 dark:focus-within:border-ink-600\"\n style=\"animation-delay: 0.15s;\"\n role=\"search\"\n action={searchHref}\n method=\"get\"\n >\n <label class=\"flex min-w-0 flex-1 items-center gap-3\">\n <span class=\"sr-only\">Search {itemsLabel}, stacks, and categories</span>\n <svg viewBox=\"0 0 16 16\" width=\"20\" height=\"20\" aria-hidden=\"true\" class=\"shrink-0 text-ink-400 dark:text-ink-500\" fill=\"currentColor\">\n <path d=\"M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z\"></path>\n </svg>\n <input\n type=\"search\"\n name=\"q\"\n placeholder={searchPlaceholder}\n class=\"grove-input-unstyled h-full w-full min-w-0 rounded-none border-0 bg-transparent px-0 text-[16px] text-ink-900 outline-none placeholder:text-ink-400 dark:text-ink-100 dark:placeholder:text-ink-500\"\n />\n </label>\n <button\n type=\"submit\"\n class=\"inline-flex h-[46px] shrink-0 cursor-pointer items-center justify-center rounded-lg border border-transparent bg-primary px-5 text-[15px] font-medium leading-none text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\"\n >\n Search\n </button>\n </form>\n\n {quickFilters.length > 0 && (\n <p class=\"m-0 mt-4 text-[13px] text-ink-500 dark:text-ink-400\">\n Try{\" \"}\n {quickFilters.map((f, i) => (\n <>\n <a href={f.href} class=\"font-mono text-ink-700 underline-offset-2 hover:underline dark:text-ink-300\">{f.label}</a>\n {i < quickFilters.length - 1 && <span aria-hidden=\"true\" class=\"mx-1\">·</span>}\n </>\n ))}\n </p>\n )}\n\n {/* Inline stats — single compact line, middle-dot separators */}\n {statParts.length > 0 && (\n <p class=\"m-0 mt-5 text-[13px] text-ink-500 dark:text-ink-400\">\n {statParts.map((part, i) => (\n <>\n {i > 0 && <span aria-hidden=\"true\" class=\"mx-2 opacity-60\">·</span>}\n <span>{part}</span>\n </>\n ))}\n </p>\n )}\n\n {/* Primary CTA only */}\n {primaryCta && (\n <div class=\"mt-8\">\n <a\n href={primaryCta.href}\n class=\"inline-flex h-11 cursor-pointer items-center justify-center gap-2 rounded-[var(--radius)] border border-transparent bg-primary px-5 text-[15px] font-medium leading-none text-primary-foreground outline-none transition-colors hover:bg-primary/90 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\"\n {...(primaryCta.external ? { target: \"_blank\", rel: \"noopener\" } : {})}\n data-event=\"hero_cta_click\"\n data-event-source=\"hero\"\n >\n {primaryCta.label}\n <svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path d=\"M5 12h14\"></path>\n <path d=\"m12 5 7 7-7 7\"></path>\n </svg>\n </a>\n </div>\n )}\n\n {/* Social proof under the CTA — see HeroProof. */}\n <slot name=\"proof\" />\n </div>\n </Container>\n</section>\n",
|
|
244
274
|
"type": "registry:component",
|
|
245
275
|
"target": "~/src/components/grove/hero.astro"
|
|
246
276
|
},
|
|
@@ -252,7 +282,7 @@
|
|
|
252
282
|
},
|
|
253
283
|
{
|
|
254
284
|
"path": "default/components/grove/pipeline-strip.astro",
|
|
255
|
-
"content": "---\n/**\n * PipelineStrip — the file-first publishing story.\n *\n * Three beats: a record YAML (source of truth) → the Grove build →\n * the published outputs (this site, README, llms.txt, sitemap),\n * plus the sync loop (edits arrive as pull requests, automation\n * keeps every output current). The sample record shown is\n * illustrative markup, not live data — pass `samplePath` (a real\n * repo-relative path to one of your own records) to turn the \"Read\n * this file on GitHub\" link on; without it, the link is omitted.\n */\n\ninterface Props {\n /** Repository URL for the \"read the source\" link. */\n repoUrl?: string;\n /** Repo-relative path to a real sample record. No default — a\n * fresh scaffold has no records yet, so the link is omitted\n * unless you supply one. */\n samplePath?: string;\n class?: string;\n}\n\nconst { repoUrl, samplePath, class: className = '' } = Astro.props;\n\nconst sampleHref = repoUrl ? `${repoUrl.replace(/\\/$/, '')}/blob/main/${samplePath}` : undefined;\n\nconst outputs = [\n { label: 'This website', detail: 'browse, search, filters' },\n { label: 'README', detail: 'awesome-list generated' },\n { label: 'llms.txt', detail: 'machine-readable index' },\n { label: 'Sitemap + SEO', detail: 'structured data' },\n];\n---\n\n<section\n id=\"pipeline\"\n class:list={[\"scroll-mt-20 border-b border-border py-12 sm:py-16\", className]}\n aria-labelledby=\"pipeline-heading\"\n>\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <header class=\"flex flex-col gap-2\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n How this site works\n </span>\n <h2\n id=\"pipeline-heading\"\n class=\"m-0 max-w-[40ch] text-[1.5rem] font-semibold tracking-tight text-foreground sm:text-[1.75rem]\"\n >\n Every listing is a plain YAML file.\n </h2>\n <p class=\"m-0 max-w-[64ch] text-[0.9375rem] leading-relaxed text-muted-foreground\">\n The content you're browsing lives as files in a repository. Grove builds them\n into this site and its machine-readable outputs — and keeps everything in sync\n when a file changes.\n </p>\n </header>\n\n <div class=\"mt-7 grid grid-cols-1 gap-3 md:grid-cols-3\">\n {/* Beat 1 — the source file */}\n <div class=\"flex flex-col rounded-[calc(var(--radius)+0.25rem)] border border-border bg-surface-raised p-4\">\n <p class=\"m-0 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n 1 · Source file\n </p>\n <pre\n class=\"mt-3 flex-1 overflow-x-auto rounded-md bg-surface-sunken p-3 font-mono text-[0.75rem] leading-relaxed text-foreground\"\n ><code>name: Open WebUI\nslug: open-webui\ncategory: interfaces\nstacks: [typescript, python]\ntags: [chat, self-host, llm]\nlicenses: [mit]</code></pre>\n {sampleHref && (\n <a\n href={sampleHref}\n target=\"_blank\"\n rel=\"noopener
|
|
285
|
+
"content": "---\n/**\n * PipelineStrip — the file-first publishing story.\n *\n * Three beats: a record YAML (source of truth) → the Grove build →\n * the published outputs (this site, README, llms.txt, sitemap),\n * plus the sync loop (edits arrive as pull requests, automation\n * keeps every output current). The sample record shown is\n * illustrative markup, not live data — pass `samplePath` (a real\n * repo-relative path to one of your own records) to turn the \"Read\n * this file on GitHub\" link on; without it, the link is omitted.\n */\n\ninterface Props {\n /** Repository URL for the \"read the source\" link. */\n repoUrl?: string;\n /** Repo-relative path to a real sample record. No default — a\n * fresh scaffold has no records yet, so the link is omitted\n * unless you supply one. */\n samplePath?: string;\n class?: string;\n}\n\nconst { repoUrl, samplePath, class: className = '' } = Astro.props;\n\nconst sampleHref = repoUrl ? `${repoUrl.replace(/\\/$/, '')}/blob/main/${samplePath}` : undefined;\n\nconst outputs = [\n { label: 'This website', detail: 'browse, search, filters' },\n { label: 'README', detail: 'awesome-list generated' },\n { label: 'llms.txt', detail: 'machine-readable index' },\n { label: 'Sitemap + SEO', detail: 'structured data' },\n];\n---\n\n<section\n id=\"pipeline\"\n class:list={[\"scroll-mt-20 border-b border-border py-12 sm:py-16\", className]}\n aria-labelledby=\"pipeline-heading\"\n>\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <header class=\"flex flex-col gap-2\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n How this site works\n </span>\n <h2\n id=\"pipeline-heading\"\n class=\"m-0 max-w-[40ch] text-[1.5rem] font-semibold tracking-tight text-foreground sm:text-[1.75rem]\"\n >\n Every listing is a plain YAML file.\n </h2>\n <p class=\"m-0 max-w-[64ch] text-[0.9375rem] leading-relaxed text-muted-foreground\">\n The content you're browsing lives as files in a repository. Grove builds them\n into this site and its machine-readable outputs — and keeps everything in sync\n when a file changes.\n </p>\n </header>\n\n <div class=\"mt-7 grid grid-cols-1 gap-3 md:grid-cols-3\">\n {/* Beat 1 — the source file */}\n <div class=\"flex flex-col rounded-[calc(var(--radius)+0.25rem)] border border-border bg-surface-raised p-4\">\n <p class=\"m-0 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n 1 · Source file\n </p>\n <pre\n class=\"mt-3 flex-1 overflow-x-auto rounded-md bg-surface-sunken p-3 font-mono text-[0.75rem] leading-relaxed text-foreground\"\n ><code>name: Open WebUI\nslug: open-webui\ncategory: interfaces\nstacks: [typescript, python]\ntags: [chat, self-host, llm]\nlicenses: [mit]</code></pre>\n {sampleHref && (\n <a\n href={sampleHref}\n target=\"_blank\"\n rel=\"noopener\"\n class=\"mt-3 text-2xs font-medium text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground\"\n >\n Read this file on GitHub →\n </a>\n )}\n </div>\n\n {/* Beat 2 — the build */}\n <div class=\"flex flex-col rounded-[calc(var(--radius)+0.25rem)] border border-border bg-surface-raised p-4\">\n <p class=\"m-0 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n 2 · Grove build\n </p>\n <ul class=\"m-0 mt-3 flex flex-1 list-none flex-col gap-2 p-0 text-[0.8125rem] leading-relaxed text-muted-foreground\">\n <li>Validates every record against the schema</li>\n <li>Joins taxonomy labels, health, and GitHub metadata</li>\n <li>Generates one index consumed by every output</li>\n </ul>\n <p class=\"m-0 mt-3 font-mono text-2xs text-muted-foreground\">grove check && astro build</p>\n </div>\n\n {/* Beat 3 — the outputs */}\n <div class=\"flex flex-col rounded-[calc(var(--radius)+0.25rem)] border border-border bg-surface-raised p-4\">\n <p class=\"m-0 text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n 3 · Published outputs\n </p>\n <ul class=\"m-0 mt-3 flex flex-1 list-none flex-col gap-2 p-0\">\n {outputs.map((output) => (\n <li class=\"flex items-baseline justify-between gap-3 text-[0.8125rem]\">\n <span class=\"font-medium text-foreground\">{output.label}</span>\n <span class=\"text-right text-2xs text-muted-foreground\">{output.detail}</span>\n </li>\n ))}\n </ul>\n </div>\n </div>\n\n <p class=\"m-0 mt-4 text-[0.8125rem] leading-relaxed text-muted-foreground\">\n The loop: edits arrive as pull requests to the files, weekly automation refreshes\n GitHub metadata, and every output above is regenerated from the same source —\n nothing is entered twice, nothing goes stale.\n </p>\n </div>\n</section>\n",
|
|
256
286
|
"type": "registry:component",
|
|
257
287
|
"target": "~/src/components/grove/pipeline-strip.astro"
|
|
258
288
|
},
|
|
@@ -264,13 +294,13 @@
|
|
|
264
294
|
},
|
|
265
295
|
{
|
|
266
296
|
"path": "default/components/grove/contributors-grid.astro",
|
|
267
|
-
"content": "---\n/**\n * ContributorsGrid — avatar grid for the home page.\n *\n * Renders a dense grid of contributor avatars with optional name and\n * contribution count. Each tile links to the contributor's profile.\n * No blueprint-specific terms — works for any \"people\" feed.\n *\n * Empty tiles are skipped. When the list is empty the entire section\n * hides its body but keeps the header (so a \"no contributors yet\"\n * state can be wired by a consumer via a slot).\n */\n\nimport { compact } from '@grove-dev/core';\nimport EmptyState from '../ui/empty-state.astro';\n\ninterface Contributor {\n username: string;\n name?: string;\n avatarUrl?: string;\n profileUrl?: string;\n contributions?: number;\n}\n\ninterface Props {\n contributors: Contributor[];\n /** Total count to display in the header (e.g. \"1,234 contributors\"). */\n total?: number;\n /** Optional view-all href rendered top-right. */\n viewAllHref?: string;\n viewAllLabel?: string;\n title?: string;\n description?: string;\n /** Render per-user contribution counts (config: contributors.showContributionCount). */\n showContributionCount?: boolean;\n class?: string;\n}\n\nconst {\n contributors,\n total,\n viewAllHref,\n viewAllLabel = 'View all',\n title = 'Built by the community',\n description = 'The people improving this directory through code, curation, and review.',\n showContributionCount = true,\n class: className = '',\n} = Astro.props;\n\nconst visible = contributors.filter((c) => c.username).slice(0, 100);\n---\n\n<section\n class:list={[\"py-12 sm:py-16\", className]}\n aria-labelledby=\"grove-contributors-heading\"\n>\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <header class=\"mb-6 flex flex-wrap items-end justify-between gap-3\">\n <div>\n <h2\n id=\"grove-contributors-heading\"\n class=\"m-0 text-[1.5rem] sm:text-[1.625rem] font-semibold tracking-tight text-ink-900 dark:text-ink-100\"\n >\n {title}\n {typeof total === \"number\" && (\n <span class=\"ml-2 font-mono text-[0.9375rem] font-normal text-ink-500 dark:text-ink-400\">\n ({compact(total)})\n </span>\n )}\n </h2>\n {description && (\n <p class=\"m-0 mt-1 max-w-[60ch] text-[0.9375rem] text-ink-500 dark:text-ink-400\">\n {description}\n </p>\n )}\n </div>\n {viewAllHref && (\n <a\n href={viewAllHref}\n class=\"text-sm font-medium text-ink-500 hover:text-ink-900 dark:text-ink-400 dark:hover:text-ink-100\"\n >\n {viewAllLabel} →\n </a>\n )}\n </header>\n\n {visible.length === 0 ? (\n <EmptyState title=\"Community profiles appear after the first repository metadata sync.\" />\n ) : (\n <ul\n class=\"m-0 grid list-none grid-cols-[repeat(auto-fill,minmax(72px,1fr))] gap-x-3 gap-y-5 p-0\"\n aria-label=\"Contributors\"\n >\n {visible.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
|
|
297
|
+
"content": "---\n/**\n * ContributorsGrid — avatar grid for the home page.\n *\n * Renders a dense grid of contributor avatars with optional name and\n * contribution count. Each tile links to the contributor's profile.\n * No blueprint-specific terms — works for any \"people\" feed.\n *\n * Empty tiles are skipped. When the list is empty the entire section\n * hides its body but keeps the header (so a \"no contributors yet\"\n * state can be wired by a consumer via a slot).\n */\n\nimport { compact } from '@grove-dev/core';\nimport EmptyState from '../ui/empty-state.astro';\n\ninterface Contributor {\n username: string;\n name?: string;\n avatarUrl?: string;\n profileUrl?: string;\n contributions?: number;\n}\n\ninterface Props {\n contributors: Contributor[];\n /** Total count to display in the header (e.g. \"1,234 contributors\"). */\n total?: number;\n /** Optional view-all href rendered top-right. */\n viewAllHref?: string;\n viewAllLabel?: string;\n title?: string;\n description?: string;\n /** Render per-user contribution counts (config: contributors.showContributionCount). */\n showContributionCount?: boolean;\n class?: string;\n}\n\nconst {\n contributors,\n total,\n viewAllHref,\n viewAllLabel = 'View all',\n title = 'Built by the community',\n description = 'The people improving this directory through code, curation, and review.',\n showContributionCount = true,\n class: className = '',\n} = Astro.props;\n\nconst visible = contributors.filter((c) => c.username).slice(0, 100);\n---\n\n<section\n class:list={[\"py-12 sm:py-16\", className]}\n aria-labelledby=\"grove-contributors-heading\"\n>\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <header class=\"mb-6 flex flex-wrap items-end justify-between gap-3\">\n <div>\n <h2\n id=\"grove-contributors-heading\"\n class=\"m-0 text-[1.5rem] sm:text-[1.625rem] font-semibold tracking-tight text-ink-900 dark:text-ink-100\"\n >\n {title}\n {typeof total === \"number\" && (\n <span class=\"ml-2 font-mono text-[0.9375rem] font-normal text-ink-500 dark:text-ink-400\">\n ({compact(total)})\n </span>\n )}\n </h2>\n {description && (\n <p class=\"m-0 mt-1 max-w-[60ch] text-[0.9375rem] text-ink-500 dark:text-ink-400\">\n {description}\n </p>\n )}\n </div>\n {viewAllHref && (\n <a\n href={viewAllHref}\n class=\"text-sm font-medium text-ink-500 hover:text-ink-900 dark:text-ink-400 dark:hover:text-ink-100\"\n >\n {viewAllLabel} →\n </a>\n )}\n </header>\n\n {visible.length === 0 ? (\n <EmptyState title=\"Community profiles appear after the first repository metadata sync.\" />\n ) : (\n <ul\n class=\"m-0 grid list-none grid-cols-[repeat(auto-fill,minmax(72px,1fr))] gap-x-3 gap-y-5 p-0\"\n aria-label=\"Contributors\"\n >\n {visible.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\"\n class=\"group flex flex-col items-center gap-1.5 p-2 text-center no-underline\"\n data-event=\"contributor_click\"\n data-event-source=\"contributors_grid\"\n >\n <img\n src={avatar}\n alt={c.name ?? c.username}\n width=\"48\"\n height=\"48\"\n loading=\"lazy\"\n decoding=\"async\"\n class=\"h-12 w-12 rounded-full border border-ink-200 object-cover dark:border-ink-800\"\n />\n <span class=\"line-clamp-1 text-2xs 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 {showContributionCount && typeof c.contributions === \"number\" && (\n <span class=\"font-mono text-2xs text-ink-400\">\n {compact(c.contributions)}\n </span>\n )}\n </a>\n </li>\n );\n })}\n </ul>\n )}\n </div>\n</section>\n",
|
|
268
298
|
"type": "registry:component",
|
|
269
299
|
"target": "~/src/components/grove/contributors-grid.astro"
|
|
270
300
|
},
|
|
271
301
|
{
|
|
272
302
|
"path": "default/components/grove/original-collection.astro",
|
|
273
|
-
"content": "---\nimport { compact } from '@grove-dev/core';\n/**\n * OriginalCollection — legacy lineage card.\n *\n * Renders a single wide card that links out to the project's origin\n * repository, with stars/forks/contributors stats. Used on home and\n * about pages to give visitors a way to find the original curated\n * collection this directory descends from.\n *\n * Generic: takes plain `stats` and a `repoUrl`. No blueprint or\n * site-specific copy.\n */\nimport { buttonClass } from '../../lib/classnames.ts';\n\ninterface OriginStats {\n stars?: number;\n forks?: number;\n contributors?: number;\n description?: string;\n}\n\ninterface Props {\n repoUrl: string;\n repoLabel?: string;\n stats?: OriginStats;\n title?: string;\n description?: string;\n class?: string;\n}\n\nconst {\n repoUrl,\n repoLabel = 'View on GitHub',\n stats = {},\n title = 'A growing list, forked from the original',\n description = 'This directory descends from an earlier curated collection. The original still lives on — same shape, same spirit, fresh data.',\n class: className = '',\n} = Astro.props;\n\nconst hasStats =\n stats.stars !== undefined || stats.forks !== undefined || stats.contributors !== undefined;\n---\n\n<section class:list={[\"py-12 sm:py-16\", className]}>\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <div\n class=\"rounded-[calc(var(--radius)+0.25rem)] border border-border bg-card shadow-none transition-colors flex flex-col gap-4 p-6 sm:flex-row sm:items-center sm:justify-between\"\n >\n <div class=\"flex flex-col gap-2\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">\n Origin\n </span>\n <h2 class=\"m-0 text-[1.25rem] font-semibold tracking-tight text-ink-900 dark:text-ink-100\">\n {title}\n </h2>\n <p class=\"m-0 max-w-2xl text-[0.875rem] text-ink-500 dark:text-ink-400\">\n {description}\n </p>\n {stats.description && (\n <p class=\"m-0 max-w-2xl text-[0.8125rem] text-ink-500 dark:text-ink-400\">\n {stats.description}\n </p>\n )}\n {hasStats && (\n <dl\n class=\"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-2xs text-ink-500 dark:text-ink-400\"\n aria-label=\"Original repository signals\"\n >\n {stats.stars !== undefined && (\n <div class=\"flex items-center gap-1\">\n <dd class=\"m-0 font-mono\">{compact(stats.stars)}</dd>\n <dt>stars</dt>\n </div>\n )}\n {stats.forks !== undefined && (\n <div class=\"flex items-center gap-1\">\n <dd class=\"m-0 font-mono\">{compact(stats.forks)}</dd>\n <dt>forks</dt>\n </div>\n )}\n {stats.contributors !== undefined && (\n <div class=\"flex items-center gap-1\">\n <dd class=\"m-0 font-mono\">\n {compact(stats.contributors)}\n </dd>\n <dt>contributors</dt>\n </div>\n )}\n </dl>\n )}\n </div>\n <div class=\"flex flex-shrink-0 items-center gap-2\">\n <a\n href={repoUrl}\n target=\"_blank\"\n rel=\"noopener
|
|
303
|
+
"content": "---\nimport { compact } from '@grove-dev/core';\n/**\n * OriginalCollection — legacy lineage card.\n *\n * Renders a single wide card that links out to the project's origin\n * repository, with stars/forks/contributors stats. Used on home and\n * about pages to give visitors a way to find the original curated\n * collection this directory descends from.\n *\n * Generic: takes plain `stats` and a `repoUrl`. No blueprint or\n * site-specific copy.\n */\nimport { buttonClass } from '../../lib/classnames.ts';\n\ninterface OriginStats {\n stars?: number;\n forks?: number;\n contributors?: number;\n description?: string;\n}\n\ninterface Props {\n repoUrl: string;\n repoLabel?: string;\n stats?: OriginStats;\n title?: string;\n description?: string;\n class?: string;\n}\n\nconst {\n repoUrl,\n repoLabel = 'View on GitHub',\n stats = {},\n title = 'A growing list, forked from the original',\n description = 'This directory descends from an earlier curated collection. The original still lives on — same shape, same spirit, fresh data.',\n class: className = '',\n} = Astro.props;\n\nconst hasStats =\n stats.stars !== undefined || stats.forks !== undefined || stats.contributors !== undefined;\n---\n\n<section class:list={[\"py-12 sm:py-16\", className]}>\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <div\n class=\"rounded-[calc(var(--radius)+0.25rem)] border border-border bg-card shadow-none transition-colors flex flex-col gap-4 p-6 sm:flex-row sm:items-center sm:justify-between\"\n >\n <div class=\"flex flex-col gap-2\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-ink-500 dark:text-ink-400\">\n Origin\n </span>\n <h2 class=\"m-0 text-[1.25rem] font-semibold tracking-tight text-ink-900 dark:text-ink-100\">\n {title}\n </h2>\n <p class=\"m-0 max-w-2xl text-[0.875rem] text-ink-500 dark:text-ink-400\">\n {description}\n </p>\n {stats.description && (\n <p class=\"m-0 max-w-2xl text-[0.8125rem] text-ink-500 dark:text-ink-400\">\n {stats.description}\n </p>\n )}\n {hasStats && (\n <dl\n class=\"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-2xs text-ink-500 dark:text-ink-400\"\n aria-label=\"Original repository signals\"\n >\n {stats.stars !== undefined && (\n <div class=\"flex items-center gap-1\">\n <dd class=\"m-0 font-mono\">{compact(stats.stars)}</dd>\n <dt>stars</dt>\n </div>\n )}\n {stats.forks !== undefined && (\n <div class=\"flex items-center gap-1\">\n <dd class=\"m-0 font-mono\">{compact(stats.forks)}</dd>\n <dt>forks</dt>\n </div>\n )}\n {stats.contributors !== undefined && (\n <div class=\"flex items-center gap-1\">\n <dd class=\"m-0 font-mono\">\n {compact(stats.contributors)}\n </dd>\n <dt>contributors</dt>\n </div>\n )}\n </dl>\n )}\n </div>\n <div class=\"flex flex-shrink-0 items-center gap-2\">\n <a\n href={repoUrl}\n target=\"_blank\"\n rel=\"noopener\"\n class={buttonClass(\"primary\", \"sm\")}\n data-event=\"original_collection_click\"\n data-event-source=\"original_collection\"\n >\n {repoLabel} →\n </a>\n </div>\n </div>\n </div>\n</section>\n",
|
|
274
304
|
"type": "registry:component",
|
|
275
305
|
"target": "~/src/components/grove/original-collection.astro"
|
|
276
306
|
},
|
|
@@ -280,6 +310,12 @@
|
|
|
280
310
|
"type": "registry:component",
|
|
281
311
|
"target": "~/src/components/grove/final-cta.astro"
|
|
282
312
|
},
|
|
313
|
+
{
|
|
314
|
+
"path": "default/components/grove/hero-proof.astro",
|
|
315
|
+
"content": "---\n/**\n * HeroProof — the proof row under the home hero, and the \"featured in\"\n * pill for its eyebrow.\n *\n * `variant=\"pill\"` renders the newest `site.press` mention as a link\n * for the hero's `eyebrow` slot. `variant=\"row\"` renders contributor\n * faces and count, the site repository's stars and the newest mention.\n * Every value comes from site-config.json; parts with no data are left\n * out, so a new site shows nothing rather than zeros.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport { compact } from '@grove-dev/core';\n\ninterface Props {\n variant: 'pill' | 'row';\n /** Contributors for the faces (the home model's `contributors`). */\n contributors?: Array<{ username: string; avatarUrl?: string }>;\n slot?: string;\n}\n\nconst { variant, contributors = [] } = Astro.props;\ntype Press = {\n outlet: string;\n title: string;\n url: string;\n date: string;\n label?: string;\n logo?: string;\n};\nconst site = siteConfig as {\n press?: Press[];\n repoUrl?: string;\n stats?: { repositoryStars?: number; repositoryContributors?: number };\n};\nconst featured = site.press?.[0];\nconst stars = site.stats?.repositoryStars ?? 0;\nconst people = site.stats?.repositoryContributors || contributors.length;\nconst faces = contributors.filter((c) => c.avatarUrl).slice(0, 5);\nconst monthYear = (date: string) =>\n new Date(`${date}-01T00:00:00Z`).toLocaleDateString('en-US', {\n month: 'long',\n year: 'numeric',\n timeZone: 'UTC',\n });\n---\n\n{variant === 'pill' ? (\n featured && (\n <a\n href={featured.url}\n target=\"_blank\"\n rel=\"noopener\"\n class=\"group inline-flex items-center gap-2 rounded-full border border-border bg-secondary py-1 pl-1.5 pr-3 text-[13px] font-medium text-secondary-foreground no-underline transition-colors hover:border-ink-400 dark:hover:border-ink-600\"\n data-event=\"press_click\"\n data-event-source=\"hero_eyebrow\"\n data-event-item={featured.outlet}\n >\n {featured.logo ? (\n <span class=\"inline-flex h-5 w-5 items-center justify-center rounded-full bg-white p-0.5\"><img src={featured.logo} alt=\"\" width=\"14\" height=\"14\" class=\"h-3.5 w-3.5\" /></span>\n ) : (\n <span aria-hidden=\"true\" class=\"inline-block h-1.5 w-1.5 rounded-full bg-success\"></span>\n )}\n {featured.label ?? `Featured in ${featured.outlet} · ${monthYear(featured.date)}`}\n <span aria-hidden=\"true\" class=\"text-muted-foreground transition-transform group-hover:translate-x-0.5\">→</span>\n </a>\n )\n) : (\n (faces.length > 0 || stars > 0 || featured) && (\n <div class=\"mt-8 flex flex-wrap items-center justify-center gap-x-6 gap-y-3 text-[13px] text-ink-500 dark:text-ink-400\">\n {faces.length > 0 && (\n <a href=\"/contributors/\" class=\"inline-flex items-center gap-2.5 text-inherit no-underline hover:text-foreground\">\n <span class=\"flex -space-x-2\" aria-hidden=\"true\">\n {faces.map((c) => (\n <img src={`${c.avatarUrl}${c.avatarUrl!.includes('?') ? '&' : '?'}s=48`} alt=\"\" width=\"24\" height=\"24\" loading=\"lazy\" decoding=\"async\" class=\"h-6 w-6 rounded-full border-2 border-background\" />\n ))}\n </span>\n <span><strong class=\"font-semibold text-foreground\">{people}</strong> contributors</span>\n </a>\n )}\n {stars > 0 && site.repoUrl && (\n <a href={site.repoUrl} target=\"_blank\" rel=\"noopener\" class=\"inline-flex items-center gap-1.5 text-inherit no-underline hover:text-foreground\">\n <svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-warning\"><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></svg>\n <span><strong class=\"font-semibold text-foreground\">{compact(stars)}</strong> stars on GitHub</span>\n </a>\n )}\n {featured && (\n <a href={featured.url} target=\"_blank\" rel=\"noopener\" class=\"inline-flex items-center gap-1.5 text-inherit no-underline hover:text-foreground\" data-event=\"press_click\" data-event-source=\"hero_proof\" data-event-item={featured.outlet}>\n {featured.logo && <span class=\"inline-flex h-4 w-4 items-center justify-center rounded-full bg-white p-px\"><img src={featured.logo} alt=\"\" width=\"12\" height=\"12\" class=\"h-3 w-3\" /></span>}\n <span>Featured by <strong class=\"font-semibold text-foreground\">{featured.outlet}</strong></span>\n </a>\n )}\n </div>\n )\n)}\n",
|
|
316
|
+
"type": "registry:component",
|
|
317
|
+
"target": "~/src/components/grove/hero-proof.astro"
|
|
318
|
+
},
|
|
283
319
|
{
|
|
284
320
|
"path": "default/pages/[slug]/index.astro",
|
|
285
321
|
"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",
|
|
@@ -372,13 +408,13 @@
|
|
|
372
408
|
},
|
|
373
409
|
{
|
|
374
410
|
"path": "default/components/grove/record-header.astro",
|
|
375
|
-
"content": "---\n/**\n * RecordHeader.astro\n *\n * Compact project-identity header used at the top of every record\n * detail page. The header carries:\n * - avatar / initials\n * - pills row (category + curation labels + \"Curated\" check +\n * optional activity badge)\n * - record name + owner/repo line\n * - short description\n * - GitHub + Homepage CTAs\n *\n * Tags + activity metadata are surfaced separately (sidebar), so\n * the header stays narrow on mobile and doesn't compete with the\n * two-column layout below.\n *\n * Tone classes for the activity badge are static `[data-activity-tone]`\n * selectors in `styles.css` — Tailwind purges any classes built from\n * dynamic strings, so the package ships the rules statically and\n * the badge's `data-activity-tone` attribute picks one at runtime.\n */\nimport type { RecordDetailModel } from '@grove-dev/astro/server';\nimport { buttonClass } from '../../lib/classnames.ts';\n\ninterface Props {\n detail: RecordDetailModel;\n}\n\nconst { detail } = Astro.props;\nconst {\n record,\n repoUrl,\n homepageUrl,\n ownerRepo,\n avatarSrc,\n initials,\n curationLabels,\n activityBadge,\n summary,\n sourceDescription,\n screenshots,\n category,\n name,\n} = detail;\n---\n\n<header class=\"mb-8\">\n {/* Identity row: logo sized to the name+repo block beside it — no\n tall avatar column leaving dead space under the logo. Pills sit\n at the row's right edge on wide viewports and wrap below on\n mobile. */}\n <div class=\"flex items-center gap-4\">\n {/* Initials stay in the DOM behind the logo and are revealed by the\n image's own `onerror` — a dead logo URL or a renamed GitHub org\n would otherwise render the broken-image glyph. */}\n {avatarSrc && (\n <img\n src={avatarSrc}\n alt=\"\"\n width=\"56\"\n height=\"56\"\n loading=\"lazy\"\n decoding=\"async\"\n onerror=\"this.hidden=true;this.nextElementSibling.hidden=false\"\n class=\"h-12 w-12 shrink-0 rounded-lg border border-ink-200 object-contain bg-white p-1 dark:border-ink-800 sm:h-14 sm:w-14\"\n />\n )}\n <span\n aria-hidden=\"true\"\n hidden={Boolean(avatarSrc)}\n data-grove-card-fallback-initials\n class=\"inline-flex h-12 w-12 shrink-0 items-center justify-center rounded-lg border border-ink-200 bg-ink-50 text-xl font-semibold text-ink-700 dark:border-ink-800 dark:bg-ink-900 dark:text-ink-200 sm:h-14 sm:w-14\"\n >\n {initials || \"·\"}\n </span>\n\n <div class=\"min-w-0 flex-1\">\n <h1 class=\"m-0 text-[1.75rem] font-semibold leading-tight tracking-tight text-ink-900 dark:text-ink-100 sm:text-[2rem]\">\n {name}\n </h1>\n {ownerRepo && (\n <p class=\"m-0 mt-0.5 text-sm text-ink-500 dark:text-ink-400\">\n <a\n href={`https://github.com/${ownerRepo.owner}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"text-inherit no-underline hover:text-ink-900 dark:hover:text-ink-100\"\n >\n @{ownerRepo.owner}\n </a>\n <span class=\"mx-1 text-ink-300 dark:text-ink-700\">/</span>\n <a\n href={repoUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"text-inherit no-underline hover:text-ink-900 dark:hover:text-ink-100\"\n >\n {ownerRepo.repo}\n </a>\n </p>\n )}\n </div>\n\n {/* Pills — right-aligned beside the name on wide viewports. */}\n <div class=\"hidden shrink-0 flex-wrap items-center justify-end gap-1.5 md:flex\">\n {category && (\n <span class=\"rounded-full border border-ink-200 px-2 py-0.5 text-2xs font-medium text-ink-700 dark:border-ink-800 dark:text-ink-300\">\n {category}\n </span>\n )}\n {curationLabels.map((l) => (\n <span class=\"rounded-full bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground\">\n {l}\n </span>\n ))}\n {/* Curated = reviewed provenance, not a success status. */}\n {record.curation?.reviewed && (\n <span class=\"inline-flex items-center gap-1 rounded-full border border-border bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground\">\n <svg viewBox=\"0 0 16 16\" width=\"10\" height=\"10\" aria-hidden=\"true\" fill=\"currentColor\">\n <path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0Zm3.41 5.09a.75.75 0 0 0-1.06 0L6.75 8.69 5.65 7.59a.75.75 0 1 0-1.06 1.06l1.65 1.65a.75.75 0 0 0 1.06 0l4.11-4.11a.75.75 0 0 0 0-1.06Z\" />\n </svg>\n Curated\n </span>\n )}\n {activityBadge && (\n <span\n data-activity-tone={activityBadge.tone}\n class=\"grove-pill grove-pill--activity inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium\"\n >\n <span class=\"relative flex h-1.5 w-1.5\">\n <span class=\"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-60\"></span>\n <span class=\"relative inline-flex h-1.5 w-1.5 rounded-full bg-current\"></span>\n </span>\n {activityBadge.label}\n </span>\n )}\n </div>\n </div>\n\n {/* Same pills below the identity row on narrow viewports. */}\n <div class=\"mt-3 flex flex-wrap items-center gap-1.5 md:hidden\">\n {category && (\n <span class=\"rounded-full border border-ink-200 px-2 py-0.5 text-2xs font-medium text-ink-700 dark:border-ink-800 dark:text-ink-300\">\n {category}\n </span>\n )}\n {curationLabels.map((l) => (\n <span class=\"rounded-full bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground\">\n {l}\n </span>\n ))}\n {record.curation?.reviewed && (\n <span class=\"inline-flex items-center gap-1 rounded-full border border-border bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground\">\n <svg viewBox=\"0 0 16 16\" width=\"10\" height=\"10\" aria-hidden=\"true\" fill=\"currentColor\">\n <path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0Zm3.41 5.09a.75.75 0 0 0-1.06 0L6.75 8.69 5.65 7.59a.75.75 0 1 0-1.06 1.06l1.65 1.65a.75.75 0 0 0 1.06 0l4.11-4.11a.75.75 0 0 0 0-1.06Z\" />\n </svg>\n Curated\n </span>\n )}\n </div>\n\n {/* Description — full width below the identity row. */}\n {summary && (\n <p class=\"m-0 mt-4 max-w-[72ch] text-base leading-relaxed text-ink-700 dark:text-ink-200\">\n {summary}\n </p>\n )}\n {sourceDescription && sourceDescription !== summary && (\n <p class=\"m-0 mt-2 max-w-[72ch] text-sm leading-relaxed text-ink-500 dark:text-ink-400\">\n <span class=\"text-2xs font-semibold uppercase tracking-wider\">From the project's README: </span>\n {sourceDescription}\n </p>\n )}\n\n {/* CTA row — primary actions only. */}\n <div class=\"mt-4 flex flex-wrap items-center gap-2\">\n {repoUrl && (\n <a\n href={repoUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class={buttonClass(\"primary\", \"sm\")}\n >\n View on GitHub →\n </a>\n )}\n {homepageUrl && (\n <a\n href={homepageUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class={buttonClass(\"secondary\", \"sm\")}\n >\n Homepage\n </a>\n )}\n </div>\n {screenshots && screenshots.length > 0 && (\n <div class=\"mt-6 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3\" aria-label=\"Screenshots\">\n {screenshots.map((shot) => (\n <figure class=\"m-0 overflow-hidden rounded-[var(--radius-lg)] border border-ink-200 bg-muted dark:border-ink-800\">\n <img\n src={shot.src}\n alt={shot.alt}\n loading=\"lazy\"\n decoding=\"async\"\n width={shot.width}\n height={shot.height}\n class=\"block h-auto w-full object-cover\"\n />\n {shot.source && (\n <figcaption class=\"px-3 py-1.5 text-2xs text-ink-500 dark:text-ink-400\">\n Source: <a href={shot.source} target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-inherit no-underline hover:underline\">{shot.source.replace(/^https?:\\/\\//, \"\")}</a>\n </figcaption>\n )}\n </figure>\n ))}\n </div>\n )}\n</header>",
|
|
411
|
+
"content": "---\n/**\n * RecordHeader.astro\n *\n * Compact project-identity header used at the top of every record\n * detail page. The header carries:\n * - avatar / initials\n * - pills row (category + curation labels + \"Curated\" check +\n * optional activity badge)\n * - record name + owner/repo line\n * - short description\n * - GitHub + Homepage CTAs\n *\n * Tags + activity metadata are surfaced separately (sidebar), so\n * the header stays narrow on mobile and doesn't compete with the\n * two-column layout below.\n *\n * Tone classes for the activity badge are static `[data-activity-tone]`\n * selectors in `styles.css` — Tailwind purges any classes built from\n * dynamic strings, so the package ships the rules statically and\n * the badge's `data-activity-tone` attribute picks one at runtime.\n */\nimport siteConfig from '@grove/generated/site-config.json';\nimport type { RecordDetailModel } from '@grove-dev/astro/server';\nimport { withRef } from '@grove-dev/core';\nimport { buttonClass } from '../../lib/classnames.ts';\n\ninterface Props {\n detail: RecordDetailModel;\n}\n\nconst { detail } = Astro.props;\nconst {\n record,\n repoUrl,\n homepageUrl,\n ownerRepo,\n avatarSrc,\n initials,\n curationLabels,\n activityBadge,\n summary,\n sourceDescription,\n screenshots,\n category,\n name,\n} = detail;\n// Links to the record's own site carry `ref=<site host>`; see `outbound`\n// in grove.config.ts.\nconst outbound =\n (siteConfig as { outbound?: { ref?: string | false; skipHosts?: string[] } }).outbound ?? {};\nconst homepageHref = withRef(homepageUrl, outbound);\nconst submittedBy = (record as { submittedBy?: string }).submittedBy;\n---\n\n<header class=\"mb-8\">\n {/* Identity row: logo sized to the name+repo block beside it — no\n tall avatar column leaving dead space under the logo. Pills sit\n at the row's right edge on wide viewports and wrap below on\n mobile. */}\n <div class=\"flex items-center gap-4\">\n {/* Initials stay in the DOM behind the logo and are revealed by the\n image's own `onerror` — a dead logo URL or a renamed GitHub org\n would otherwise render the broken-image glyph. */}\n {avatarSrc && (\n <img\n src={avatarSrc}\n alt=\"\"\n width=\"56\"\n height=\"56\"\n loading=\"lazy\"\n decoding=\"async\"\n onerror=\"this.hidden=true;this.nextElementSibling.hidden=false\"\n class=\"h-12 w-12 shrink-0 rounded-lg border border-ink-200 object-contain bg-white p-1 dark:border-ink-800 sm:h-14 sm:w-14\"\n />\n )}\n <span\n aria-hidden=\"true\"\n hidden={Boolean(avatarSrc)}\n data-grove-card-fallback-initials\n class=\"inline-flex h-12 w-12 shrink-0 items-center justify-center rounded-lg border border-ink-200 bg-ink-50 text-xl font-semibold text-ink-700 dark:border-ink-800 dark:bg-ink-900 dark:text-ink-200 sm:h-14 sm:w-14\"\n >\n {initials || \"·\"}\n </span>\n\n <div class=\"min-w-0 flex-1\">\n <h1 class=\"m-0 text-[1.75rem] font-semibold leading-tight tracking-tight text-ink-900 dark:text-ink-100 sm:text-[2rem]\">\n {name}\n </h1>\n {ownerRepo && (\n <p class=\"m-0 mt-0.5 text-sm text-ink-500 dark:text-ink-400\">\n <a\n href={`https://github.com/${ownerRepo.owner}`}\n target=\"_blank\"\n rel=\"noopener\"\n class=\"text-inherit no-underline hover:text-ink-900 dark:hover:text-ink-100\"\n >\n @{ownerRepo.owner}\n </a>\n <span class=\"mx-1 text-ink-300 dark:text-ink-700\">/</span>\n <a\n href={repoUrl}\n target=\"_blank\"\n rel=\"noopener\"\n class=\"text-inherit no-underline hover:text-ink-900 dark:hover:text-ink-100\"\n >\n {ownerRepo.repo}\n </a>\n </p>\n )}\n </div>\n\n {/* Pills — right-aligned beside the name on wide viewports. */}\n <div class=\"hidden shrink-0 flex-wrap items-center justify-end gap-1.5 md:flex\">\n {category && (\n <span class=\"rounded-full border border-ink-200 px-2 py-0.5 text-2xs font-medium text-ink-700 dark:border-ink-800 dark:text-ink-300\">\n {category}\n </span>\n )}\n {curationLabels.map((l) => (\n <span class=\"rounded-full bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground\">\n {l}\n </span>\n ))}\n {submittedBy && (\n <a\n href={`/contributors/#${submittedBy.toLowerCase()}`}\n class=\"inline-flex items-center gap-1.5 rounded-full border border-border py-0.5 pl-0.5 pr-2 text-2xs font-medium text-ink-700 no-underline hover:border-ink-400 dark:text-ink-300\"\n title={`Submitted by @${submittedBy}`}\n data-submitted-by={submittedBy}\n >\n <img src={`https://github.com/${submittedBy}.png?size=32`} alt=\"\" width=\"16\" height=\"16\" loading=\"lazy\" decoding=\"async\" class=\"h-4 w-4 rounded-full\" />\n Submitted by @{submittedBy}\n </a>\n )}\n {/* Curated = reviewed provenance, not a success status. */}\n {record.curation?.reviewed && (\n <span class=\"inline-flex items-center gap-1 rounded-full border border-border bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground\">\n <svg viewBox=\"0 0 16 16\" width=\"10\" height=\"10\" aria-hidden=\"true\" fill=\"currentColor\">\n <path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0Zm3.41 5.09a.75.75 0 0 0-1.06 0L6.75 8.69 5.65 7.59a.75.75 0 1 0-1.06 1.06l1.65 1.65a.75.75 0 0 0 1.06 0l4.11-4.11a.75.75 0 0 0 0-1.06Z\" />\n </svg>\n Curated\n </span>\n )}\n {activityBadge && (\n <span\n data-activity-tone={activityBadge.tone}\n class=\"grove-pill grove-pill--activity inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-2xs font-medium\"\n >\n <span class=\"relative flex h-1.5 w-1.5\">\n <span class=\"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-60\"></span>\n <span class=\"relative inline-flex h-1.5 w-1.5 rounded-full bg-current\"></span>\n </span>\n {activityBadge.label}\n </span>\n )}\n </div>\n </div>\n\n {/* Same pills below the identity row on narrow viewports. */}\n <div class=\"mt-3 flex flex-wrap items-center gap-1.5 md:hidden\">\n {category && (\n <span class=\"rounded-full border border-ink-200 px-2 py-0.5 text-2xs font-medium text-ink-700 dark:border-ink-800 dark:text-ink-300\">\n {category}\n </span>\n )}\n {curationLabels.map((l) => (\n <span class=\"rounded-full bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground\">\n {l}\n </span>\n ))}\n {submittedBy && (\n <a\n href={`/contributors/#${submittedBy.toLowerCase()}`}\n class=\"inline-flex items-center gap-1.5 rounded-full border border-border py-0.5 pl-0.5 pr-2 text-2xs font-medium text-ink-700 no-underline hover:border-ink-400 dark:text-ink-300\"\n title={`Submitted by @${submittedBy}`}\n data-submitted-by={submittedBy}\n >\n <img src={`https://github.com/${submittedBy}.png?size=32`} alt=\"\" width=\"16\" height=\"16\" loading=\"lazy\" decoding=\"async\" class=\"h-4 w-4 rounded-full\" />\n Submitted by @{submittedBy}\n </a>\n )}\n {record.curation?.reviewed && (\n <span class=\"inline-flex items-center gap-1 rounded-full border border-border bg-secondary px-2 py-0.5 text-2xs font-medium text-secondary-foreground\">\n <svg viewBox=\"0 0 16 16\" width=\"10\" height=\"10\" aria-hidden=\"true\" fill=\"currentColor\">\n <path d=\"M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0Zm3.41 5.09a.75.75 0 0 0-1.06 0L6.75 8.69 5.65 7.59a.75.75 0 1 0-1.06 1.06l1.65 1.65a.75.75 0 0 0 1.06 0l4.11-4.11a.75.75 0 0 0 0-1.06Z\" />\n </svg>\n Curated\n </span>\n )}\n </div>\n\n {/* Description — full width below the identity row. */}\n {summary && (\n <p class=\"m-0 mt-4 max-w-[72ch] text-base leading-relaxed text-ink-700 dark:text-ink-200\">\n {summary}\n </p>\n )}\n {sourceDescription && sourceDescription !== summary && (\n <p class=\"m-0 mt-2 max-w-[72ch] text-sm leading-relaxed text-ink-500 dark:text-ink-400\">\n <span class=\"text-2xs font-semibold uppercase tracking-wider\">From the project's README: </span>\n {sourceDescription}\n </p>\n )}\n\n {/* CTA row — primary actions only. */}\n <div class=\"mt-4 flex flex-wrap items-center gap-2\">\n {repoUrl && (\n <a\n href={repoUrl}\n target=\"_blank\"\n rel=\"noopener\"\n class={buttonClass(\"primary\", \"sm\")}\n data-event=\"external_repo_click\"\n data-event-source=\"record_header\"\n data-event-item={record.slug}\n >\n View on GitHub →\n </a>\n )}\n {homepageUrl && (\n <a\n href={homepageHref}\n target=\"_blank\"\n rel=\"noopener\"\n class={buttonClass(\"secondary\", \"sm\")}\n data-event=\"homepage_click\"\n data-event-source=\"record_header\"\n data-event-item={record.slug}\n >\n Homepage\n </a>\n )}\n </div>\n {screenshots && screenshots.length > 0 && (\n <div class=\"mt-6 grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3\" aria-label=\"Screenshots\">\n {screenshots.map((shot) => (\n <figure class=\"m-0 overflow-hidden rounded-[var(--radius-lg)] border border-ink-200 bg-muted dark:border-ink-800\">\n <img\n src={shot.src}\n alt={shot.alt}\n loading=\"lazy\"\n decoding=\"async\"\n width={shot.width}\n height={shot.height}\n class=\"block h-auto w-full object-cover\"\n />\n {shot.source && (\n <figcaption class=\"px-3 py-1.5 text-2xs text-ink-500 dark:text-ink-400\">\n Source: <a href={shot.source} target=\"_blank\" rel=\"noopener\" class=\"text-inherit no-underline hover:underline\">{shot.source.replace(/^https?:\\/\\//, \"\")}</a>\n </figcaption>\n )}\n </figure>\n ))}\n </div>\n )}\n</header>",
|
|
376
412
|
"type": "registry:component",
|
|
377
413
|
"target": "~/src/components/grove/record-header.astro"
|
|
378
414
|
},
|
|
379
415
|
{
|
|
380
416
|
"path": "default/components/grove/record-sidebar.astro",
|
|
381
|
-
"content": "---\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 } from '@grove-dev/core';\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}\n---\n\n<aside\n class:list={[\n layout === \"grid\"\n ? \"grove-sidebar grid grid-cols-1 items-start gap-4 sm:grid-cols-2 xl:grid-cols-4\"\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 noreferrer\"\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 {repo?.updated_at && lastFetchedLabel && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Last fetched</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={String(repo.homepage)} target=\"_blank\" rel=\"noopener noreferrer\" 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 noreferrer\" 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 {/* ── Source card (small) ────────────────────────────────── */}\n {sidebar.showSource && (\n <section\n class=\"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>",
|
|
417
|
+
"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 ? \"grove-sidebar grid grid-cols-1 items-start gap-4 sm:grid-cols-2 xl:grid-cols-4\"\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 {repo?.updated_at && lastFetchedLabel && (\n <div class=\"flex items-baseline justify-between gap-3\">\n <dt class=\"text-ink-500 dark:text-ink-400\">Last fetched</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 <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\n {/* ── Source card (small) ────────────────────────────────── */}\n {sidebar.showSource && (\n <section\n class=\"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>",
|
|
382
418
|
"type": "registry:component",
|
|
383
419
|
"target": "~/src/components/grove/record-sidebar.astro"
|
|
384
420
|
},
|
|
@@ -418,27 +454,33 @@
|
|
|
418
454
|
"type": "registry:component",
|
|
419
455
|
"target": "~/src/components/grove/language-breakdown.astro"
|
|
420
456
|
},
|
|
457
|
+
{
|
|
458
|
+
"path": "default/components/site/featured-badge.astro",
|
|
459
|
+
"content": "---\n/**\n * FeaturedBadge — \"Featured on <site>\" README badge for maintainers.\n *\n * The SVGs are generated into `public/badges/` by the Grove build\n * (light and dark). The snippets link back to the record with\n * `?ref=badge` so badge traffic shows up in analytics, and the HTML\n * variant swaps to the dark badge through <picture>, which GitHub\n * READMEs honour.\n */\ninterface Props {\n /** Absolute URL of the record page, without a query string. */\n pageUrl: string;\n /** Absolute site origin, e.g. https://example.dev */\n origin: string;\n /** Site name, for the alt text. */\n siteName: string;\n /** Record name, for the alt text. */\n name: string;\n /** The `ref` value outbound links carry, if any — mentioned in the copy. */\n outboundRef?: string | false;\n}\n\nconst { pageUrl, origin, siteName, name, outboundRef } = Astro.props;\nconst href = `${pageUrl}?ref=badge`;\nconst light = `${origin}/badges/featured.svg`;\nconst dark = `${origin}/badges/featured-dark.svg`;\nconst alt = `${name} on ${siteName}`;\nconst markdown = `[](${href})`;\nconst html = `<a href=\"${href}\"><picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"${dark}\"><img alt=\"${alt}\" src=\"${light}\" height=\"40\"></picture></a>`;\n---\n\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-badge-title\"\n>\n <h2 id=\"sidebar-badge-title\" class=\"m-0 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\">\n Maintainer? Add the badge\n </h2>\n <p class=\"m-0 mt-1.5 text-sm leading-relaxed text-ink-700 dark:text-ink-300\">\n Show readers where to find this page.\n {outboundRef && <> Visits from here reach your site with <code class=\"text-2xs\">ref={outboundRef}</code>.</>}\n </p>\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"/badges/featured-dark.svg\" />\n <img src=\"/badges/featured.svg\" alt=\"\" height=\"40\" loading=\"lazy\" decoding=\"async\" class=\"mt-3 block h-10 w-auto\" />\n </picture>\n <div class=\"mt-3 flex flex-wrap gap-2\" data-badge-copy>\n <button type=\"button\" data-copy={markdown} class=\"cursor-pointer rounded-[var(--radius)] border border-border bg-secondary px-2.5 py-1 text-2xs font-medium text-secondary-foreground hover:bg-accent\">\n Copy Markdown\n </button>\n <button type=\"button\" data-copy={html} class=\"cursor-pointer rounded-[var(--radius)] border border-border bg-secondary px-2.5 py-1 text-2xs font-medium text-secondary-foreground hover:bg-accent\">\n Copy HTML\n </button>\n </div>\n</section>\n\n<script>\n document.querySelectorAll<HTMLElement>('[data-badge-copy] [data-copy]').forEach((button) => {\n const label = button.textContent?.trim() ?? '';\n button.addEventListener('click', async () => {\n try {\n await navigator.clipboard.writeText(button.dataset.copy ?? '');\n button.textContent = 'Copied';\n } catch {\n button.textContent = 'Copy failed';\n }\n setTimeout(() => (button.textContent = label), 1500);\n });\n });\n</script>\n",
|
|
460
|
+
"type": "registry:component",
|
|
461
|
+
"target": "~/src/components/site/featured-badge.astro"
|
|
462
|
+
},
|
|
421
463
|
{
|
|
422
464
|
"path": "default/pages/submit.astro",
|
|
423
|
-
"content": "---\nimport siteConfig from '@grove/generated/site-config.json';\nimport { getSubmissionPageModel } from '@grove-dev/astro/server';\nimport SubmissionClient from '../components/grove/submission-client.astro';\nimport BaseLayout from '../layouts/base-layout.astro';\nimport Container from '../layouts/container.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\nconst {\n singular,\n title,\n description,\n repoUrl,\n copy,\n fields,\n categories,\n stacks,\n existingSlugs,\n existingFullNames,\n platformOptions,\n licenseOptions,\n taxonomy,\n} = getSubmissionPageModel(siteConfig);\nconst goodSubmissions = [\n ...(copy.good?.length\n ? copy.good\n : [\n `A real, usable ${singular}, not a tutorial or one-screen demo`,\n 'A public repository with a clear open-source license',\n 'Enough documentation to understand, run, or contribute',\n 'Recent maintenance, releases, or meaningful project history',\n ]),\n];\nconst pleaseAvoid = [\n ...(copy.avoid?.length\n ? copy.avoid\n : [\n 'Snippets, exercises, abandoned experiments, or duplicate entries',\n 'Private repositories or projects without source',\n 'Marketing pages with no usable project behind them',\n 'Records with no license or verifiable repository',\n ]),\n];\n---\n\n<BaseLayout title={title} description={description} site={siteConfig} noindex>\n <Container>\n <section class=\"py-10 sm:py-14\">\n <div class=\"max-w-3xl\">\n <p class=\"m-0 text-2xs font-semibold uppercase tracking-wider text-ink-500 dark:text-ink-400\">\n {copy.eyebrow ?? `${singular} submission`}\n </p>\n <h1 class=\"mt-2 text-[2rem] font-semibold tracking-tight text-ink-900 dark:text-ink-100\">\n {copy.title ?? `Add ${singular === \"app\" ? \"an\" : \"a\"} ${singular} to the directory`}\n </h1>\n <p class=\"m-0 mt-3 max-w-[60ch] text-[0.9375rem] leading-relaxed text-ink-500 dark:text-ink-400\">\n {copy.description ?? `Paste a GitHub URL to pull in the basics, edit the generated draft, then open a pull request. The data stays in this repository.`}\n </p>\n </div>\n\n {/* One compact line, not three cards — on mobile the form\n starts within the first viewport. */}\n <ol class=\"mt-4 flex flex-wrap gap-x-6 gap-y-1.5 text-2xs text-muted-foreground\" aria-label=\"Submission steps\">\n {[\n [\"1\", \"Paste a GitHub URL\"],\n [\"2\", \"Review the draft\"],\n [\"3\", \"Open a pull request\"],\n ].map(([number, heading]) => (\n <li class=\"flex items-center gap-1.5\">\n <span class=\"inline-flex h-4.5 w-4.5 shrink-0 items-center justify-center rounded-full border border-border font-mono text-[10px] font-semibold text-foreground\">{number}</span>\n <span class=\"font-medium text-foreground\">{heading}</span>\n </li>\n ))}\n </ol>\n\n <div class=\"mt-8 grid grid-cols-1 items-start gap-6 md:grid-cols-[minmax(0,1fr)_minmax(300px,0.72fr)]\">\n <form id=\"submit-form\" class=\"rounded-[calc(var(--radius)+0.25rem)] border border-ink-200 bg-background p-5 shadow-sm dark:border-ink-800\">\n <div class=\"grid gap-5\">\n <label class=\"grid gap-1.5\">\n <span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">GitHub URL</span>\n <div class=\"flex flex-col gap-2 sm:flex-row\">\n <input id=\"repo-url\" type=\"url\" required placeholder=\"https://github.com/owner/repo\" class=\"min-h-10 flex-1 rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\" />\n <button id=\"fetch-repo\" type=\"button\" class={buttonClass(\"primary\", \"bare\", \"min-h-10 whitespace-nowrap px-3 text-sm\")}>Generate draft</button>\n </div>\n <span class=\"text-2xs text-muted-foreground\">The repository must be public. We never write to it.</span>\n </label>\n\n <div class=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <label class=\"grid gap-1.5\"><span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Name</span><input id=\"item-name\" type=\"text\" class=\"min-h-10 rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\" /></label>\n <label class=\"grid gap-1.5\"><span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Slug</span><input id=\"item-slug\" type=\"text\" class=\"min-h-10 rounded-[var(--radius)] border border-input bg-background px-3 py-2 font-mono text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\" /><span class=\"text-2xs text-muted-foreground\">URL fragment, auto-filled from the repository name.</span></label>\n </div>\n\n <label class=\"grid gap-1.5\">\n <span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Description</span>\n <textarea id=\"item-description\" rows=\"3\" class=\"min-h-10 resize-y rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\"></textarea>\n <span class=\"text-2xs text-muted-foreground\">One or two sentences in plain language.</span>\n </label>\n\n {(fields.category || fields.stack) && <div class:list={[\"grid grid-cols-1 gap-4\", fields.category && fields.stack && \"sm:grid-cols-2\"]}>\n {fields.category && (\n <label class=\"grid gap-1.5\">\n <span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Category</span>\n <select id=\"item-category\" class=\"min-h-10 rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\">\n <option value=\"\">Choose a category</option>\n {categories.map((option) => <option value={option.id}>{option.label}</option>)}\n </select>\n </label>\n )}\n {fields.stack && (\n <label class=\"grid gap-1.5\">\n <span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Primary stack</span>\n <select id=\"primary-stack\" class=\"min-h-10 rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\">\n <option value=\"\">Choose a stack</option>\n {stacks.map((option) => <option value={option.id}>{option.label}</option>)}\n </select>\n </label>\n )}\n </div>}\n\n {fields.platforms && <fieldset class=\"grid gap-2\">\n <legend class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Platforms</legend>\n <div class=\"grid grid-cols-2 gap-2 sm:grid-cols-3\">\n {platformOptions.map((platform) => (\n <label class=\"flex min-h-9 items-center gap-2 rounded-md border border-ink-200 px-2 text-sm dark:border-ink-800\">\n <input type=\"checkbox\" name=\"platform\" value={platform.id} class=\"h-4 w-4\" />\n <span>{platform.label}</span>\n </label>\n ))}\n </div>\n </fieldset>}\n\n {fields.tags && <label class=\"grid gap-1.5\"><span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Tags</span><input id=\"item-tags\" type=\"text\" placeholder=\"self-hosted, developer-tools, offline-first\" class=\"min-h-10 rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\" /></label>}\n\n {fields.license && licenseOptions.length > 0 && (\n <label class=\"grid gap-1.5\">\n <span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">License</span>\n <select id=\"item-license\" class=\"min-h-10 rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\">\n <option value=\"\">Detected from the repository if left empty</option>\n {licenseOptions.map((option) => <option value={option.id}>{option.label}</option>)}\n </select>\n </label>\n )}\n <label class=\"grid gap-1.5\"><span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Website</span><input id=\"item-website\" type=\"url\" placeholder=\"https://example.com\" class=\"min-h-10 rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\" /></label>\n <label class=\"grid gap-1.5\"><span class=\"text-2xs font-medium uppercase tracking-[.05em] text-muted-foreground\">Best for</span><textarea id=\"best-for\" rows=\"3\" class=\"min-h-10 resize-y rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35\" placeholder=\"One use case per line\"></textarea></label>\n </div>\n </form>\n\n <aside class=\"flex flex-col gap-4 md:sticky md:top-24\">\n <div class=\"rounded-[calc(var(--radius)+0.25rem)] border border-border bg-card p-5\">\n <h2 class=\"m-0 text-[0.9375rem] font-semibold text-ink-900 dark:text-ink-100\">Submission criteria</h2>\n <p class=\"m-0 mt-1 text-2xs text-ink-500 dark:text-ink-400\">Use this checklist before opening the draft.</p>\n <div class=\"mt-4 grid grid-cols-1 gap-4 text-2xs sm:grid-cols-2 lg:grid-cols-1 xl:grid-cols-2\">\n <div>\n <div class=\"font-semibold uppercase tracking-wider text-emerald-700 dark:text-emerald-400\">Good submissions</div>\n <ul class=\"m-0 mt-2 list-none space-y-1 p-0 text-ink-700 dark:text-ink-200\">{goodSubmissions.map((item) => <li class=\"flex gap-2\"><span class=\"text-emerald-600\">✓</span><span>{item}</span></li>)}</ul>\n </div>\n <div>\n <div class=\"font-semibold uppercase tracking-wider text-amber-700 dark:text-amber-400\">Please avoid</div>\n <ul class=\"m-0 mt-2 list-none space-y-1 p-0 text-ink-700 dark:text-ink-200\">{pleaseAvoid.map((item) => <li class=\"flex gap-2\"><span class=\"text-amber-600\">·</span><span>{item}</span></li>)}</ul>\n </div>\n </div>\n </div>\n\n <div class=\"flex min-h-[360px] flex-col rounded-[calc(var(--radius)+0.25rem)] border border-border bg-card p-5\">\n <div class=\"flex flex-wrap items-center justify-between gap-3\">\n <h2 class=\"m-0 text-base font-semibold text-ink-900 dark:text-ink-100\">YAML draft</h2>\n <div class=\"flex items-center gap-2\">\n <button id=\"copy-yaml\" type=\"button\" class={buttonClass(\"secondary\", \"sm\", \"whitespace-nowrap pointer-events-none opacity-50\")} disabled>Copy YAML</button>\n <a id=\"open-pr-link\" href=\"#\" target=\"_blank\" rel=\"noopener noreferrer\" class={buttonClass(\"secondary\", \"sm\", \"whitespace-nowrap pointer-events-none opacity-50\")}>Open PR draft</a>\n </div>\n </div>\n <pre class=\"mt-4 min-h-0 flex-1 overflow-auto rounded-md border border-ink-200 bg-ink-50 p-3 text-xs leading-relaxed text-ink-800 dark:border-ink-800 dark:bg-ink-900/60 dark:text-ink-200\"><code id=\"yaml-preview\">Paste a GitHub URL to generate a draft.</code></pre>\n <p id=\"submit-status\" class=\"mt-3 min-h-5 text-2xs text-ink-500 dark:text-ink-400\" aria-live=\"polite\"></p>\n </div>\n </aside>\n </div>\n </section>\n </Container>\n\n <SubmissionClient\n existingSlugs={existingSlugs}\n existingFullNames={existingFullNames}\n repoUrl={repoUrl}\n fields={fields}\n taxonomy={taxonomy}\n />\n</BaseLayout>\n",
|
|
465
|
+
"content": "---\nimport siteConfig from '@grove/generated/site-config.json';\nimport { getSubmissionPageModel } from '@grove-dev/astro/server';\nimport SubmissionClient from '../components/grove/submission-client.astro';\nimport BaseLayout from '../layouts/base-layout.astro';\nimport Container from '../layouts/container.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\nconst {\n singular,\n title,\n description,\n repoUrl,\n copy,\n fields,\n categories,\n stacks,\n existingSlugs,\n existingFullNames,\n platformOptions,\n licenseOptions,\n taxonomy,\n} = getSubmissionPageModel(siteConfig);\nconst goodSubmissions = [\n ...(copy.good?.length\n ? copy.good\n : [\n `A real, usable ${singular}, not a tutorial or one-screen demo`,\n 'A public repository with a clear open-source license',\n 'Enough documentation to understand, run, or contribute',\n 'Recent maintenance, releases, or meaningful project history',\n ]),\n];\nconst pleaseAvoid = [\n ...(copy.avoid?.length\n ? copy.avoid\n : [\n 'Snippets, exercises, abandoned experiments, or duplicate entries',\n 'Private repositories or projects without source',\n 'Marketing pages with no usable project behind them',\n 'Records with no license or verifiable repository',\n ]),\n];\n\n// Shared control styling.\nconst control =\n 'min-h-10 w-full rounded-[var(--radius)] border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/35';\nconst labelText = 'text-sm font-medium text-foreground';\nconst hint = 'text-2xs leading-relaxed text-muted-foreground';\nconst steps = [\n { id: 'repo', title: 'Repository', text: 'Paste the GitHub URL' },\n { id: 'details', title: 'Details', text: 'Say what it is and who it is for' },\n { id: 'review', title: 'Open the pull request', text: 'Check the preview, open one PR' },\n];\n---\n\n<BaseLayout\n title={title}\n description={description}\n noindex\n site={siteConfig}\n submitHref=\"/submit\"\n>\n <div class=\"border-b border-border bg-surface-sunken/60\">\n <Container>\n <section class=\"py-10 sm:py-14\">\n <p class=\"m-0 text-2xs font-semibold uppercase tracking-wider text-muted-foreground\">\n {copy.eyebrow ?? `${singular} submission`}\n </p>\n <h1 class=\"m-0 mt-2 text-[2rem] font-semibold leading-tight tracking-tight text-foreground sm:text-[2.5rem]\">\n {copy.title ?? `Add ${singular === \"app\" ? \"an\" : \"a\"} ${singular} to the directory`}\n </h1>\n <p class=\"m-0 mt-3 max-w-[62ch] text-[1rem] leading-relaxed text-muted-foreground\">\n {copy.description ?? description}\n </p>\n <ul class=\"m-0 mt-5 flex list-none flex-wrap gap-2 p-0 text-2xs\">\n {[\"No account on this site\", \"Reviewed by a person\", \"Credited on the page\", \"README badge for maintainers\"].map((item) => (\n <li class=\"inline-flex items-center gap-1.5 rounded-full border border-border bg-background px-2.5 py-1 font-medium text-foreground\">\n <svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" aria-hidden=\"true\" fill=\"currentColor\" class=\"text-success\"><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\" /></svg>\n {item}\n </li>\n ))}\n </ul>\n\n <ol id=\"submit-steps\" class=\"m-0 mt-8 grid list-none grid-cols-1 gap-2 p-0 sm:grid-cols-3\" aria-label=\"Submission steps\">\n {steps.map((step, i) => (\n <li data-step={step.id} data-state={i === 0 ? \"current\" : \"todo\"} class=\"group flex items-center gap-3 rounded-[var(--radius-lg)] border border-border bg-background px-3 py-2.5 data-[state=current]:border-foreground data-[state=done]:border-success/50\">\n <span class=\"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border text-xs font-semibold tabular-nums text-muted-foreground group-data-[state=current]:border-foreground group-data-[state=current]:bg-foreground group-data-[state=current]:text-background group-data-[state=done]:border-success group-data-[state=done]:bg-success group-data-[state=done]:text-background\">\n <span class=\"group-data-[state=done]:hidden\">{i + 1}</span>\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" fill=\"currentColor\" class=\"hidden group-data-[state=done]:block\"><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\" /></svg>\n </span>\n <span class=\"min-w-0\">\n <span class=\"block text-sm font-semibold text-foreground\">{step.title}</span>\n <span class=\"block truncate text-2xs text-muted-foreground\">{step.text}</span>\n </span>\n </li>\n ))}\n </ol>\n </section>\n </Container>\n </div>\n\n <Container>\n <div class=\"grid grid-cols-1 items-start gap-6 py-8 sm:py-10 lg:grid-cols-[minmax(0,1fr)_minmax(320px,0.8fr)]\">\n <form id=\"submit-form\" class=\"grid gap-6\" novalidate>\n {/* ── 1. Repository ───────────────────────────── */}\n <section aria-labelledby=\"step-repo\" class=\"rounded-[var(--radius-lg)] border border-border bg-card p-5 sm:p-6\">\n <h2 id=\"step-repo\" class=\"m-0 flex items-center gap-2 text-[1.0625rem] font-semibold text-foreground\">\n <span class=\"text-muted-foreground\">1.</span> Repository\n </h2>\n <label class=\"mt-4 grid gap-1.5\">\n <span class={labelText}>GitHub URL</span>\n <div class=\"flex flex-col gap-2 sm:flex-row\">\n <input id=\"repo-url\" type=\"url\" required autocomplete=\"off\" placeholder=\"https://github.com/owner/repo\" class={`${control} min-h-11 text-[0.9375rem] sm:flex-1`} />\n <button id=\"fetch-repo\" type=\"button\" class={buttonClass(\"primary\", \"bare\", \"min-h-11 whitespace-nowrap px-4 text-sm\")}>Fetch details</button>\n </div>\n <span class={hint}>Public repositories only. We read it from the GitHub API and never write to it.</span>\n </label>\n <div id=\"repo-card\" hidden class=\"mt-4 flex items-start gap-3 rounded-[var(--radius)] border border-border bg-background p-3\">\n <img id=\"repo-avatar\" src=\"data:,\" alt=\"\" width=\"40\" height=\"40\" class=\"h-10 w-10 shrink-0 rounded-lg border border-border object-cover\" />\n <div class=\"min-w-0 flex-1\">\n <p id=\"repo-name\" class=\"m-0 truncate text-sm font-semibold text-foreground\"></p>\n <p id=\"repo-description\" class=\"m-0 mt-0.5 line-clamp-2 text-2xs text-muted-foreground\"></p>\n <p id=\"repo-facts\" class=\"m-0 mt-1.5 flex flex-wrap gap-x-3 text-2xs text-muted-foreground\"></p>\n </div>\n </div>\n </section>\n\n {/* ── 2. Details ──────────────────────────────── */}\n <section aria-labelledby=\"step-details\" class=\"rounded-[var(--radius-lg)] border border-border bg-card p-5 sm:p-6\">\n <h2 id=\"step-details\" class=\"m-0 flex items-center gap-2 text-[1.0625rem] font-semibold text-foreground\">\n <span class=\"text-muted-foreground\">2.</span> About the {singular}\n </h2>\n <p class=\"m-0 mt-1 text-2xs text-muted-foreground\">Filled from GitHub where possible — edit anything that reads like a README.</p>\n\n <div class=\"mt-5 grid gap-5\">\n <div class=\"grid grid-cols-1 items-start gap-4 sm:grid-cols-[minmax(0,1fr)_14rem]\">\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Name</span>\n <input id=\"item-name\" type=\"text\" class={control} />\n </label>\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Page address</span>\n <input id=\"item-slug\" type=\"text\" class={`${control} font-mono`} />\n <span class={hint}>The last part of the page URL — from the repo name.</span>\n </label>\n </div>\n\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Description</span>\n <textarea id=\"item-description\" rows=\"3\" class={`${control} resize-y`}></textarea>\n <span class={hint}>One or two plain sentences: what it is and who it is for. At least 40 characters.</span>\n </label>\n\n {(fields.category || fields.stack) && (\n <div class:list={[\"grid grid-cols-1 gap-4\", fields.category && fields.stack && \"sm:grid-cols-2\"]}>\n {fields.category && (\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Category</span>\n <select id=\"item-category\" class={control}>\n <option value=\"\">Choose a category</option>\n {categories.map((option) => <option value={option.id}>{option.label}</option>)}\n </select>\n </label>\n )}\n {fields.stack && (\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Primary stack</span>\n <select id=\"primary-stack\" class={control}>\n <option value=\"\">Choose a stack</option>\n {stacks.map((option) => <option value={option.id}>{option.label}</option>)}\n </select>\n </label>\n )}\n </div>\n )}\n\n {fields.platforms && (\n <fieldset class=\"m-0 grid gap-2 border-0 p-0\">\n <legend class={`${labelText} mb-2`}>Platforms</legend>\n <div class=\"flex flex-wrap gap-2\">\n {platformOptions.map((platform) => (\n <label class=\"inline-flex min-h-9 cursor-pointer items-center gap-2 rounded-full border border-border px-3 text-sm text-foreground has-[:checked]:border-foreground has-[:checked]:bg-foreground has-[:checked]:text-background\">\n <input type=\"checkbox\" name=\"platform\" value={platform.id} class=\"sr-only\" />\n <span>{platform.label}</span>\n </label>\n ))}\n </div>\n </fieldset>\n )}\n\n\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Your GitHub username <span class=\"font-normal text-muted-foreground\">(recommended)</span></span>\n <div class=\"flex items-center gap-2\">\n <span class=\"text-sm text-muted-foreground\">@</span>\n <input id=\"submitted-by\" type=\"text\" autocomplete=\"username\" spellcheck=\"false\" placeholder=\"octocat\" class={`${control} max-w-xs`} />\n </div>\n <span class={hint}>Shown as “Submitted by @you” on the page and on the contributors page.</span>\n </label>\n\n <details class=\"group rounded-[var(--radius)] border border-border bg-background\">\n <summary class=\"flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-medium text-foreground [&::-webkit-details-marker]:hidden\">\n <span>Add more detail <span class=\"font-normal text-muted-foreground\">— optional: tags, licence, website, who it is for</span></span>\n <span aria-hidden=\"true\" class=\"text-muted-foreground transition-transform group-open:rotate-45\">+</span>\n </summary>\n <div class=\"grid gap-5 border-t border-border px-4 pb-5 pt-4\">\n {fields.tags && (\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Tags</span>\n <input id=\"item-tags\" type=\"text\" placeholder=\"self-hosted, developer-tools, offline-first\" class={control} />\n <span class={hint}>Comma-separated. Pre-filled from the repository topics.</span>\n </label>\n )}\n <div class=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n {fields.license && licenseOptions.length > 0 && (\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Licence</span>\n <select id=\"item-license\" class={control}>\n <option value=\"\">Detected from the repository</option>\n {licenseOptions.map((option) => <option value={option.id}>{option.label}</option>)}\n </select>\n </label>\n )}\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Website</span>\n <input id=\"item-website\" type=\"url\" placeholder=\"https://example.com\" class={control} />\n </label>\n </div>\n <label class=\"grid gap-1.5\">\n <span class={labelText}>Best for</span>\n <textarea id=\"best-for\" rows=\"2\" class={`${control} resize-y`} placeholder=\"One use case per line\"></textarea>\n <span class={hint}>Who it suits — one audience or use case per line.</span>\n </label>\n </div>\n </details>\n </div>\n </section>\n </form>\n\n {/* ── 3. Review & open the pull request ─────────── */}\n <aside class=\"flex flex-col gap-4 lg:sticky lg:top-20\" aria-labelledby=\"step-review\">\n <section class=\"rounded-[var(--radius-lg)] border border-border bg-card p-5\">\n <h2 id=\"step-review\" class=\"m-0 flex items-center gap-2 text-[1.0625rem] font-semibold text-foreground\">\n <span class=\"text-muted-foreground\">3.</span> Preview and open the PR\n </h2>\n\n <div id=\"preview-card\" class=\"mt-4 rounded-[var(--radius)] border border-border bg-background p-4\">\n <div class=\"flex items-start gap-3\">\n <img id=\"preview-avatar\" hidden src=\"data:,\" alt=\"\" width=\"40\" height=\"40\" class=\"h-10 w-10 shrink-0 rounded-lg border border-border object-cover\" />\n <span id=\"preview-initials\" class=\"inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-dashed border-border text-sm font-semibold text-muted-foreground\">?</span>\n <div class=\"min-w-0\">\n <p id=\"preview-name\" class=\"m-0 truncate text-[0.9375rem] font-semibold text-foreground\">{`Your ${singular}`}</p>\n <p id=\"preview-meta\" class=\"m-0 mt-0.5 text-2xs text-muted-foreground\">Category · Stack</p>\n </div>\n </div>\n <p id=\"preview-description\" class=\"m-0 mt-3 line-clamp-3 text-sm leading-relaxed text-muted-foreground\">The description appears here.</p>\n <p id=\"preview-credit\" hidden class=\"m-0 mt-3 text-2xs text-muted-foreground\"></p>\n </div>\n\n <ul id=\"submit-checklist\" class=\"m-0 mt-4 flex list-none flex-col gap-1.5 p-0 text-sm\" aria-label=\"Before you open the pull request\">\n {[\n [\"repo\", \"Repository fetched\"],\n [\"description\", \"Description of 40+ characters\"],\n ...(fields.category ? [[\"category\", \"Category chosen\"]] : []),\n ...(fields.stack ? [[\"stack\", \"Primary stack chosen\"]] : []),\n ...(fields.platforms ? [[\"platforms\", \"At least one platform\"]] : []),\n [\"credit\", \"Your GitHub username (optional)\"],\n ].map(([key, label]) => (\n <li data-check={key} data-ok=\"false\" class=\"group flex items-center gap-2 text-muted-foreground data-[ok=true]:text-foreground\">\n <span class=\"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border border-border group-data-[ok=true]:border-success group-data-[ok=true]:bg-success group-data-[ok=true]:text-background\">\n <svg viewBox=\"0 0 16 16\" width=\"9\" height=\"9\" aria-hidden=\"true\" fill=\"currentColor\" class=\"hidden group-data-[ok=true]:block\"><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\" /></svg>\n </span>\n {label}\n </li>\n ))}\n </ul>\n\n <div class=\"mt-5 grid gap-2\">\n <a id=\"open-pr-link\" href=\"#\" target=\"_blank\" rel=\"noopener\" class={buttonClass(\"primary\", \"md\", \"w-full justify-center pointer-events-none opacity-50\")}>\n Open pull request on GitHub\n </a>\n <button id=\"copy-yaml\" type=\"button\" disabled class={buttonClass(\"ghost\", \"sm\", \"w-full justify-center pointer-events-none opacity-50\")}>Copy the file instead</button>\n </div>\n <p id=\"submit-status\" class=\"m-0 mt-3 min-h-5 text-2xs text-muted-foreground\" aria-live=\"polite\"></p>\n\n <details class=\"group mt-2 border-t border-border pt-3\">\n <summary class=\"flex cursor-pointer list-none items-center justify-between text-2xs font-medium text-muted-foreground hover:text-foreground [&::-webkit-details-marker]:hidden\">\n <span>Show the file <span id=\"record-path\" class=\"font-mono\"></span></span>\n <span aria-hidden=\"true\" class=\"transition-transform group-open:rotate-45\">+</span>\n </summary>\n <pre class=\"mt-3 max-h-96 overflow-auto rounded-md border border-border bg-surface-sunken p-3 text-xs leading-relaxed text-foreground\"><code id=\"yaml-preview\">Paste a GitHub URL to generate a draft.</code></pre>\n </details>\n </section>\n\n <section class=\"rounded-[var(--radius-lg)] border border-border bg-card p-5\">\n <h2 class=\"m-0 text-sm font-semibold text-foreground\">What happens next</h2>\n <ol class=\"m-0 mt-3 flex list-none flex-col gap-3 p-0 text-2xs leading-relaxed text-muted-foreground\">\n {[\n [\"GitHub opens with the file ready.\", \"Commit it to a fork and open the pull request — one record file.\"],\n [\"Checks run on the pull request.\", \"Schema, taxonomy and duplicate checks — fix anything they flag.\"],\n [\"A maintainer reviews and merges.\", \"Curation and review fields are theirs to fill.\"],\n [\"The page goes live and credits you.\", \"It shows “Submitted by @you”, and maintainers get a README badge.\"],\n ].map(([head, text], i) => (\n <li class=\"flex gap-3\">\n <span class=\"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-secondary text-[10px] font-semibold text-secondary-foreground\">{i + 1}</span>\n <span><strong class=\"font-semibold text-foreground\">{head}</strong> {text}</span>\n </li>\n ))}\n </ol>\n </section>\n\n <details class=\"group rounded-[var(--radius-lg)] border border-border bg-card\">\n <summary class=\"flex cursor-pointer list-none items-center justify-between px-5 py-4 text-sm font-semibold text-foreground [&::-webkit-details-marker]:hidden\">\n Is it a good fit?\n <span aria-hidden=\"true\" class=\"text-muted-foreground transition-transform group-open:rotate-45\">+</span>\n </summary>\n <div class=\"grid gap-4 border-t border-border px-5 pb-5 pt-4 text-2xs sm:grid-cols-2 lg:grid-cols-1\">\n <div>\n <p class=\"m-0 font-semibold uppercase tracking-wider text-emerald-700 dark:text-emerald-400\">Good fit</p>\n <ul class=\"m-0 mt-2 list-none space-y-1.5 p-0 text-foreground\">\n {goodSubmissions.map((item) => <li class=\"flex gap-2\"><span class=\"text-success\">✓</span><span>{item}</span></li>)}\n </ul>\n </div>\n <div>\n <p class=\"m-0 font-semibold uppercase tracking-wider text-amber-700 dark:text-amber-400\">Not a fit</p>\n <ul class=\"m-0 mt-2 list-none space-y-1.5 p-0 text-foreground\">\n {pleaseAvoid.map((item) => <li class=\"flex gap-2\"><span class=\"text-warning\">×</span><span>{item}</span></li>)}\n </ul>\n </div>\n </div>\n </details>\n </aside>\n </div>\n </Container>\n\n <SubmissionClient\n existingSlugs={existingSlugs}\n existingFullNames={existingFullNames}\n repoUrl={repoUrl}\n fields={fields}\n taxonomy={taxonomy}\n categoryLabels={Object.fromEntries(categories.map((c) => [c.id, c.label]))}\n stackLabels={Object.fromEntries(stacks.map((c) => [c.id, c.label]))}\n />\n</BaseLayout>\n",
|
|
424
466
|
"type": "registry:page",
|
|
425
467
|
"target": "~/src/pages/submit.astro"
|
|
426
468
|
},
|
|
427
469
|
{
|
|
428
470
|
"path": "default/components/grove/submission-client.astro",
|
|
429
|
-
"content": "---\nimport {\n inferStackFromTopics,\n parseGithubRepo,\n recordSlugify,\n yamlLines,\n yamlQuote,\n} from '@grove-dev/core';\n\ninterface Props {\n existingSlugs: string[];\n existingFullNames: string[];\n repoUrl: string;\n fields: {\n category: boolean;\n stack: boolean;\n platforms: boolean;\n tags: boolean;\n license?: boolean;\n };\n /** Taxonomy ids for client-side validation. */\n taxonomy?: {\n categoryIds?: string[];\n stackIds?: string[];\n platformIds?: string[];\n };\n /**\n * Optional path of a server-side proxy endpoint that wraps\n * `api.github.com` (SSR consumers with an adapter can wire one and\n * read a `GITHUB_TOKEN` env var to lift the rate limit). When\n * omitted — the static-build default — the visitor's browser calls\n * `https://api.github.com/repos/{owner}/{repo}` directly, which\n * works on any static host but is subject to GitHub's per-IP\n * unauthenticated limit (60 requests/hour).\n */\n githubProxyPath?: string;\n}\nconst {\n existingSlugs,\n existingFullNames,\n repoUrl,\n fields,\n taxonomy,\n githubProxyPath = '',\n} = Astro.props;\n---\n\n<script is:inline define:vars={{ existingSlugs, existingFullNames, repoUrl, fields, taxonomy, githubProxyPath, recordSlugify, parseGithubRepo, yamlQuote, yamlLines, inferStackFromTopics }}>\n /** @typedef {{ name: string; description: string | null; html_url: string; homepage: string | null; language: string | null; private: boolean; topics: string[] }} GitHubRepo */\n /** @type {GitHubRepo | null} */\n let repository = null;\n\n const $ = /** @param {string} selector */ (selector) => /** @type {HTMLElement | null} */ (document.querySelector(selector));\n /** @type {Record<string, HTMLInputElement | HTMLTextAreaElement | null>} */\n const inputs = {\n repo: /** @type {HTMLInputElement | null} */ ($(\"#repo-url\")),\n name: /** @type {HTMLInputElement | null} */ ($(\"#item-name\")),\n slug: /** @type {HTMLInputElement | null} */ ($(\"#item-slug\")),\n description: /** @type {HTMLInputElement | null} */ ($(\"#item-description\")),\n category: /** @type {HTMLSelectElement | null} */ ($(\"#item-category\")),\n stack: /** @type {HTMLSelectElement | null} */ ($(\"#primary-stack\")),\n tags: /** @type {HTMLInputElement | null} */ ($(\"#item-tags\")),\n license: /** @type {HTMLSelectElement | null} */ ($(\"#item-license\")),\n website: /** @type {HTMLInputElement | null} */ ($(\"#item-website\")),\n bestFor: /** @type {HTMLTextAreaElement | null} */ ($(\"#best-for\")),\n };\n const fetchButton = /** @type {HTMLButtonElement | null} */ ($(\"#fetch-repo\"));\n const preview = /** @type {HTMLElement | null} */ ($(\"#yaml-preview\"));\n const status = /** @type {HTMLElement | null} */ ($(\"#submit-status\"));\n const copyButton = /** @type {HTMLButtonElement | null} */ ($(\"#copy-yaml\"));\n const openPrLink = /** @type {HTMLAnchorElement | null} */ ($(\"#open-pr-link\"));\n const slugSet = new Set(existingSlugs);\n const repoSet = new Set(existingFullNames);\n const categoryIds = new Set(taxonomy?.categoryIds ?? []);\n const stackIds = new Set(taxonomy?.stackIds ?? []);\n const platformIds = new Set(taxonomy?.platformIds ?? []);\n\n const slugify = recordSlugify;\n const parseRepo = parseGithubRepo;\n const quote = yamlQuote;\n const lines = yamlLines;\n const inferStack = /** @param {GitHubRepo} repo */ (repo) =>\n inferStackFromTopics({ language: repo.language, topics: repo.topics });\n const selectedPlatforms = () =>\n /** @type {string[]} */ ([...document.querySelectorAll(\"input[name=platform]:checked\")].map((input) => /** @type {HTMLInputElement} */ (input).value));\n const setStatus = (text, tone = \"muted\") => {\n if (!status) return;\n status.textContent = text;\n // Status tokens (danger/warning/success) so the submit states use\n // the same semantic roles as the rest of the system.\n status.className = `mt-3 min-h-5 text-2xs ${tone === \"error\" ? \"text-danger\" : tone === \"warn\" ? \"text-warning\" : tone === \"success\" ? \"text-success\" : \"text-muted-foreground\"}`;\n };\n const generateYaml = () => {\n if (!repository) return \"\";\n const parsed = parseRepo(inputs.repo?.value ?? \"\");\n if (!parsed) return \"\";\n const tags = String(inputs.tags?.value ?? \"\").split(\",\").map((tag) => tag.trim()).filter(Boolean);\n const platforms = selectedPlatforms();\n const bestFor = String(inputs.bestFor?.value ?? \"\").split(\"\\n\").map((item) => item.trim()).filter(Boolean);\n return [\n \"kind: project\",\n `slug: ${slugify(inputs.slug?.value ?? repository.name)}`,\n // The day the record joins the directory. Without it the\n // `recently-added` sort has nothing to sort a new record on and\n // drops it to the bottom of the list built to show it off.\n `addedAt: ${new Date().toISOString().slice(0, 10)}`,\n `name: ${quote(inputs.name?.value ?? \"\")}`,\n `description: ${quote(inputs.description?.value ?? \"\")}`,\n ...(fields.category ? [`category: ${inputs.category?.value || \"uncategorized\"}`] : []),\n \"projectType: real-app\",\n ...(fields.stack && inputs.stack?.value ? [`stack: ${quote(inputs.stack.value)}`] : []),\n ...(fields.platforms ? [\"platforms:\", platforms.length ? lines(platforms) : \" []\"] : []),\n ...(fields.tags ? [\"tags:\", tags.length ? lines(tags) : \" []\"] : []),\n ...(fields.license && inputs.license?.value ? [\"licenses:\", lines([inputs.license.value])] : []),\n `repoUrl: ${repository.html_url}`,\n \"links:\",\n ` github: ${repository.html_url}`,\n ...(inputs.website?.value ? [` website: ${inputs.website.value}`] : []),\n \"bestFor:\", bestFor.length ? lines(bestFor) : \" []\",\n \"source:\",\n \" type: manual\",\n ` owner: ${parsed.owner}`,\n ` repo: ${parsed.repo}`,\n \"curation:\",\n \" reviewed: false\",\n \" labels: []\",\n \" lenses: []\",\n \"\",\n ].join(\"\\n\");\n };\n // NOTE: this taxonomy/slug membership logic duplicates a concern\n // that belongs in `@grove-dev/core` (domain/taxonomy rules, not\n // UI), but it can't be moved into an import here. This `<script>`\n // uses `define:vars` (see the tag above), which Astro's compiler\n // implicitly treats as `is:inline` — the script is emitted\n // verbatim into the page and is NOT run through Vite's bundler,\n // so a bare-specifier `import ... from \"@grove-dev/core\"` would\n // not resolve in the browser (no bundler rewrite, no import map).\n // `define:vars` itself only hands the script JSON-serializable\n // data (see `taxonomy`, `existingSlugs`, etc. above) — a function\n // reference can't cross that boundary either. Moving this out\n // would require converting the script off `is:inline`/`define:vars`\n // to a regular bundled `<script>` that reads its props from\n // `data-*` attributes or a JSON island, which is a larger\n // structural change than this fix warrants.\n const validationIssues = () => {\n const issues = [];\n if (inputs.slug && slugSet.has(slugify(inputs.slug.value))) {\n issues.push(\"A record with that slug already exists — update the existing one instead of opening a duplicate PR.\");\n }\n const description = String(inputs.description?.value ?? \"\");\n if (description.trim().length < 40) {\n issues.push(\"Description must be at least 40 characters.\");\n }\n if (fields.category && inputs.category) {\n const v = inputs.category.value;\n if (!v || v === \"uncategorized\" || (categoryIds.size > 0 && !categoryIds.has(v))) {\n issues.push(\"Choose a category from the taxonomy.\");\n }\n }\n if (fields.stack && inputs.stack) {\n const v = inputs.stack.value;\n if (!v || (stackIds.size > 0 && !stackIds.has(v))) {\n issues.push(\"Choose a primary stack from the taxonomy.\");\n }\n }\n if (fields.platforms && selectedPlatforms().length === 0) {\n issues.push(\"Select at least one platform.\");\n } else if (fields.platforms && platformIds.size > 0) {\n const bad = selectedPlatforms().find((p) => !platformIds.has(p));\n if (bad) issues.push(`Platform \"${bad}\" is not in the taxonomy.`);\n }\n return issues;\n };\n const refresh = () => {\n const yaml = generateYaml();\n if (preview) preview.textContent = yaml || \"Paste a GitHub URL to generate a draft.\";\n if (!yaml || !openPrLink || !copyButton) return;\n const issues = validationIssues();\n if (issues.length > 0) {\n setStatus(issues[0], \"error\");\n openPrLink.classList.add(\"pointer-events-none\", \"opacity-50\");\n copyButton.disabled = true;\n copyButton.classList.add(\"pointer-events-none\", \"opacity-50\");\n return;\n }\n const params = new URLSearchParams({ filename: `data/records/${slugify(inputs.slug?.value ?? \"\")}.yml`, value: yaml });\n openPrLink.href = `${repoUrl}/new/main?${params}`;\n openPrLink.classList.remove(\"pointer-events-none\", \"opacity-50\");\n copyButton.disabled = false;\n copyButton.classList.remove(\"pointer-events-none\", \"opacity-50\");\n };\n\n fetchButton?.addEventListener(\"click\", async () => {\n const parsed = parseRepo(inputs.repo?.value ?? \"\");\n if (!parsed) return setStatus(\"Enter a valid GitHub repository URL.\", \"error\");\n const fullName = `${parsed.owner}/${parsed.repo}`.toLowerCase();\n if (repoSet.has(fullName)) setStatus(\"This repository is already listed. The draft can update its record.\", \"warn\");\n if (fetchButton) fetchButton.disabled = true;\n setStatus(\"Fetching GitHub metadata...\");\n try {\n if (githubProxyPath) {\n // Server-side proxy (SSR consumers) — the endpoint reads an\n // optional `GITHUB_TOKEN` env var and forwards the request\n // with a Bearer header (or unauthenticated, if no token).\n const proxyUrl = `${githubProxyPath}?owner=${encodeURIComponent(parsed.owner)}&repo=${encodeURIComponent(parsed.repo)}`;\n const response = await fetch(proxyUrl);\n const payload = /** @type {{ ok: boolean; status?: number; message?: string; data?: GitHubRepo }} */ (await response.json());\n if (!response.ok || !payload.ok || !payload.data) {\n throw new Error(payload.message || `GitHub returned ${response.status}.`);\n }\n repository = payload.data;\n } else {\n // Static-build default — call api.github.com directly. The\n // raw payload carries the same field names the form fill\n // logic consumes (name, description, html_url, homepage,\n // language, private, topics).\n const response = await fetch(\n `https://api.github.com/repos/${encodeURIComponent(parsed.owner)}/${encodeURIComponent(parsed.repo)}`,\n { headers: { Accept: \"application/vnd.github+json\" } },\n );\n if (response.status === 404) {\n throw new Error(\"Repository not found or not public.\");\n }\n if (response.status === 403 || response.status === 429) {\n throw new Error(\n \"GitHub rate limit reached (60 requests/hour per visitor). Try again later or fill the fields manually.\",\n );\n }\n if (!response.ok) {\n throw new Error(`GitHub returned ${response.status}.`);\n }\n const data = /** @type {GitHubRepo & { topics?: string[] }} */ (await response.json());\n repository = {\n name: data.name,\n description: data.description ?? null,\n html_url: data.html_url,\n homepage: data.homepage ?? null,\n language: data.language ?? null,\n private: Boolean(data.private),\n topics: Array.isArray(data.topics) ? data.topics : [],\n };\n }\n if (repository.private) throw new Error(\"Private repositories cannot be submitted.\");\n if (inputs.name) inputs.name.value = repository.name || parsed.repo;\n if (inputs.slug) inputs.slug.value = slugify(repository.name || parsed.repo);\n if (inputs.description) inputs.description.value = repository.description || \"\";\n if (inputs.stack) inputs.stack.value = inferStack(repository);\n if (inputs.tags) inputs.tags.value = (repository.topics || []).slice(0, 8).join(\", \");\n if (inputs.website) inputs.website.value = repository.homepage || \"\";\n const duplicate = inputs.slug ? slugSet.has(inputs.slug.value) : false;\n setStatus(\n duplicate ? \"That slug already exists. Choose another or update the existing record.\" : \"Draft generated. Edit any field and the YAML will refresh.\",\n duplicate ? \"warn\" : \"success\",\n );\n refresh();\n } catch (error) {\n repository = null;\n setStatus(error instanceof Error ? error.message : \"Unable to fetch repository metadata.\", \"error\");\n } finally {\n if (fetchButton) fetchButton.disabled = false;\n }\n });\n $(\"#submit-form\")?.addEventListener(\"input\", refresh);\n $(\"#submit-form\")?.addEventListener(\"change\", refresh);\n copyButton?.addEventListener(\"click\", async () => {\n try {\n await navigator.clipboard.writeText(preview?.textContent || \"\");\n setStatus(\"Copied YAML to clipboard.\", \"success\");\n } catch {\n setStatus(\"Couldn't copy automatically. Select the YAML and copy it.\", \"error\");\n }\n });\n </script>\n",
|
|
471
|
+
"content": "---\n// The helpers below mirror `recordSlugify`, `parseGithubRepo`,\n// `yamlQuote`, `yamlLines` and `inferStackFromTopics` in @grove-dev/core.\n// They are written out inside the script because `define:vars` only\n// carries JSON: a function passed through it arrives as `undefined`,\n// which left \"Fetch details\" doing nothing. core's tests pin the rules.\n\ninterface Props {\n existingSlugs: string[];\n existingFullNames: string[];\n repoUrl: string;\n fields: {\n category: boolean;\n stack: boolean;\n platforms: boolean;\n tags: boolean;\n license?: boolean;\n };\n /** Taxonomy ids for client-side validation. */\n taxonomy?: {\n categoryIds?: string[];\n stackIds?: string[];\n platformIds?: string[];\n };\n /**\n * Optional path of a server-side proxy endpoint that wraps\n * `api.github.com` (SSR consumers with an adapter can wire one and\n * read a `GITHUB_TOKEN` env var to lift the rate limit). When\n * omitted — the static-build default — the visitor's browser calls\n * `https://api.github.com/repos/{owner}/{repo}` directly, which\n * works on any static host but is subject to GitHub's per-IP\n * unauthenticated limit (60 requests/hour).\n */\n githubProxyPath?: string;\n /** id → label, for the live preview card. */\n categoryLabels?: Record<string, string>;\n stackLabels?: Record<string, string>;\n}\nconst {\n existingSlugs,\n existingFullNames,\n repoUrl,\n fields,\n taxonomy,\n githubProxyPath = '',\n categoryLabels = {},\n stackLabels = {},\n} = Astro.props;\n---\n\n<script is:inline define:vars={{ existingSlugs, existingFullNames, repoUrl, fields, taxonomy, githubProxyPath, categoryLabels, stackLabels }}>\n /** @typedef {{ name: string; description: string | null; html_url: string; homepage: string | null; language: string | null; private: boolean; topics: string[] }} GitHubRepo */\n /** @type {GitHubRepo | null} */\n let repository = null;\n\n const $ = /** @param {string} selector */ (selector) => /** @type {HTMLElement | null} */ (document.querySelector(selector));\n /** @type {Record<string, HTMLInputElement | HTMLTextAreaElement | null>} */\n const inputs = {\n repo: /** @type {HTMLInputElement | null} */ ($(\"#repo-url\")),\n name: /** @type {HTMLInputElement | null} */ ($(\"#item-name\")),\n slug: /** @type {HTMLInputElement | null} */ ($(\"#item-slug\")),\n description: /** @type {HTMLInputElement | null} */ ($(\"#item-description\")),\n category: /** @type {HTMLSelectElement | null} */ ($(\"#item-category\")),\n stack: /** @type {HTMLSelectElement | null} */ ($(\"#primary-stack\")),\n tags: /** @type {HTMLInputElement | null} */ ($(\"#item-tags\")),\n license: /** @type {HTMLSelectElement | null} */ ($(\"#item-license\")),\n website: /** @type {HTMLInputElement | null} */ ($(\"#item-website\")),\n bestFor: /** @type {HTMLTextAreaElement | null} */ ($(\"#best-for\")),\n submittedBy: /** @type {HTMLInputElement | null} */ ($(\"#submitted-by\")),\n };\n /** Facts for the repository card; not written to the record. */\n let repoFacts = null;\n const GITHUB_LOGIN = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/;\n const submitter = () => String(inputs.submittedBy?.value ?? \"\").trim().replace(/^@/, \"\");\n const fetchButton = /** @type {HTMLButtonElement | null} */ ($(\"#fetch-repo\"));\n const preview = /** @type {HTMLElement | null} */ ($(\"#yaml-preview\"));\n const status = /** @type {HTMLElement | null} */ ($(\"#submit-status\"));\n const copyButton = /** @type {HTMLButtonElement | null} */ ($(\"#copy-yaml\"));\n const openPrLink = /** @type {HTMLAnchorElement | null} */ ($(\"#open-pr-link\"));\n const slugSet = new Set(existingSlugs);\n const repoSet = new Set(existingFullNames);\n const categoryIds = new Set(taxonomy?.categoryIds ?? []);\n const stackIds = new Set(taxonomy?.stackIds ?? []);\n const platformIds = new Set(taxonomy?.platformIds ?? []);\n\n const slugify = (value) =>\n String(value || \"\").toLowerCase().replace(/[^a-z0-9]+/g, \"-\").replace(/^-+|-+$/g, \"\");\n const parseRepo = (value) => {\n const match = String(value ?? \"\").match(/github\\.com\\/([^/]+)\\/([^/?#]+)/);\n return match ? { owner: match[1] ?? \"\", repo: (match[2] ?? \"\").replace(/\\.git$/, \"\") } : null;\n };\n const quote = (value) => `\"${String(value ?? \"\").replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`;\n const lines = (values, indent = 2) => values.map((value) => `${\" \".repeat(indent)}- ${value}`).join(\"\\n\");\n const inferStack = /** @param {GitHubRepo} repo */ (repo) => {\n const language = String(repo.language || \"\").toLowerCase();\n const topics = (repo.topics || []).map((topic) => String(topic).toLowerCase());\n if (topics.includes(\"flutter\") || language === \"dart\") return \"flutter\";\n if (topics.includes(\"react-native\")) return \"react-native\";\n if (language === \"swift\" || language === \"objective-c\") return \"ios\";\n if (language === \"kotlin\" || language === \"java\") return \"android\";\n return language;\n };\n const selectedPlatforms = () =>\n /** @type {string[]} */ ([...document.querySelectorAll(\"input[name=platform]:checked\")].map((input) => /** @type {HTMLInputElement} */ (input).value));\n const setStatus = (text, tone = \"muted\") => {\n if (!status) return;\n status.textContent = text;\n // Status tokens (danger/warning/success) so the submit states use\n // the same semantic roles as the rest of the system.\n status.className = `mt-3 min-h-5 whitespace-pre-line text-2xs ${tone === \"error\" ? \"text-danger\" : tone === \"warn\" ? \"text-warning\" : tone === \"success\" ? \"text-success\" : \"text-muted-foreground\"}`;\n };\n const generateYaml = () => {\n if (!repository) return \"\";\n const parsed = parseRepo(inputs.repo?.value ?? \"\");\n if (!parsed) return \"\";\n const tags = String(inputs.tags?.value ?? \"\").split(\",\").map((tag) => tag.trim()).filter(Boolean);\n const platforms = selectedPlatforms();\n const bestFor = String(inputs.bestFor?.value ?? \"\").split(\"\\n\").map((item) => item.trim()).filter(Boolean);\n return [\n \"kind: project\",\n `slug: ${slugify(inputs.slug?.value ?? repository.name)}`,\n // The day the record joins the directory. Without it the\n // `recently-added` sort has nothing to sort a new record on and\n // drops it to the bottom of the list built to show it off.\n `addedAt: ${new Date().toISOString().slice(0, 10)}`,\n // Credits the contributor on the record page and /contributors/.\n ...(GITHUB_LOGIN.test(submitter()) ? [`submittedBy: ${submitter()}`] : []),\n `name: ${quote(inputs.name?.value ?? \"\")}`,\n `description: ${quote(inputs.description?.value ?? \"\")}`,\n ...(fields.category ? [`category: ${inputs.category?.value || \"uncategorized\"}`] : []),\n \"projectType: real-app\",\n ...(fields.stack && inputs.stack?.value ? [`stack: ${quote(inputs.stack.value)}`] : []),\n ...(fields.platforms ? [\"platforms:\", platforms.length ? lines(platforms) : \" []\"] : []),\n ...(fields.tags ? [\"tags:\", tags.length ? lines(tags) : \" []\"] : []),\n ...(fields.license && inputs.license?.value ? [\"licenses:\", lines([inputs.license.value])] : []),\n `repoUrl: ${repository.html_url}`,\n \"links:\",\n ` github: ${repository.html_url}`,\n ...(inputs.website?.value ? [` website: ${inputs.website.value}`] : []),\n \"bestFor:\", bestFor.length ? lines(bestFor) : \" []\",\n \"source:\",\n \" type: manual\",\n ` owner: ${parsed.owner}`,\n ` repo: ${parsed.repo}`,\n \"curation:\",\n \" reviewed: false\",\n \" labels: []\",\n \" lenses: []\",\n \"\",\n ].join(\"\\n\");\n };\n // NOTE: this taxonomy/slug membership logic duplicates a concern\n // that belongs in `@grove-dev/core` (domain/taxonomy rules, not\n // UI), but it can't be moved into an import here. This `<script>`\n // uses `define:vars` (see the tag above), which Astro's compiler\n // implicitly treats as `is:inline` — the script is emitted\n // verbatim into the page and is NOT run through Vite's bundler,\n // so a bare-specifier `import ... from \"@grove-dev/core\"` would\n // not resolve in the browser (no bundler rewrite, no import map).\n // `define:vars` itself only hands the script JSON-serializable\n // data (see `taxonomy`, `existingSlugs`, etc. above) — a function\n // reference can't cross that boundary either. Moving this out\n // would require converting the script off `is:inline`/`define:vars`\n // to a regular bundled `<script>` that reads its props from\n // `data-*` attributes or a JSON island, which is a larger\n // structural change than this fix warrants.\n const validationIssues = () => {\n const issues = [];\n if (inputs.slug && slugSet.has(slugify(inputs.slug.value))) {\n issues.push(\"A record with that slug already exists — update the existing one instead of opening a duplicate PR.\");\n }\n const description = String(inputs.description?.value ?? \"\");\n if (description.trim().length < 40) {\n issues.push(\"Description must be at least 40 characters.\");\n }\n if (fields.category && inputs.category) {\n const v = inputs.category.value;\n if (!v || v === \"uncategorized\" || (categoryIds.size > 0 && !categoryIds.has(v))) {\n issues.push(\"Choose a category from the taxonomy.\");\n }\n }\n if (fields.stack && inputs.stack) {\n const v = inputs.stack.value;\n if (!v || (stackIds.size > 0 && !stackIds.has(v))) {\n issues.push(\"Choose a primary stack from the taxonomy.\");\n }\n }\n if (submitter() && !GITHUB_LOGIN.test(submitter())) {\n issues.push(\"That GitHub username doesn't look right — letters, digits and dashes only.\");\n }\n if (fields.platforms && selectedPlatforms().length === 0) {\n issues.push(\"Select at least one platform.\");\n } else if (fields.platforms && platformIds.size > 0) {\n const bad = selectedPlatforms().find((p) => !platformIds.has(p));\n if (bad) issues.push(`Platform \"${bad}\" is not in the taxonomy.`);\n }\n return issues;\n };\n // ── Live preview, checklist and step states ──────────────────\n const setText = (selector, text) => {\n const el = $(selector);\n if (el) el.textContent = text;\n };\n const updateGuide = (valid) => {\n const state = {\n repo: Boolean(repository),\n description: String(inputs.description?.value ?? \"\").trim().length >= 40,\n category: Boolean(inputs.category?.value),\n stack: Boolean(inputs.stack?.value),\n platforms: selectedPlatforms().length > 0,\n credit: GITHUB_LOGIN.test(submitter()),\n };\n document.querySelectorAll(\"[data-check]\").forEach((li) => {\n li.setAttribute(\"data-ok\", String(Boolean(state[li.getAttribute(\"data-check\") ?? \"\"])));\n });\n const steps = {\n repo: state.repo ? \"done\" : \"current\",\n details: !state.repo ? \"todo\" : valid ? \"done\" : \"current\",\n review: state.repo && valid ? \"current\" : \"todo\",\n };\n document.querySelectorAll(\"[data-step]\").forEach((li) => {\n li.setAttribute(\"data-state\", steps[li.getAttribute(\"data-step\") ?? \"\"] ?? \"todo\");\n });\n const name = String(inputs.name?.value ?? \"\").trim();\n if (name) setText(\"#preview-name\", name);\n setText(\"#preview-initials\", name ? name.slice(0, 2).toUpperCase() : \"?\");\n const meta = [categoryLabels[inputs.category?.value ?? \"\"], stackLabels[inputs.stack?.value ?? \"\"]].filter(Boolean);\n setText(\"#preview-meta\", meta.length ? meta.join(\" · \") : \"Category · Stack\");\n const description = String(inputs.description?.value ?? \"\").trim();\n setText(\"#preview-description\", description || \"The description appears here.\");\n const avatar = /** @type {HTMLImageElement | null} */ ($(\"#preview-avatar\"));\n const initials = $(\"#preview-initials\");\n if (avatar && initials) {\n avatar.hidden = !repoFacts?.avatar;\n initials.hidden = Boolean(repoFacts?.avatar);\n if (repoFacts?.avatar) avatar.src = repoFacts.avatar;\n }\n const credit = $(\"#preview-credit\");\n if (credit) {\n credit.hidden = !state.credit;\n credit.textContent = state.credit ? `Submitted by @${submitter()}` : \"\";\n }\n };\n const showRepoCard = () => {\n const card = $(\"#repo-card\");\n if (!card) return;\n card.hidden = !repoFacts;\n if (!repoFacts) return;\n const avatar = /** @type {HTMLImageElement | null} */ ($(\"#repo-avatar\"));\n if (avatar) avatar.src = repoFacts.avatar;\n setText(\"#repo-name\", repoFacts.fullName);\n setText(\"#repo-description\", repoFacts.description || \"No description on GitHub.\");\n const facts = $(\"#repo-facts\");\n if (facts) {\n facts.replaceChildren(\n ...[\n `★ ${repoFacts.stars.toLocaleString(\"en\")} stars`,\n repoFacts.license ? `Licence: ${repoFacts.license}` : \"No licence detected\",\n repoFacts.pushedAt ? `Last push ${new Date(repoFacts.pushedAt).toLocaleDateString(\"en\", { year: \"numeric\", month: \"short\", day: \"numeric\" })}` : \"\",\n repoFacts.archived ? \"Archived\" : \"\",\n ].filter(Boolean).map((text) => {\n const span = document.createElement(\"span\");\n span.textContent = text;\n return span;\n }),\n );\n }\n };\n\n const refresh = () => {\n updateGuide(Boolean(generateYaml()) && validationIssues().length === 0);\n const yaml = generateYaml();\n const path = `data/records/${slugify(inputs.slug?.value ?? \"\")}.yml`;\n setText(\"#record-path\", yaml ? path : \"\");\n if (preview) preview.textContent = yaml || \"Paste a GitHub URL to generate a draft.\";\n if (!yaml || !openPrLink || !copyButton) return;\n const issues = validationIssues();\n if (issues.length > 0) {\n setStatus(issues.map((issue) => `• ${issue}`).join(\"\\n\"), \"error\");\n openPrLink.classList.add(\"pointer-events-none\", \"opacity-50\");\n copyButton.disabled = true;\n copyButton.classList.add(\"pointer-events-none\", \"opacity-50\");\n return;\n }\n const params = new URLSearchParams({ filename: `data/records/${slugify(inputs.slug?.value ?? \"\")}.yml`, value: yaml });\n openPrLink.href = `${repoUrl}/new/main?${params}`;\n openPrLink.classList.remove(\"pointer-events-none\", \"opacity-50\");\n copyButton.disabled = false;\n copyButton.classList.remove(\"pointer-events-none\", \"opacity-50\");\n setStatus(`Draft is valid. \"Open pull request\" creates ${path} in one step.`, \"success\");\n };\n\n fetchButton?.addEventListener(\"click\", async () => {\n const parsed = parseRepo(inputs.repo?.value ?? \"\");\n if (!parsed) return setStatus(\"Enter a valid GitHub repository URL.\", \"error\");\n const fullName = `${parsed.owner}/${parsed.repo}`.toLowerCase();\n if (repoSet.has(fullName)) setStatus(\"This repository is already listed. The draft can update its record.\", \"warn\");\n if (fetchButton) fetchButton.disabled = true;\n setStatus(\"Fetching GitHub metadata...\");\n try {\n if (githubProxyPath) {\n // Server-side proxy (SSR consumers) — the endpoint reads an\n // optional `GITHUB_TOKEN` env var and forwards the request\n // with a Bearer header (or unauthenticated, if no token).\n const proxyUrl = `${githubProxyPath}?owner=${encodeURIComponent(parsed.owner)}&repo=${encodeURIComponent(parsed.repo)}`;\n const response = await fetch(proxyUrl);\n const payload = /** @type {{ ok: boolean; status?: number; message?: string; data?: GitHubRepo }} */ (await response.json());\n if (!response.ok || !payload.ok || !payload.data) {\n throw new Error(payload.message || `GitHub returned ${response.status}.`);\n }\n repository = payload.data;\n } else {\n // Static-build default — call api.github.com directly. The\n // raw payload carries the same field names the form fill\n // logic consumes (name, description, html_url, homepage,\n // language, private, topics).\n const response = await fetch(\n `https://api.github.com/repos/${encodeURIComponent(parsed.owner)}/${encodeURIComponent(parsed.repo)}`,\n { headers: { Accept: \"application/vnd.github+json\" } },\n );\n if (response.status === 404) {\n throw new Error(\"Repository not found or not public.\");\n }\n if (response.status === 403 || response.status === 429) {\n throw new Error(\n \"GitHub rate limit reached (60 requests/hour per visitor). Try again later or fill the fields manually.\",\n );\n }\n if (!response.ok) {\n throw new Error(`GitHub returned ${response.status}.`);\n }\n const data = /** @type {any} */ (await response.json());\n repoFacts = {\n fullName: data.full_name ?? `${parsed.owner}/${parsed.repo}`,\n description: data.description ?? \"\",\n avatar: data.owner?.avatar_url ? `${data.owner.avatar_url}&s=80` : `https://github.com/${parsed.owner}.png?size=80`,\n stars: Number(data.stargazers_count ?? 0),\n license: data.license?.spdx_id && data.license.spdx_id !== \"NOASSERTION\" ? data.license.spdx_id : \"\",\n pushedAt: data.pushed_at ?? \"\",\n archived: Boolean(data.archived),\n };\n repository = {\n name: data.name,\n description: data.description ?? null,\n html_url: data.html_url,\n homepage: data.homepage ?? null,\n language: data.language ?? null,\n private: Boolean(data.private),\n topics: Array.isArray(data.topics) ? data.topics : [],\n };\n }\n if (repository.private) throw new Error(\"Private repositories cannot be submitted.\");\n showRepoCard();\n if (inputs.name) inputs.name.value = repository.name || parsed.repo;\n if (inputs.slug) inputs.slug.value = slugify(repository.name || parsed.repo);\n if (inputs.description) inputs.description.value = repository.description || \"\";\n if (inputs.stack) {\n // Only a real taxonomy id; an unknown value would blank the select.\n const inferred = inferStack(repository);\n inputs.stack.value = stackIds.size === 0 || stackIds.has(inferred) ? inferred : \"\";\n }\n if (inputs.tags) inputs.tags.value = (repository.topics || []).slice(0, 8).join(\", \");\n if (inputs.website) inputs.website.value = repository.homepage || \"\";\n const duplicate = inputs.slug ? slugSet.has(inputs.slug.value) : false;\n setStatus(\n duplicate ? \"That slug already exists. Choose another or update the existing record.\" : \"Draft generated. Edit any field and the YAML will refresh.\",\n duplicate ? \"warn\" : \"success\",\n );\n refresh();\n } catch (error) {\n repository = null;\n repoFacts = null;\n showRepoCard();\n refresh();\n setStatus(error instanceof Error ? error.message : \"Unable to fetch repository metadata.\", \"error\");\n } finally {\n if (fetchButton) fetchButton.disabled = false;\n }\n });\n inputs.repo?.addEventListener(\"keydown\", (event) => {\n if (/** @type {KeyboardEvent} */ (event).key === \"Enter\") {\n event.preventDefault();\n fetchButton?.click();\n }\n });\n $(\"#submit-form\")?.addEventListener(\"submit\", (event) => event.preventDefault());\n $(\"#submit-form\")?.addEventListener(\"input\", refresh);\n $(\"#submit-form\")?.addEventListener(\"change\", refresh);\n copyButton?.addEventListener(\"click\", async () => {\n try {\n await navigator.clipboard.writeText(preview?.textContent || \"\");\n setStatus(\"Copied YAML to clipboard.\", \"success\");\n } catch {\n setStatus(\"Couldn't copy automatically. Select the YAML and copy it.\", \"error\");\n }\n });\n </script>\n",
|
|
430
472
|
"type": "registry:component",
|
|
431
473
|
"target": "~/src/components/grove/submission-client.astro"
|
|
432
474
|
},
|
|
433
475
|
{
|
|
434
476
|
"path": "default/pages/about.astro",
|
|
435
|
-
"content": "---\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getAboutPageSeo,\n getPageContentHtml,\n indexSlug,\n itemLabel,\n itemLabelPlural,\n} from '@grove-dev/astro/server';\n/**\n * About page — generic.\n *\n * A continuous narrative in three movements: what this site is →\n * how it's built (the file-first pipeline: source files → Grove →\n * multiple outputs → ongoing sync) → how to contribute. Prose\n * sections, not a stack of cards — the reading experience is the\n * point here.\n *\n * The copy is generic — references \"directory\", \"record\",\n * \"repository\" — so it works for any blueprint, and every dynamic\n * value (`siteConfig.tagline`, `siteConfig.repoUrl`, item labels)\n * flows from the site config.\n */\nimport BaseLayout from '../layouts/base-layout.astro';\nimport Container from '../layouts/container.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\nconst githubUrl = siteConfig.repoUrl;\nconst seo = getAboutPageSeo(siteConfig);\nconst slug = indexSlug();\nconst item = itemLabel();\nconst items = itemLabelPlural();\nconst pageContentHtml = getPageContentHtml('about');\n---\n\n<BaseLayout title={seo.title} description={seo.description} image={seo.image} jsonLd={seo.jsonLd} site={siteConfig}>\n <Container size=\"narrow\">\n <article class=\"py-12 sm:py-16\">\n <nav class=\"text-2xs text-muted-foreground\" aria-label=\"Breadcrumb\">\n <a href=\"/\" class=\"hover:text-foreground\">Home</a>\n <span class=\"mx-1.5 text-ink-300 dark:text-ink-700\">/</span>\n <span class=\"text-foreground\">About</span>\n </nav>\n\n {pageContentHtml ? (\n <section class=\"grove-prose mt-8\" set:html={pageContentHtml} />\n ) : (\n <>\n <header class=\"mt-5\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n About\n </span>\n <h1 class=\"mt-1 m-0 text-[1.75rem] sm:text-[2.25rem] font-semibold tracking-[-0.02em] leading-[1.1] text-foreground\">\n A directory that lives in files.\n </h1>\n <p class=\"mt-4 m-0 text-[1rem] sm:text-[1.0625rem] leading-relaxed text-foreground max-w-[62ch]\">\n {siteConfig.name} is a curated, health-aware directory of open-source\n {items} — and every listing you see here is a plain YAML file in a\n public repository. This website is one of the outputs generated from\n those files.\n </p>\n </header>\n\n <section class=\"mt-10\">\n <h2 class=\"m-0 text-[1.25rem] sm:text-[1.375rem] font-semibold tracking-tight text-foreground\">\n Why it exists\n </h2>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n GitHub search and README lists optimize for the repository name and\n description. They rarely tell you whether a project is a real {item}\n or a demo, which stack it uses beyond the headline, how active it\n really is, or whether it has a clear license.\n </p>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n Each entry here carries the metadata a developer actually needs\n before opening the repo: stack, platforms, license, activity and\n health signals, plus curated notes — best for, why listed, caveats.\n Everything links back to real, runnable source. No SEO spam, no\n affiliate farms, no broken links.\n </p>\n </section>\n\n <section class=\"mt-10\">\n <h2 class=\"m-0 text-[1.25rem] sm:text-[1.375rem] font-semibold tracking-tight text-foreground\">\n How it's built\n </h2>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n The source of truth is a folder of files: one YAML record per\n {item}, taxonomy files for categories, stacks, platforms, and\n licenses, and Markdown for long-form notes. <a href=\"https://github.com/tortuvshin/grove\" class=\"font-medium underline decoration-border underline-offset-2 hover:decoration-ring\">Grove</a> validates\n those files, joins in synced GitHub metadata, and publishes them as\n multiple outputs — this website with its search and filters, a\n generated README, an <code class=\"font-mono text-[0.875em]\">llms.txt</code> index\n for machines, and sitemap/SEO data.\n </p>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n Automation keeps the outputs current: weekly syncs refresh stars,\n activity, and contributor data, and every change to a source file\n rebuilds everything derived from it. There is no database and no\n server — the output is static HTML, and the content stays portable\n in files you can fork.\n </p>\n </section>\n\n <section class=\"mt-10\">\n <h2 class=\"m-0 text-[1.25rem] sm:text-[1.375rem] font-semibold tracking-tight text-foreground\">\n How to contribute\n </h2>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n Because the content is files, contributing is a pull request: add a\n YAML record for a new {item}, fix a typo, or improve the metadata\n behind an existing listing. The <a href=\"/submit\" class=\"font-medium underline decoration-border underline-offset-2 hover:decoration-ring\">submit page</a> drafts\n the YAML for you from a repository URL, and every submission is\n reviewed against the curation bar before it lands.\n </p>\n </section>\n\n <section class=\"mt-10 flex flex-wrap items-center gap-3\">\n <a href={`/${slug}/`} class={buttonClass(\"primary\", \"sm\")}>Browse the directory</a>\n {githubUrl && (\n <a\n href={githubUrl}\n target=\"_blank\"\n rel=\"noopener
|
|
477
|
+
"content": "---\nimport siteConfig from '@grove/generated/site-config.json';\nimport {\n getAboutPageSeo,\n getPageContentHtml,\n indexSlug,\n itemLabel,\n itemLabelPlural,\n} from '@grove-dev/astro/server';\n/**\n * About page — generic.\n *\n * A continuous narrative in three movements: what this site is →\n * how it's built (the file-first pipeline: source files → Grove →\n * multiple outputs → ongoing sync) → how to contribute. Prose\n * sections, not a stack of cards — the reading experience is the\n * point here.\n *\n * The copy is generic — references \"directory\", \"record\",\n * \"repository\" — so it works for any blueprint, and every dynamic\n * value (`siteConfig.tagline`, `siteConfig.repoUrl`, item labels)\n * flows from the site config.\n */\nimport BaseLayout from '../layouts/base-layout.astro';\nimport Container from '../layouts/container.astro';\nimport { buttonClass } from '../lib/classnames.ts';\n\ntype Press = { outlet: string; title: string; url: string; date: string; logo?: string };\nconst press = (siteConfig as { press?: Press[] }).press ?? [];\n\nconst githubUrl = siteConfig.repoUrl;\nconst seo = getAboutPageSeo(siteConfig);\nconst slug = indexSlug();\nconst item = itemLabel();\nconst items = itemLabelPlural();\nconst pageContentHtml = getPageContentHtml('about');\n---\n\n<BaseLayout title={seo.title} description={seo.description} image={seo.image} jsonLd={seo.jsonLd} site={siteConfig}>\n <Container size=\"narrow\">\n <article class=\"py-12 sm:py-16\">\n <nav class=\"text-2xs text-muted-foreground\" aria-label=\"Breadcrumb\">\n <a href=\"/\" class=\"hover:text-foreground\">Home</a>\n <span class=\"mx-1.5 text-ink-300 dark:text-ink-700\">/</span>\n <span class=\"text-foreground\">About</span>\n </nav>\n\n {pageContentHtml ? (\n <section class=\"grove-prose mt-8\" set:html={pageContentHtml} />\n ) : (\n <>\n <header class=\"mt-5\">\n <span class=\"text-2xs font-medium uppercase tracking-wider text-muted-foreground\">\n About\n </span>\n <h1 class=\"mt-1 m-0 text-[1.75rem] sm:text-[2.25rem] font-semibold tracking-[-0.02em] leading-[1.1] text-foreground\">\n A directory that lives in files.\n </h1>\n <p class=\"mt-4 m-0 text-[1rem] sm:text-[1.0625rem] leading-relaxed text-foreground max-w-[62ch]\">\n {siteConfig.name} is a curated, health-aware directory of open-source\n {items} — and every listing you see here is a plain YAML file in a\n public repository. This website is one of the outputs generated from\n those files.\n </p>\n </header>\n\n <section class=\"mt-10\">\n <h2 class=\"m-0 text-[1.25rem] sm:text-[1.375rem] font-semibold tracking-tight text-foreground\">\n Why it exists\n </h2>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n GitHub search and README lists optimize for the repository name and\n description. They rarely tell you whether a project is a real {item}\n or a demo, which stack it uses beyond the headline, how active it\n really is, or whether it has a clear license.\n </p>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n Each entry here carries the metadata a developer actually needs\n before opening the repo: stack, platforms, license, activity and\n health signals, plus curated notes — best for, why listed, caveats.\n Everything links back to real, runnable source. No SEO spam, no\n affiliate farms, no broken links.\n </p>\n </section>\n\n <section class=\"mt-10\">\n <h2 class=\"m-0 text-[1.25rem] sm:text-[1.375rem] font-semibold tracking-tight text-foreground\">\n How it's built\n </h2>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n The source of truth is a folder of files: one YAML record per\n {item}, taxonomy files for categories, stacks, platforms, and\n licenses, and Markdown for long-form notes. <a href=\"https://github.com/tortuvshin/grove\" class=\"font-medium underline decoration-border underline-offset-2 hover:decoration-ring\">Grove</a> validates\n those files, joins in synced GitHub metadata, and publishes them as\n multiple outputs — this website with its search and filters, a\n generated README, an <code class=\"font-mono text-[0.875em]\">llms.txt</code> index\n for machines, and sitemap/SEO data.\n </p>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n Automation keeps the outputs current: weekly syncs refresh stars,\n activity, and contributor data, and every change to a source file\n rebuilds everything derived from it. There is no database and no\n server — the output is static HTML, and the content stays portable\n in files you can fork.\n </p>\n </section>\n\n <section class=\"mt-10\">\n <h2 class=\"m-0 text-[1.25rem] sm:text-[1.375rem] font-semibold tracking-tight text-foreground\">\n How to contribute\n </h2>\n <p class=\"mt-3 m-0 text-[0.9375rem] leading-relaxed text-foreground\">\n Because the content is files, contributing is a pull request: add a\n YAML record for a new {item}, fix a typo, or improve the metadata\n behind an existing listing. The <a href=\"/submit\" class=\"font-medium underline decoration-border underline-offset-2 hover:decoration-ring\">submit page</a> drafts\n the YAML for you from a repository URL, and every submission is\n reviewed against the curation bar before it lands.\n </p>\n </section>\n\n <section class=\"mt-10 flex flex-wrap items-center gap-3\">\n <a href={`/${slug}/`} class={buttonClass(\"primary\", \"sm\")}>Browse the directory</a>\n {githubUrl && (\n <a\n href={githubUrl}\n target=\"_blank\"\n rel=\"noopener\"\n class={buttonClass(\"secondary\", \"sm\")}\n >\n View on GitHub\n </a>\n )}\n <a href=\"/submit\" class={buttonClass(\"ghost\", \"sm\")}>Submit a {item} →</a>\n </section>\n </>\n )}\n {press.length > 0 && (\n <section class=\"mt-12 border-t border-border pt-8\" aria-labelledby=\"press-heading\">\n <h2 id=\"press-heading\" class=\"m-0 text-[1.25rem] font-semibold tracking-tight text-foreground\">Featured in</h2>\n <ul class=\"m-0 mt-4 flex list-none flex-col gap-2 p-0\">\n {press.map((item) => (\n <li class=\"m-0\">\n <a href={item.url} target=\"_blank\" rel=\"noopener\" class=\"flex items-center gap-3 rounded-[var(--radius-lg)] border border-border bg-card p-3 no-underline hover:border-ink-400 dark:hover:border-ink-600\">\n {item.logo && (\n <span class=\"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-white p-1.5\"><img src={item.logo} alt=\"\" width=\"20\" height=\"20\" class=\"h-5 w-5\" /></span>\n )}\n <span class=\"min-w-0\">\n <span class=\"block text-sm font-semibold text-foreground\">{item.title}</span>\n <span class=\"block text-2xs text-muted-foreground\">{item.outlet} · {new Date(`${item.date}-01T00:00:00Z`).toLocaleDateString('en-US', { month: 'long', year: 'numeric', timeZone: 'UTC' })}</span>\n </span>\n </a>\n </li>\n ))}\n </ul>\n </section>\n )}\n </article>\n </Container>\n</BaseLayout>\n",
|
|
436
478
|
"type": "registry:page",
|
|
437
479
|
"target": "~/src/pages/about.astro"
|
|
438
480
|
},
|
|
439
481
|
{
|
|
440
482
|
"path": "default/pages/contributors.astro",
|
|
441
|
-
"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
|
|
483
|
+
"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, getSubmissionsBySubmitter } 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// Records per `submittedBy`; the ids are what a record page's\n// \"Submitted by @login\" links to.\nconst submitters = getSubmissionsBySubmitter(siteConfig);\nconst submittedTotal = submitters.reduce((n, p) => n + p.items.length, 0);\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\"\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 {submitters.length > 0 && (\n <section aria-labelledby=\"submitted-heading\" class=\"pb-4\">\n <div class=\"mx-auto w-full max-w-container px-5 sm:px-7\">\n <h2 id=\"submitted-heading\" class=\"m-0 text-[1.25rem] font-semibold tracking-tight text-foreground\">\n Added by the community\n </h2>\n <p class=\"m-0 mt-1 text-sm text-muted-foreground\">\n {submittedTotal} {submittedTotal === 1 ? \"entry\" : \"entries\"} came in from {submitters.length} {submitters.length === 1 ? \"person\" : \"people\"}. Each page credits who submitted it.\n </p>\n <ul class=\"m-0 mt-4 grid list-none grid-cols-1 gap-2 p-0 sm:grid-cols-2 lg:grid-cols-3\">\n {submitters.map((person) => (\n <li id={person.id} class=\"m-0 flex scroll-mt-24 items-start gap-3 rounded-[var(--radius-lg)] border border-border bg-card p-3 target:border-ring target:ring-3 target:ring-ring/35\">\n <img src={`https://github.com/${person.login}.png?size=64`} alt=\"\" width=\"32\" height=\"32\" loading=\"lazy\" decoding=\"async\" class=\"h-8 w-8 shrink-0 rounded-full border border-border\" />\n <div class=\"min-w-0\">\n <a href={`https://github.com/${person.login}`} target=\"_blank\" rel=\"noopener\" class=\"text-sm font-semibold text-foreground no-underline hover:underline\" data-event=\"contributor_click\" data-event-source=\"submitted_by\">\n @{person.login}\n </a>\n <p class=\"m-0 mt-0.5 text-sm leading-snug text-muted-foreground\">\n {person.items.map((item, i) => (\n <>{i > 0 && \", \"}<a href={item.url} class=\"text-muted-foreground underline decoration-border underline-offset-2 hover:text-foreground\">{item.name}</a></>\n ))}\n </p>\n </div>\n </li>\n ))}\n </ul>\n </div>\n </section>\n )}\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\"\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",
|
|
442
484
|
"type": "registry:page",
|
|
443
485
|
"target": "~/src/pages/contributors.astro"
|
|
444
486
|
},
|
|
@@ -456,8 +498,8 @@
|
|
|
456
498
|
}
|
|
457
499
|
],
|
|
458
500
|
"meta": {
|
|
459
|
-
"version": "1.
|
|
460
|
-
"requiresGrove": "0.
|
|
501
|
+
"version": "1.5.0",
|
|
502
|
+
"requiresGrove": "1.0.0"
|
|
461
503
|
},
|
|
462
504
|
"type": "registry:block"
|
|
463
505
|
}
|