{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chess-knight",
  "type": "registry:ui",
  "title": "chess-knight",
  "description": "Animated chess knight icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/chess-knight.vue",
      "type": "registry:ui",
      "content": "<script setup lang=\"ts\">\nimport { motion, useAnimationControls } from 'motion-v'\nimport type { Variants } from 'motion-v'\nimport { useIconAnimation } from '../composables/useIconAnimation'\nimport type { AnimatedIconHandle } from '../types'\n\ndefineOptions({ inheritAttrs: false, name: 'ChessKnightIcon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\n// after puzzle: the piece lifts, advances one square, and seats on the board\n// generated from @hugeicons/core-free-icons\nconst iconVariants: Variants = {\n  normal: {\n    transform: 'translateY(0px) scale(1)',\n  },\n  animate: {\n    transform: ['translateY(0px) scale(1)', 'translateY(-2.21px) scale(0.96)', 'translateY(0.4px) scale(1.04)', 'translateY(0px) scale(1)'],\n    transition: {\n      duration: 0.55,\n      ease: [0.23, 1, 0.32, 1],\n    },\n  },\n}\n\nconst controls = useAnimationControls()\nconst { onMouseEnter, onMouseLeave, startAnimation, stopAnimation } = useIconAnimation({\n  controls,\n  loops: false,\n})\n\ndefineExpose<AnimatedIconHandle>({ startAnimation, stopAnimation })\n</script>\n\n<template>\n  <div class=\"hia-icon\" @mouseenter=\"onMouseEnter\" @mouseleave=\"onMouseLeave\" v-bind=\"$attrs\">\n          <svg xmlns=\"http://www.w3.org/2000/svg\" :width=\"size\" :height=\"size\" viewBox=\"0 0 24 24\" fill=\"none\" overflow=\"visible\">\n            <motion.path d=\"M16.6732 18H8.00651C7.38653 18 7.07654 18 6.82221 18.0681C6.13202 18.2531 5.59293 18.7922 5.40799 19.4824C5.33984 19.7367 5.33984 20.0467 5.33984 20.6667C5.33984 20.9767 5.33984 21.1317 5.37392 21.2588C5.46639 21.6039 5.73593 21.8735 6.08102 21.9659C6.20819 22 6.36319 22 6.67318 22H18.0065C18.3165 22 18.4715 22 18.5987 21.9659C18.9438 21.8735 19.2133 21.6039 19.3058 21.2588C19.3398 21.1317 19.3398 20.9767 19.3398 20.6667C19.3398 20.0467 19.3398 19.7367 19.2717 19.4824C19.0868 18.7922 18.5477 18.2531 17.8575 18.0681C17.6031 18 17.2932 18 16.6732 18Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '11.92px 18px' }\" />\n            <motion.path d=\"M14.339 9C14.1723 9.83333 13.339 11.6 11.339 12M11.339 12C10.6779 11.3389 8.77103 10.2188 6.39873 10.9805C6.35925 10.9931 6.32037 11.0093 6.28329 11.0278C5.79258 11.2732 5.19966 11.0124 5.04894 10.4849L4.731 9.37207C4.50037 8.56485 4.84641 7.704 5.57157 7.28099L10.339 4.5V4C10.339 3.05719 10.339 2.58579 10.6319 2.29289C10.9248 2 11.3962 2 12.339 2C16.205 2 19.339 5.13401 19.339 9C19.339 12.5 18.339 15 17.339 18H7.33898L11.339 12Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '11.92px 18px' }\" />\n          </svg>\n        </div>\n</template>\n"
    },
    {
      "path": "composables/useIconAnimation.ts",
      "type": "registry:lib",
      "content": "import { ref, toValue, type MaybeRefOrGetter } from 'vue'\nimport type { AnimatedIconHandle } from '../types'\n\nexport type IconPose = 'normal' | 'animate'\n\ntype AnimationControls = {\n  set: (variant: IconPose | Record<string, unknown>) => void\n  start: (variant: IconPose | Record<string, unknown>) => Promise<unknown>\n}\n\nexport function useReducedMotionFlag(\n  reduced?: MaybeRefOrGetter<boolean | undefined>,\n) {\n  if (typeof window === 'undefined') return () => false\n  return () => {\n    const override = reduced === undefined ? undefined : toValue(reduced)\n    if (override !== undefined) return override\n    return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n  }\n}\n\nexport function useIconAnimation(options: {\n  controls: AnimationControls\n  loops?: boolean\n}): AnimatedIconHandle & {\n  onMouseEnter: () => void\n  onMouseLeave: () => void\n} {\n  const { controls, loops = false } = options\n  const isPlaying = ref(false)\n  let run = 0\n\n  const prefersReduced = () =>\n    typeof window !== 'undefined' &&\n    window.matchMedia('(prefers-reduced-motion: reduce)').matches\n\n  async function startAnimation() {\n    if (prefersReduced() || isPlaying.value) return\n\n    isPlaying.value = true\n    const current = ++run\n    controls.set('normal')\n    await controls.start('animate')\n    if (run === current) isPlaying.value = false\n  }\n\n  function stopAnimation() {\n    if (!loops) return\n    run += 1\n    isPlaying.value = false\n    void controls.start('normal')\n  }\n\n  return {\n    startAnimation,\n    stopAnimation,\n    onMouseEnter: () => {\n      void startAnimation()\n    },\n    onMouseLeave: () => {\n      stopAnimation()\n    },\n  }\n}\n"
    },
    {
      "path": "types/animated-icon.ts",
      "type": "registry:lib",
      "content": "export interface AnimatedIconHandle {\n  startAnimation: () => void\n  stopAnimation: () => void\n}\n\nexport interface AnimatedIconProps {\n  size?: number\n}\n"
    }
  ]
}
