{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cancel-01",
  "type": "registry:ui",
  "title": "cancel-01",
  "description": "Animated cancel icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/cancel-01.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: 'Cancel01Icon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\nconst FIRST_PATH = 'M18 6L6.00081 17.9992';\nconst SECOND_PATH = 'M6 6.00085L17.9992 18';\n\n// Use the same single landing as Tick after the second strike is complete.\nconst impactVariants: Variants = {\n  normal: { transform: 'translateY(0px) rotate(0deg) scale(1)' },\n  animate: {\n    transform: [\n      'translateY(0px) rotate(0deg) scale(1)',\n      'translateY(0px) rotate(0deg) scale(1)',\n      'translateY(-0.35px) rotate(0.8deg) scale(1.08)',\n      'translateY(0px) rotate(0deg) scale(1)',\n    ],\n    transition: {\n      duration: 1.04,\n      ease: ['linear', [0.23, 1, 0.32, 1], [0.23, 1, 0.32, 1]],\n      times: [0, 0.78, 0.9, 1],\n    },\n  },\n};\n\n// Each stroke continues briefly as the pen lifts from the page.\nconst firstEndFlourishVariants: Variants = {\n  normal: {\n    pathLength: 0,\n    opacity: 0,\n    visibility: 'hidden',\n  },\n  animate: {\n    pathLength: [0, 0, 1, 1],\n    opacity: [0, 0, 1, 0],\n    visibility: ['hidden', 'hidden', 'visible', 'hidden'],\n    transition: {\n      duration: 0.76,\n      ease: [\n        'linear',\n        [0.23, 1, 0.32, 1],\n        [0.23, 1, 0.32, 1],\n      ],\n      times: [0, 0.69, 0.84, 1],\n    },\n  },\n};\n\nconst secondEndFlourishVariants: Variants = {\n  normal: {\n    pathLength: 0,\n    opacity: 0,\n    visibility: 'hidden',\n  },\n  animate: {\n    pathLength: [0, 0, 1, 1],\n    opacity: [0, 0, 1, 0],\n    visibility: ['hidden', 'hidden', 'visible', 'hidden'],\n    transition: {\n      duration: 1.06,\n      ease: [\n        'linear',\n        [0.23, 1, 0.32, 1],\n        [0.23, 1, 0.32, 1],\n      ],\n      times: [0, 0.77, 0.88, 1],\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// rest-parity: split-source-path\n// The first strike starts at the top-right. The second starts at the top-left.\n// Erase and redraw use those same starts, with the offset reset while hidden.\nconst firstStrikeVariants: Variants = {\n  normal: { pathLength: 1, pathOffset: 0, visibility: 'visible' },\n  animate: {\n    pathLength: [1, 1, 0.12, 0, 0, 0.12, 1, 1],\n    pathOffset: [0, 0, 0.88, 1, 0, 0, 0, 0],\n    visibility: [\n      'visible',\n      'visible',\n      'hidden',\n      'hidden',\n      'hidden',\n      'hidden',\n      'visible',\n      'visible',\n    ],\n    transition: {\n      duration: 0.9,\n      ease: [\n        'linear',\n        [0.77, 0, 0.175, 1],\n        'linear',\n        'linear',\n        'linear',\n        [0.77, 0, 0.175, 1],\n        'linear',\n      ],\n      times: [0, 0.05, 0.22, 0.25, 0.34, 0.38, 0.58, 1],\n    },\n  },\n};\n\nconst secondStrikeVariants: Variants = {\n  normal: { pathLength: 1, pathOffset: 0, visibility: 'visible' },\n  animate: {\n    pathLength: [1, 1, 0.12, 0, 0, 0.12, 1, 1],\n    pathOffset: [0, 0, 0.88, 1, 0, 0, 0, 0],\n    visibility: [\n      'visible',\n      'visible',\n      'hidden',\n      'hidden',\n      'hidden',\n      'hidden',\n      'visible',\n      'visible',\n    ],\n    transition: {\n      duration: 0.9,\n      ease: [\n        'linear',\n        [0.77, 0, 0.175, 1],\n        'linear',\n        'linear',\n        'linear',\n        [0.77, 0, 0.175, 1],\n        'linear',\n      ],\n      times: [0, 0.1, 0.27, 0.3, 0.64, 0.7, 0.9, 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          <motion.svg xmlns=\"http://www.w3.org/2000/svg\" :width=\"size\" :height=\"size\" viewBox=\"0 0 24 24\" fill=\"none\" overflow=\"visible\" :variants=\"impactVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12px 12px' }\">\n            <motion.path :d=\"FIRST_PATH\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"firstStrikeVariants\" :animate=\"controls\" initial=\"normal\" />\n            <motion.path :d=\"SECOND_PATH\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"secondStrikeVariants\" :animate=\"controls\" initial=\"normal\" />\n            <motion.g :variants=\"generatedGeometryVariants\" :animate=\"controls\" initial=\"normal\">\n              <motion.path d=\"M6.00081 17.9992L5.1 18.9\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"firstEndFlourishVariants\" :animate=\"controls\" initial=\"normal\" />\n              <motion.path d=\"M17.9992 18L18.9 18.9008\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"secondEndFlourishVariants\" :animate=\"controls\" initial=\"normal\" />\n            </motion.g>\n          </motion.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"
    }
  ]
}
