fix(components): refactor types after @nuxt/module-builder upgrade (#3855)

This commit is contained in:
Benjamin Canac
2025-04-12 17:53:03 +02:00
committed by GitHub
parent 333b7e4c9b
commit 39c861a64b
57 changed files with 635 additions and 731 deletions

View File

@@ -1,12 +1,9 @@
<script lang="ts">
import type { AppConfig } from '@nuxt/schema'
import _appConfig from '#build/app.config'
import theme from '#build/ui/skeleton'
import { tv } from '../utils/tv'
import type { ComponentConfig } from '../types/utils'
const appConfigSkeleton = _appConfig as AppConfig & { ui: { skeleton: Partial<typeof theme> } }
const skeleton = tv({ extend: tv(theme), ...(appConfigSkeleton.ui?.skeleton || {}) })
type Skeleton = ComponentConfig<typeof theme, AppConfig, 'skeleton'>
export interface SkeletonProps {
/**
@@ -19,13 +16,20 @@ export interface SkeletonProps {
</script>
<script setup lang="ts">
import { computed } from 'vue'
import { Primitive } from 'reka-ui'
import { useAppConfig } from '#imports'
import { tv } from '../utils/tv'
const props = defineProps<SkeletonProps>()
const appConfig = useAppConfig() as Skeleton['AppConfig']
const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.skeleton || {}) }))
</script>
<template>
<Primitive :as="as" :class="skeleton({ class: props.class })">
<Primitive :as="as" :class="ui({ class: props.class })">
<slot />
</Primitive>
</template>