{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "changelog-compact",
  "type": "registry:block",
  "title": "Changelog Compact",
  "description": "A compact, filterable changelog with version links and an RSS link.",
  "files": [
    {
      "path": "src/registry/blocks/changelog/changelog-compact.tsx",
      "type": "registry:block",
      "content": "\"use client\";\n\nimport { useId, useState, type ComponentProps, type CSSProperties } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type CompactChangeType = \"new\" | \"improved\" | \"fixed\";\nexport type CompactFilter = \"all\" | CompactChangeType;\n\nexport type CompactChange = {\n  /** Display date, e.g. \"06 Oct\". */\n  date: string;\n  /** Machine-readable date for the <time> element, e.g. \"2026-10-06\". */\n  dateTime: string;\n  type: CompactChangeType;\n  text: string;\n  version: string;\n  href: string;\n};\n\nexport type ChangelogCompactProps = {\n  eyebrow?: string;\n  title?: string;\n  description?: string;\n  changes?: CompactChange[];\n  /** Controlled filter. Leave undefined to let the block manage it. */\n  filter?: CompactFilter;\n  defaultFilter?: CompactFilter;\n  onFilterChange?: (filter: CompactFilter) => void;\n  rssHref?: string;\n  /** Marker colour for \"New\". Default Devsloka blue. */\n  accent?: string;\n  /** Marker colour for \"Improved\". Default ink blue. */\n  secondary?: string;\n} & ComponentProps<\"section\">;\n\nconst FILTERS: { value: CompactFilter; label: string }[] = [\n  { value: \"all\", label: \"All\" },\n  { value: \"new\", label: \"New\" },\n  { value: \"improved\", label: \"Improved\" },\n  { value: \"fixed\", label: \"Fixed\" },\n];\n\nconst TYPE_LABEL: Record<CompactChangeType, string> = {\n  new: \"New\",\n  improved: \"Improved\",\n  fixed: \"Fixed\",\n};\n\nconst MARKER_CLASS: Record<CompactChangeType, string> = {\n  new: \"bg-[var(--block-accent)]\",\n  improved: \"bg-[var(--block-secondary)] ring-1 ring-border\",\n  fixed: \"border border-foreground\",\n};\n\nconst v = (version: string) => ({ version, href: `#v${version}` });\n\nconst DEFAULT_CHANGES: CompactChange[] = [\n  { date: \"06 Oct\", dateTime: \"2026-10-06\", type: \"new\", text: \"Baselines are committed to .plumbline/ in your repository.\", ...v(\"5.0.0\") },\n  { date: \"06 Oct\", dateTime: \"2026-10-06\", type: \"new\", text: \"plumbline review runs the review queue on localhost:4410.\", ...v(\"5.0.0\") },\n  { date: \"06 Oct\", dateTime: \"2026-10-06\", type: \"improved\", text: \"Capture on 400 stories: 6m 12s down to 2m 41s.\", ...v(\"5.0.0\") },\n  { date: \"29 Sep\", dateTime: \"2026-09-29\", type: \"new\", text: \"Review queue groups snapshots by component.\", ...v(\"4.12.0\") },\n  { date: \"29 Sep\", dateTime: \"2026-09-29\", type: \"fixed\", text: \"Webfont 404s on Linux runners now fail the capture loudly.\", ...v(\"4.12.0\") },\n  { date: \"16 Sep\", dateTime: \"2026-09-16\", type: \"fixed\", text: \"Subpixel antialiasing ignored on text below 12px.\", ...v(\"4.11.2\") },\n  { date: \"16 Sep\", dateTime: \"2026-09-16\", type: \"improved\", text: \"Missing baseline branch is named in the error message.\", ...v(\"4.11.2\") },\n  { date: \"02 Sep\", dateTime: \"2026-09-02\", type: \"new\", text: \"Drift report flags colours within ΔE 2 of a token.\", ...v(\"4.11.0\") },\n  { date: \"02 Sep\", dateTime: \"2026-09-02\", type: \"improved\", text: \"Uploads resume after a dropped connection.\", ...v(\"4.11.0\") },\n  { date: \"19 Aug\", dateTime: \"2026-08-19\", type: \"fixed\", text: \"Timestamps in the digest use the team's time zone, not UTC.\", ...v(\"4.10.1\") },\n  { date: \"12 Aug\", dateTime: \"2026-08-12\", type: \"new\", text: \"Capture shards across up to 16 parallel workers.\", ...v(\"4.10.0\") },\n  { date: \"12 Aug\", dateTime: \"2026-08-12\", type: \"improved\", text: \"plumbline.config.ts gets full type hints for every option.\", ...v(\"4.10.0\") },\n];\n\nexport function ChangelogCompact({\n  eyebrow = \"Plumbline / Changelog\",\n  title = \"Every change, one line each\",\n  description = \"The short version of the release notes. Filter by kind, or follow along in your feed reader.\",\n  changes = DEFAULT_CHANGES,\n  filter: filterProp,\n  defaultFilter = \"all\",\n  onFilterChange,\n  rssHref = \"/changelog/rss.xml\",\n  accent = \"#0A6EFF\",\n  secondary = \"#0A0A0A\",\n  className,\n  style,\n  ...props\n}: ChangelogCompactProps) {\n  const headingId = useId();\n  const [uncontrolledFilter, setFilter] = useState<CompactFilter>(defaultFilter);\n  const filter = filterProp ?? uncontrolledFilter;\n\n  const visible = filter === \"all\" ? changes : changes.filter((c) => c.type === filter);\n  const activeLabel = FILTERS.find((f) => f.value === filter)?.label ?? \"All\";\n\n  const choose = (next: CompactFilter) => {\n    setFilter(next);\n    onFilterChange?.(next);\n  };\n\n  return (\n    <section\n      data-slot=\"changelog-compact\"\n      aria-labelledby={headingId}\n      className={cn(\"w-full bg-background text-foreground\", className)}\n      style={\n        { \"--block-accent\": accent, \"--block-secondary\": secondary, ...style } as CSSProperties\n      }\n      {...props}\n    >\n      <div className=\"mx-auto max-w-4xl px-6 py-20 md:py-28\">\n        <header className=\"flex flex-col gap-6 md:flex-row md:items-end md:justify-between\">\n          <div>\n            <p className=\"font-mono text-xs uppercase tracking-wider text-muted-foreground\">\n              {eyebrow}\n            </p>\n            <h2\n              id={headingId}\n              className=\"mt-4 text-3xl font-semibold tracking-[-0.03em] text-balance md:text-4xl\"\n            >\n              {title}\n            </h2>\n            <p className=\"mt-3 max-w-md text-sm leading-relaxed text-muted-foreground\">\n              {description}\n            </p>\n          </div>\n          <a\n            href={rssHref}\n            className=\"shrink-0 self-start font-mono text-xs uppercase tracking-wider underline decoration-1 underline-offset-4 outline-none hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring md:self-auto\"\n          >\n            Subscribe via RSS\n          </a>\n        </header>\n\n        <div\n          role=\"group\"\n          aria-label=\"Filter changes by type\"\n          className=\"mt-10 flex flex-wrap border-y\"\n        >\n          {FILTERS.map((f) => {\n            const pressed = filter === f.value;\n            const count =\n              f.value === \"all\" ? changes.length : changes.filter((c) => c.type === f.value).length;\n            return (\n              <button\n                key={f.value}\n                type=\"button\"\n                aria-pressed={pressed}\n                onClick={() => choose(f.value)}\n                className={cn(\n                  \"flex items-center gap-2 border-r px-4 py-2.5 text-sm outline-none transition-colors last:border-r-0 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n                  pressed\n                    ? \"bg-foreground text-background\"\n                    : \"text-muted-foreground hover:bg-muted hover:text-foreground\"\n                )}\n              >\n                {f.value !== \"all\" && (\n                  <span aria-hidden className={cn(\"size-2\", MARKER_CLASS[f.value])} />\n                )}\n                {f.label}\n                <span className=\"font-mono text-[11px] tabular-nums opacity-70\">{count}</span>\n              </button>\n            );\n          })}\n        </div>\n\n        <p aria-live=\"polite\" className=\"sr-only\">\n          {filter === \"all\"\n            ? `Showing all ${visible.length} changes`\n            : `Showing ${visible.length} ${activeLabel.toLowerCase()} changes`}\n        </p>\n\n        {visible.length > 0 ? (\n          <ul className=\"divide-y border-b\">\n            {visible.map((change, i) => (\n              <li\n                key={`${change.version}-${i}-${change.text}`}\n                className=\"grid grid-cols-[4.5rem_1fr] items-baseline gap-x-4 gap-y-1 py-3 text-sm sm:grid-cols-[4.5rem_6.5rem_1fr_auto]\"\n              >\n                <time\n                  dateTime={change.dateTime}\n                  className=\"font-mono text-xs tabular-nums text-muted-foreground\"\n                >\n                  {change.date}\n                </time>\n                <span className=\"flex items-center gap-2 font-mono text-[11px] uppercase tracking-wider text-muted-foreground max-sm:hidden\">\n                  <span aria-hidden className={cn(\"size-2 shrink-0\", MARKER_CLASS[change.type])} />\n                  {TYPE_LABEL[change.type]}\n                </span>\n                <span className=\"leading-relaxed\">\n                  <span className=\"sr-only sm:hidden\">{TYPE_LABEL[change.type]}: </span>\n                  <span\n                    aria-hidden\n                    className={cn(\n                      \"mr-2 inline-block size-2 align-middle sm:hidden\",\n                      MARKER_CLASS[change.type]\n                    )}\n                  />\n                  {change.text}\n                </span>\n                <a\n                  href={change.href}\n                  className=\"col-start-2 font-mono text-xs tabular-nums text-muted-foreground underline-offset-4 outline-none hover:text-foreground hover:underline focus-visible:ring-2 focus-visible:ring-ring sm:col-start-auto sm:text-right\"\n                >\n                  v{change.version}\n                </a>\n              </li>\n            ))}\n          </ul>\n        ) : (\n          <div className=\"border-b py-16 text-center\">\n            <p className=\"text-sm\">No {activeLabel.toLowerCase()} changes in this period.</p>\n            <button\n              type=\"button\"\n              onClick={() => choose(\"all\")}\n              className=\"mt-3 font-mono text-xs uppercase tracking-wider underline decoration-1 underline-offset-4 outline-none hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n            >\n              Show all changes\n            </button>\n          </div>\n        )}\n\n        <p className=\"mt-6 font-mono text-xs text-muted-foreground\">\n          Showing {visible.length} of {changes.length} · Older entries are in the 4.x archive.\n        </p>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}
