chore: improve types export

This commit is contained in:
Benjamin Canac
2024-06-25 17:58:14 +02:00
parent ea288e9624
commit cd7cc0d9a3
50 changed files with 87 additions and 83 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { withoutTrailingSlash } from 'ufo' import { withoutTrailingSlash } from 'ufo'
// import { debounce } from 'perfect-debounce' // import { debounce } from 'perfect-debounce'
import type { ContentSearchFile } from '#ui-pro/types' import type { ContentSearchFile } from '@nuxt/ui-pro'
const route = useRoute() const route = useRoute()
// const colorMode = useColorMode() // const colorMode = useColorMode()

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { NavItem } from '@nuxt/content' import type { NavItem } from '@nuxt/content'
import type { NavigationMenuItem } from '#ui/types' import type { NavigationMenuItem } from '@nuxt/ui'
const props = defineProps<{ const props = defineProps<{
links: NavigationMenuItem[] links: NavigationMenuItem[]

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { NuxtError } from '#app' import type { NuxtError } from '#app'
import type { ContentSearchFile } from '#ui-pro/types' import type { ContentSearchFile } from '@nuxt/ui-pro'
useSeoMeta({ useSeoMeta({
title: 'Page not found', title: 'Page not found',

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { withoutTrailingSlash } from 'ufo' import { withoutTrailingSlash } from 'ufo'
import { findPageHeadline } from '#ui-pro/utils/content' import { findPageHeadline } from '@nuxt/ui-pro/runtime/utils/content'
const route = useRoute() const route = useRoute()

View File

@@ -11,10 +11,11 @@
"license": "MIT", "license": "MIT",
"exports": { "exports": {
".": { ".": {
"types": "./dist/types.d.ts", "types": "./dist/module.d.ts",
"import": "./dist/module.mjs", "import": "./dist/module.mjs",
"require": "./dist/module.cjs" "require": "./dist/module.cjs"
} },
"./runtime/*": "./dist/runtime/*"
}, },
"bin": { "bin": {
"nuxt-ui": "./cli/index.mjs" "nuxt-ui": "./cli/index.mjs"

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { z } from 'zod' import { z } from 'zod'
import type { FormSubmitEvent, Form } from '#ui/types/form' import type { FormSubmitEvent, Form } from '@nuxt/ui'
const schema = z.object({ const schema = z.object({
input: z.string().min(10), input: z.string().min(10),

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { z } from 'zod' import { z } from 'zod'
import type { FormSubmitEvent } from '#ui/types/form' import type { FormSubmitEvent } from '@nuxt/ui'
const schema = z.object({ const schema = z.object({
email: z.string().min(2), email: z.string().min(2),

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { z } from 'zod' import { z } from 'zod'
import type { FormSubmitEvent } from '#ui/types/form' import type { FormSubmitEvent } from '@nuxt/ui'
const schema = z.object({ const schema = z.object({
email: z.string().min(2), email: z.string().min(2),

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { z } from 'zod' import { z } from 'zod'
import type { FormSubmitEvent } from '#ui/types/form' import type { FormSubmitEvent } from '@nuxt/ui'
const schema = z.object({ const schema = z.object({
email: z.string().email(), email: z.string().email(),

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import theme from '#build/ui/kbd' import theme from '#build/ui/kbd'
import { kbdKeysMap } from '#ui/composables/useKbd' import { kbdKeysMap } from '@nuxt/ui/runtime/composables/useKbd.js'
const sizes = Object.keys(theme.variants.size) const sizes = Object.keys(theme.variants.size)
const kbdKeys = Object.keys(kbdKeysMap) const kbdKeys = Object.keys(kbdKeysMap)

View File

@@ -4,6 +4,8 @@ import tailwindcss from '@tailwindcss/vite'
import { addTemplates } from './templates' import { addTemplates } from './templates'
import icons from './theme/icons' import icons from './theme/icons'
export type * from './runtime/types'
export interface ModuleOptions { export interface ModuleOptions {
/** /**
* Prefix for components * Prefix for components
@@ -40,8 +42,7 @@ export default defineNuxtModule<ModuleOptions>({
options.colors = options.colors?.length ? [...new Set(['primary', ...options.colors])] : ['primary', 'red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchia', 'pink', 'rose'] options.colors = options.colors?.length ? [...new Set(['primary', ...options.colors])] : ['primary', 'red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchia', 'pink', 'rose']
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error - Add ui options to nuxt
// @ts-ignore
nuxt.options.ui = options nuxt.options.ui = options
nuxt.options.alias['#ui'] = resolve('./runtime') nuxt.options.alias['#ui'] = resolve('./runtime')
@@ -54,6 +55,7 @@ export default defineNuxtModule<ModuleOptions>({
// Isolate root node from portaled components // Isolate root node from portaled components
nuxt.options.app.rootAttrs = nuxt.options.app.rootAttrs || {} nuxt.options.app.rootAttrs = nuxt.options.app.rootAttrs || {}
// TODO: Check if already set
nuxt.options.app.rootAttrs.class = 'isolate' nuxt.options.app.rootAttrs.class = 'isolate'
addVitePlugin(tailwindcss) addVitePlugin(tailwindcss)

View File

@@ -4,7 +4,7 @@ import type { AccordionRootProps, AccordionRootEmits, AccordionContentProps, Acc
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/accordion' import theme from '#build/ui/accordion'
import type { DynamicSlots } from '#ui/types/utils' import type { DynamicSlots } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { accordion: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { accordion: Partial<typeof theme> } }

View File

@@ -5,7 +5,7 @@ import type { PrimitiveProps } from 'radix-vue'
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/alert' import theme from '#build/ui/alert'
import type { AvatarProps, ButtonProps } from '#ui/types' import type { AvatarProps, ButtonProps } from '../types'
const appConfig = _appConfig as AppConfig & { ui: { alert: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { alert: Partial<typeof theme> } }

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { ConfigProviderProps, TooltipProviderProps } from 'radix-vue' import type { ConfigProviderProps, TooltipProviderProps } from 'radix-vue'
import type { ToasterProps } from '#ui/types' import type { ToasterProps } from '../types'
export interface ProviderProps extends ConfigProviderProps { export interface ProviderProps extends ConfigProviderProps {
tooltip?: TooltipProviderProps tooltip?: TooltipProviderProps

View File

@@ -4,8 +4,8 @@ import type { PrimitiveProps } from 'radix-vue'
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/breadcrumb' import theme from '#build/ui/breadcrumb'
import type { AvatarProps, LinkProps } from '#ui/types' import type { AvatarProps, LinkProps } from '../types'
import type { DynamicSlots } from '#ui/types/utils' import type { DynamicSlots } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { breadcrumb: Partial<typeof theme> } }
@@ -45,7 +45,7 @@ import { computed } from 'vue'
import { Primitive } from 'radix-vue' import { Primitive } from 'radix-vue'
import { useAppConfig } from '#imports' import { useAppConfig } from '#imports'
import { ULink, UIcon, UAvatar } from '#components' import { ULink, UIcon, UAvatar } from '#components'
import { pickLinkProps } from '#ui/utils/link' import { pickLinkProps } from '../utils/link'
const props = defineProps<BreadcrumbProps<T>>() const props = defineProps<BreadcrumbProps<T>>()
const slots = defineSlots<BreadcrumbSlots<T>>() const slots = defineSlots<BreadcrumbSlots<T>>()

View File

@@ -3,8 +3,8 @@ import { tv, type VariantProps } from 'tailwind-variants'
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/button' import theme from '#build/ui/button'
import type { LinkProps } from '#ui/components/Link.vue' import type { LinkProps } from './Link.vue'
import type { UseComponentIconsProps } from '#ui/composables/useComponentIcons' import type { UseComponentIconsProps } from '../composables/useComponentIcons'
const appConfig = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
@@ -37,7 +37,7 @@ import { computed } from 'vue'
import { useForwardProps } from 'radix-vue' import { useForwardProps } from 'radix-vue'
import { useComponentIcons, useButtonGroup } from '#imports' import { useComponentIcons, useButtonGroup } from '#imports'
import { UIcon, ULink } from '#components' import { UIcon, ULink } from '#components'
import { pickLinkProps } from '#ui/utils/link' import { pickLinkProps } from '../utils/link'
const props = defineProps<ButtonProps>() const props = defineProps<ButtonProps>()
const slots = defineSlots<ButtonSlots>() const slots = defineSlots<ButtonSlots>()

View File

@@ -6,9 +6,9 @@ import type { AppConfig } from '@nuxt/schema'
import type { UseFuseOptions } from '@vueuse/integrations/useFuse' import type { UseFuseOptions } from '@vueuse/integrations/useFuse'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/command-palette' import theme from '#build/ui/command-palette'
import type { UseComponentIconsProps } from '#ui/composables/useComponentIcons' import type { UseComponentIconsProps } from '../composables/useComponentIcons'
import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '#ui/types' import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '../types'
import type { DynamicSlots } from '#ui/types/utils' import type { DynamicSlots } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { commandPalette: Partial<typeof theme> } }
@@ -94,8 +94,8 @@ import { reactivePick } from '@vueuse/core'
import { useFuse } from '@vueuse/integrations/useFuse' import { useFuse } from '@vueuse/integrations/useFuse'
import { UInput, UAvatar, UIcon, UKbd, UChip } from '#components' import { UInput, UAvatar, UIcon, UKbd, UChip } from '#components'
import { useAppConfig } from '#imports' import { useAppConfig } from '#imports'
import { omit } from '#ui/utils' import { omit } from '../utils'
import { highlight } from '#ui/utils/fuse' import { highlight } from '../utils/fuse'
const props = withDefaults(defineProps<CommandPaletteProps<G, T>>(), { const props = withDefaults(defineProps<CommandPaletteProps<G, T>>(), {
modelValue: '', modelValue: '',

View File

@@ -4,8 +4,8 @@ import type { ContextMenuRootProps, ContextMenuRootEmits, ContextMenuContentProp
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/context-menu' import theme from '#build/ui/context-menu'
import type { AvatarProps, KbdProps, LinkProps } from '#ui/types' import type { AvatarProps, KbdProps, LinkProps } from '../types'
import type { DynamicSlots } from '#ui/types/utils' import type { DynamicSlots } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { contextMenu: Partial<typeof theme> } }
@@ -60,7 +60,7 @@ import { computed, toRef } from 'vue'
import { ContextMenuRoot, ContextMenuTrigger, useForwardPropsEmits } from 'radix-vue' import { ContextMenuRoot, ContextMenuTrigger, useForwardPropsEmits } from 'radix-vue'
import { reactivePick } from '@vueuse/core' import { reactivePick } from '@vueuse/core'
import { UContextMenuContent } from '#components' import { UContextMenuContent } from '#components'
import { omit } from '#ui/utils' import { omit } from '../utils'
const props = withDefaults(defineProps<ContextMenuProps<T>>(), { const props = withDefaults(defineProps<ContextMenuProps<T>>(), {
portal: true, portal: true,

View File

@@ -2,7 +2,7 @@
import { tv } from 'tailwind-variants' import { tv } from 'tailwind-variants'
import type { ContextMenuContentProps as RadixContextMenuContentProps, ContextMenuContentEmits as RadixContextMenuContentEmits } from 'radix-vue' import type { ContextMenuContentProps as RadixContextMenuContentProps, ContextMenuContentEmits as RadixContextMenuContentEmits } from 'radix-vue'
import theme from '#build/ui/context-menu' import theme from '#build/ui/context-menu'
import type { ContextMenuItem, ContextMenuSlots } from '#ui/types' import type { ContextMenuItem, ContextMenuSlots } from '../types'
const contextMenu = tv(theme)() const contextMenu = tv(theme)()
@@ -24,8 +24,8 @@ import { useForwardPropsEmits } from 'radix-vue'
import { reactiveOmit, createReusableTemplate } from '@vueuse/core' import { reactiveOmit, createReusableTemplate } from '@vueuse/core'
import { useAppConfig } from '#imports' import { useAppConfig } from '#imports'
import { ULink } from '#components' import { ULink } from '#components'
import { omit } from '#ui/utils' import { omit } from '../utils'
import { pickLinkProps } from '#ui/utils/link' import { pickLinkProps } from '../utils/link'
const props = defineProps<ContextMenuContentProps<T>>() const props = defineProps<ContextMenuContentProps<T>>()
const emits = defineEmits<ContextMenuContentEmits>() const emits = defineEmits<ContextMenuContentEmits>()

View File

@@ -4,8 +4,8 @@ import type { DropdownMenuRootProps, DropdownMenuRootEmits, DropdownMenuContentP
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/dropdown-menu' import theme from '#build/ui/dropdown-menu'
import type { AvatarProps, KbdProps, LinkProps } from '#ui/types' import type { AvatarProps, KbdProps, LinkProps } from '../types'
import type { DynamicSlots } from '#ui/types/utils' import type { DynamicSlots } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { dropdownMenu: Partial<typeof theme> } }
@@ -72,7 +72,7 @@ import { defu } from 'defu'
import { DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuArrow, useForwardPropsEmits } from 'radix-vue' import { DropdownMenuRoot, DropdownMenuTrigger, DropdownMenuArrow, useForwardPropsEmits } from 'radix-vue'
import { reactivePick } from '@vueuse/core' import { reactivePick } from '@vueuse/core'
import { UDropdownMenuContent } from '#components' import { UDropdownMenuContent } from '#components'
import { omit } from '#ui/utils' import { omit } from '../utils'
const props = withDefaults(defineProps<DropdownMenuProps<T>>(), { const props = withDefaults(defineProps<DropdownMenuProps<T>>(), {
portal: true, portal: true,

View File

@@ -2,7 +2,7 @@
import { tv } from 'tailwind-variants' import { tv } from 'tailwind-variants'
import type { DropdownMenuContentProps as RadixDropdownMenuContentProps, DropdownMenuContentEmits as RadixDropdownMenuContentEmits } from 'radix-vue' import type { DropdownMenuContentProps as RadixDropdownMenuContentProps, DropdownMenuContentEmits as RadixDropdownMenuContentEmits } from 'radix-vue'
import theme from '#build/ui/dropdown-menu' import theme from '#build/ui/dropdown-menu'
import type { KbdProps, AvatarProps, DropdownMenuItem, DropdownMenuSlots } from '#ui/types' import type { KbdProps, AvatarProps, DropdownMenuItem, DropdownMenuSlots } from '../types'
const dropdownMenu = tv(theme)() const dropdownMenu = tv(theme)()
@@ -28,8 +28,8 @@ import { useForwardPropsEmits } from 'radix-vue'
import { reactiveOmit, createReusableTemplate } from '@vueuse/core' import { reactiveOmit, createReusableTemplate } from '@vueuse/core'
import { useAppConfig } from '#imports' import { useAppConfig } from '#imports'
import { ULink } from '#components' import { ULink } from '#components'
import { omit } from '#ui/utils' import { omit } from '../utils'
import { pickLinkProps } from '#ui/utils/link' import { pickLinkProps } from '../utils/link'
const props = defineProps<DropdownMenuContentProps<T>>() const props = defineProps<DropdownMenuContentProps<T>>()
const emits = defineEmits<DropdownMenuContentEmits>() const emits = defineEmits<DropdownMenuContentEmits>()

View File

@@ -3,8 +3,8 @@ import { tv } from 'tailwind-variants'
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/form' import theme from '#build/ui/form'
import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, FormEvent, Form, FormErrorWithId } from '#ui/types/form' import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, FormEvent, Form, FormErrorWithId } from '../types/form'
import { FormValidationException } from '#ui/types/form' import { FormValidationException } from '../types/form'
import { formOptionsInjectionKey, formInputsInjectionKey, formBusInjectionKey, useId } from '#imports' import { formOptionsInjectionKey, formInputsInjectionKey, formBusInjectionKey, useId } from '#imports'
@@ -36,7 +36,7 @@ export interface FormSlots {
<script lang="ts" setup generic="T extends object"> <script lang="ts" setup generic="T extends object">
import { provide, inject, nextTick, ref, onUnmounted, onMounted, computed } from 'vue' import { provide, inject, nextTick, ref, onUnmounted, onMounted, computed } from 'vue'
import { useEventBus } from '@vueuse/core' import { useEventBus } from '@vueuse/core'
import { getYupErrors, isYupSchema, getValibotError, isValibotSchema, getZodErrors, isZodSchema, getJoiErrors, isJoiSchema } from '#ui/utils/form' import { getYupErrors, isYupSchema, getValibotError, isValibotSchema, getZodErrors, isZodSchema, getJoiErrors, isJoiSchema } from '../utils/form'
const props = withDefaults(defineProps<FormProps<T>>(), { const props = withDefaults(defineProps<FormProps<T>>(), {
validateOn() { validateOn() {

View File

@@ -38,8 +38,8 @@ export interface FormFieldSlots {
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, inject, provide, type Ref } from 'vue' import { computed, ref, inject, provide, type Ref } from 'vue'
import { Label } from 'radix-vue' import { Label } from 'radix-vue'
import type { FormError } from '#ui/types/form'
import { useId, formFieldInjectionKey } from '#imports' import { useId, formFieldInjectionKey } from '#imports'
import type { FormError } from '../types/form'
const props = defineProps<FormFieldProps>() const props = defineProps<FormFieldProps>()
const slots = defineSlots<FormFieldSlots>() const slots = defineSlots<FormFieldSlots>()

View File

@@ -4,7 +4,7 @@ import { tv, type VariantProps } from 'tailwind-variants'
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/input' import theme from '#build/ui/input'
import type { UseComponentIconsProps } from '#ui/composables/useComponentIcons' import type { UseComponentIconsProps } from '../composables/useComponentIcons'
const appConfig = _appConfig as AppConfig & { ui: { input: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { input: Partial<typeof theme> } }
@@ -45,7 +45,7 @@ export interface InputSlots {
import { ref, computed, onMounted } from 'vue' import { ref, computed, onMounted } from 'vue'
import { useComponentIcons, useFormField, useButtonGroup } from '#imports' import { useComponentIcons, useFormField, useButtonGroup } from '#imports'
import { UIcon } from '#components' import { UIcon } from '#components'
import { looseToNumber } from '#ui/utils' import { looseToNumber } from '../utils'
defineOptions({ inheritAttrs: false }) defineOptions({ inheritAttrs: false })

View File

@@ -5,9 +5,9 @@ import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, Combob
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/input-menu' import theme from '#build/ui/input-menu'
import type { UseComponentIconsProps } from '#ui/composables/useComponentIcons' import type { UseComponentIconsProps } from '../composables/useComponentIcons'
import type { AvatarProps, ChipProps, InputProps } from '#ui/types' import type { AvatarProps, ChipProps, InputProps } from '../types'
import type { AcceptableValue, ArrayOrWrapped } from '#ui/types/utils' import type { AcceptableValue, ArrayOrWrapped } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { inputMenu: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { inputMenu: Partial<typeof theme> } }
@@ -104,7 +104,7 @@ import { defu } from 'defu'
import { reactivePick } from '@vueuse/core' import { reactivePick } from '@vueuse/core'
import { useAppConfig, useFormField, useButtonGroup, useComponentIcons } from '#imports' import { useAppConfig, useFormField, useButtonGroup, useComponentIcons } from '#imports'
import { UIcon, UChip, UAvatar } from '#components' import { UIcon, UChip, UAvatar } from '#components'
import { get } from '#ui/utils' import { get } from '../utils'
defineOptions({ inheritAttrs: false }) defineOptions({ inheritAttrs: false })

View File

@@ -4,7 +4,7 @@ import type { PrimitiveProps } from 'radix-vue'
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/kbd' import theme from '#build/ui/kbd'
import type { KbdKey } from '#ui/composables/useKbd' import type { KbdKey } from '../composables/useKbd'
const appConfig = _appConfig as AppConfig & { ui: { kbd: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { kbd: Partial<typeof theme> } }

View File

@@ -4,7 +4,7 @@ import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'radix
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/modal' import theme from '#build/ui/modal'
import type { ButtonProps } from '#ui/types' import type { ButtonProps } from '../types'
const appConfig = _appConfig as AppConfig & { ui: { modal: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { modal: Partial<typeof theme> } }

View File

@@ -4,8 +4,8 @@ import type { NavigationMenuRootProps, NavigationMenuRootEmits, NavigationMenuIt
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/navigation-menu' import theme from '#build/ui/navigation-menu'
import type { AvatarProps, BadgeProps, LinkProps } from '#ui/types' import type { AvatarProps, BadgeProps, LinkProps } from '../types'
import type { DynamicSlots } from '#ui/types/utils' import type { DynamicSlots } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { navigationMenu: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { navigationMenu: Partial<typeof theme> } }
@@ -76,7 +76,7 @@ import { computed, toRef } from 'vue'
import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from 'radix-vue' import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from 'radix-vue'
import { reactivePick } from '@vueuse/core' import { reactivePick } from '@vueuse/core'
import { UIcon, UAvatar, UBadge, ULink, ULinkBase } from '#components' import { UIcon, UAvatar, UBadge, ULink, ULinkBase } from '#components'
import { pickLinkProps } from '#ui/utils/link' import { pickLinkProps } from '../utils/link'
const props = withDefaults(defineProps<NavigationMenuProps<T>>(), { const props = withDefaults(defineProps<NavigationMenuProps<T>>(), {
orientation: 'horizontal', orientation: 'horizontal',

View File

@@ -5,7 +5,7 @@ import type { AppConfig } from '@nuxt/schema'
import type { RouteLocationRaw } from '#vue-router' import type { RouteLocationRaw } from '#vue-router'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/pagination' import theme from '#build/ui/pagination'
import type { ButtonProps } from '#ui/types' import type { ButtonProps } from '../types'
const appConfig = _appConfig as AppConfig & { ui: { pagination: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { pagination: Partial<typeof theme> } }

View File

@@ -4,7 +4,7 @@ import type { RadioGroupRootProps, RadioGroupRootEmits, RadioGroupItemProps } fr
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/radio-group' import theme from '#build/ui/radio-group'
import type { AcceptableValue } from '#ui/types/utils' import type { AcceptableValue } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { radioGroup: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { radioGroup: Partial<typeof theme> } }

View File

@@ -4,9 +4,9 @@ import type { SelectRootProps, SelectRootEmits, SelectContentProps, SelectArrowP
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/select' import theme from '#build/ui/select'
import type { UseComponentIconsProps } from '#ui/composables/useComponentIcons' import type { UseComponentIconsProps } from '../composables/useComponentIcons'
import type { AvatarProps, ChipProps, InputProps } from '#ui/types' import type { AvatarProps, ChipProps, InputProps } from '../types'
import type { AcceptableValue } from '#ui/types/utils' import type { AcceptableValue } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { select: Partial<typeof theme> } }

View File

@@ -4,9 +4,9 @@ import type { ComboboxRootProps, ComboboxRootEmits, ComboboxContentProps, Combob
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/select-menu' import theme from '#build/ui/select-menu'
import type { UseComponentIconsProps } from '#ui/composables/useComponentIcons' import type { UseComponentIconsProps } from '../composables/useComponentIcons'
import type { AvatarProps, ChipProps, InputProps } from '#ui/types' import type { AvatarProps, ChipProps, InputProps } from '../types'
import type { AcceptableValue, ArrayOrWrapped } from '#ui/types/utils' import type { AcceptableValue, ArrayOrWrapped } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { selectMenu: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { selectMenu: Partial<typeof theme> } }
@@ -95,7 +95,7 @@ import { defu } from 'defu'
import { reactivePick } from '@vueuse/core' import { reactivePick } from '@vueuse/core'
import { useAppConfig, useFormField, useButtonGroup, useComponentIcons } from '#imports' import { useAppConfig, useFormField, useButtonGroup, useComponentIcons } from '#imports'
import { UIcon, UChip, UAvatar } from '#components' import { UIcon, UChip, UAvatar } from '#components'
import { get } from '#ui/utils' import { get } from '../utils'
const props = withDefaults(defineProps<SelectMenuProps<T>>(), { const props = withDefaults(defineProps<SelectMenuProps<T>>(), {
portal: true, portal: true,

View File

@@ -1,10 +1,10 @@
<script lang="ts"> <script lang="ts">
import { tv, type VariantProps } from 'tailwind-variants' import { tv, type VariantProps } from 'tailwind-variants'
import type { SeparatorProps as _SeparatorProps } from 'radix-vue' import type { SeparatorProps as _SeparatorProps } from 'radix-vue'
import type { AvatarProps } from '#ui/types'
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/separator' import theme from '#build/ui/separator'
import type { AvatarProps } from '../types'
const appConfig = _appConfig as AppConfig & { ui: { separator: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { separator: Partial<typeof theme> } }

View File

@@ -4,7 +4,7 @@ import type { DialogRootProps, DialogRootEmits, DialogContentProps } from 'radix
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/slideover' import theme from '#build/ui/slideover'
import type { ButtonProps } from '#ui/types' import type { ButtonProps } from '../types'
const appConfig = _appConfig as AppConfig & { ui: { slideover: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { slideover: Partial<typeof theme> } }

View File

@@ -4,8 +4,8 @@ import type { TabsRootProps, TabsRootEmits, TabsContentProps, TabsTriggerProps }
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/tabs' import theme from '#build/ui/tabs'
import type { AvatarProps } from '#ui/types' import type { AvatarProps } from '../types'
import type { DynamicSlots } from '#ui/types/utils' import type { DynamicSlots } from '../types/utils'
const appConfig = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { tabs: Partial<typeof theme> } }

View File

@@ -42,7 +42,7 @@ export interface TextareaSlots {
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, onMounted, nextTick, watch } from 'vue' import { ref, computed, onMounted, nextTick, watch } from 'vue'
import { useFormField } from '#imports' import { useFormField } from '#imports'
import { looseToNumber } from '#ui/utils' import { looseToNumber } from '../utils'
defineOptions({ inheritAttrs: false }) defineOptions({ inheritAttrs: false })

View File

@@ -5,7 +5,7 @@ import type { ToastRootProps, ToastRootEmits } from 'radix-vue'
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/toast' import theme from '#build/ui/toast'
import type { AvatarProps, ButtonProps, ToasterContext } from '#ui/types' import type { AvatarProps, ButtonProps, ToasterContext } from '../types'
const appConfig = _appConfig as AppConfig & { ui: { toast: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { toast: Partial<typeof theme> } }

View File

@@ -38,7 +38,7 @@ import { ToastProvider, ToastViewport, useForwardProps } from 'radix-vue'
import { reactivePick } from '@vueuse/core' import { reactivePick } from '@vueuse/core'
import { useToast } from '#imports' import { useToast } from '#imports'
import { UToast } from '#components' import { UToast } from '#components'
import { omit } from '#ui/utils' import { omit } from '../utils'
const props = withDefaults(defineProps<ToasterProps>(), { const props = withDefaults(defineProps<ToasterProps>(), {
expand: true, expand: true,

View File

@@ -4,7 +4,7 @@ import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps, TooltipAr
import type { AppConfig } from '@nuxt/schema' import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config' import _appConfig from '#build/app.config'
import theme from '#build/ui/tooltip' import theme from '#build/ui/tooltip'
import type { KbdProps } from '#ui/types' import type { KbdProps } from '../types'
const appConfig = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } } const appConfig = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }

View File

@@ -1,5 +1,5 @@
import { inject, provide, computed, type ComputedRef, type InjectionKey } from 'vue' import { inject, provide, computed, type ComputedRef, type InjectionKey } from 'vue'
import type { AvatarGroupProps } from '#ui/types' import type { AvatarGroupProps } from '../types'
export const avatarGroupInjectionKey: InjectionKey<ComputedRef<{ size: AvatarGroupProps['size'] }>> = Symbol('nuxt-ui.avatar-group') export const avatarGroupInjectionKey: InjectionKey<ComputedRef<{ size: AvatarGroupProps['size'] }>> = Symbol('nuxt-ui.avatar-group')

View File

@@ -1,7 +1,7 @@
import { type InjectionKey, type ComputedRef } from 'vue' import { type InjectionKey, type ComputedRef } from 'vue'
import { inject, computed } from 'vue' import { inject, computed } from 'vue'
import type { GetObjectField } from '#ui/types/utils'
import type { ButtonGroupProps } from '../components/ButtonGroup.vue' import type { ButtonGroupProps } from '../components/ButtonGroup.vue'
import type { GetObjectField } from '../types/utils'
export const buttonGroupInjectionKey: InjectionKey<ComputedRef<{ export const buttonGroupInjectionKey: InjectionKey<ComputedRef<{
size: ButtonGroupProps ['size'] size: ButtonGroupProps ['size']

View File

@@ -1,8 +1,8 @@
import { inject, ref, computed, type InjectionKey, type Ref, type ComputedRef } from 'vue' import { inject, ref, computed, type InjectionKey, type Ref, type ComputedRef } from 'vue'
import { type UseEventBusReturn, useDebounceFn } from '@vueuse/core' import { type UseEventBusReturn, useDebounceFn } from '@vueuse/core'
import type { FormEvent, FormInputEvents, FormFieldInjectedOptions, FormInjectedOptions } from '#ui/types/form' import type { FormFieldProps } from '../types'
import type { GetObjectField } from '#ui/types/utils' import type { FormEvent, FormInputEvents, FormFieldInjectedOptions, FormInjectedOptions } from '../types/form'
import type { FormFieldProps } from '#ui/types' import type { GetObjectField } from '../types/utils'
type Props<T> = { type Props<T> = {
id?: string id?: string

View File

@@ -1,8 +1,8 @@
import { ref, inject } from 'vue' import { ref, inject } from 'vue'
import type { ShallowRef, Component, InjectionKey } from 'vue' import type { ShallowRef, Component, InjectionKey } from 'vue'
import { createSharedComposable } from '@vueuse/core' import { createSharedComposable } from '@vueuse/core'
import type { ModalProps } from '#ui/types' import type { ModalProps } from '../types'
import type { ComponentProps } from '#ui/types/component' import type { ComponentProps } from '../types/component'
export interface ModalState { export interface ModalState {
component: Component | string component: Component | string

View File

@@ -1,8 +1,8 @@
import { ref, inject } from 'vue' import { ref, inject } from 'vue'
import type { ShallowRef, Component, InjectionKey } from 'vue' import type { ShallowRef, Component, InjectionKey } from 'vue'
import { createSharedComposable } from '@vueuse/core' import { createSharedComposable } from '@vueuse/core'
import type { SlideoverProps } from '#ui/types' import type { SlideoverProps } from '../types'
import type { ComponentProps } from '#ui/types/component' import type { ComponentProps } from '../types/component'
export interface SlideoverState { export interface SlideoverState {
component: Component | string component: Component | string

View File

@@ -1,5 +1,5 @@
import type { ToastProps } from '#ui/types'
import { useState } from '#imports' import { useState } from '#imports'
import type { ToastProps } from '../types'
export interface Toast extends Omit<ToastProps, 'defaultOpen'> { export interface Toast extends Omit<ToastProps, 'defaultOpen'> {
id: string | number id: string | number

View File

@@ -39,3 +39,4 @@ export * from '../components/Textarea.vue'
export * from '../components/Toast.vue' export * from '../components/Toast.vue'
export * from '../components/Toaster.vue' export * from '../components/Toaster.vue'
export * from '../components/Tooltip.vue' export * from '../components/Tooltip.vue'
export * from './form'

View File

@@ -2,7 +2,7 @@ import type { ZodSchema } from 'zod'
import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi' import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi'
import type { ObjectSchema as YupObjectSchema, ValidationError as YupError } from 'yup' import type { ObjectSchema as YupObjectSchema, ValidationError as YupError } from 'yup'
import type { ObjectSchemaAsync as ValibotObjectSchema } from 'valibot' import type { ObjectSchemaAsync as ValibotObjectSchema } from 'valibot'
import type { FormError } from '#ui/types/form' import type { FormError } from '../types/form'
export function isYupSchema(schema: any): schema is YupObjectSchema<any> { export function isYupSchema(schema: any): schema is YupObjectSchema<any> {
return schema.validate && schema.__isYupSchema__ return schema.validate && schema.__isYupSchema__

View File

@@ -1,5 +1,5 @@
import { reactivePick } from '@vueuse/core' import { reactivePick } from '@vueuse/core'
import type { LinkProps } from '#ui/types' import type { LinkProps } from '../types'
export function pickLinkProps(link: LinkProps) { export function pickLinkProps(link: LinkProps) {
return reactivePick(link, 'active', 'activeClass', 'ariaCurrentValue', 'as', 'disabled', 'exact', 'exactActiveClass', 'exactHash', 'exactQuery', 'external', 'href', 'inactiveClass', 'noPrefetch', 'noRel', 'prefetch', 'prefetchedClass', 'rel', 'replace', 'target', 'to', 'type') return reactivePick(link, 'active', 'activeClass', 'ariaCurrentValue', 'as', 'disabled', 'exact', 'exactActiveClass', 'exactHash', 'exactQuery', 'external', 'href', 'inactiveClass', 'noPrefetch', 'noRel', 'prefetch', 'prefetchedClass', 'rel', 'replace', 'target', 'to', 'type')