naive.ts 835 B

12345678910111213141516171819202122232425
  1. import { computed } from 'vue';
  2. import { preferences } from '@vben/preferences';
  3. import '@vben/styles';
  4. import { createDiscreteApi, darkTheme, lightTheme } from 'naive-ui';
  5. const themeOverridesProviderProps = computed(() => ({
  6. themeOverrides: preferences.theme.mode === 'light' ? lightTheme : darkTheme,
  7. }));
  8. const themeProviderProps = computed(() => ({
  9. theme: preferences.theme.mode === 'light' ? lightTheme : darkTheme,
  10. }));
  11. export const { dialog, loadingBar, message, modal, notification } =
  12. createDiscreteApi(
  13. ['message', 'dialog', 'notification', 'loadingBar', 'modal'],
  14. {
  15. configProviderProps: themeProviderProps,
  16. loadingBarProviderProps: themeOverridesProviderProps,
  17. messageProviderProps: themeOverridesProviderProps,
  18. notificationProviderProps: themeOverridesProviderProps,
  19. },
  20. );