{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chess-rook",
  "type": "registry:ui",
  "title": "chess-rook",
  "description": "Animated chess rook icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/chess-rook.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: 'ChessRookIcon' })\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.14px) scale(0.96)', 'translateY(0.39px) scale(1.04)', 'translateY(0px) scale(1)'],\n    transition: {\n      duration: 0.54,\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.3333 18H7.66667C7.04669 18 6.73669 18 6.48236 18.0681C5.79218 18.2531 5.25308 18.7922 5.06815 19.4824C5 19.7367 5 20.0467 5 20.6667C5 20.9767 5 21.1317 5.03407 21.2588C5.12654 21.6039 5.39609 21.8735 5.74118 21.9659C5.86835 22 6.02334 22 6.33333 22H17.6667C17.9767 22 18.1317 22 18.2588 21.9659C18.6039 21.8735 18.8735 21.6039 18.9659 21.2588C19 21.1317 19 20.9767 19 20.6667C19 20.0467 19 19.7367 18.9319 19.4824C18.7469 18.7922 18.2078 18.2531 17.5176 18.0681C17.2633 18 16.9533 18 16.3333 18Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12px 18px' }\" />\n            <motion.path d=\"M18 5V3.68466C18 3.04453 18 2.72446 17.8589 2.48781C17.7739 2.34527 17.6547 2.22613 17.5122 2.14113C17.2755 2 16.9555 2 16.3153 2H16.0308C15.7931 2 15.6742 2 15.5701 2.02244C15.2713 2.08683 15.0184 2.2843 14.8835 2.55853C14.8365 2.65412 14.8076 2.76941 14.75 3C14.6924 3.23059 14.6635 3.34589 14.6165 3.44147C14.4816 3.7157 14.2287 3.91317 13.9299 3.97756C13.8258 4 13.7069 4 13.4692 4H10.5308C10.2931 4 10.1742 4 10.0701 3.97756C9.77134 3.91317 9.51842 3.7157 9.3835 3.44147C9.33647 3.34589 9.30765 3.23059 9.25 3C9.19235 2.76941 9.16353 2.65412 9.1165 2.55853C8.98158 2.2843 8.72866 2.08683 8.42989 2.02244C8.32575 2 8.20691 2 7.96922 2H7.68466C7.04453 2 6.72446 2 6.48781 2.14113C6.34527 2.22613 6.22613 2.34527 6.14113 2.48781C6 2.72446 6 3.04453 6 3.68466V5C6 6.88562 6 7.82843 6.58579 8.41421C7.17157 9 8.11438 9 10 9H14C15.8856 9 16.8284 9 17.4142 8.41421C18 7.82843 18 6.88562 18 5Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12px 18px' }\" />\n            <motion.path d=\"M17 18H7L8 9H16L17 18Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12px 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"
    }
  ]
}
