{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "flower",
  "type": "registry:ui",
  "title": "flower",
  "description": "Animated flower icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/flower.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: 'FlowerIcon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\nconst BLOOM_DURATION = 0.86;\nconst BLOOM_TIMES = [0, 0.18, 0.5, 0.78, 1];\n\nconst POLLEN_DOTS = [\n  { cx: 7.4, cy: 5.8, x: -2.6, y: -2.4, delay: 0.16, duration: 0.58 },\n  { cx: 16.5, cy: 5.9, x: 2.4, y: -2.5, delay: 0.22, duration: 0.54 },\n  { cx: 19.1, cy: 13.1, x: 2.5, y: 0.8, delay: 0.28, duration: 0.5 },\n] as const;\n\n// the petals turn around an optically fixed center and release a little pollen\nconst bloomVariants: Variants = {\n  normal: { transform: 'rotate(0deg)' },\n  animate: {\n    transform: [\n      'rotate(0deg)',\n      'rotate(-7deg)',\n      'rotate(9deg)',\n      'rotate(-2deg)',\n      'rotate(0deg)',\n    ],\n    transition: {\n      duration: BLOOM_DURATION,\n      ease: [0.77, 0, 0.175, 1],\n      times: BLOOM_TIMES,\n    },\n  },\n};\n\nconst generatedGeometryVariants: Variants = {\n  normal: { visibility: 'hidden' },\n  animate: { visibility: 'visible', transition: { duration: 0.08, ease: 'linear' } },\n};\n\nconst pollenVariants: Variants = {\n  normal: { visibility: 'hidden', transform: 'translate(0px, 0px) scale(0.7)' },\n  animate: ({ x, y, delay, duration }: (typeof POLLEN_DOTS)[number]) => ({\n    visibility: ['hidden', 'hidden', 'visible', 'visible', 'hidden'],\n    transform: [\n      'translate(0px, 0px) scale(0.7)',\n      `translate(${x * 0.08}px, ${y * 0.08}px) scale(0.82)`,\n      `translate(${x * 0.42}px, ${y * 0.42}px) scale(1)`,\n      `translate(${x * 0.76}px, ${y * 0.76}px) scale(0.92)`,\n      `translate(${x}px, ${y}px) scale(0.72)`,\n    ],\n    transition: {\n      transform: {\n        delay,\n        duration,\n        ease: [0.23, 1, 0.32, 1],\n        times: [0, 0.12, 0.32, 0.62, 1],\n      },\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            <path d=\"M14.4999 12.5C14.4999 13.8807 13.3807 15 11.9999 15C10.6192 15 9.49994 13.8807 9.49994 12.5C9.49994 11.1193 10.6192 10 11.9999 10C13.3807 10 14.4999 11.1193 14.4999 12.5Z\" stroke=\"currentColor\" stroke-linejoin=\"round\" stroke-width=\"1.5\" />\n            <motion.path d=\"M11.9999 3C14.2091 3 15.998 4.91739 15.998 7.12653C16.3182 7.04393 16.6539 7 16.9999 7C19.2091 7 20.9999 8.79086 20.9999 11C20.9999 12.5964 20.0647 13.9745 18.7122 14.616C19.2071 15.2818 19.4999 16.1067 19.4999 17C19.4999 19.2091 17.7091 21 15.4999 21C13.9939 21 12.6823 20.1677 11.9999 18.938C11.3176 20.1677 10.006 21 8.49994 21C6.2908 21 4.49994 19.2091 4.49994 17C4.49994 16.1067 4.79277 15.2818 5.28767 14.616C3.93518 13.9745 2.99994 12.5964 2.99994 11C2.99994 8.79086 4.7908 7 6.99994 7C7.34595 7 7.68169 7.04393 8.0019 7.12652C8.0019 4.91738 9.7908 3 11.9999 3Z\" stroke=\"currentColor\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"bloomVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12px 12px' }\" />\n            <motion.g :variants=\"generatedGeometryVariants\" :animate=\"controls\" initial=\"normal\">\n              <motion.circle\n                v-for=\"dot in POLLEN_DOTS\"\n                :key=\"`${dot.cx}-${dot.cy}`\"\n                :cx=\"dot.cx\"\n                :cy=\"dot.cy\"\n                r=\"0.7\"\n                fill=\"currentColor\"\n                :variants=\"pollenVariants\"\n                :custom=\"dot\"\n                :animate=\"controls\"\n                initial=\"normal\"\n              />\n            </motion.g>\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"
    }
  ]
}
