'use client';
import { useEffect, useState } from 'react';
import { store } from '../core/store';
import type { ToastRecord } from '../core/types';
/**
* Headless access to the toast queue — render the toasts however you like
* instead of using ``.
*/
export const useVyrn = (): { toasts: ToastRecord[] } => {
const [toasts, setToasts] = useState(() => store.getToasts());
useEffect(() => {
// Re-sync on mount: toasts may have arrived between render and commit.
setToasts(store.getToasts());
return store.subscribe(setToasts);
}, []);
return { toasts };
};
/** Sonner-compatible alias. */
export const useSonner = useVyrn;