{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "drag-04",
  "type": "registry:ui",
  "title": "drag-04",
  "description": "Animated drag icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/drag-04.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: 'Drag04Icon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\n// after cursor-pointer-01: the grabbed object pulls away, carries momentum, and returns\n// generated from @hugeicons/core-free-icons\nconst iconVariants: Variants = {\n  normal: {\n    transform: 'translateX(0px) rotate(0deg)',\n  },\n  animate: {\n    transform: ['translateX(0px) rotate(0deg)', 'translateX(3.24px) rotate(4.05deg)', 'translateX(-0.4px) rotate(-1.01deg)', 'translateX(0px) rotate(0deg)'],\n    transition: {\n      duration: 0.62,\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=\"M12.102 8.41938L12.3133 11.1053L19.0713 4.49715C19.7413 3.84209 20.8275 3.84209 21.4973 4.49715C22.1673 5.1522 22.1673 6.21426 21.4973 6.8693L17.8584 10.4276L19.5984 12.7763C20.7346 14.2795 21.3028 15.0311 21.4915 15.7673C21.8034 16.9832 21.667 18.2183 20.6457 19.2171C19.9342 19.9126 19.281 20.2075 17.5712 21.0434C16.4863 21.5738 15.9438 21.8391 15.4006 21.9377C14.5063 22.1002 13.5819 21.9535 12.786 21.5228C12.3026 21.2613 11.8738 20.842 11.016 20.0032L10.289 19.2923C9.14863 18.1773 8.57847 17.6198 8.28011 16.9189C8.22661 16.7932 8.17999 16.6648 8.14045 16.5342C7.91998 15.8063 8.00296 15.022 8.16889 13.4535L8.7061 8.3757C8.78866 7.59541 9.41637 6.97695 10.2137 6.89032C11.1721 6.7862 12.028 7.47929 12.102 8.41938Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '15.04px 22.1px' }\" />\n            <motion.path d=\"M9.06903 3.52615C9.06903 4.3701 9.7281 5.05425 10.5411 5.05425C11.3541 5.05425 12.0132 4.3701 12.0132 3.52615C12.0132 2.6822 11.3541 1.99805 10.5411 1.99805C9.7281 1.99805 9.06903 2.6822 9.06903 3.52615ZM9.06903 3.52615H8.41758L7.63791 3.59909M3.5102 9.0061C4.35702 8.99222 5.00174 9.65386 5.01515 10.473C5.02856 11.2922 4.39838 11.9972 3.55156 12.0111C2.70474 12.025 2.01458 11.3337 2.00117 10.5145C1.98776 9.6953 2.66338 9.01997 3.5102 9.0061ZM3.5102 9.0061L3.6009 7.66037M5.31608 4.67383L4.98443 4.98365L4.69136 5.29936\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"iconVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '15.04px 22.1px' }\" />\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"
    }
  ]
}
