{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toast-notification",
  "type": "registry:component",
  "title": "Toast Notification",
  "description": "Canonical shadcn Sonner toast host and success, error, and info helpers for M8 plugin surfaces.",
  "dependencies": [
    "sonner"
  ],
  "registryDependencies": [
    "sonner"
  ],
  "files": [
    {
      "path": "registry/blocks/feedback/toast-notification.tsx",
      "content": "\"use client\";\n// astro-ui-m8-skin-version: 1.5.3 (A-C6 — run `npx astro-ui-m8-skin-lock` to compare against your installed @mano8/astro-ui-m8)\n\nimport * as React from \"react\";\nimport { Toaster as SonnerToaster, toast } from \"sonner\";\n\nexport type ToastNotification = {\n  title: string;\n  description?: string;\n};\n\nexport type ToastPosition =\n  | \"top-left\"\n  | \"top-center\"\n  | \"top-right\"\n  | \"bottom-left\"\n  | \"bottom-center\"\n  | \"bottom-right\";\n\n// Astro/Starlight drives light/dark via `data-theme` on <html>. Sonner defaults\n// to \"light\" and never reads that attribute, so the very first toast renders\n// light regardless of the active theme. Track `data-theme` and hand Sonner an\n// explicit theme so every toast — including the first — matches Starlight.\nfunction useStarlightTheme(): \"light\" | \"dark\" {\n  return React.useSyncExternalStore(\n    (onStoreChange) => {\n      const observer = new MutationObserver(onStoreChange);\n      observer.observe(document.documentElement, {\n        attributes: true,\n        attributeFilter: [\"data-theme\"],\n      });\n      return () => observer.disconnect();\n    },\n    () => (document.documentElement.dataset.theme === \"dark\" ? \"dark\" : \"light\"),\n    () => \"light\",\n  );\n}\n\nexport function ToastNotificationHost({\n  position = \"top-right\",\n}: {\n  position?: ToastPosition;\n} = {}) {\n  const theme = useStarlightTheme();\n  return (\n    <SonnerToaster\n      closeButton\n      richColors\n      position={position}\n      theme={theme}\n    />\n  );\n}\n\nexport const toastNotification = {\n  success(message: ToastNotification) {\n    toast.success(message.title, { description: message.description });\n  },\n  error(message: ToastNotification) {\n    toast.error(message.title, { description: message.description });\n  },\n  info(message: ToastNotification) {\n    toast.info(message.title, { description: message.description });\n  },\n} as const;\n",
      "type": "registry:component",
      "target": "components/m8-ui/toast-notification.tsx"
    }
  ]
}
