{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"motion-reduced","type":"registry:lib","title":"Motion reduced","description":"Whether to keep still, as the kit decides it: the OS asks for less motion, or the app turned motion down with","dependencies":[],"registryDependencies":["https://dashral.com/r/lib-motion.json"],"files":[{"path":"registry/dashral/lib/motion-reduced.ts","type":"registry:file","target":"components/dashral/lib/motion-reduced.ts","content":"import { useSyncExternalStore } from \"react\"\nimport { reducedMotion } from \"./motion\"\n\n// Whether to keep still, as the kit decides it: the OS asks for less motion, or the app turned motion down with\n// data-motion=\"reduce\" on <html> (the dashboards' setting). motion/react's own hook hears only the first.\n\nfunction subscribe(onChange: () => void) {\n  const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\")\n  query.addEventListener(\"change\", onChange)\n  const observer = new MutationObserver(onChange)\n  observer.observe(document.documentElement, { attributes: true, attributeFilter: [\"data-motion\"] })\n  return () => {\n    query.removeEventListener(\"change\", onChange)\n    observer.disconnect()\n  }\n}\n\n/** True while motion should stay still; false on the server, so the first paint matches. */\nexport function useReducedMotion() {\n  return useSyncExternalStore(subscribe, reducedMotion, () => false)\n}\n"}]}