{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "motion-progressive-blur",
  "title": "Progressive blur",
  "description": "A component that applies progressive blur effects to elements.",
  "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/progressive-blur.tsx",
      "content": "'use client';\nimport { cn } from '@/lib/utils';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { HTMLMotionProps, motion, MotionConfig } from 'motion/react';\n\nexport const GRADIENT_ANGLES = {\n  top: 0,\n  right: 90,\n  bottom: 180,\n  left: 270,\n};\n\nfunction ReducedMotionConfig({ children }: { children: React.ReactNode }) {\n  const prefersReducedMotion = usePrefersReducedMotion();\n  if (!prefersReducedMotion) {\n    return children;\n  }\n  return <MotionConfig reducedMotion='always'>{children}</MotionConfig>;\n}\n\nfunction maskColorOf(stopIndex: number) {\n  const isInsideBand = stopIndex === 1 || stopIndex === 2;\n  if (isInsideBand) {\n    return 'black';\n  }\n  return 'transparent';\n}\n\n/** Without explicit levels, each layer blurs `index * intensity` pixels, as before. */\nfunction blursOf(\n  blurLevels: readonly number[] | undefined,\n  blurLayers: number,\n  blurIntensity: number\n) {\n  const hasLevels = blurLevels !== undefined && blurLevels.length > 0;\n  if (hasLevels) {\n    return [...blurLevels];\n  }\n  const layerCount = Math.max(blurLayers, 2);\n  return Array.from({ length: layerCount }, (_, index) => {\n    return index * blurIntensity;\n  });\n}\n\nexport type ProgressiveBlurProps = {\n  direction?: keyof typeof GRADIENT_ANGLES;\n  blurLayers?: number;\n  className?: string;\n  blurIntensity?: number;\n  blurLevels?: readonly number[];\n} & HTMLMotionProps<'div'>;\n\nexport function ProgressiveBlur({\n  direction = 'bottom',\n  blurLayers = 8,\n  className,\n  blurIntensity = 0.25,\n  blurLevels,\n  ...props\n}: ProgressiveBlurProps) {\n  const blurs = blursOf(blurLevels, blurLayers, blurIntensity);\n  const bandCount = blurs.length + 1;\n  const segmentSize = 1 / bandCount;\n\n  return (\n    <ReducedMotionConfig>\n      <div aria-hidden='true' className={cn('relative', className)}>\n        {blurs.map((blur, index) => {\n          const angle = GRADIENT_ANGLES[direction];\n          const gradientStops = [\n            index * segmentSize,\n            (index + 1) * segmentSize,\n            (index + 2) * segmentSize,\n            (index + 3) * segmentSize,\n          ].map((pos, posIndex) => `${maskColorOf(posIndex)} ${pos * 100}%`);\n\n          const gradient = `linear-gradient(${angle}deg, ${gradientStops.join(\n            ', '\n          )})`;\n\n          return (\n            <motion.div\n              key={index}\n              className='pointer-events-none absolute inset-0 rounded-[inherit]'\n              style={{\n                maskImage: gradient,\n                WebkitMaskImage: gradient,\n                backdropFilter: `blur(${blur}px)`,\n                WebkitBackdropFilter: `blur(${blur}px)`,\n              }}\n              {...props}\n            />\n          );\n        })}\n      </div>\n    </ReducedMotionConfig>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/core/progressive-blur.tsx"
    }
  ],
  "categories": [
    "motion"
  ],
  "type": "registry:component"
}