diff --git a/.nuxtrc b/.nuxtrc index 87857b2a75..f033419921 100644 --- a/.nuxtrc +++ b/.nuxtrc @@ -1,3 +1,2 @@ imports.autoImport=false typescript.includeWorkspace=true -typescript.strict=false diff --git a/docs/nuxt.config.ts b/docs/nuxt.config.ts index 09b1909c36..bc6fc7ca8f 100644 --- a/docs/nuxt.config.ts +++ b/docs/nuxt.config.ts @@ -123,5 +123,8 @@ export default defineNuxtConfig({ } }) } + }, + typescript: { + strict: false } }) diff --git a/playground/nuxt.config.ts b/playground/nuxt.config.ts index aecaf0907d..efab84513d 100644 --- a/playground/nuxt.config.ts +++ b/playground/nuxt.config.ts @@ -1,7 +1,5 @@ -import module from '../src/module' - export default defineNuxtConfig({ modules: [ - module + '../src/module' ] }) diff --git a/src/colors.ts b/src/colors.ts index b866d24ba8..a0455fc928 100644 --- a/src/colors.ts +++ b/src/colors.ts @@ -243,7 +243,7 @@ export const generateSafelist = (colors: string[], globalColors) => { } export const customSafelistExtractor = (prefix, content: string, colors: string[], safelistColors: string[]) => { - const classes = [] + const classes: string[] = [] const regex = /<([A-Za-z][A-Za-z0-9]*(?:-[A-Za-z][A-Za-z0-9]*)*)\s+(?![^>]*:color\b)[^>]*\bcolor=["']([^"']+)["'][^>]*>/gs const matches = content.matchAll(regex) diff --git a/src/module.ts b/src/module.ts index 7a636088fb..febde1e736 100644 --- a/src/module.ts +++ b/src/module.ts @@ -10,10 +10,15 @@ import type { DeepPartial, Strategy } from './runtime/types/utils' const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } }) +// @ts-ignore delete defaultColors.lightBlue +// @ts-ignore delete defaultColors.warmGray +// @ts-ignore delete defaultColors.trueGray +// @ts-ignore delete defaultColors.coolGray +// @ts-ignore delete defaultColors.blueGray type UI = { @@ -79,12 +84,15 @@ export default defineNuxtModule({ // @ts-ignore nuxt.hook('tailwindcss:config', function (tailwindConfig) { + tailwindConfig.theme = tailwindConfig.theme || {} + tailwindConfig.theme.extend = tailwindConfig.theme.extend || {} + tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {} + const globalColors: any = { ...(tailwindConfig.theme.colors || defaultColors), ...tailwindConfig.theme.extend?.colors } - tailwindConfig.theme.extend.colors = tailwindConfig.theme.extend.colors || {} // @ts-ignore globalColors.primary = tailwindConfig.theme.extend.colors.primary = { 50: 'rgb(var(--color-primary-50) / )', @@ -132,7 +140,7 @@ export default defineNuxtModule({ } tailwindConfig.safelist = tailwindConfig.safelist || [] - tailwindConfig.safelist.push(...generateSafelist(options.safelistColors, colors)) + tailwindConfig.safelist.push(...generateSafelist(options.safelistColors || [], colors)) tailwindConfig.plugins = tailwindConfig.plugins || [] tailwindConfig.plugins.push(iconsPlugin(Array.isArray(options.icons) || options.icons === 'all' ? { collections: getIconCollections(options.icons) } : typeof options.icons === 'object' ? options.icons as IconsPluginOptions : {})) diff --git a/src/runtime/components/data/Table.vue b/src/runtime/components/data/Table.vue index be65e7df9a..6bdb78a0b6 100644 --- a/src/runtime/components/data/Table.vue +++ b/src/runtime/components/data/Table.vue @@ -11,7 +11,7 @@ , - default: undefined + default: () => '' }, ui: { - type: Object as PropType>, - default: undefined + type: Object as PropType & { strategy?: Strategy }>, + default: () => ({}) } }, emits: ['update:modelValue', 'update:sort'], diff --git a/src/runtime/components/elements/Accordion.vue b/src/runtime/components/elements/Accordion.vue index 3873bc3346..ab930230dd 100644 --- a/src/runtime/components/elements/Accordion.vue +++ b/src/runtime/components/elements/Accordion.vue @@ -93,17 +93,17 @@ export default defineComponent({ }, class: { type: [String, Object, Array] as PropType, - default: undefined + default: () => '' }, ui: { - type: Object as PropType>, - default: undefined + type: Object as PropType & { strategy?: Strategy }>, + default: () => ({}) } }, setup (props) { const { ui, attrs } = useUI('accordion', toRef(props, 'ui'), config, toRef(props, 'class')) - const uiButton = computed>(() => configButton) + const uiButton = computed(() => configButton) const buttonRefs = ref<{ open: boolean, close: (e: EventTarget) => {} }[]>([]) @@ -114,7 +114,7 @@ export default defineComponent({ buttonRefs.value.forEach((button) => { if (button.open) { - button.close(e.target) + button.close(e.target as EventTarget) } }) } diff --git a/src/runtime/components/elements/Alert.vue b/src/runtime/components/elements/Alert.vue index 13072fdd6d..e5809b3c7e 100644 --- a/src/runtime/components/elements/Alert.vue +++ b/src/runtime/components/elements/Alert.vue @@ -17,15 +17,15 @@

- +
- +
@@ -73,7 +73,7 @@ export default defineComponent({ }, closeButton: { type: Object as PropType