{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "newsletter-plotted",
  "title": "Starburst sign-up",
  "description": "A newsletter sign-up beside a starburst a pen draws ray by ray, clockwise from the top, with every twelfth ray in the accent colour.",
  "dependencies": [
    "svg-scroll-draw@^2.29.0"
  ],
  "registryDependencies": [
    "https://scrollfx-ui.vercel.app/r/plotter.json"
  ],
  "files": [
    {
      "path": "registry/blocks/newsletter-plotted.tsx",
      "content": "'use client';\n\n/**\n * newsletter-plotted — a sign-up beside a starburst a pen draws ray by ray,\n * clockwise from the top, as the section arrives: ink rays rising and falling\n * round the circle, every twelfth one long and in the accent colour.\n *\n * Built on svg-scroll-draw (MIT): https://github.com/DhruvilChauahan0210/scrollfx\n * Needs: react, svg-scroll-draw, and lib/plotter (installed with it).\n * Styling: Tailwind CSS with shadcn/ui tokens. The heading takes one emphasised\n * word between asterisks, set in `font-serif`. The print is a `bg-card` sheet.\n *\n * The form is a plain HTML form: it posts `email` to `action`, or calls\n * `onSubmit` if you pass one. Sending the email is up to your provider. The\n * copy and the form are in the server HTML; the starburst is drawn in the\n * browser, finishing as it reaches the middle of the screen. Reduced motion\n * shows it drawn.\n */\n\nimport { useEffect, useState, type FormEvent } from 'react';\nimport { ScrollDraw } from 'svg-scroll-draw/react';\nimport 'svg-scroll-draw/no-flash.css';\nimport { scrollWindow, staggerFor, starburst, type Stroke } from '@/lib/plotter';\n\nexport interface NewsletterPlottedProps {\n  eyebrow?: string;\n  heading?: string;\n  description?: string;\n  /** Where the form posts. Ignored when `onSubmit` is given. */\n  action?: string;\n  onSubmit?: (email: string) => void;\n  button?: string;\n  /** A line under the form, such as how often you write. */\n  note?: string;\n  caption?: string;\n  seed?: number;\n  accent?: string;\n  className?: string;\n}\n\n// The rays draw one after another over this many trigger ranges (see scrollWindow).\nconst SPREAD = 1;\n\nfunction Heading({ text }: { text: string }) {\n  return <>{text.split(/(\\*[^*]+\\*)/).map((p, i) => (p.startsWith('*') ? <em key={i} className=\"italic\">{p.slice(1, -1)}</em> : <span key={i}>{p}</span>))}</>;\n}\n\nexport function NewsletterPlotted({\n  eyebrow = 'Letters',\n  heading = 'One email, *once* a month.',\n  description = 'What we shipped, what we learned, and one chart worth reading. Nothing else.',\n  action = '#',\n  onSubmit,\n  button = 'Subscribe',\n  note = 'Unsubscribe from any letter, in one click.',\n  caption = 'Pl. — Starburst',\n  seed = 23,\n  accent = '#e0482a',\n  className = '',\n}: NewsletterPlottedProps) {\n  const [rays, setRays] = useState<Stroke[] | null>(null);\n  useEffect(() => setRays(starburst(seed)), [seed]);\n\n  const submit = onSubmit\n    ? (e: FormEvent<HTMLFormElement>) => {\n        e.preventDefault();\n        onSubmit(String(new FormData(e.currentTarget).get('email') ?? ''));\n      }\n    : undefined;\n\n  return (\n    <section className={`mx-auto grid max-w-7xl items-center gap-14 px-6 py-28 sm:px-10 lg:grid-cols-[minmax(0,5fr)_minmax(0,6fr)] lg:gap-24 ${className}`}>\n      <figure className=\"mx-auto w-full max-w-md lg:max-w-none\">\n        <div className=\"aspect-square w-full rounded-[3px] bg-card p-[7%] shadow-[0_1px_0_rgba(0,0,0,.04),0_18px_40px_-18px_rgba(40,30,10,.3)] dark:shadow-[0_0_0_1px_rgba(255,255,255,.05),0_24px_60px_-20px_rgba(0,0,0,.8)]\">\n          {rays && (\n            <ScrollDraw stagger={staggerFor(rays.length, SPREAD)} easing=\"linear\" trigger={scrollWindow(SPREAD)} className=\"size-full\" aria-hidden>\n              <svg viewBox=\"0 0 400 400\" className=\"size-full\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1\" strokeLinecap=\"round\">\n                {rays.map((r, i) => (r.pen ? <path key={i} d={r.d} stroke={accent} strokeWidth=\"1.4\" /> : <path key={i} d={r.d} />))}\n              </svg>\n            </ScrollDraw>\n          )}\n        </div>\n        <figcaption className=\"mt-4 flex justify-between font-mono text-[11px] uppercase tracking-[0.2em] text-muted-foreground\">\n          <span>{caption}</span>\n          <span>{rays ? rays.length : 0} rays · seed {seed}</span>\n        </figcaption>\n      </figure>\n\n      <div className=\"max-w-lg\">\n        <p className=\"font-mono text-[11px] uppercase tracking-[0.22em] text-muted-foreground\">{eyebrow}</p>\n        <h2 className=\"mt-6 font-serif text-[clamp(2.6rem,5vw,4.4rem)] leading-[0.98] tracking-[-0.03em]\">\n          <Heading text={heading} />\n        </h2>\n        <p className=\"mt-6 text-pretty text-[17px] leading-relaxed text-muted-foreground\">{description}</p>\n        <form action={onSubmit ? undefined : action} method=\"post\" onSubmit={submit} className=\"mt-10 flex flex-col gap-3 sm:flex-row\">\n          <label className=\"sr-only\" htmlFor=\"newsletter-email\">Email address</label>\n          <input\n            id=\"newsletter-email\"\n            name=\"email\"\n            type=\"email\"\n            required\n            autoComplete=\"email\"\n            placeholder=\"you@company.com\"\n            className=\"h-12 min-w-0 flex-1 rounded-full border bg-background px-5 text-[15px] outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n          />\n          <button type=\"submit\" className=\"inline-flex h-12 items-center justify-center rounded-full bg-foreground px-7 text-[15px] font-medium text-background transition-transform hover:-translate-y-px\">\n            {button}\n          </button>\n        </form>\n        {note && <p className=\"mt-4 font-mono text-[11px] uppercase tracking-[0.18em] text-muted-foreground\">{note}</p>}\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "motion": "Scroll to it: the rays sweep round from the top.",
    "tall": false
  },
  "type": "registry:block"
}