From 11e00a10e4781881e293e5fcd382331008c15346 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 4 May 2023 16:24:22 +0100 Subject: [PATCH] fix: update to fix type issues (#151) --- src/module.ts | 7 ++- src/{runtime/app.config.ts => preset.ts} | 54 ++++++++++----------- src/runtime/components/forms/Input.vue | 6 +-- src/runtime/components/forms/Select.vue | 6 +-- src/runtime/components/forms/SelectMenu.vue | 2 +- src/runtime/components/forms/Textarea.vue | 6 +-- 6 files changed, 41 insertions(+), 40 deletions(-) rename src/{runtime/app.config.ts => preset.ts} (98%) diff --git a/src/module.ts b/src/module.ts index 714615b0..51bddc21 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1,9 +1,10 @@ import { defineNuxtModule, installModule, addComponentsDir, addImportsDir, createResolver, addPlugin } from '@nuxt/kit' import colors from 'tailwindcss/colors.js' import { iconsPlugin, getIconCollections } from '@egoist/tailwindcss-icons' +import { defu } from 'defu' import { name, version } from '../package.json' import { colorsAsRegex, excludeColors } from './runtime/utils/colors' -import preset from './runtime/app.config' +import { ui as preset } from './preset' import type { DeepPartial } from './runtime/types' // @ts-ignore @@ -23,7 +24,7 @@ declare module 'nuxt/schema' { primary?: string gray?: string colors?: string[] - } & DeepPartial + } & DeepPartial } } @@ -64,6 +65,8 @@ export default defineNuxtModule({ nuxt.options.css.push(resolve(runtimeDir, 'ui.css')) + nuxt.options.appConfig.ui = defu(nuxt.options.appConfig.ui, preset) + nuxt.hook('app:resolve', (app) => { app.configs.push(resolve(runtimeDir, 'app.config')) }) diff --git a/src/runtime/app.config.ts b/src/preset.ts similarity index 98% rename from src/runtime/app.config.ts rename to src/preset.ts index 16ed74f3..fc8168c0 100644 --- a/src/runtime/app.config.ts +++ b/src/preset.ts @@ -677,32 +677,30 @@ const notifications = { container: 'px-4 sm:px-6 py-6 space-y-3 overflow-y-auto' } -export default { - ui: { - avatar, - avatarGroup, - badge, - button, - buttonGroup, - dropdown, - input, - inputGroup, - textarea, - select, - selectMenu, - checkbox, - radio, - toggle, - card, - container, - verticalNavigation, - commandPalette, - modal, - slideover, - popover, - tooltip, - contextMenu, - notification, - notifications - } +export const ui = { + avatar, + avatarGroup, + badge, + button, + buttonGroup, + dropdown, + input, + inputGroup, + textarea, + select, + selectMenu, + checkbox, + radio, + toggle, + card, + container, + verticalNavigation, + commandPalette, + modal, + slideover, + popover, + tooltip, + contextMenu, + notification, + notifications } diff --git a/src/runtime/components/forms/Input.vue b/src/runtime/components/forms/Input.vue index b85e7d9e..c3f2a7c0 100644 --- a/src/runtime/components/forms/Input.vue +++ b/src/runtime/components/forms/Input.vue @@ -13,7 +13,7 @@ :autocomplete="autocomplete" :spellcheck="spellcheck" :class="inputClass" - @input="onInput(($event.target as any).value)" + @input="onInput" @focus="$emit('focus', $event)" @blur="$emit('blur', $event)" > @@ -147,8 +147,8 @@ export default defineComponent({ } } - const onInput = (value: string) => { - emit('update:modelValue', value) + const onInput = (event: InputEvent) => { + emit('update:modelValue', (event.target as any).value) } onMounted(() => { diff --git a/src/runtime/components/forms/Select.vue b/src/runtime/components/forms/Select.vue index f1fb28d3..b104c4e4 100644 --- a/src/runtime/components/forms/Select.vue +++ b/src/runtime/components/forms/Select.vue @@ -7,7 +7,7 @@ :required="required" :disabled="disabled" :class="selectClass" - @input="onInput(($event.target as any).value)" + @input="onInput" >