refactor(module)!: implement design system with CSS variables (#2298)

This commit is contained in:
Benjamin Canac
2024-10-07 14:48:02 +02:00
committed by GitHub
parent 3cf5535b2f
commit 9368c6a639
279 changed files with 6533 additions and 6994 deletions

View File

@@ -52,15 +52,17 @@ export function addTemplates(options: ModuleOptions, nuxt: Nuxt) {
filename: 'types/ui.d.ts',
getContents: () => `import * as ui from '#build/ui'
import type { DeepPartial } from '#ui/types/utils'
import colors from 'tailwindcss/colors'
const colors = ${JSON.stringify(options.theme?.colors || [])} as const;
const icons = ${JSON.stringify(nuxt.options.appConfig.ui.icons)};
type NeutralColor = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone'
type Color = Exclude<keyof typeof colors, 'inherit' | 'current' | 'transparent' | 'black' | 'white' | NeutralColor>
type AppConfigUI = {
colors?: {
primary?: Exclude<typeof colors[number], 'error' | 'primary'>
error?: Exclude<typeof colors[number], 'primary' | 'error'>
gray?: 'slate' | 'cool' | 'zinc' | 'neutral' | 'stone'
${options.theme?.colors?.map(color => `${color}?: Color`).join('\n\t\t')}
neutral?: NeutralColor
}
icons?: Partial<typeof icons>
} & DeepPartial<typeof ui, string>