{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hatch-highlight",
  "title": "Hatched highlight",
  "description": "A large statement whose key phrases a pen hatches over as they are read, like a proof marked up by hand.",
  "dependencies": [
    "svg-scroll-draw@^2.29.0"
  ],
  "registryDependencies": [
    "https://scrollfx-ui.vercel.app/r/plotter.json"
  ],
  "files": [
    {
      "path": "registry/blocks/hatch-highlight.tsx",
      "content": "'use client';\n\n/**\n * hatch-highlight — a large statement whose key phrases a pen hatches over as\n * they are read: diagonal strokes plotted one after another, the way you would\n * mark up a proof.\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 statement is set in `font-serif`.\n *\n * Mark a phrase with asterisks: `Most sections *sit still*.` Each mark is\n * measured and hatched to fit, and again when the layout changes. The words\n * are plain text throughout. Reduced motion shows the hatching drawn.\n */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { ScrollDraw } from 'svg-scroll-draw/react';\nimport 'svg-scroll-draw/no-flash.css';\nimport { hatch, scrollWindow, staggerFor, type Stroke } from '@/lib/plotter';\n\nexport interface HatchHighlightProps {\n  eyebrow?: string;\n  /** The statement. Phrases between asterisks get hatched. */\n  text?: string;\n  /** The hatching's colour. */\n  accent?: string;\n  className?: string;\n}\n\nfunction Mark({ children, accent }: { children: string; accent: string }) {\n  const ref = useRef<HTMLSpanElement>(null);\n  const [box, setBox] = useState<{ w: number; h: number; lines: Stroke[] } | null>(null);\n\n  useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const measure = () => {\n      const w = Math.round(el.offsetWidth + 12);\n      const h = Math.round(el.offsetHeight * 0.62);\n      setBox((b) => (b && b.w === w && b.h === h ? b : { w, h, lines: hatch({ w, h, gap: 5, angle: 62 }) }));\n    };\n    measure();\n    const ro = new ResizeObserver(measure);\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n\n  return (\n    <span ref={ref} className=\"relative isolate inline-block whitespace-nowrap\">\n      {box && (\n        // Hatched as the phrase rises, the last stroke landing as it reaches\n        // the middle of the screen.\n        <ScrollDraw key={`${box.w}x${box.h}`} stagger={staggerFor(box.lines.length, 1)} easing=\"linear\" trigger={scrollWindow(1)} className=\"absolute -left-1.5 top-[30%] -z-10\" aria-hidden>\n          <svg width={box.w} height={box.h} viewBox={`0 0 ${box.w} ${box.h}`} fill=\"none\" stroke={accent} strokeWidth=\"1.6\" strokeLinecap=\"round\" className=\"block opacity-80\">\n            {box.lines.map((l, i) => <path key={i} d={l.d} />)}\n          </svg>\n        </ScrollDraw>\n      )}\n      {children}\n    </span>\n  );\n}\n\nexport function HatchHighlight({\n  eyebrow = 'In short',\n  text = 'Most sections *sit still*. These are *drawn in* as you read, every line plotted by a pen that keeps pace *with the reader*.',\n  accent = '#e0482a',\n  className = '',\n}: HatchHighlightProps) {\n  return (\n    <section className={`mx-auto max-w-5xl px-6 py-32 sm:px-10 ${className}`}>\n      <p className=\"font-mono text-[11px] uppercase tracking-[0.22em] text-muted-foreground\">{eyebrow}</p>\n      {/* A div, not a p: each mark holds the drawing's wrapper div. */}\n      <div className=\"mt-10 text-balance font-serif text-[clamp(2.2rem,4.8vw,4.4rem)] leading-[1.12] tracking-[-0.025em]\">\n        {text.split(/(\\*[^*]+\\*)/).map((part, i) =>\n          part.startsWith('*') ? <Mark key={i} accent={accent}>{part.slice(1, -1)}</Mark> : <span key={i}>{part}</span>,\n        )}\n      </div>\n    </section>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "motion": "Scroll to it: the marked phrases are hatched in.",
    "tall": false
  },
  "type": "registry:block"
}