mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
feat(module): set disableTransition option on @nuxtjs/color-mode
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { defu } from 'defu'
|
||||
import { createResolver, defineNuxtModule, addComponentsDir, addImportsDir, addVitePlugin, addPlugin, installModule, hasNuxtModule } from '@nuxt/kit'
|
||||
import type { NuxtOptions } from '@nuxt/schema'
|
||||
import { addTemplates } from './templates'
|
||||
import icons from './theme/icons'
|
||||
|
||||
@@ -79,35 +80,21 @@ export default defineNuxtModule<ModuleOptions>({
|
||||
nuxt.options.postcss.plugins['@tailwindcss/postcss'] = {}
|
||||
}
|
||||
|
||||
if (options.fonts) {
|
||||
if (!hasNuxtModule('@nuxt/fonts')) {
|
||||
await installModule('@nuxt/fonts', { experimental: { processCSSVariables: true } })
|
||||
async function registerModule(name: string, options: Record<string, any>) {
|
||||
if (!hasNuxtModule(name)) {
|
||||
await installModule(name, options)
|
||||
} else {
|
||||
nuxt.options.fonts = defu(nuxt.options.fonts, { experimental: { processCSSVariables: true } })
|
||||
(nuxt.options as any)[name] = defu((nuxt.options as any)[name], options)
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasNuxtModule('@nuxt/icon')) {
|
||||
await installModule('@nuxt/icon', { cssLayer: 'components' })
|
||||
} else {
|
||||
nuxt.options.icon = defu(nuxt.options.icon, { cssLayer: 'components' })
|
||||
}
|
||||
await registerModule('@nuxt/icon', { cssLayer: 'components' })
|
||||
await registerModule('@nuxt/fonts', { experimental: { processCSSVariables: true } })
|
||||
await registerModule('@nuxtjs/color-mode', { classSuffix: '', disableTransition: true })
|
||||
|
||||
if (!hasNuxtModule('@nuxtjs/color-mode')) {
|
||||
await installModule('@nuxtjs/color-mode', { classSuffix: '' })
|
||||
} else {
|
||||
nuxt.options.colorMode = defu(nuxt.options.colorMode, { classSuffix: '' })
|
||||
}
|
||||
|
||||
addPlugin({
|
||||
src: resolve('./runtime/plugins/colors')
|
||||
})
|
||||
addPlugin({
|
||||
src: resolve('./runtime/plugins/modal')
|
||||
})
|
||||
addPlugin({
|
||||
src: resolve('./runtime/plugins/slideover')
|
||||
})
|
||||
addPlugin({ src: resolve('./runtime/plugins/colors') })
|
||||
addPlugin({ src: resolve('./runtime/plugins/modal') })
|
||||
addPlugin({ src: resolve('./runtime/plugins/slideover') })
|
||||
|
||||
addComponentsDir({
|
||||
path: resolve('./runtime/components'),
|
||||
|
||||
Reference in New Issue
Block a user