{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "heatmap-hero",
  "title": "Heatmap Hero",
  "description": "A launch hero where your logo glows like a heat map above the headline.",
  "dependencies": [
    "@paper-design/shaders-react"
  ],
  "registryDependencies": [
    "button"
  ],
  "files": [
    {
      "path": "registry/shaders/heatmap-hero/heatmap-hero.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Heatmap, type PaperShaderElement } from \"@paper-design/shaders-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { buttonVariants } from \"@/components/ui/button\"\n\n// A placeholder app mark: a bold four-point spark.\nconst DEFAULT_LOGO = `data:image/svg+xml,${encodeURIComponent(\n  '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"200\" height=\"200\" viewBox=\"0 0 200 200\"><path d=\"M100 0c8 56 36 84 100 100-64 16-92 44-100 100-8-56-36-84-100-100C64 84 92 56 100 0z\"/></svg>'\n)}`\n\ntype HeatmapHeroProps = React.ComponentProps<\"section\"> & {\n  /**\n   * A dark logo on a transparent background, like a black SVG. Bold, filled\n   * shapes glow best. Remote images must be served with CORS headers.\n   */\n  logo?: string\n  eyebrow?: string\n  title?: string\n  description?: string\n  primaryAction?: { label: string; href: string }\n  secondaryAction?: { label: string; href: string }\n  /** Heat colors, from coolest to hottest. */\n  colors?: string[]\n  colorBack?: string\n  speed?: number\n}\n\nfunction HeatmapHero({\n  logo = DEFAULT_LOGO,\n  eyebrow = \"Introducing Spark\",\n  title = \"The app you've been waiting for\",\n  description = \"Spark is here. Faster, smarter and a little bit warmer than anything you've used before.\",\n  primaryAction = { label: \"Download for macOS\", href: \"#\" },\n  secondaryAction = { label: \"Read the announcement\", href: \"#\" },\n  colors = [\n    \"#11206a\",\n    \"#1f3ba2\",\n    \"#2f63e7\",\n    \"#6bd7ff\",\n    \"#ffe679\",\n    \"#ff991e\",\n    \"#ff4c00\",\n  ],\n  colorBack = \"#000000\",\n  speed = 1,\n  className,\n  style,\n  ...props\n}: HeatmapHeroProps) {\n  // The logo the browser has loaded. Only a loaded logo is handed to the\n  // shader, so one that fails (e.g. missing CORS headers) just doesn't glow.\n  const [loadedLogo, setLoadedLogo] = React.useState<string | null>(null)\n\n  React.useEffect(() => {\n    const image = new Image()\n    image.crossOrigin = \"anonymous\"\n    image.onload = () => setLoadedLogo(logo)\n    image.src = logo\n    return () => {\n      image.onload = null\n    }\n  }, [logo])\n\n  return (\n    <section\n      data-slot=\"heatmap-hero\"\n      className={cn(\n        \"dark relative isolate flex min-h-[640px] w-full flex-col items-center justify-center overflow-hidden px-6 py-24 text-center text-white\",\n        className\n      )}\n      style={{ backgroundColor: colorBack, ...style }}\n      {...props}\n    >\n      {/* Oversized so the glow can fade out, and pulled into the copy below. */}\n      <div\n        aria-hidden\n        className=\"pointer-events-none -my-12 size-72 sm:-my-16 sm:size-96\"\n      >\n        {loadedLogo === logo && (\n          // Heatmap processes the logo before it can draw it, which suspends\n          // until it's ready.\n          <React.Suspense fallback={null}>\n            <Glow logo={logo} colors={colors} speed={speed} />\n          </React.Suspense>\n        )}\n      </div>\n      <div className=\"relative flex max-w-2xl flex-col items-center gap-6\">\n        <span className=\"border border-white/20 bg-white/5 px-3 py-1 font-mono text-[11px] tracking-widest text-white/80 uppercase\">\n          {eyebrow}\n        </span>\n        <h1 className=\"font-heading text-4xl leading-[1.05] tracking-tight text-balance sm:text-6xl\">\n          {title}\n        </h1>\n        <p className=\"max-w-lg text-base text-pretty text-white/70 sm:text-lg\">\n          {description}\n        </p>\n        <div className=\"flex flex-wrap items-center justify-center gap-3\">\n          <a\n            href={primaryAction.href}\n            className={cn(\n              buttonVariants({ size: \"lg\" }),\n              \"bg-white text-black hover:bg-white/80\"\n            )}\n          >\n            {primaryAction.label}\n          </a>\n          <a\n            href={secondaryAction.href}\n            className={buttonVariants({ size: \"lg\", variant: \"outline\" })}\n          >\n            {secondaryAction.label}\n          </a>\n        </div>\n      </div>\n    </section>\n  )\n}\n\nfunction Glow({\n  logo,\n  colors,\n  speed,\n}: {\n  logo: string\n  colors: string[]\n  speed: number\n}) {\n  const ref = React.useRef<PaperShaderElement>(null)\n\n  // Runs once the processed logo is on screen.\n  React.useLayoutEffect(() => {\n    ref.current?.animate(\n      { opacity: [0, 1], scale: [0.96, 1] },\n      { duration: 1200, easing: \"cubic-bezier(0.16, 1, 0.3, 1)\" }\n    )\n  }, [logo])\n\n  return (\n    <Heatmap\n      ref={ref}\n      className=\"size-full\"\n      image={logo}\n      suspendWhenProcessingImage\n      colors={colors}\n      colorBack=\"#00000000\"\n      contour={0.5}\n      angle={0}\n      noise={0}\n      innerGlow={0.5}\n      outerGlow={0.5}\n      // Heatmap pads the logo to leave room for the glow. Drawing it at 4/7\n      // fits the padding on the canvas, so the glow fades out before the edge.\n      scale={4 / 7}\n      speed={speed}\n    />\n  )\n}\n\nexport { HeatmapHero }\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "sections",
    "hero"
  ],
  "type": "registry:block"
}