{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "nintendo-switch",
  "type": "registry:ui",
  "title": "nintendo-switch",
  "description": "Animated nintendo switch icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/nintendo-switch.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: 'NintendoSwitchIcon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\n// after dashboard-square-01: the separate cells of the nintendo switch assemble from top-left to bottom-right\n// generated from @hugeicons/core-free-icons\nconst folderVariants: Variants = {\n  normal: {\n    transform: 'translateY(0px) rotate(0deg)',\n  },\n  animate: {\n    transform: ['translateY(0px) rotate(0deg)', 'translateY(-1.84px) rotate(-2.17deg)', 'translateY(0.43px) rotate(0.76deg)', 'translateY(0px) rotate(0deg)'],\n    transition: {\n      duration: 0.59,\n      ease: [0.23, 1, 0.32, 1],\n    },\n  },\n}\n\nconst tileVariants: Variants = {\n  normal: {\n    transform: 'scale(1)',\n    visibility: 'visible',\n  },\n  animate: (i: number) => ({\n    transform: ['translateY(1.52px) scale(0.74)', 'translateY(-0.43px) scale(1.1)', 'translateY(0px) scale(1)'],\n    visibility: ['visible', 'visible', 'visible'],\n    transition: { duration: 0.5, ease: [0.23, 1, 0.32, 1], delay: i * 0.06 },\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=\"M10.5 4.31818V15.6818C10.5 16.4448 10.5 16.8263 10.3644 17.1231C10.2146 17.4514 9.95135 17.7146 9.62312 17.8644C9.3263 18 8.94481 18 8.18182 18C6.14717 18 5.12985 18 4.33834 17.6385C3.46306 17.2388 2.7612 16.5369 2.36147 15.6617C2 14.8701 2 13.8528 2 11.8182V8.18182C2 6.14717 2 5.12985 2.36147 4.33834C2.7612 3.46306 3.46306 2.7612 4.33834 2.36147C5.12985 2 6.14717 2 8.18182 2C8.94481 2 9.3263 2 9.62312 2.13555C9.95135 2.28545 10.2146 2.54865 10.3644 2.87688C10.5 3.17369 10.5 3.55519 10.5 4.31818Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"folderVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12px 12px' }\" />\n            <motion.path d=\"M6.375 14H6.25M6.5 14C6.5 14.1381 6.38807 14.25 6.25 14.25C6.11193 14.25 6 14.1381 6 14C6 13.8619 6.11193 13.75 6.25 13.75C6.38807 13.75 6.5 13.8619 6.5 14Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"2\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '6.25px 14px' }\" />\n            <motion.path d=\"M17.875 10H17.75M18 10C18 10.1381 17.8881 10.25 17.75 10.25C17.6119 10.25 17.5 10.1381 17.5 10C17.5 9.86193 17.6119 9.75 17.75 9.75C17.8881 9.75 18 9.86193 18 10Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"1\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '17.75px 10px' }\" />\n            <motion.path d=\"M6.25 5.5V8.5M4.75 7H7.75\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"0\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '6.25px 7px' }\" />\n            <motion.path d=\"M13.5 19.6818V8.31818C13.5 7.55519 13.5 7.17369 13.6356 6.87688C13.7854 6.54865 14.0486 6.28545 14.3769 6.13555C14.6737 6 15.0552 6 15.8182 6C17.8528 6 18.8701 6 19.6617 6.36147C20.5369 6.7612 21.2388 7.46306 21.6385 8.33834C22 9.12985 22 10.1472 22 12.1818V15.8182C22 17.8528 22 18.8701 21.6385 19.6617C21.2388 20.5369 20.5369 21.2388 19.6617 21.6385C18.8701 22 17.8528 22 15.8182 22C15.0552 22 14.6737 22 14.3769 21.8644C14.0486 21.7145 13.7854 21.4514 13.6356 21.1231C13.5 20.8263 13.5 20.4448 13.5 19.6818Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"folderVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12px 12px' }\" />\n            <motion.path d=\"M17.75 18.5V15.5M19.25 17H16.25\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"3\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '17.75px 17px' }\" />\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"
    }
  ]
}
