{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "changelog",
  "type": "registry:block",
  "title": "Changelog",
  "description": "A release timeline with sticky version tags, New / Improved / Fixed chips you can filter by, small drawn media cards instead of screenshots, and a load-more that eases older releases into place.",
  "categories": [
    "block",
    "Content"
  ],
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/button.json"
  ],
  "files": [
    {
      "path": "registry/devl/changelog.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { ArrowDownIcon, CheckIcon, CloudIcon, CommandIcon, FileTextIcon, RssIcon, SearchIcon } from \"lucide-react\";\nimport { AnimatePresence, motion, MotionConfig, useReducedMotion } from \"motion/react\";\nimport { type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\nfunction useReducedMotionSafe() {\n  const prefers = useReducedMotion();\n  const [mounted, setMounted] = useState(false);\n  useEffect(() => setMounted(true), []);\n  return mounted && Boolean(prefers);\n}\n\nexport type ChangeType = \"new\" | \"improved\" | \"fixed\";\nexport type ReleaseMedia = \"palette\" | \"chart\" | \"editor\" | \"offline\";\n\nexport interface Release {\n  version: string;\n  date: string;\n  title: string;\n  summary?: string;\n  media?: ReleaseMedia;\n  changes: { type: ChangeType; text: string }[];\n}\n\nexport interface ChangelogProps {\n  eyebrow?: string;\n  title?: ReactNode;\n  description?: ReactNode;\n  releases: Release[];\n  pageSize?: number;\n  rssHref?: string;\n  endNote?: string;\n  className?: string;\n}\n\nconst ease = [0.23, 1, 0.32, 1] as const;\n\nconst typeStyle: Record<ChangeType, { label: string; chip: string; dot: string }> = {\n  new: { label: \"New\", chip: \"bg-info/10 text-info-foreground\", dot: \"bg-info\" },\n  improved: { label: \"Improved\", chip: \"bg-success/10 text-success-foreground\", dot: \"bg-success\" },\n  fixed: { label: \"Fixed\", chip: \"bg-warning/12 text-warning-foreground\", dot: \"bg-warning\" },\n};\n\nfunction MediaFrame({ children }: { children: ReactNode }) {\n  return (\n    <div className=\"relative mt-5 flex h-48 items-center justify-center overflow-hidden rounded-xl border bg-muted/50 sm:h-56\">\n      <div\n        aria-hidden\n        className=\"absolute inset-0 bg-[linear-gradient(to_right,var(--color-border)_1px,transparent_1px),linear-gradient(to_bottom,var(--color-border)_1px,transparent_1px)] [background-size:24px_24px] [mask-image:radial-gradient(60%_70%_at_50%_50%,black,transparent)]\"\n      />\n      <div className=\"relative w-full px-6\">{children}</div>\n    </div>\n  );\n}\n\nfunction PaletteMedia() {\n  return (\n    <MediaFrame>\n      <div className=\"mx-auto max-w-sm overflow-hidden rounded-xl border bg-popover shadow-lg/5\">\n        <div className=\"flex items-center gap-2 border-b px-3 py-2.5 text-xs\">\n          <SearchIcon className=\"size-3.5 text-muted-foreground\" />\n          <span>move to</span>\n          <span className=\"ms-auto flex items-center gap-0.5 rounded border bg-muted px-1 font-mono text-[0.625rem] text-muted-foreground\">\n            <CommandIcon className=\"size-2.5\" />K\n          </span>\n        </div>\n        {[\"Move to… Product / Roadmaps\", \"Move to… Marketing / Launches\", \"Move to… Archive\"].map((row, i) => (\n          <div className={cn(\"flex items-center gap-2 px-3 py-2 text-xs\", i === 0 && \"bg-accent\")} key={row}>\n            <FileTextIcon className=\"size-3.5 text-muted-foreground\" />\n            <span className=\"truncate\">{row}</span>\n            {i === 0 && <span className=\"ms-auto text-[0.625rem] text-muted-foreground\">↵</span>}\n          </div>\n        ))}\n      </div>\n    </MediaFrame>\n  );\n}\n\nfunction ChartMedia() {\n  const bars = [32, 44, 38, 56, 50, 68, 62, 80, 74, 92];\n  return (\n    <MediaFrame>\n      <div className=\"mx-auto max-w-sm rounded-xl border bg-popover p-4 shadow-lg/5\">\n        <div className=\"flex items-baseline justify-between\">\n          <span className=\"text-[0.6875rem] text-muted-foreground\">Page reads, last 10 weeks</span>\n          <span className=\"font-semibold text-sm tabular-nums\">18,204</span>\n        </div>\n        <div className=\"mt-3 flex h-20 items-end gap-1.5\">\n          {bars.map((h, i) => (\n            <div\n              className={cn(\"flex-1 rounded-[calc(var(--radius)*0.3)]\", i === bars.length - 1 ? \"bg-foreground/80\" : \"bg-foreground/12\")}\n              // biome-ignore lint/suspicious/noArrayIndexKey: fixed chart\n              key={i}\n              style={{ height: `${h}%` }}\n            />\n          ))}\n        </div>\n      </div>\n    </MediaFrame>\n  );\n}\n\nfunction EditorMedia() {\n  return (\n    <MediaFrame>\n      <div className=\"relative mx-auto max-w-sm\">\n        <div className=\"rounded-xl border bg-popover p-4 shadow-lg/5\">\n          <div className=\"h-2 w-2/5 rounded-full bg-foreground/60\" />\n          <div className=\"mt-3 space-y-1.5\">\n            <div className=\"h-1.5 w-full rounded-full bg-foreground/10\" />\n            <div className=\"relative h-1.5 w-11/12 rounded-full bg-warning/50\" />\n            <div className=\"h-1.5 w-4/5 rounded-full bg-foreground/10\" />\n            <div className=\"h-1.5 w-3/5 rounded-full bg-foreground/10\" />\n          </div>\n        </div>\n        <div className=\"absolute -right-2 -bottom-6 w-44 rounded-lg border bg-popover p-2.5 shadow-lg/5 sm:-right-6\">\n          <div className=\"flex items-center gap-1.5\">\n            <span className=\"flex size-4 items-center justify-center rounded-full bg-amber-100 font-semibold text-[0.5rem] text-amber-800 dark:bg-amber-950 dark:text-amber-300\">\n              IK\n            </span>\n            <span className=\"font-medium text-[0.625rem]\">Iris K.</span>\n          </div>\n          <p className=\"mt-1 text-[0.625rem] text-muted-foreground leading-snug\">Can we tighten this paragraph before Friday?</p>\n        </div>\n      </div>\n    </MediaFrame>\n  );\n}\n\nfunction OfflineMedia() {\n  return (\n    <MediaFrame>\n      <div className=\"mx-auto flex max-w-sm items-center justify-center gap-4\">\n        <div className=\"flex flex-col items-center gap-2\">\n          <span className=\"flex size-12 items-center justify-center rounded-2xl border bg-popover shadow-lg/5\">\n            <FileTextIcon className=\"size-5 text-muted-foreground\" />\n          </span>\n          <span className=\"text-[0.625rem] text-muted-foreground\">On device</span>\n        </div>\n        <div className=\"flex items-center gap-1\" aria-hidden>\n          {[0, 1, 2, 3, 4].map((i) => (\n            <span className=\"size-1 rounded-full bg-foreground/25\" key={i} />\n          ))}\n        </div>\n        <div className=\"flex flex-col items-center gap-2\">\n          <span className=\"relative flex size-12 items-center justify-center rounded-2xl border bg-popover shadow-lg/5\">\n            <CloudIcon className=\"size-5 text-muted-foreground\" />\n            <span className=\"absolute -right-1 -bottom-1 flex size-4 items-center justify-center rounded-full bg-success text-white ring-2 ring-popover\">\n              <CheckIcon className=\"size-2.5\" strokeWidth={3} />\n            </span>\n          </span>\n          <span className=\"text-[0.625rem] text-muted-foreground\">Synced 2s ago</span>\n        </div>\n      </div>\n    </MediaFrame>\n  );\n}\n\nconst media: Record<ReleaseMedia, () => ReactNode> = {\n  palette: PaletteMedia,\n  chart: ChartMedia,\n  editor: EditorMedia,\n  offline: OfflineMedia,\n};\n\nfunction slug(version: string) {\n  return `release-${version.replace(/[^a-z0-9]+/gi, \"-\").toLowerCase()}`;\n}\n\nexport function Changelog({\n  eyebrow = \"Changelog\",\n  title = \"What's new\",\n  description,\n  releases,\n  pageSize = 3,\n  rssHref,\n  endNote,\n  className,\n}: ChangelogProps) {\n  const reduce = useReducedMotionSafe();\n  const filterId = useId();\n  const [filter, setFilter] = useState<ChangeType | \"all\">(\"all\");\n  const [shown, setShown] = useState(pageSize);\n  const [loading, setLoading] = useState(false);\n  const timer = useRef<number | undefined>(undefined);\n  useEffect(() => () => window.clearTimeout(timer.current), []);\n\n  const filtered = releases\n    .map((r) => ({ ...r, changes: filter === \"all\" ? r.changes : r.changes.filter((c) => c.type === filter) }))\n    .filter((r) => r.changes.length > 0);\n  const visible = filtered.slice(0, shown);\n  const remaining = filtered.length - visible.length;\n  const count = (t: ChangeType | \"all\") =>\n    releases.reduce((n, r) => n + (t === \"all\" ? r.changes.length : r.changes.filter((c) => c.type === t).length), 0);\n\n  const loadMore = () => {\n    setLoading(true);\n    timer.current = window.setTimeout(() => {\n      setShown((s) => s + pageSize);\n      setLoading(false);\n    }, 650);\n  };\n\n  const filters: (ChangeType | \"all\")[] = [\"all\", \"new\", \"improved\", \"fixed\"];\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <section className={cn(\"mx-auto w-full max-w-[1100px]\", className)}>\n        <header className=\"flex flex-col gap-6 md:flex-row md:items-end md:justify-between\">\n          <div className=\"max-w-xl\">\n            {eyebrow && <p className=\"font-medium text-muted-foreground text-xs uppercase tracking-widest\">{eyebrow}</p>}\n            <h2 className=\"mt-2 text-balance font-heading font-semibold text-3xl tracking-tight sm:text-4xl\">{title}</h2>\n            {description && <p className=\"mt-3 text-pretty text-muted-foreground text-sm leading-relaxed\">{description}</p>}\n          </div>\n          <div className=\"flex items-center gap-2 sm:gap-3\">\n            <div aria-label=\"Filter changes\" className=\"flex rounded-full border bg-muted p-0.5\" role=\"radiogroup\">\n              {filters.map((f) => {\n                const on = filter === f;\n                return (\n                  <button\n                    aria-checked={on}\n                    className={cn(\n                      \"relative flex h-7 cursor-pointer items-center gap-1.5 rounded-full px-2.5 font-medium text-xs outline-none after:absolute after:inset-x-0 after:-inset-y-[3px] after:content-[''] transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-ring\",\n                      on ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n                    )}\n                    key={f}\n                    onClick={() => {\n                      setFilter(f);\n                      setShown(pageSize);\n                    }}\n                    role=\"radio\"\n                    type=\"button\"\n                  >\n                    {on && (\n                      <motion.span\n                        className=\"absolute inset-0 rounded-full bg-background shadow-xs/5 dark:bg-input\"\n                        layoutId={filterId}\n                        transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 40 }}\n                      />\n                    )}\n                    {f !== \"all\" && <span className={cn(\"relative size-1.5 rounded-full\", typeStyle[f].dot)} />}\n                    <span className=\"relative\">{f === \"all\" ? \"All\" : typeStyle[f].label}</span>\n                    <span className={cn(\"relative font-mono text-[0.625rem] text-muted-foreground tabular-nums\", on && \"dark:text-foreground/72\")}>{count(f)}</span>\n                  </button>\n                );\n              })}\n            </div>\n            {rssHref && (\n              <a\n                aria-label=\"RSS feed\"\n                className=\"flex h-8 items-center justify-center gap-1.5 rounded-full text-muted-foreground text-xs outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring max-sm:w-8 sm:px-2\"\n                href={rssHref}\n              >\n                <RssIcon className=\"size-3.5\" />\n                <span aria-hidden className=\"max-sm:hidden\">\n                  RSS\n                </span>\n              </a>\n            )}\n          </div>\n        </header>\n\n        <ol className=\"mt-12 sm:mt-14\">\n          <AnimatePresence initial={false} mode=\"popLayout\">\n            {visible.map((release, i) => {\n              const Media = release.media ? media[release.media] : null;\n              const latest = release.version === releases[0]?.version;\n              return (\n                <motion.li\n                  animate={{ opacity: 1, y: 0 }}\n                  className=\"group/release relative grid gap-3 md:grid-cols-[11rem_minmax(0,1fr)] md:gap-10\"\n                  exit={{ opacity: 0 }}\n                  id={slug(release.version)}\n                  initial={{ opacity: 0, y: 12 }}\n                  key={release.version}\n                  layout=\"position\"\n                  transition={{ duration: 0.4, ease, delay: i >= shown - pageSize && i > 0 ? (i % pageSize) * 0.06 : 0 }}\n                >\n                  <div className=\"md:sticky md:top-8 md:self-start md:pt-1\">\n                    <div className=\"flex items-center gap-2 md:flex-col md:items-start md:gap-2.5\">\n                      <a\n                        className=\"rounded-md border bg-background px-2 py-0.5 font-medium font-mono text-xs shadow-xs/5 outline-none transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring\"\n                        href={`#${slug(release.version)}`}\n                      >\n                        {release.version}\n                      </a>\n                      <time className=\"text-muted-foreground text-xs tabular-nums\">{release.date}</time>\n                      {latest && (\n                        <span className=\"rounded-full bg-primary px-2 py-0.5 font-medium text-[0.625rem] text-primary-foreground\">\n                          Latest\n                        </span>\n                      )}\n                    </div>\n                  </div>\n\n                  <div className=\"relative pb-14 md:border-l md:ps-10\">\n                    <span\n                      aria-hidden\n                      className={cn(\n                        \"absolute top-2 -left-[5px] hidden size-[9px] rounded-full ring-4 ring-background md:block\",\n                        latest ? \"bg-foreground\" : \"bg-foreground/25\",\n                      )}\n                    />\n                    <h3 className=\"text-balance font-heading font-semibold text-xl tracking-tight\">{release.title}</h3>\n                    {release.summary && (\n                      <p className=\"mt-2 max-w-prose text-pretty text-muted-foreground text-sm leading-relaxed\">{release.summary}</p>\n                    )}\n                    {Media && filter === \"all\" && <Media />}\n                    <ul className=\"mt-5 space-y-2.5\">\n                      {release.changes.map((change) => (\n                        <li className=\"flex items-start gap-3 text-sm\" key={change.text}>\n                          <span\n                            className={cn(\n                              \"mt-px w-[4.75rem] shrink-0 rounded-full px-2 py-0.5 text-center font-medium text-[0.6875rem]\",\n                              typeStyle[change.type].chip,\n                            )}\n                          >\n                            {typeStyle[change.type].label}\n                          </span>\n                          <span className=\"text-pretty leading-relaxed\">{change.text}</span>\n                        </li>\n                      ))}\n                    </ul>\n                  </div>\n                </motion.li>\n              );\n            })}\n          </AnimatePresence>\n        </ol>\n\n        <div className=\"flex justify-center md:ps-[16rem] md:justify-start\">\n          {remaining > 0 ? (\n            <Button\n              className=\"transition-[box-shadow,translate,scale,rotate] duration-150 ease-out active:scale-[0.97]\"\n              loading={loading}\n              onClick={loadMore}\n              variant=\"outline\"\n            >\n              <ArrowDownIcon />\n              Load older releases\n              <span className=\"font-mono text-muted-foreground text-xs tabular-nums\">{remaining}</span>\n            </Button>\n          ) : (\n            <p className=\"text-muted-foreground text-xs\">{endNote ?? \"You've reached the beginning.\"}</p>\n          )}\n        </div>\n      </section>\n    </MotionConfig>\n  );\n}\n"
    }
  ]
}