{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "heading",
  "title": "Heading",
  "description": "Display, section and card headings with optional fit-to-width and reveal.",
  "dependencies": [
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "@khaeli/fit-text",
    "@khaeli/text-reveal",
    "@khaeli/utils"
  ],
  "files": [
    {
      "path": "registry/khaeli/ui/heading.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { FitText } from \"@/components/ui/fit-text\"\nimport { TextReveal } from \"@/components/ui/text-reveal\"\n\nexport type HeadingLevel = \"h1\" | \"h2\" | \"h3\" | \"h4\"\nexport type HeadingSize = \"display-xl\" | \"display\" | \"section\" | \"card\" | \"inline\"\n\nconst headingVariants = cva(\n  \"font-sans text-balance leading-[1.1] tracking-[-0.02em]\",\n  {\n    variants: {\n      level: {\n        h1: \"\",\n        h2: \"\",\n        h3: \"\",\n        h4: \"\",\n      },\n      size: {\n        \"display-xl\":\n          \"text-[clamp(3.5rem,7.5vw,9rem)] leading-[1.05] tracking-[-0.03em]\",\n        display: \"text-3xl sm:text-4xl md:text-5xl lg:text-6xl\",\n        section: \"text-3xl md:text-4xl lg:text-5xl\",\n        card: \"text-lg md:text-xl lg:text-2xl\",\n        inline: \"text-base md:text-lg\",\n      },\n      textColor: {\n        default: \"text-foreground\",\n        muted: \"text-muted-foreground\",\n        accent: \"text-accent-500\",\n      },\n      weight: {\n        normal: \"font-normal\",\n        medium: \"font-medium\",\n        semibold: \"font-semibold\",\n        bold: \"font-bold\",\n      },\n    },\n    defaultVariants: {\n      level: \"h2\",\n      textColor: \"default\",\n      weight: \"medium\",\n    },\n  }\n)\n\nexport interface HeadingProps\n  extends Omit<React.HTMLAttributes<HTMLHeadingElement>, \"color\">,\n    VariantProps<typeof headingVariants> {\n  level?: HeadingLevel\n  as?: HeadingLevel\n  size?: HeadingSize\n  animated?: boolean\n  fit?: boolean\n  animationDelay?: number\n}\n\nconst SIZE_MAP: Record<HeadingLevel, HeadingSize> = {\n  h1: \"display\",\n  h2: \"section\",\n  h3: \"card\",\n  h4: \"inline\",\n}\n\nfunction Heading({\n  className,\n  level = \"h2\",\n  as,\n  size,\n  textColor = \"default\",\n  weight = \"medium\",\n  animated,\n  fit,\n  animationDelay: _animationDelay,\n  children,\n  ...rest\n}: HeadingProps) {\n  const Level = (as ?? level) as React.ElementType\n  const resolvedSize: HeadingSize = size ?? SIZE_MAP[level]\n  const shouldFit = fit !== undefined ? fit : resolvedSize === \"display-xl\"\n\n  const classes = cn(\n    headingVariants({ level, size: resolvedSize, textColor, weight }),\n    className\n  )\n\n  if (shouldFit) {\n    return (\n      <Level\n        data-slot=\"heading\"\n        data-animated={false}\n        className={classes}\n        {...rest}\n      >\n        <FitText>{children}</FitText>\n      </Level>\n    )\n  }\n\n  if (animated !== false && typeof children === \"string\") {\n    return (\n      <TextReveal\n        as={Level}\n        data-slot=\"heading\"\n        data-animated\n        className={classes}\n        {...(rest as Omit<React.ComponentProps<\"div\">, \"children\">)}\n      >\n        {children}\n      </TextReveal>\n    )\n  }\n\n  return (\n    <Level data-slot=\"heading\" className={classes} {...rest}>\n      {children}\n    </Level>\n  )\n}\n\nexport { Heading, headingVariants }\n",
      "type": "registry:ui"
    }
  ],
  "docs": "Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.",
  "type": "registry:ui"
}