{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bento-plotted",
  "title": "Plotted bento grid",
  "description": "A bento grid of cards in mixed sizes, each with a drawing of its own: a moiré of two ring sets, a Lissajous knot, a rosette, ridgelines and a globe.",
  "dependencies": [
    "svg-scroll-draw@^2.29.0"
  ],
  "registryDependencies": [
    "https://scrollfx-ui.vercel.app/r/plotter.json"
  ],
  "files": [
    {
      "path": "registry/blocks/bento-plotted.tsx",
      "content": "'use client';\n\n/**\n * bento-plotted — a bento grid of cards in mixed sizes, each with a drawing of\n * its own a pen plots as the card arrives: a moiré of two ring sets, a\n * Lissajous knot, a rosette, ridgelines and a wireframe globe.\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`. Cards are `bg-card` sheets.\n *\n * The default cards are samples: pass your own. The first card is the large\n * one; the next two stack beside it and the last two share a row. Copy is in\n * the server HTML; the drawings are made in the browser, each finishing as its\n * card's drawing reaches the middle of the screen. Reduced motion shows them\n * drawn.\n */\n\nimport { useEffect, useState } from 'react';\nimport { ScrollDraw } from 'svg-scroll-draw/react';\nimport 'svg-scroll-draw/no-flash.css';\nimport { globe, lissajous, moire, ridgelines, rosette, scrollWindow, staggerFor, type Stroke } from '@/lib/plotter';\n\ntype Art = 'moire' | 'lissajous' | 'rosette' | 'ridgelines' | 'globe';\n\nexport interface BentoCard {\n  title: string;\n  body: string;\n  art?: Art;\n}\n\nexport interface BentoPlottedProps {\n  eyebrow?: string;\n  heading?: string;\n  description?: string;\n  cards?: BentoCard[];\n  accent?: string;\n  className?: string;\n}\n\n/** Each drawing with its viewBox and its pen weight, in viewBox units (about a pixel on screen). */\nconst ART: Record<Art, { box: [number, number]; weight: number; draw: () => Stroke[] }> = {\n  moire: { box: [400, 400], weight: 0.6, draw: () => moire({ seed: 5 }) },\n  lissajous: { box: [400, 400], weight: 1, draw: () => lissajous(2) },\n  rosette: { box: [100, 100], weight: 0.3, draw: () => rosette(14) },\n  ridgelines: { box: [600, 220], weight: 1.2, draw: () => ridgelines({ seed: 4, w: 600, h: 220, rows: 12 }) },\n  globe: { box: [600, 220], weight: 1.2, draw: () => globe({ w: 600, h: 220, step: 15 }) },\n};\n\nconst ARTS: Art[] = ['moire', 'lissajous', 'rosette', 'ridgelines', 'globe'];\n\nconst SAMPLES: BentoCard[] = [\n  { title: 'One place for *everything*.', body: 'Sample copy: the feature you lead with, given the most room. Say what it does in a sentence or two.', art: 'moire' },\n  { title: 'Fast by default', body: 'Sample copy: a second feature, in a line.', art: 'lissajous' },\n  { title: 'Yours to shape', body: 'Sample copy: a third feature, in a line.', art: 'rosette' },\n  { title: 'Built for the long run', body: 'Sample copy: a wider card for a feature that needs a sentence more.', art: 'ridgelines' },\n  { title: 'Wherever you work', body: 'Sample copy: the last card, beside it on the same row.', art: 'globe' },\n];\n\n// The card spans in a six-column grid on large screens, by position.\nconst SPANS = ['lg:col-span-4 lg:row-span-2', 'lg:col-span-2', 'lg:col-span-2', 'lg:col-span-3', 'lg:col-span-3'];\n// Each drawing's strokes are spread over this many trigger ranges (see scrollWindow).\n// A drawing of one line (the rosette) has nothing to spread.\nconst SPREAD = 0.8;\nconst spreadFor = (paths: number) => (paths > 1 ? SPREAD : 0);\n\nfunction Title({ 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\nfunction Drawing({ art, accent }: { art: Art; accent: string }) {\n  const [strokes, setStrokes] = useState<Stroke[] | null>(null);\n  useEffect(() => setStrokes(ART[art].draw()), [art]);\n  const [w, h] = ART[art].box;\n  const weight = ART[art].weight;\n  if (!strokes) return null;\n  return (\n    <ScrollDraw stagger={staggerFor(strokes.length, SPREAD)} easing=\"linear\" trigger={scrollWindow(spreadFor(strokes.length))} className=\"absolute inset-0\" aria-hidden>\n      <svg viewBox={`0 0 ${w} ${h}`} className=\"size-full\" fill=\"none\" stroke=\"currentColor\" strokeWidth={weight} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n        {strokes.map((s, i) => (s.pen ? <path key={i} d={s.d} stroke={accent} strokeWidth={weight * 1.5} /> : <path key={i} d={s.d} />))}\n      </svg>\n    </ScrollDraw>\n  );\n}\n\nexport function BentoPlotted({\n  eyebrow = 'At a glance',\n  heading = 'Everything, *in its place*.',\n  description = 'Sample cards: put your own features in them.',\n  cards = SAMPLES,\n  accent = '#e0482a',\n  className = '',\n}: BentoPlottedProps) {\n  return (\n    <section className={`mx-auto max-w-7xl px-6 py-28 sm:px-10 ${className}`}>\n      <div className=\"max-w-2xl\">\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.2rem)] leading-[0.98] tracking-[-0.03em]\">\n          <Title text={heading} />\n        </h2>\n        {description && <p className=\"mt-4 font-mono text-[11px] uppercase tracking-[0.18em] text-muted-foreground\">{description}</p>}\n      </div>\n\n      <ul className=\"mt-16 grid gap-6 sm:grid-cols-2 lg:grid-cols-6\">\n        {cards.map((c, i) => {\n          const art = c.art ?? ARTS[i % ARTS.length];\n          const big = i === 0;\n          return (\n            <li key={c.title} className={`flex flex-col rounded-[3px] bg-card p-6 shadow-[0_1px_0_rgba(0,0,0,.04),0_18px_40px_-24px_rgba(40,30,10,.3)] sm:p-8 dark:shadow-[0_0_0_1px_rgba(255,255,255,.05)] ${big ? 'sm:col-span-2' : ''} ${SPANS[i] ?? 'lg:col-span-2'}`}>\n              <div className={`relative w-full ${big ? 'aspect-square sm:aspect-[16/10] lg:aspect-auto lg:min-h-[22rem] lg:flex-1' : ART[art].box[0] > ART[art].box[1] ? 'aspect-[600/220]' : 'aspect-[4/3]'}`}>\n                <Drawing art={art} accent={accent} />\n              </div>\n              <h3 className={`mt-6 font-serif tracking-[-0.02em] ${big ? 'text-4xl' : 'text-2xl'}`}>\n                <Title text={c.title} />\n              </h3>\n              <p className=\"mt-2 text-pretty text-[15px] leading-relaxed text-muted-foreground\">{c.body}</p>\n            </li>\n          );\n        })}\n      </ul>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "motion": "Scroll down: each card's drawing is plotted as it arrives.",
    "tall": true
  },
  "type": "registry:block"
}