UNPKG

maz-ui

Version:

A standalone components library for Vue.Js 3 & Nuxt.Js 3

27 lines (26 loc) 634 B
import { ToasterHandler } from "maz-ui"; import { defineNuxtPlugin } from "#imports"; export default defineNuxtPlugin(({ vueApp, $config }) => { const toasterOptions = $config.public.mazUi?.injectUseToast; const options = typeof toasterOptions === "object" ? toasterOptions : void 0; const instance = new ToasterHandler(vueApp, options); const toasterServer = { show: () => { }, success: () => { }, error: () => { }, warning: () => { }, info: () => { }, message: () => { } }; return { provide: { toast: import.meta.server ? toasterServer : instance } }; });