{"version":3,"file":"useAtom.cjs","names":["useSelector"],"sources":["../src/useAtom.ts"],"sourcesContent":["import { useSelector } from './useSelector'\nimport type { Ref } from 'vue-demi'\nimport type { Atom } from '@tanstack/store'\nimport type { UseSelectorOptions } from './useSelector'\n\n/**\n * Returns the current atom ref together with a setter.\n *\n * Use this when a component needs to both read and update the same writable\n * atom.\n *\n * @example\n * ```ts\n * const [count, setCount] = useAtom(countAtom)\n *\n * setCount((prev) => prev + 1)\n * console.log(count.value)\n * ```\n */\nexport function useAtom<TValue>(\n  atom: Atom<TValue>,\n  options?: UseSelectorOptions<TValue>,\n): [Readonly<Ref<TValue>>, Atom<TValue>['set']] {\n  const value = useSelector(atom, undefined, options)\n\n  return [value, atom.set]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,SAAgB,QACd,MACA,SAC8C;AAG9C,QAAO,CAFOA,gCAAY,MAAM,QAAW,QAAQ,EAEpC,KAAK,IAAI"}