{
  "$schema": "https://shadcn-vue.com/schema/registry-item.json",
  "name": "qr-code",
  "type": "registry:component",
  "title": "qr-code",
  "description": "Animated qr-code icon for Vue",
  "author": "Aniket Pawar <pawaraniket508@gmail.com>",
  "registryDependencies": [],
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "src/icons/qr-code.vue",
      "type": "registry:component",
      "target": "~/src/components/heroicons-animated/qr-code.vue",
      "content": "<template>\n  <div\n    :class=\"props.class\"\n    @mouseenter=\"handleMouseEnter\"\n    @mouseleave=\"handleMouseLeave\"\n    v-bind=\"$attrs\"\n  >\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      :width=\"props.size\"\n      :height=\"props.size\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      :stroke=\"props.color\"\n      :stroke-width=\"props.strokeWidth\"\n      stroke-linecap=\"round\"\n      stroke-linejoin=\"round\"\n    >\n      <path\n        d=\"M3.75 4.875C3.75 4.25368 4.25368 3.75 4.875 3.75H9.375C9.99632 3.75 10.5 4.25368 10.5 4.875V9.375C10.5 9.99632 9.99632 10.5 9.375 10.5H4.875C4.25368 10.5 3.75 9.99632 3.75 9.375V4.875Z\"\n      />\n      <path\n        d=\"M3.75 14.625C3.75 14.0037 4.25368 13.5 4.875 13.5H9.375C9.99632 13.5 10.5 14.0037 10.5 14.625V19.125C10.5 19.7463 9.99632 20.25 9.375 20.25H4.875C4.25368 20.25 3.75 19.7463 3.75 19.125V14.625Z\"\n      />\n      <path\n        d=\"M13.5 4.875C13.5 4.25368 14.0037 3.75 14.625 3.75H19.125C19.7463 3.75 20.25 4.25368 20.25 4.875V9.375C20.25 9.99632 19.7463 10.5 19.125 10.5H14.625C14.0037 10.5 13.5 9.99632 13.5 9.375V4.875Z\"\n      />\n      <path ref=\"dot0Ref\" d=\"M6.75 6.75H7.5V7.5H6.75V6.75Z\" />\n      <path ref=\"dot1Ref\" d=\"M6.75 16.5H7.5V17.25H6.75V16.5Z\" />\n      <path ref=\"dot2Ref\" d=\"M16.5 6.75H17.25V7.5H16.5V6.75Z\" />\n      <path ref=\"dot3Ref\" d=\"M13.5 13.5H14.25V14.25H13.5V13.5Z\" />\n      <path ref=\"dot4Ref\" d=\"M13.5 19.5H14.25V20.25H13.5V19.5Z\" />\n      <path ref=\"dot5Ref\" d=\"M19.5 13.5H20.25V14.25H19.5V13.5Z\" />\n      <path ref=\"dot6Ref\" d=\"M19.5 19.5H20.25V20.25H19.5V19.5Z\" />\n      <path ref=\"dot7Ref\" d=\"M16.5 16.5H17.25V17.25H16.5V16.5Z\" />\n    </svg>\n  </div>\n</template>\n\n<script lang=\"ts\">\n  export default {\n    name: \"QrCodeIcon\",\n  };\n</script>\n\n<script setup lang=\"ts\">\n  import { useMotion } from \"../motion\";\n  import { ref } from \"vue\";\n\n  export interface Props {\n    size?: number;\n    class?: string;\n    color?: string;\n    strokeWidth?: number | string;\n  }\n\n  const props = withDefaults(defineProps<Props>(), {\n    size: 28,\n    color: \"currentColor\",\n    strokeWidth: 1.5,\n  });\n\n  const createDotVariants = (delay: number) => ({\n    normal: {\n      opacity: 1,\n      scale: 1,\n    },\n    animate: {\n      opacity: [0, 1],\n      scale: [0, 1.2, 1],\n      transition: { delay, duration: 0.3, ease: \"easeOut\" },\n    },\n  });\n\n  const DELAYS = [0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35];\n  const dot0Ref = ref<SVGPathElement | null>(null);\n  const dot1Ref = ref<SVGPathElement | null>(null);\n  const dot2Ref = ref<SVGPathElement | null>(null);\n  const dot3Ref = ref<SVGPathElement | null>(null);\n  const dot4Ref = ref<SVGPathElement | null>(null);\n  const dot5Ref = ref<SVGPathElement | null>(null);\n  const dot6Ref = ref<SVGPathElement | null>(null);\n  const dot7Ref = ref<SVGPathElement | null>(null);\n\n  const motion0 = useMotion(dot0Ref, {\n    initial: createDotVariants(0).normal,\n    enter: createDotVariants(0).normal,\n  });\n  const motion1 = useMotion(dot1Ref, {\n    initial: createDotVariants(0.05).normal,\n    enter: createDotVariants(0.05).normal,\n  });\n  const motion2 = useMotion(dot2Ref, {\n    initial: createDotVariants(0.1).normal,\n    enter: createDotVariants(0.1).normal,\n  });\n  const motion3 = useMotion(dot3Ref, {\n    initial: createDotVariants(0.15).normal,\n    enter: createDotVariants(0.15).normal,\n  });\n  const motion4 = useMotion(dot4Ref, {\n    initial: createDotVariants(0.2).normal,\n    enter: createDotVariants(0.2).normal,\n  });\n  const motion5 = useMotion(dot5Ref, {\n    initial: createDotVariants(0.25).normal,\n    enter: createDotVariants(0.25).normal,\n  });\n  const motion6 = useMotion(dot6Ref, {\n    initial: createDotVariants(0.3).normal,\n    enter: createDotVariants(0.3).normal,\n  });\n  const motion7 = useMotion(dot7Ref, {\n    initial: createDotVariants(0.35).normal,\n    enter: createDotVariants(0.35).normal,\n  });\n\n  const motions = [\n    motion0,\n    motion1,\n    motion2,\n    motion3,\n    motion4,\n    motion5,\n    motion6,\n    motion7,\n  ];\n\n  let isControlled = false;\n\n  const startAnimation = () => {\n    let index = 0;\n    for (const delay of DELAYS) {\n      motions[index].apply(createDotVariants(delay).animate);\n      index += 1;\n    }\n  };\n\n  const stopAnimation = () => {\n    let index = 0;\n    for (const motion of motions) {\n      motion.apply(createDotVariants(DELAYS[index]).normal);\n      index += 1;\n    }\n  };\n\n  const handleMouseEnter = () => {\n    if (!isControlled) {\n      startAnimation();\n    }\n  };\n\n  const handleMouseLeave = () => {\n    if (!isControlled) {\n      stopAnimation();\n    }\n  };\n\n  const setControlled = (value: boolean) => {\n    isControlled = value;\n  };\n\n  defineExpose({\n    startAnimation,\n    stopAnimation,\n    setControlled,\n  });\n</script>\n"
    },
    {
      "path": "src/motion.ts",
      "type": "registry:component",
      "target": "~/src/components/motion.ts",
      "content": "import { animate } from \"motion-v\";\nimport { isRef, watch, type Ref } from \"vue\";\n\ntype MotionElement = Element | SVGElement;\ntype MotionTarget =\n  | MotionElement\n  | Ref<MotionElement | null | undefined>\n  | null\n  | undefined;\n\ntype MotionTransition = Record<string, unknown>;\ntype MotionValues = Record<string, unknown>;\n\nexport interface MotionVariant extends MotionValues {\n  transition?: MotionTransition;\n}\n\nexport interface UseMotionOptions {\n  initial?: MotionVariant;\n  enter?: MotionVariant;\n}\n\ninterface MotionControls {\n  stop?: () => void;\n}\n\nexport interface MotionInstance {\n  apply: (variant: MotionVariant) => void;\n  stop: () => void;\n}\n\nconst isDomElement = (value: unknown): value is MotionElement => {\n  if (typeof window === \"undefined\") {\n    return false;\n  }\n  return value instanceof Element;\n};\n\nconst resolveElement = (target: MotionTarget): MotionElement | null => {\n  const element = isRef(target) ? target.value : target;\n  if (!element) {\n    return null;\n  }\n  return isDomElement(element) ? element : null;\n};\n\nconst takeTransformOrigin = (value: unknown): string | null => {\n  if (typeof value === \"string\") {\n    return value;\n  }\n  if (Array.isArray(value) && value.length > 0) {\n    // biome-ignore lint/style/useAtIndex: ES2020 lib target for package type-check does not include Array.prototype.at.\n    const lastValue = value[value.length - 1];\n    if (typeof lastValue === \"string\") {\n      return lastValue;\n    }\n  }\n  return null;\n};\n\nconst extractAnimatableValues = (\n  element: MotionElement,\n  values: MotionValues\n): MotionValues => {\n  const animatableValues: MotionValues = { ...values };\n  const transformOrigin = takeTransformOrigin(values.transformOrigin);\n\n  if (transformOrigin && \"style\" in element) {\n    element.style.transformOrigin = transformOrigin;\n    animatableValues.transformOrigin = undefined;\n  }\n\n  return animatableValues;\n};\n\nconst runAnimation = (\n  element: MotionElement,\n  controlsRef: { current: MotionControls | null },\n  variant: MotionVariant,\n  instant = false\n): void => {\n  if (typeof window === \"undefined\") {\n    return;\n  }\n\n  const { transition, ...values } = variant;\n  const animatableValues = extractAnimatableValues(element, values);\n\n  if (Object.keys(animatableValues).length === 0) {\n    return;\n  }\n\n  controlsRef.current?.stop?.();\n\n  const animationOptions = instant\n    ? ({ duration: 0 } as MotionTransition)\n    : (transition ?? {});\n\n  controlsRef.current = animate(\n    element,\n    animatableValues as Record<string, unknown>,\n    animationOptions\n  ) as MotionControls;\n};\n\nexport const useMotion = (\n  target: MotionTarget,\n  options: UseMotionOptions = {}\n): MotionInstance => {\n  const controlsRef: { current: MotionControls | null } = { current: null };\n\n  const initialize = (element: MotionElement): void => {\n    if (options.initial) {\n      runAnimation(element, controlsRef, options.initial, true);\n      return;\n    }\n    if (options.enter) {\n      runAnimation(element, controlsRef, options.enter, true);\n    }\n  };\n\n  const resolvedAtSetup = resolveElement(target);\n  if (resolvedAtSetup) {\n    initialize(resolvedAtSetup);\n  }\n\n  if (isRef(target)) {\n    watch(\n      () => target.value,\n      (element) => {\n        if (isDomElement(element)) {\n          initialize(element);\n        }\n      },\n      { immediate: true }\n    );\n  }\n\n  const apply = (variant: MotionVariant): void => {\n    if (typeof window === \"undefined\") {\n      return;\n    }\n    const element = resolveElement(target);\n    if (!element) {\n      return;\n    }\n    runAnimation(element, controlsRef, variant);\n  };\n\n  return {\n    apply,\n    stop: () => {\n      controlsRef.current?.stop?.();\n    },\n  };\n};\n"
    }
  ]
}