{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "image-play",
  "type": "registry:ui",
  "title": "image-play",
  "description": "Animated image play icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/image-play.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: 'ImagePlayIcon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\n// after play: the play head compresses, releases forward, and settles\n// generated from @hugeicons/core-free-icons\nconst iconVariants: Variants = {\n  normal: {\n    transform: 'translateX(0px) scaleX(1) scaleY(1)',\n  },\n  animate: {\n    transform: ['translateX(0px) scaleX(1) scaleY(1)', 'translateX(-0.82px) scaleX(0.9) scaleY(1.04)', 'translateX(2.05px) scaleX(1.1) scaleY(0.97)', 'translateX(0px) scaleX(1) scaleY(1)'],\n    transition: {\n      duration: 0.52,\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=\"M15.5 8.00049C15.7761 8.00049 16 7.77663 16 7.50049C16 7.22435 15.7761 7.00049 15.5 7.00049M15.5 8.00049C15.2239 8.00049 15 7.77663 15 7.50049C15 7.22435 15.2239 7.00049 15.5 7.00049M15.5 8.00049V7.00049\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '2.5px 12px' }\" />\n            <motion.path d=\"M21.5 12.0032C21.5 7.77208 21.5 5.65653 20.302 4.25344C20.1319 4.0542 19.9464 3.86864 19.7472 3.69848C18.3446 2.50012 16.2297 2.50012 12 2.50012C7.77027 2.50012 5.6554 2.50012 4.25276 3.69848C4.05358 3.86864 3.86808 4.0542 3.69797 4.25344C2.5 5.65653 2.5 7.77208 2.5 12.0032C2.5 16.2342 2.5 18.3498 3.69797 19.7529C3.86808 19.9521 4.05358 20.1377 4.25276 20.3078C5.41441 21.3003 7.06457 21.4708 10 21.5001\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '2.5px 12px' }\" />\n            <motion.path d=\"M3 16.0024L7.46967 11.5328C7.80923 11.1932 8.26978 11.0024 8.75 11.0024C9.23022 11.0024 9.69077 11.1932 10.0303 11.5328L11 12.5024\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '2.5px 12px' }\" />\n            <motion.path d=\"M15.5 8.00244C15.7761 8.00244 16 7.77858 16 7.50244C16 7.2263 15.7761 7.00244 15.5 7.00244M15.5 8.00244C15.2239 8.00244 15 7.77858 15 7.50244C15 7.2263 15.2239 7.00244 15.5 7.00244M15.5 8.00244V7.00244\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '2.5px 12px' }\" />\n            <motion.path d=\"M21.4453 17.9517C21.2686 18.668 20.4333 19.1741 18.7629 20.1864L18.7629 20.1864C17.148 21.165 16.3406 21.6543 15.6899 21.4576C15.4209 21.3763 15.1758 21.2218 14.9781 21.0091C14.5 20.4946 14.5 19.4965 14.5 17.5005C14.5 15.5044 14.5 14.5064 14.9781 13.9919C15.1758 13.7791 15.4209 13.6247 15.6899 13.5434C16.3406 13.3467 17.148 13.836 18.7629 14.8146C20.4333 15.8269 21.2686 16.333 21.4453 17.0493C21.5182 17.345 21.5182 17.656 21.4453 17.9517Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '2.5px 12px' }\" />\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"
    }
  ]
}
