{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "history",
  "type": "registry:ui",
  "title": "history",
  "description": "Animated history icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/history.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: 'HistoryIcon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\n// The rewind ring and both hands share one motion curve. A small forward\n// anticipation leads into the backward sweep, then every part overshoots and\n// settles together. The hour hand turns three times and the minute hand turns\n// six times, preserving Clock's 2:1 pace with much more visible rewinding.\n// rest-parity: split-source-path\nconst HISTORY_DURATION = 0.82;\nconst HISTORY_TIMES = [\n  0, 0.06, 0.1, 0.14, 0.21, 0.26, 0.31, 0.36, 0.41, 0.46, 0.51, 0.56, 0.61,\n  0.66, 0.71, 0.77, 0.84, 0.91, 1,\n];\n\nconst frameVariants: Variants = {\n  normal: { transform: 'rotate(0deg)' },\n  animate: {\n    transform: [\n      'rotate(0deg)',\n      'rotate(8deg)',\n      'rotate(12deg)',\n      'rotate(8deg)',\n      'rotate(-30deg)',\n      'rotate(-60deg)',\n      'rotate(-90deg)',\n      'rotate(-120deg)',\n      'rotate(-150deg)',\n      'rotate(-180deg)',\n      'rotate(-210deg)',\n      'rotate(-240deg)',\n      'rotate(-270deg)',\n      'rotate(-300deg)',\n      'rotate(-330deg)',\n      'rotate(-355deg)',\n      'rotate(-369deg)',\n      'rotate(-366deg)',\n      'rotate(-360deg)',\n    ],\n    transition: {\n      duration: HISTORY_DURATION,\n      ease: 'linear',\n      times: HISTORY_TIMES,\n    },\n  },\n};\n\nconst minuteHandVariants: Variants = {\n  normal: { transform: 'rotate(0deg)' },\n  animate: {\n    transform: [\n      'rotate(0deg)',\n      'rotate(48deg)',\n      'rotate(72deg)',\n      'rotate(48deg)',\n      'rotate(-180deg)',\n      'rotate(-360deg)',\n      'rotate(-540deg)',\n      'rotate(-720deg)',\n      'rotate(-900deg)',\n      'rotate(-1080deg)',\n      'rotate(-1260deg)',\n      'rotate(-1440deg)',\n      'rotate(-1620deg)',\n      'rotate(-1800deg)',\n      'rotate(-1980deg)',\n      'rotate(-2130deg)',\n      'rotate(-2214deg)',\n      'rotate(-2196deg)',\n      'rotate(-2160deg)',\n    ],\n    transition: {\n      duration: HISTORY_DURATION,\n      ease: 'linear',\n      times: HISTORY_TIMES,\n    },\n  },\n};\n\nconst hourHandVariants: Variants = {\n  normal: { transform: 'rotate(0deg)' },\n  animate: {\n    transform: [\n      'rotate(0deg)',\n      'rotate(24deg)',\n      'rotate(36deg)',\n      'rotate(24deg)',\n      'rotate(-90deg)',\n      'rotate(-180deg)',\n      'rotate(-270deg)',\n      'rotate(-360deg)',\n      'rotate(-450deg)',\n      'rotate(-540deg)',\n      'rotate(-630deg)',\n      'rotate(-720deg)',\n      'rotate(-810deg)',\n      'rotate(-900deg)',\n      'rotate(-990deg)',\n      'rotate(-1065deg)',\n      'rotate(-1107deg)',\n      'rotate(-1098deg)',\n      'rotate(-1080deg)',\n    ],\n    transition: {\n      duration: HISTORY_DURATION,\n      ease: 'linear',\n      times: HISTORY_TIMES,\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            <motion.g :variants=\"frameVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '12.9319px 12px' }\">\n              <path d=\"M4.43186 14.9656C5.65759 18.4791 9.00032 21 12.9318 21C17.9024 21 21.9318 16.9706 21.9318 12C21.9318 7.02944 17.9024 3 12.9318 3C9.23111 3 5.83124 5.6756 4.62227 8.5\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" />\n              <path d=\"M8.43054 8.74363C8.43054 8.74363 4.74691 9.3026 4.1879 8.7436C3.62888 8.1846 4.18791 4.50098 4.18791 4.50098\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" />\n            </motion.g>\n            <motion.g :variants=\"minuteHandVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{\n                transformBox: 'view-box',\n                originX: 12.9319 / 24,\n                originY: 0.5,\n              }\">\n              <path d=\"M12.9319 7V12\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" />\n            </motion.g>\n            <motion.g :variants=\"hourHandVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{\n                transformBox: 'view-box',\n                originX: 12.9319 / 24,\n                originY: 0.5,\n              }\">\n              <path d=\"M12.9319 12L15.9319 14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" />\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"
    }
  ]
}
