Files
kartoteka/resources/js/Plugins/naiveUI.js

23 lines
786 B
JavaScript

import {createDiscreteApi, darkTheme, lightTheme} from "naive-ui";
export function setupNaiveDiscreteApi(app) {
const {message, notification, dialog, loadingBar} = createDiscreteApi(
['message', 'dialog', 'notification', 'loadingBar'],
{
configProviderProps: {
theme: window.matchMedia('(prefers-color-scheme: dark)').matches ? darkTheme : lightTheme
}
}
)
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
}