{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "motion-border-trail",
  "title": "Border trail",
  "description": "An effect that creates animated border trails around elements on interaction.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "components/core/border-trail.tsx",
      "content": "'use client';\nimport { cn } from '@/lib/utils';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { motion, Transition } from 'motion/react';\n\nexport type BorderTrailProps = {\n  className?: string;\n  size?: number;\n  transition?: Transition;\n  onAnimationComplete?: () => void;\n  style?: React.CSSProperties;\n};\n\nconst STILL_TRAIL = {\n  offsetDistance: '0%',\n};\n\nconst MOVING_TRAIL = {\n  offsetDistance: ['0%', '100%'],\n};\n\nconst INSTANT: Transition = {\n  duration: 0,\n};\n\nconst DEFAULT_TRANSITION: Transition = {\n  repeat: Infinity,\n  duration: 5,\n  ease: 'linear',\n};\n\nfunction trailAnimationOf(prefersReducedMotion: boolean | null) {\n  if (prefersReducedMotion) {\n    return STILL_TRAIL;\n  }\n  return MOVING_TRAIL;\n}\n\nfunction trailTransitionOf(\n  prefersReducedMotion: boolean | null,\n  transition?: Transition\n) {\n  if (prefersReducedMotion) {\n    return INSTANT;\n  }\n  return transition || DEFAULT_TRANSITION;\n}\n\nexport function BorderTrail({\n  className,\n  size = 60,\n  transition,\n  onAnimationComplete,\n  style,\n}: BorderTrailProps) {\n  const prefersReducedMotion = usePrefersReducedMotion();\n\n  return (\n    <div className='pointer-events-none absolute inset-0 rounded-[inherit] border border-transparent [mask-image:linear-gradient(transparent,transparent),linear-gradient(black,black)] [mask-composite:intersect] [mask-clip:padding-box,border-box]'>\n      <motion.div\n        className={cn('bg-muted-foreground absolute aspect-square', className)}\n        style={{\n          width: size,\n          offsetPath: `rect(0 auto auto 0 round ${size}px)`,\n          ...style,\n        }}\n        animate={trailAnimationOf(prefersReducedMotion)}\n        transition={trailTransitionOf(prefersReducedMotion, transition)}\n        onAnimationComplete={onAnimationComplete}\n      />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/core/border-trail.tsx"
    }
  ],
  "categories": [
    "motion"
  ],
  "type": "registry:component"
}