{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "fence",
  "type": "registry:ui",
  "title": "fence",
  "description": "Animated fence icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/fence.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: 'FenceIcon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\n// after dashboard-square-01: the separate cells of the fence assemble from top-left to bottom-right\n// generated from @hugeicons/core-free-icons\nconst tileVariants: Variants = {\n  normal: {\n    transform: 'scale(1)',\n    visibility: 'visible',\n  },\n  animate: (i: number) => ({\n    transform: ['translateY(1.36px) scale(0.74)', 'translateY(-0.39px) scale(1.1)', 'translateY(0px) scale(1)'],\n    visibility: ['visible', 'visible', 'visible'],\n    transition: { duration: 0.46, 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=\"M21.4 4.2L20.8 3.4C20.6111 3.14819 20.3148 3 20 3C19.6852 3 19.3889 3.14819 19.2 3.4L18.6 4.2C18.3026 4.59649 18.154 4.79473 18.077 5.02566C18 5.25658 18 5.50439 18 6V19C18 19.465 18 19.6975 18.0511 19.8882C18.1898 20.4059 18.5941 20.8102 19.1118 20.9489C19.3025 21 19.535 21 20 21C20.465 21 20.6975 21 20.8882 20.9489C21.4059 20.8102 21.8102 20.4059 21.9489 19.8882C22 19.6975 22 19.465 22 19V6C22 5.50439 22 5.25658 21.923 5.02566C21.846 4.79473 21.6974 4.59649 21.4 4.2Z\" stroke=\"currentColor\" stroke-linecap=\"square\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"2\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '20px 12px' }\" />\n            <motion.path d=\"M13.4 4.2L12.8 3.4C12.6111 3.14819 12.3148 3 12 3C11.6852 3 11.3889 3.14819 11.2 3.4L10.6 4.2C10.3026 4.59649 10.154 4.79473 10.077 5.02566C10 5.25658 10 5.50439 10 6V19C10 19.465 10 19.6975 10.0511 19.8882C10.1898 20.4059 10.5941 20.8102 11.1118 20.9489C11.3025 21 11.535 21 12 21C12.465 21 12.6975 21 12.8882 20.9489C13.4059 20.8102 13.8102 20.4059 13.9489 19.8882C14 19.6975 14 19.465 14 19V6C14 5.50439 14 5.25658 13.923 5.02566C13.846 4.79473 13.6974 4.59649 13.4 4.2Z\" stroke=\"currentColor\" stroke-linecap=\"square\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"1\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12px 12px' }\" />\n            <motion.path d=\"M5.4 4.2L4.8 3.4C4.61115 3.14819 4.31476 3 4 3C3.68524 3 3.38885 3.14819 3.2 3.4L2.6 4.2C2.30263 4.59649 2.15395 4.79473 2.07698 5.02566C2 5.25658 2 5.50439 2 6V19C2 19.465 2 19.6975 2.05111 19.8882C2.18981 20.4059 2.59413 20.8102 3.11177 20.9489C3.30252 21 3.53501 21 4 21C4.46499 21 4.69748 21 4.88823 20.9489C5.40587 20.8102 5.81019 20.4059 5.94889 19.8882C6 19.6975 6 19.465 6 19V6C6 5.50439 6 5.25658 5.92302 5.02566C5.84605 4.79473 5.69737 4.59649 5.4 4.2Z\" stroke=\"currentColor\" stroke-linecap=\"square\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"0\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '4px 12px' }\" />\n            <motion.path d=\"M10 8H6V18H10V8Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"3\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '8px 13px' }\" />\n            <motion.path d=\"M18 8H14V18H18V8Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"tileVariants\" :custom=\"4\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '16px 13px' }\" />\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"
    }
  ]
}
