Skip to content

Commit 52f1963

Browse files
committed
chore(cli): improve templates
1 parent 9a83c9c commit 52f1963

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cli/templates.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ const component = ({ name, primitive, pro, prose, content }) => {
3131
? `
3232
<script lang="ts">
3333
import type { AppConfig } from '@nuxt/schema'
34+
${pro ? `import type { ComponentConfig } from '@nuxt/ui'` : ''}
3435
import theme from '#build/${path}/${prose ? 'prose/' : ''}${content ? 'content/' : ''}${kebabName}'
35-
import type { ComponentConfig } from '../types/utils'
36+
${!pro ? `import type { ComponentConfig } from '../types/utils'` : ''}
3637
3738
type ${upperName} = ComponentConfig<typeof theme, AppConfig, ${upperName}${pro ? `, '${key}'` : ''}>
3839
@@ -62,7 +63,7 @@ defineSlots<${upperName}Slots>()
6263
6364
const appConfig = useAppConfig() as ${upperName}['AppConfig']
6465
65-
const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.${camelName} || {}) })())
66+
const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.${pro ? 'uiPro' : 'ui'}?.${camelName} || {}) })())
6667
</script>
6768
6869
<template>
@@ -75,8 +76,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.${camelName}
7576
<script lang="ts">
7677
import type { ${upperName}RootProps, ${upperName}RootEmits } from 'reka-ui'
7778
import type { AppConfig } from '@nuxt/schema'
79+
${pro ? `import type { ComponentConfig } from '@nuxt/ui'` : ''}
7880
import theme from '#build/${path}/${prose ? 'prose/' : ''}${content ? 'content/' : ''}${kebabName}'
79-
import type { ComponentConfig } from '../types/utils'
81+
${!pro ? `import type { ComponentConfig } from '../types/utils'` : ''}
8082
8183
type ${upperName} = ComponentConfig<typeof theme, AppConfig, ${upperName}${pro ? `, '${key}'` : ''}>
8284
@@ -105,7 +107,7 @@ const appConfig = useAppConfig() as ${upperName}['AppConfig']
105107
106108
const rootProps = useForwardPropsEmits(reactivePick(props), emits)
107109
108-
const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.${camelName} || {}) })())
110+
const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.${pro ? 'uiPro' : 'ui'}?.${camelName} || {}) })())
109111
</script>
110112
111113
<template>
@@ -186,6 +188,7 @@ links:${primitive
186188
- label: GitHub
187189
icon: i-simple-icons-github
188190
to: https://github.com/nuxt/${pro ? 'ui-pro' : 'ui'}/tree/v3/src/runtime/components/${upperName}.vue
191+
navigation.badge: Soon
189192
---
190193
191194
## Usage

0 commit comments

Comments
 (0)