import { createDiscreteApi, darkTheme, type GlobalTheme } from 'naive-ui'; import type { App } from 'vue'; /** * Тема приложения. Зафиксирована (тёмная, как в onboard), чтобы серверный и * клиентский рендеринг при SSR совпадали и не было «перекраски» при гидратации. * Для переключения темы используйте отдельный механизм после монтирования. */ export const appTheme: GlobalTheme = darkTheme; /** * Подключение «безоконных» (discrete) API NaiveUI: message, notification, * dialog, loadingBar. Только в браузере (используют document). * * Перенесено из проекта onboard (resources/js/Plugins/NaiveUI.js). */ export function setupNaiveDiscreteApi(app: App): void { const { message, notification, dialog, loadingBar } = createDiscreteApi( ['message', 'dialog', 'notification', 'loadingBar'], { configProviderProps: { theme: appTheme }, }, ); window.$notification = notification; window.$message = message; window.$dialog = dialog; window.$loadingBar = loadingBar; app.config.globalProperties.$notification = notification; app.config.globalProperties.$message = message; app.config.globalProperties.$dialog = dialog; app.config.globalProperties.$loadingBar = loadingBar; }