UNPKG

vuestic-ui

Version:
1 lines 1.36 kB
{"version":3,"file":"index.mjs","sources":["../../../../../../src/components/va-toast/plugin/index.ts"],"sourcesContent":["import { App } from 'vue'\n\nimport { defineVuesticPlugin, defineGlobalProperty } from '../../../services/vue-plugin/utils'\nimport { createToastInstance, closeById, closeAllNotifications, NotificationOptions } from '../toast'\n\nconst createVaToastPlugin = (app: App) => ({\n /** Returns toast instance id */\n init (options: string | NotificationOptions) {\n return createToastInstance(options, app?._context)\n },\n\n close (id: string) {\n closeById(id)\n },\n\n closeAll (allApps = false) {\n closeAllNotifications(allApps ? undefined : app?._context)\n },\n})\n\nexport const VaToastPlugin = defineVuesticPlugin(() => ({\n install (app) {\n defineGlobalProperty(app, '$vaToast', createVaToastPlugin(app))\n },\n}))\n\ndeclare module 'vue' {\n export interface ComponentCustomProperties {\n $vaToast: ReturnType<typeof createVaToastPlugin>\n }\n}\n"],"names":[],"mappings":";;;AAKA,MAAM,sBAAsB,CAAC,SAAc;AAAA;AAAA,EAEzC,KAAM,SAAuC;AACpC,WAAA,oBAAoB,SAAS,2BAAK,QAAQ;AAAA,EACnD;AAAA,EAEA,MAAO,IAAY;AACjB,cAAU,EAAE;AAAA,EACd;AAAA,EAEA,SAAU,UAAU,OAAO;AACH,0BAAA,UAAU,SAAY,2BAAK,QAAQ;AAAA,EAC3D;AACF;AAEa,MAAA,gBAAgB,oBAAoB,OAAO;AAAA,EACtD,QAAS,KAAK;AACZ,yBAAqB,KAAK,YAAY,oBAAoB,GAAG,CAAC;AAAA,EAChE;AACF,EAAE;"}