{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "copy-01",
  "type": "registry:ui",
  "title": "copy-01",
  "description": "Animated copy icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/copy-01.vue",
      "type": "registry:ui",
      "content": "<script setup lang=\"ts\">\nimport { motion, useAnimationControls } from 'motion-v'\nimport type { Variants } from 'motion-v'\nimport { useId } from 'vue'\nimport { useIconAnimation } from '../composables/useIconAnimation'\nimport type { AnimatedIconHandle } from '../types'\n\ndefineOptions({ inheritAttrs: false, name: 'Copy01Icon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\nconst FRONT_PATH =\n  'M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z';\n\nconst COPY_DURATION = 0.86;\nconst COPY_TIMES = [0, 0.1, 0.34, 0.46, 0.56, 0.76, 0.88, 1];\nconst COPY_EASING: Easing[] = [\n  [0.23, 1, 0.32, 1],\n  [0.77, 0, 0.175, 1],\n  [0.23, 1, 0.32, 1],\n  'linear',\n  [0.77, 0, 0.175, 1],\n  [0.23, 1, 0.32, 1],\n  [0.23, 1, 0.32, 1],\n];\n\n// The front sheet grows to cover the rear panel, pauses, then returns.\nconst frontVariants: Variants = {\n  normal: {\n    transform: 'translate(0px, 0px) scale(1)',\n    strokeWidth: 1.5,\n    visibility: 'visible',\n  },\n  animate: {\n    transform: [\n      'translate(0px, 0px) scale(1)',\n      'translate(0.45px, 0.45px) scale(0.97)',\n      'translate(-6.2px, -6.2px) scale(1.2)',\n      'translate(-6px, -6px) scale(1.14)',\n      'translate(-6px, -6px) scale(1.14)',\n      'translate(0.65px, 0.65px) scale(0.96)',\n      'translate(-0.25px, -0.25px) scale(1.03)',\n      'translate(0px, 0px) scale(1)',\n    ],\n    strokeWidth: [\n      1.5,\n      1.5 / 0.97,\n      1.5 / 1.2,\n      1.5 / 1.14,\n      1.5 / 1.14,\n      1.5 / 0.96,\n      1.5 / 1.03,\n      1.5,\n    ],\n    visibility: 'visible',\n    transition: {\n      duration: COPY_DURATION,\n      ease: COPY_EASING,\n      times: COPY_TIMES,\n    },\n  },\n};\n\n// The invisible mask grows during the overlap so the rear panel is fully hidden.\nconst occlusionVariants: Variants = {\n  normal: { transform: 'translate(0px, 0px) scale(1)' },\n  animate: {\n    transform: [\n      'translate(0px, 0px) scale(1)',\n      'translate(0.45px, 0.45px) scale(0.97)',\n      'translate(-6.2px, -6.2px) scale(1.24)',\n      'translate(-6px, -6px) scale(1.18)',\n      'translate(-6px, -6px) scale(1.18)',\n      'translate(0.65px, 0.65px) scale(1.06)',\n      'translate(-0.25px, -0.25px) scale(1.03)',\n      'translate(0px, 0px) scale(1)',\n    ],\n    transition: {\n      duration: COPY_DURATION,\n      ease: COPY_EASING,\n      times: COPY_TIMES,\n    },\n  },\n};\n\nconst generatedGeometryVariants: Variants = {\n  normal: { visibility: 'hidden', transition: { duration: 0.08 } },\n  animate: { visibility: 'visible', transition: { duration: 0 } },\n};\n\n/** Animated Copy icon with imperative hover controls. */\n\nconst controls = useAnimationControls()\nconst occlusionMaskId = useId();\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            <defs>\n              <mask :id=\"occlusionMaskId\" maskUnits=\"userSpaceOnUse\" x=\"-4\" y=\"-4\" width=\"32\" height=\"32\">\n                <rect x=\"-4\" y=\"-4\" width=\"32\" height=\"32\" fill=\"white\" />\n                <motion.g :variants=\"generatedGeometryVariants\" :animate=\"controls\" initial=\"normal\">\n                  <motion.path :d=\"FRONT_PATH\" fill=\"black\" stroke=\"black\" stroke-linejoin=\"round\" stroke-width=\"2.5\" :variants=\"occlusionVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '15.5px 15.5px' }\" />\n                </motion.g>\n              </mask>\n            </defs>\n            <motion.path :d=\"FRONT_PATH\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"frontVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '15.5px 15.5px' }\" />\n            <motion.path d=\"M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :mask=\"`url(#${occlusionMaskId})`\" />\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"
    }
  ]
}
