mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 11:47:55 +01:00
fix(templates): dont override AppConfig type
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tv, type VariantProps } from 'tailwind-variants'
|
import { tv, type VariantProps } from 'tailwind-variants'
|
||||||
import appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/badge'
|
import theme from '#build/ui/badge'
|
||||||
import type { LinkProps } from '#ui/components/Link.vue'
|
import type { LinkProps } from '#ui/components/Link.vue'
|
||||||
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
|
|
||||||
|
const appConfig = _appConfig as AppConfig & { ui: { badge: Partial<typeof theme> } }
|
||||||
|
|
||||||
const badge = tv({ extend: tv(theme), ...(appConfig.ui?.badge || {}) })
|
const badge = tv({ extend: tv(theme), ...(appConfig.ui?.badge || {}) })
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tv, type VariantProps } from 'tailwind-variants'
|
import { tv, type VariantProps } from 'tailwind-variants'
|
||||||
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 '#ui/components/Link.vue'
|
||||||
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
|
|
||||||
|
const appConfig = _appConfig as AppConfig & { ui: { button: Partial<typeof theme> } }
|
||||||
|
|
||||||
const button = tv({ extend: tv(theme), ...(appConfig.ui?.button || {}) })
|
const button = tv({ extend: tv(theme), ...(appConfig.ui?.button || {}) })
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tv } from 'tailwind-variants'
|
import { tv } from 'tailwind-variants'
|
||||||
import type { CollapsibleRootProps, CollapsibleRootEmits } from 'radix-vue'
|
import type { CollapsibleRootProps, CollapsibleRootEmits } from 'radix-vue'
|
||||||
import appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/collapsible'
|
import theme from '#build/ui/collapsible'
|
||||||
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
|
|
||||||
|
const appConfig = _appConfig as AppConfig & { ui: { collapsible: Partial<typeof theme> } }
|
||||||
|
|
||||||
const collapsible = tv({ extend: tv(theme), ...(appConfig.ui?.collapsible || {}) })
|
const collapsible = tv({ extend: tv(theme), ...(appConfig.ui?.collapsible || {}) })
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tv } from 'tailwind-variants'
|
import { tv } from 'tailwind-variants'
|
||||||
import appConfig from '#build/app.config'
|
import _appConfig from '#build/app.config'
|
||||||
import theme from '#build/ui/container'
|
import theme from '#build/ui/container'
|
||||||
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
|
|
||||||
|
const appConfig = _appConfig as AppConfig & { ui: { container: Partial<typeof theme> } }
|
||||||
|
|
||||||
const container = tv({ extend: tv(theme), ...(appConfig.ui?.container || {}) })
|
const container = tv({ extend: tv(theme), ...(appConfig.ui?.container || {}) })
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tv } from 'tailwind-variants'
|
import { tv } from 'tailwind-variants'
|
||||||
import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps } from 'radix-vue'
|
import type { TooltipRootProps, TooltipRootEmits, TooltipContentProps } from 'radix-vue'
|
||||||
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 { AppConfig } from '@nuxt/schema'
|
||||||
|
|
||||||
|
const appConfig = _appConfig as AppConfig & { ui: { tooltip: Partial<typeof theme> } }
|
||||||
|
|
||||||
const tooltip = tv({ extend: tv(theme), ...(appConfig.ui?.tooltip || {}) })
|
const tooltip = tv({ extend: tv(theme), ...(appConfig.ui?.tooltip || {}) })
|
||||||
|
|
||||||
|
|||||||
@@ -66,31 +66,22 @@ export default function createTemplates (options: ModuleOptions, nuxt: Nuxt) {
|
|||||||
[P in keyof T]: DeepPartial<T[P]> | { [key: string]: string | object }
|
[P in keyof T]: DeepPartial<T[P]> | { [key: string]: string | object }
|
||||||
}>
|
}>
|
||||||
|
|
||||||
type AppConfigUI = {
|
const colors = ${JSON.stringify(options.colors)} as const;
|
||||||
primary: string
|
|
||||||
gray: string
|
|
||||||
} & typeof ui
|
|
||||||
|
|
||||||
type AppConfigInputUI = {
|
type UI = {
|
||||||
primary?: string
|
primary?: typeof colors[number]
|
||||||
gray?: string
|
gray?: 'slate' | 'cool' | 'zinc' | 'neutral' | 'stone'
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
} & DeepPartial<typeof ui>
|
} & DeepPartial<typeof ui>
|
||||||
|
|
||||||
declare module 'nuxt/schema' {
|
declare module 'nuxt/schema' {
|
||||||
interface AppConfig {
|
|
||||||
ui: AppConfigUI
|
|
||||||
}
|
|
||||||
interface AppConfigInput {
|
interface AppConfigInput {
|
||||||
ui?: AppConfigInputUI
|
ui?: UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare module '@nuxt/schema' {
|
declare module '@nuxt/schema' {
|
||||||
interface AppConfig {
|
|
||||||
ui: AppConfigUI
|
|
||||||
}
|
|
||||||
interface AppConfigInput {
|
interface AppConfigInput {
|
||||||
ui?: AppConfigInputUI
|
ui?: UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export {}
|
export {}
|
||||||
|
|||||||
Reference in New Issue
Block a user