diff --git a/cli/templates.mjs b/cli/templates.mjs index 37c4ea71..29924aca 100644 --- a/cli/templates.mjs +++ b/cli/templates.mjs @@ -35,9 +35,9 @@ import _appConfig from '#build/app.config' import theme from '#build/${path}/${prose ? 'prose/' : ''}${content ? 'content/' : ''}${kebabName}' import { tv } from '${pro ? '#ui/utils/tv' : '../utils/tv'}' -const appConfig = _appConfig as AppConfig & { ${key}: { ${prose ? 'prose: { ' : ''}${camelName}: Partial } }${prose ? ' }' : ''} +const appConfig${camelName} = _appConfig as AppConfig & { ${key}: { ${prose ? 'prose: { ' : ''}${camelName}: Partial } }${prose ? ' }' : ''} -const ${camelName} = tv({ extend: tv(theme), ...(appConfig.${key}?.${prose ? 'prose?.' : ''}${camelName} || {}) }) +const ${camelName} = tv({ extend: tv(theme), ...(appConfig${camelName}.${key}?.${prose ? 'prose?.' : ''}${camelName} || {}) }) export interface ${upperName}Props { /** @@ -78,9 +78,9 @@ import _appConfig from '#build/app.config' import theme from '#build/${path}/${prose ? 'prose/' : ''}${content ? 'content/' : ''}${kebabName}' import { tv } from '${pro ? '#ui/utils/tv' : '../utils/tv'}' -const appConfig = _appConfig as AppConfig & { ${key}: { ${prose ? 'prose: { ' : ''}${camelName}: Partial } }${prose ? ' }' : ''} +const appConfig${camelName} = _appConfig as AppConfig & { ${key}: { ${prose ? 'prose: { ' : ''}${camelName}: Partial } }${prose ? ' }' : ''} -const ${camelName} = tv({ extend: tv(theme), ...(appConfig.${key}?.${prose ? 'prose?.' : ''}${camelName} || {}) }) +const ${camelName} = tv({ extend: tv(theme), ...(appConfig${camelName}.${key}?.${prose ? 'prose?.' : ''}${camelName} || {}) }) type ${upperName}Variants = VariantProps diff --git a/src/runtime/components/Accordion.vue b/src/runtime/components/Accordion.vue index 91adc4aa..0178c1dd 100644 --- a/src/runtime/components/Accordion.vue +++ b/src/runtime/components/Accordion.vue @@ -7,9 +7,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { DynamicSlots } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { accordion: Partial } } +const appConfigAccordion = _appConfig as AppConfig & { ui: { accordion: Partial } } -const accordion = tv({ extend: tv(theme), ...(appConfig.ui?.accordion || {}) }) +const accordion = tv({ extend: tv(theme), ...(appConfigAccordion.ui?.accordion || {}) }) export interface AccordionItem { label?: string diff --git a/src/runtime/components/Alert.vue b/src/runtime/components/Alert.vue index 56d1631d..4744bea7 100644 --- a/src/runtime/components/Alert.vue +++ b/src/runtime/components/Alert.vue @@ -7,9 +7,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { AvatarProps, ButtonProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { alert: Partial } } +const appConfigAlert = _appConfig as AppConfig & { ui: { alert: Partial } } -const alert = tv({ extend: tv(theme), ...(appConfig.ui?.alert || {}) }) +const alert = tv({ extend: tv(theme), ...(appConfigAlert.ui?.alert || {}) }) type AlertVariants = VariantProps diff --git a/src/runtime/components/Avatar.vue b/src/runtime/components/Avatar.vue index b35310e7..192787a3 100644 --- a/src/runtime/components/Avatar.vue +++ b/src/runtime/components/Avatar.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/avatar' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { avatar: Partial } } +const appConfigAvatar = _appConfig as AppConfig & { ui: { avatar: Partial } } -const avatar = tv({ extend: tv(theme), ...(appConfig.ui?.avatar || {}) }) +const avatar = tv({ extend: tv(theme), ...(appConfigAvatar.ui?.avatar || {}) }) type AvatarVariants = VariantProps diff --git a/src/runtime/components/AvatarGroup.vue b/src/runtime/components/AvatarGroup.vue index 11f342ea..21c650fd 100644 --- a/src/runtime/components/AvatarGroup.vue +++ b/src/runtime/components/AvatarGroup.vue @@ -6,9 +6,9 @@ import theme from '#build/ui/avatar-group' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { avatarGroup: Partial } } +const appConfigAvatarGroup = _appConfig as AppConfig & { ui: { avatarGroup: Partial } } -const avatarGroup = tv({ extend: tv(theme), ...(appConfig.ui?.avatarGroup || {}) }) +const avatarGroup = tv({ extend: tv(theme), ...(appConfigAvatarGroup.ui?.avatarGroup || {}) }) type AvatarGroupVariants = VariantProps diff --git a/src/runtime/components/Badge.vue b/src/runtime/components/Badge.vue index 65e5672c..53b54907 100644 --- a/src/runtime/components/Badge.vue +++ b/src/runtime/components/Badge.vue @@ -8,9 +8,9 @@ import type { UseComponentIconsProps } from '../composables/useComponentIcons' import { tv } from '../utils/tv' import type { AvatarProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { badge: Partial } } +const appConfigBadge = _appConfig as AppConfig & { ui: { badge: Partial } } -const badge = tv({ extend: tv(theme), ...(appConfig.ui?.badge || {}) }) +const badge = tv({ extend: tv(theme), ...(appConfigBadge.ui?.badge || {}) }) type BadgeVariants = VariantProps diff --git a/src/runtime/components/Breadcrumb.vue b/src/runtime/components/Breadcrumb.vue index 76d702b7..64b9663c 100644 --- a/src/runtime/components/Breadcrumb.vue +++ b/src/runtime/components/Breadcrumb.vue @@ -7,9 +7,9 @@ import { tv } from '../utils/tv' import type { AvatarProps, LinkProps } from '../types' import type { DynamicSlots, PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { breadcrumb: Partial } } +const appConfigBreadcrumb = _appConfig as AppConfig & { ui: { breadcrumb: Partial } } -const breadcrumb = tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb || {}) }) +const breadcrumb = tv({ extend: tv(theme), ...(appConfigBreadcrumb.ui?.breadcrumb || {}) }) export interface BreadcrumbItem extends Omit { label?: string diff --git a/src/runtime/components/Button.vue b/src/runtime/components/Button.vue index 22bb672c..abfeb030 100644 --- a/src/runtime/components/Button.vue +++ b/src/runtime/components/Button.vue @@ -10,9 +10,9 @@ import { tv } from '../utils/tv' import type { AvatarProps } from '../types' import type { PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { button: Partial } } +const appConfigButton = _appConfig as AppConfig & { ui: { button: Partial } } -const button = tv({ extend: tv(theme), ...(appConfig.ui?.button || {}) }) +const button = tv({ extend: tv(theme), ...(appConfigButton.ui?.button || {}) }) type ButtonVariants = VariantProps diff --git a/src/runtime/components/ButtonGroup.vue b/src/runtime/components/ButtonGroup.vue index 5ef2de50..8f56c1dd 100644 --- a/src/runtime/components/ButtonGroup.vue +++ b/src/runtime/components/ButtonGroup.vue @@ -6,9 +6,9 @@ import theme from '#build/ui/button-group' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { buttonGroup: Partial } } +const appConfigButtonGroup = _appConfig as AppConfig & { ui: { buttonGroup: Partial } } -const buttonGroup = tv({ extend: tv(theme), ...(appConfig.ui?.buttonGroup) }) +const buttonGroup = tv({ extend: tv(theme), ...(appConfigButtonGroup.ui?.buttonGroup) }) type ButtonGroupVariants = VariantProps diff --git a/src/runtime/components/Calendar.vue b/src/runtime/components/Calendar.vue index a454694d..b9e02544 100644 --- a/src/runtime/components/Calendar.vue +++ b/src/runtime/components/Calendar.vue @@ -7,9 +7,9 @@ import _appConfig from '#build/app.config' import theme from '#build/ui/calendar' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { calendar: Partial } } +const appConfigCalendar = _appConfig as AppConfig & { ui: { calendar: Partial } } -const calendar = tv({ extend: tv(theme), ...(appConfig.ui?.calendar || {}) }) +const calendar = tv({ extend: tv(theme), ...(appConfigCalendar.ui?.calendar || {}) }) type CalendarVariants = VariantProps @@ -77,6 +77,7 @@ import { computed } from 'vue' import { useForwardPropsEmits } from 'reka-ui' import { Calendar as SingleCalendar, RangeCalendar } from 'reka-ui/namespaced' import { reactiveOmit } from '@vueuse/core' +import { useAppConfig } from '#imports' import { useLocale } from '../composables/useLocale' import UButton from './Button.vue' @@ -88,6 +89,7 @@ const props = withDefaults(defineProps>(), { const emits = defineEmits>() defineSlots() +const appConfig = useAppConfig() const { code: locale, dir, t } = useLocale() const rootProps = useForwardPropsEmits(reactiveOmit(props, 'range', 'modelValue', 'defaultValue', 'color', 'size', 'monthControls', 'yearControls', 'class', 'ui'), emits) diff --git a/src/runtime/components/Card.vue b/src/runtime/components/Card.vue index abf0393f..ccf5e564 100644 --- a/src/runtime/components/Card.vue +++ b/src/runtime/components/Card.vue @@ -5,9 +5,9 @@ import theme from '#build/ui/card' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { card: Partial } } +const appConfigCard = _appConfig as AppConfig & { ui: { card: Partial } } -const card = tv({ extend: tv(theme), ...(appConfig.ui?.card || {}) }) +const card = tv({ extend: tv(theme), ...(appConfigCard.ui?.card || {}) }) export interface CardProps { /** diff --git a/src/runtime/components/Carousel.vue b/src/runtime/components/Carousel.vue index 908e29ff..19b91301 100644 --- a/src/runtime/components/Carousel.vue +++ b/src/runtime/components/Carousel.vue @@ -16,9 +16,9 @@ import { tv } from '../utils/tv' import type { ButtonProps } from '../types' import type { PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { carousel: Partial } } +const appConfigCarousel = _appConfig as AppConfig & { ui: { carousel: Partial } } -const carousel = tv({ extend: tv(theme), ...(appConfig.ui?.carousel || {}) }) +const carousel = tv({ extend: tv(theme), ...(appConfigCarousel.ui?.carousel || {}) }) type CarouselVariants = VariantProps diff --git a/src/runtime/components/Checkbox.vue b/src/runtime/components/Checkbox.vue index 76e2a78f..583e49e1 100644 --- a/src/runtime/components/Checkbox.vue +++ b/src/runtime/components/Checkbox.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/checkbox' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { checkbox: Partial } } +const appConfigCheckbox = _appConfig as AppConfig & { ui: { checkbox: Partial } } -const checkbox = tv({ extend: tv(theme), ...(appConfig.ui?.checkbox || {}) }) +const checkbox = tv({ extend: tv(theme), ...(appConfigCheckbox.ui?.checkbox || {}) }) type CheckboxVariants = VariantProps diff --git a/src/runtime/components/Chip.vue b/src/runtime/components/Chip.vue index 92e0cea4..e5a888bb 100644 --- a/src/runtime/components/Chip.vue +++ b/src/runtime/components/Chip.vue @@ -6,9 +6,9 @@ import theme from '#build/ui/chip' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { chip: Partial } } +const appConfigChip = _appConfig as AppConfig & { ui: { chip: Partial } } -const chip = tv({ extend: tv(theme), ...(appConfig.ui?.chip || {}) }) +const chip = tv({ extend: tv(theme), ...(appConfigChip.ui?.chip || {}) }) type ChipVariants = VariantProps diff --git a/src/runtime/components/Collapsible.vue b/src/runtime/components/Collapsible.vue index cdad70a5..5c6edcae 100644 --- a/src/runtime/components/Collapsible.vue +++ b/src/runtime/components/Collapsible.vue @@ -6,9 +6,9 @@ import theme from '#build/ui/collapsible' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { collapsible: Partial } } +const appConfigCollapsible = _appConfig as AppConfig & { ui: { collapsible: Partial } } -const collapsible = tv({ extend: tv(theme), ...(appConfig.ui?.collapsible || {}) }) +const collapsible = tv({ extend: tv(theme), ...(appConfigCollapsible.ui?.collapsible || {}) }) export interface CollapsibleProps extends Pick { /** diff --git a/src/runtime/components/ColorPicker.vue b/src/runtime/components/ColorPicker.vue index 43ff2c2e..dd5ac5f1 100644 --- a/src/runtime/components/ColorPicker.vue +++ b/src/runtime/components/ColorPicker.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/color-picker' import { tv } from '../utils/tv' import type { HSLObject } from 'colortranslator' -const appConfig = _appConfig as AppConfig & { ui: { colorPicker: Partial } } +const appConfigColorPicker = _appConfig as AppConfig & { ui: { colorPicker: Partial } } -const colorPicker = tv({ extend: tv(theme), ...(appConfig.ui?.colorPicker || {}) }) +const colorPicker = tv({ extend: tv(theme), ...(appConfigColorPicker.ui?.colorPicker || {}) }) type ColorPickerVariants = VariantProps diff --git a/src/runtime/components/CommandPalette.vue b/src/runtime/components/CommandPalette.vue index fc08c737..9cf06ca1 100644 --- a/src/runtime/components/CommandPalette.vue +++ b/src/runtime/components/CommandPalette.vue @@ -11,9 +11,9 @@ import { tv } from '../utils/tv' import type { AvatarProps, ButtonProps, ChipProps, KbdProps, InputProps } from '../types' import type { DynamicSlots, PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { commandPalette: Partial } } +const appConfigCommandPalette = _appConfig as AppConfig & { ui: { commandPalette: Partial } } -const commandPalette = tv({ extend: tv(theme), ...(appConfig.ui?.commandPalette || {}) }) +const commandPalette = tv({ extend: tv(theme), ...(appConfigCommandPalette.ui?.commandPalette || {}) }) export interface CommandPaletteItem { prefix?: string diff --git a/src/runtime/components/Container.vue b/src/runtime/components/Container.vue index ad177410..a9d07f9a 100644 --- a/src/runtime/components/Container.vue +++ b/src/runtime/components/Container.vue @@ -5,9 +5,9 @@ import theme from '#build/ui/container' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { container: Partial } } +const appConfigContainer = _appConfig as AppConfig & { ui: { container: Partial } } -const container = tv({ extend: tv(theme), ...(appConfig.ui?.container || {}) }) +const container = tv({ extend: tv(theme), ...(appConfigContainer.ui?.container || {}) }) export interface ContainerProps { /** diff --git a/src/runtime/components/ContextMenu.vue b/src/runtime/components/ContextMenu.vue index 6ced3280..f989d1af 100644 --- a/src/runtime/components/ContextMenu.vue +++ b/src/runtime/components/ContextMenu.vue @@ -9,9 +9,9 @@ import { tv } from '../utils/tv' import type { AvatarProps, KbdProps, LinkProps } from '../types' import type { DynamicSlots, PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { contextMenu: Partial } } +const appConfigContextMenu = _appConfig as AppConfig & { ui: { contextMenu: Partial } } -const contextMenu = tv({ extend: tv(theme), ...(appConfig.ui?.contextMenu || {}) }) +const contextMenu = tv({ extend: tv(theme), ...(appConfigContextMenu.ui?.contextMenu || {}) }) type ContextMenuVariants = VariantProps diff --git a/src/runtime/components/Drawer.vue b/src/runtime/components/Drawer.vue index e27eb680..3dc44cae 100644 --- a/src/runtime/components/Drawer.vue +++ b/src/runtime/components/Drawer.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/drawer' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { drawer: Partial } } +const appConfigDrawer = _appConfig as AppConfig & { ui: { drawer: Partial } } -const drawer = tv({ extend: tv(theme), ...(appConfig.ui?.drawer || {}) }) +const drawer = tv({ extend: tv(theme), ...(appConfigDrawer.ui?.drawer || {}) }) export interface DrawerProps extends Pick { /** diff --git a/src/runtime/components/DropdownMenu.vue b/src/runtime/components/DropdownMenu.vue index 328c4f4e..30ffa288 100644 --- a/src/runtime/components/DropdownMenu.vue +++ b/src/runtime/components/DropdownMenu.vue @@ -9,9 +9,9 @@ import { tv } from '../utils/tv' import type { AvatarProps, KbdProps, LinkProps } from '../types' import type { DynamicSlots, PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { dropdownMenu: Partial } } +const appConfigDropdownMenu = _appConfig as AppConfig & { ui: { dropdownMenu: Partial } } -const dropdownMenu = tv({ extend: tv(theme), ...(appConfig.ui?.dropdownMenu || {}) }) +const dropdownMenu = tv({ extend: tv(theme), ...(appConfigDropdownMenu.ui?.dropdownMenu || {}) }) type DropdownMenuVariants = VariantProps diff --git a/src/runtime/components/Form.vue b/src/runtime/components/Form.vue index 2054c412..4812dd37 100644 --- a/src/runtime/components/Form.vue +++ b/src/runtime/components/Form.vue @@ -7,9 +7,9 @@ import { tv } from '../utils/tv' import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, FormEvent, Form, FormErrorWithId } from '../types/form' import type { DeepReadonly } from 'vue' -const appConfig = _appConfig as AppConfig & { ui: { form: Partial } } +const appConfigForm = _appConfig as AppConfig & { ui: { form: Partial } } -const form = tv({ extend: tv(theme), ...(appConfig.ui?.form || {}) }) +const form = tv({ extend: tv(theme), ...(appConfigForm.ui?.form || {}) }) export interface FormProps { id?: string | number diff --git a/src/runtime/components/FormField.vue b/src/runtime/components/FormField.vue index ec5ab91d..a3b6d51c 100644 --- a/src/runtime/components/FormField.vue +++ b/src/runtime/components/FormField.vue @@ -6,9 +6,9 @@ import theme from '#build/ui/form-field' import { tv } from '../utils/tv' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' -const appConfig = _appConfig as AppConfig & { ui: { formField: Partial } } +const appConfigFormField = _appConfig as AppConfig & { ui: { formField: Partial } } -const formField = tv({ extend: tv(theme), ...(appConfig.ui?.formField || {}) }) +const formField = tv({ extend: tv(theme), ...(appConfigFormField.ui?.formField || {}) }) type FormFieldVariants = VariantProps diff --git a/src/runtime/components/Input.vue b/src/runtime/components/Input.vue index 538966f3..594b3518 100644 --- a/src/runtime/components/Input.vue +++ b/src/runtime/components/Input.vue @@ -9,9 +9,9 @@ import { tv } from '../utils/tv' import type { AvatarProps } from '../types' import type { PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { input: Partial } } +const appConfigInput = _appConfig as AppConfig & { ui: { input: Partial } } -const input = tv({ extend: tv(theme), ...(appConfig.ui?.input || {}) }) +const input = tv({ extend: tv(theme), ...(appConfigInput.ui?.input || {}) }) type InputVariants = VariantProps diff --git a/src/runtime/components/InputMenu.vue b/src/runtime/components/InputMenu.vue index 07c78c54..7196c61f 100644 --- a/src/runtime/components/InputMenu.vue +++ b/src/runtime/components/InputMenu.vue @@ -11,9 +11,9 @@ import { tv } from '../utils/tv' import type { AvatarProps, ChipProps, InputProps } from '../types' import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { inputMenu: Partial } } +const appConfigInputMenu = _appConfig as AppConfig & { ui: { inputMenu: Partial } } -const inputMenu = tv({ extend: tv(theme), ...(appConfig.ui?.inputMenu || {}) }) +const inputMenu = tv({ extend: tv(theme), ...(appConfigInputMenu.ui?.inputMenu || {}) }) export interface InputMenuItem { label?: string diff --git a/src/runtime/components/InputNumber.vue b/src/runtime/components/InputNumber.vue index c5ada76d..42125557 100644 --- a/src/runtime/components/InputNumber.vue +++ b/src/runtime/components/InputNumber.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/input-number' import { tv } from '../utils/tv' import type { ButtonProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { inputNumber: Partial } } +const appConfigInputNumber = _appConfig as AppConfig & { ui: { inputNumber: Partial } } -const inputNumber = tv({ extend: tv(theme), ...(appConfig.ui?.inputNumber || {}) }) +const inputNumber = tv({ extend: tv(theme), ...(appConfigInputNumber.ui?.inputNumber || {}) }) type InputNumberVariants = VariantProps @@ -78,6 +78,7 @@ export interface InputNumberSlots { import { onMounted, ref, computed } from 'vue' import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from 'reka-ui' import { reactivePick } from '@vueuse/core' +import { useAppConfig } from '#imports' import { useFormField } from '../composables/useFormField' import { useLocale } from '../composables/useLocale' import UButton from './Button.vue' @@ -92,6 +93,7 @@ defineSlots() const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'formatOptions'), emits) +const appConfig = useAppConfig() const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size, name, highlight, disabled, ariaAttrs } = useFormField(props) const { t, code: codeLocale } = useLocale() diff --git a/src/runtime/components/Kbd.vue b/src/runtime/components/Kbd.vue index bb4026b6..d697354a 100644 --- a/src/runtime/components/Kbd.vue +++ b/src/runtime/components/Kbd.vue @@ -7,9 +7,9 @@ import type { KbdKey } from '../composables/useKbd' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { kbd: Partial } } +const appConfigKbd = _appConfig as AppConfig & { ui: { kbd: Partial } } -const kbd = tv({ extend: tv(theme), ...(appConfig.ui?.kbd || {}) }) +const kbd = tv({ extend: tv(theme), ...(appConfigKbd.ui?.kbd || {}) }) type KbdVariants = VariantProps diff --git a/src/runtime/components/Link.vue b/src/runtime/components/Link.vue index f61ff1a0..7d9bddde 100644 --- a/src/runtime/components/Link.vue +++ b/src/runtime/components/Link.vue @@ -53,9 +53,9 @@ interface NuxtLinkProps extends Omit { noPrefetch?: boolean } -const appConfig = _appConfig as AppConfig & { ui: { link: Partial } } +const appConfigLink = _appConfig as AppConfig & { ui: { link: Partial } } -const link = tv({ extend: tv(theme), ...(appConfig.ui?.link || {}) }) +const link = tv({ extend: tv(theme), ...(appConfigLink.ui?.link || {}) }) export interface LinkProps extends NuxtLinkProps { /** diff --git a/src/runtime/components/Modal.vue b/src/runtime/components/Modal.vue index 2b274bab..3e35186a 100644 --- a/src/runtime/components/Modal.vue +++ b/src/runtime/components/Modal.vue @@ -7,9 +7,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { ButtonProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { modal: Partial } } +const appConfigModal = _appConfig as AppConfig & { ui: { modal: Partial } } -const modal = tv({ extend: tv(theme), ...(appConfig.ui?.modal || {}) }) +const modal = tv({ extend: tv(theme), ...(appConfigModal.ui?.modal || {}) }) export interface ModalProps extends DialogRootProps { title?: string diff --git a/src/runtime/components/NavigationMenu.vue b/src/runtime/components/NavigationMenu.vue index 7253a7c8..2b90e546 100644 --- a/src/runtime/components/NavigationMenu.vue +++ b/src/runtime/components/NavigationMenu.vue @@ -9,9 +9,9 @@ import { tv } from '../utils/tv' import type { AvatarProps, BadgeProps, LinkProps } from '../types' import type { DynamicSlots, MaybeArrayOfArray, MaybeArrayOfArrayItem, PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { navigationMenu: Partial } } +const appConfigNavigationMenu = _appConfig as AppConfig & { ui: { navigationMenu: Partial } } -const navigationMenu = tv({ extend: tv(theme), ...(appConfig.ui?.navigationMenu || {}) }) +const navigationMenu = tv({ extend: tv(theme), ...(appConfigNavigationMenu.ui?.navigationMenu || {}) }) export interface NavigationMenuChildItem extends Omit { /** Description is only used when `orientation` is `horizontal`. */ @@ -148,6 +148,7 @@ extendDevtoolsMeta({ import { computed, toRef } from 'vue' import { NavigationMenuRoot, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, useForwardPropsEmits } from 'reka-ui' import { createReusableTemplate } from '@vueuse/core' +import { useAppConfig } from '#imports' import { get } from '../utils' import { pickLinkProps } from '../utils/link' import ULinkBase from './LinkBase.vue' @@ -182,6 +183,7 @@ const rootProps = useForwardPropsEmits(computed(() => ({ const contentProps = toRef(() => props.content) +const appConfig = useAppConfig() const [DefineLinkTemplate, ReuseLinkTemplate] = createReusableTemplate<{ item: NavigationMenuItem, index: number, active?: boolean }>() const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate<{ item: NavigationMenuItem, index: number }>() diff --git a/src/runtime/components/Pagination.vue b/src/runtime/components/Pagination.vue index 2272cfad..e9013307 100644 --- a/src/runtime/components/Pagination.vue +++ b/src/runtime/components/Pagination.vue @@ -8,9 +8,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { ButtonProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { pagination: Partial } } +const appConfigPagination = _appConfig as AppConfig & { ui: { pagination: Partial } } -const pagination = tv({ extend: tv(theme), ...(appConfig.ui?.pagination || {}) }) +const pagination = tv({ extend: tv(theme), ...(appConfigPagination.ui?.pagination || {}) }) export interface PaginationProps extends Partial> { /** diff --git a/src/runtime/components/PinInput.vue b/src/runtime/components/PinInput.vue index a7a8053f..84190ada 100644 --- a/src/runtime/components/PinInput.vue +++ b/src/runtime/components/PinInput.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/pin-input' import { tv } from '../utils/tv' import type { PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { pinInput: Partial } } +const appConfigPinInput = _appConfig as AppConfig & { ui: { pinInput: Partial } } -const pinInput = tv({ extend: tv(theme), ...(appConfig.ui?.pinInput || {}) }) +const pinInput = tv({ extend: tv(theme), ...(appConfigPinInput.ui?.pinInput || {}) }) type PinInputVariants = VariantProps diff --git a/src/runtime/components/Popover.vue b/src/runtime/components/Popover.vue index 6c1c0a9f..9d6e32f7 100644 --- a/src/runtime/components/Popover.vue +++ b/src/runtime/components/Popover.vue @@ -6,9 +6,9 @@ import theme from '#build/ui/popover' import { tv } from '../utils/tv' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' -const appConfig = _appConfig as AppConfig & { ui: { popover: Partial } } +const appConfigPopover = _appConfig as AppConfig & { ui: { popover: Partial } } -const popover = tv({ extend: tv(theme), ...(appConfig.ui?.popover || {}) }) +const popover = tv({ extend: tv(theme), ...(appConfigPopover.ui?.popover || {}) }) export interface PopoverProps extends PopoverRootProps, Pick { /** diff --git a/src/runtime/components/Progress.vue b/src/runtime/components/Progress.vue index b70bc01a..c00bf42b 100644 --- a/src/runtime/components/Progress.vue +++ b/src/runtime/components/Progress.vue @@ -7,9 +7,9 @@ import _appConfig from '#build/app.config' import theme from '#build/ui/progress' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { progress: Partial } } +const appConfigProgress = _appConfig as AppConfig & { ui: { progress: Partial } } -const progress = tv({ extend: tv(theme), ...(appConfig.ui?.progress || {}) }) +const progress = tv({ extend: tv(theme), ...(appConfigProgress.ui?.progress || {}) }) type ProgressVariants = VariantProps diff --git a/src/runtime/components/RadioGroup.vue b/src/runtime/components/RadioGroup.vue index 4cb44d73..07a9d8fa 100644 --- a/src/runtime/components/RadioGroup.vue +++ b/src/runtime/components/RadioGroup.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/radio-group' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { radioGroup: Partial } } +const appConfigRadioGroup = _appConfig as AppConfig & { ui: { radioGroup: Partial } } -const radioGroup = tv({ extend: tv(theme), ...(appConfig.ui?.radioGroup || {}) }) +const radioGroup = tv({ extend: tv(theme), ...(appConfigRadioGroup.ui?.radioGroup || {}) }) type RadioGroupVariants = VariantProps diff --git a/src/runtime/components/Select.vue b/src/runtime/components/Select.vue index a5e59722..9099a20c 100644 --- a/src/runtime/components/Select.vue +++ b/src/runtime/components/Select.vue @@ -10,9 +10,9 @@ import { tv } from '../utils/tv' import type { AvatarProps, ChipProps, InputProps } from '../types' import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { select: Partial } } +const appConfigSelect = _appConfig as AppConfig & { ui: { select: Partial } } -const select = tv({ extend: tv(theme), ...(appConfig.ui?.select || {}) }) +const select = tv({ extend: tv(theme), ...(appConfigSelect.ui?.select || {}) }) export interface SelectItem { label?: string diff --git a/src/runtime/components/SelectMenu.vue b/src/runtime/components/SelectMenu.vue index 28c8052d..bbdeda33 100644 --- a/src/runtime/components/SelectMenu.vue +++ b/src/runtime/components/SelectMenu.vue @@ -10,9 +10,9 @@ import { tv } from '../utils/tv' import type { AvatarProps, ChipProps, InputProps } from '../types' import type { PartialString, MaybeArrayOfArray, MaybeArrayOfArrayItem, SelectModelValue, SelectModelValueEmits, SelectItemKey } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { selectMenu: Partial } } +const appConfigSelectMenu = _appConfig as AppConfig & { ui: { selectMenu: Partial } } -const selectMenu = tv({ extend: tv(theme), ...(appConfig.ui?.selectMenu || {}) }) +const selectMenu = tv({ extend: tv(theme), ...(appConfigSelectMenu.ui?.selectMenu || {}) }) export interface SelectMenuItem { label?: string diff --git a/src/runtime/components/Separator.vue b/src/runtime/components/Separator.vue index d105740b..b6ceeddf 100644 --- a/src/runtime/components/Separator.vue +++ b/src/runtime/components/Separator.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/separator' import { tv } from '../utils/tv' import type { AvatarProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { separator: Partial } } +const appConfigSeparator = _appConfig as AppConfig & { ui: { separator: Partial } } -const separator = tv({ extend: tv(theme), ...(appConfig.ui?.separator || {}) }) +const separator = tv({ extend: tv(theme), ...(appConfigSeparator.ui?.separator || {}) }) type SeparatorVariants = VariantProps diff --git a/src/runtime/components/Skeleton.vue b/src/runtime/components/Skeleton.vue index b7f62601..8e7068fd 100644 --- a/src/runtime/components/Skeleton.vue +++ b/src/runtime/components/Skeleton.vue @@ -5,9 +5,9 @@ import theme from '#build/ui/skeleton' import { tv } from '../utils/tv' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' -const appConfig = _appConfig as AppConfig & { ui: { skeleton: Partial } } +const appConfigSkeleton = _appConfig as AppConfig & { ui: { skeleton: Partial } } -const skeleton = tv({ extend: tv(theme), ...(appConfig.ui?.skeleton || {}) }) +const skeleton = tv({ extend: tv(theme), ...(appConfigSkeleton.ui?.skeleton || {}) }) export interface SkeletonProps { /** diff --git a/src/runtime/components/Slideover.vue b/src/runtime/components/Slideover.vue index 48f075b7..a4abab83 100644 --- a/src/runtime/components/Slideover.vue +++ b/src/runtime/components/Slideover.vue @@ -8,9 +8,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { ButtonProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { slideover: Partial } } +const appConfigSlideover = _appConfig as AppConfig & { ui: { slideover: Partial } } -const slideover = tv({ extend: tv(theme), ...(appConfig.ui?.slideover || {}) }) +const slideover = tv({ extend: tv(theme), ...(appConfigSlideover.ui?.slideover || {}) }) type SlideoverVariants = VariantProps diff --git a/src/runtime/components/Slider.vue b/src/runtime/components/Slider.vue index 5bd11c4b..5705bdea 100644 --- a/src/runtime/components/Slider.vue +++ b/src/runtime/components/Slider.vue @@ -6,9 +6,9 @@ import _appConfig from '#build/app.config' import theme from '#build/ui/slider' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { slider: Partial } } +const appConfigSlider = _appConfig as AppConfig & { ui: { slider: Partial } } -const slider = tv({ extend: tv(theme), ...(appConfig.ui?.slider || {}) }) +const slider = tv({ extend: tv(theme), ...(appConfigSlider.ui?.slider || {}) }) type SliderVariants = VariantProps diff --git a/src/runtime/components/Stepper.vue b/src/runtime/components/Stepper.vue index 81ba77e3..bef17122 100644 --- a/src/runtime/components/Stepper.vue +++ b/src/runtime/components/Stepper.vue @@ -8,9 +8,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { DynamicSlots } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { stepper: Partial } } +const appConfigStepper = _appConfig as AppConfig & { ui: { stepper: Partial } } -const stepper = tv({ extend: tv(theme), ...(appConfig.ui?.stepper || {}) }) +const stepper = tv({ extend: tv(theme), ...(appConfigStepper.ui?.stepper || {}) }) type StepperVariants = VariantProps diff --git a/src/runtime/components/Switch.vue b/src/runtime/components/Switch.vue index 152ad0d3..400fce7f 100644 --- a/src/runtime/components/Switch.vue +++ b/src/runtime/components/Switch.vue @@ -8,9 +8,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { switch: Partial } } +const appConfigSwitch = _appConfig as AppConfig & { ui: { switch: Partial } } -const switchTv = tv({ extend: tv(theme), ...(appConfig.ui?.switch || {}) }) +const switchTv = tv({ extend: tv(theme), ...(appConfigSwitch.ui?.switch || {}) }) type SwitchVariants = VariantProps diff --git a/src/runtime/components/Table.vue b/src/runtime/components/Table.vue index c4d325ec..3edf586c 100644 --- a/src/runtime/components/Table.vue +++ b/src/runtime/components/Table.vue @@ -38,9 +38,9 @@ declare module '@tanstack/table-core' { } } -const appConfig = _appConfig as AppConfig & { ui: { table: Partial } } +const appConfigTable = _appConfig as AppConfig & { ui: { table: Partial } } -const table = tv({ extend: tv(theme), ...(appConfig.ui?.table || {}) }) +const table = tv({ extend: tv(theme), ...(appConfigTable.ui?.table || {}) }) type TableVariants = VariantProps diff --git a/src/runtime/components/Tabs.vue b/src/runtime/components/Tabs.vue index d1d535f2..ccf572cf 100644 --- a/src/runtime/components/Tabs.vue +++ b/src/runtime/components/Tabs.vue @@ -9,9 +9,9 @@ import { tv } from '../utils/tv' import type { AvatarProps } from '../types' import type { DynamicSlots, PartialString } from '../types/utils' -const appConfig = _appConfig as AppConfig & { ui: { tabs: Partial } } +const appConfigTabs = _appConfig as AppConfig & { ui: { tabs: Partial } } -const tabs = tv({ extend: tv(theme), ...(appConfig.ui?.tabs || {}) }) +const tabs = tv({ extend: tv(theme), ...(appConfigTabs.ui?.tabs || {}) }) export interface TabsItem { label?: string diff --git a/src/runtime/components/Textarea.vue b/src/runtime/components/Textarea.vue index 4fb96b23..1c3dea31 100644 --- a/src/runtime/components/Textarea.vue +++ b/src/runtime/components/Textarea.vue @@ -5,9 +5,9 @@ import _appConfig from '#build/app.config' import theme from '#build/ui/textarea' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { textarea: Partial } } +const appConfigTextarea = _appConfig as AppConfig & { ui: { textarea: Partial } } -const textarea = tv({ extend: tv(theme), ...(appConfig.ui?.textarea || {}) }) +const textarea = tv({ extend: tv(theme), ...(appConfigTextarea.ui?.textarea || {}) }) type TextareaVariants = VariantProps diff --git a/src/runtime/components/Toast.vue b/src/runtime/components/Toast.vue index e60add12..d707570b 100644 --- a/src/runtime/components/Toast.vue +++ b/src/runtime/components/Toast.vue @@ -8,9 +8,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { AvatarProps, ButtonProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { toast: Partial } } +const appConfigToast = _appConfig as AppConfig & { ui: { toast: Partial } } -const toast = tv({ extend: tv(theme), ...(appConfig.ui?.toast || {}) }) +const toast = tv({ extend: tv(theme), ...(appConfigToast.ui?.toast || {}) }) type ToastVariants = VariantProps diff --git a/src/runtime/components/Toaster.vue b/src/runtime/components/Toaster.vue index 66ee2ec7..d853d40a 100644 --- a/src/runtime/components/Toaster.vue +++ b/src/runtime/components/Toaster.vue @@ -7,9 +7,9 @@ import theme from '#build/ui/toaster' import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' -const appConfig = _appConfig as AppConfig & { ui: { toaster: Partial } } +const appConfigToaster = _appConfig as AppConfig & { ui: { toaster: Partial } } -const toaster = tv({ extend: tv(theme), ...(appConfig.ui?.toaster || {}) }) +const toaster = tv({ extend: tv(theme), ...(appConfigToaster.ui?.toaster || {}) }) type ToasterVariants = VariantProps diff --git a/src/runtime/components/Tooltip.vue b/src/runtime/components/Tooltip.vue index c83249d1..4335769e 100644 --- a/src/runtime/components/Tooltip.vue +++ b/src/runtime/components/Tooltip.vue @@ -7,9 +7,9 @@ import { extendDevtoolsMeta } from '../composables/extendDevtoolsMeta' import { tv } from '../utils/tv' import type { KbdProps } from '../types' -const appConfig = _appConfig as AppConfig & { ui: { tooltip: Partial } } +const appConfigTooltip = _appConfig as AppConfig & { ui: { tooltip: Partial } } -const tooltip = tv({ extend: tv(theme), ...(appConfig.ui?.tooltip || {}) }) +const tooltip = tv({ extend: tv(theme), ...(appConfigTooltip.ui?.tooltip || {}) }) export interface TooltipProps extends TooltipRootProps { /** The text content of the tooltip. */ diff --git a/src/runtime/utils/tv.ts b/src/runtime/utils/tv.ts index 93236ec6..e4413427 100644 --- a/src/runtime/utils/tv.ts +++ b/src/runtime/utils/tv.ts @@ -2,6 +2,6 @@ import { createTV, type defaultConfig } from 'tailwind-variants' import type { AppConfig } from '@nuxt/schema' import _appConfig from '#build/app.config' -const appConfig = _appConfig as AppConfig & { ui: { tv: typeof defaultConfig } } +const appConfigTv = _appConfig as AppConfig & { ui: { tv: typeof defaultConfig } } -export const tv = createTV(appConfig.ui?.tv) +export const tv = createTV(appConfigTv.ui?.tv) diff --git a/src/runtime/vue/components/Link.vue b/src/runtime/vue/components/Link.vue index b3b8f353..ca3403e9 100644 --- a/src/runtime/vue/components/Link.vue +++ b/src/runtime/vue/components/Link.vue @@ -52,9 +52,9 @@ interface NuxtLinkProps extends Omit { noPrefetch?: boolean } -const appConfig = _appConfig as AppConfig & { ui: { link: Partial } } +const appConfigLink = _appConfig as AppConfig & { ui: { link: Partial } } -const link = tv({ extend: tv(theme), ...(appConfig.ui?.link || {}) }) +const link = tv({ extend: tv(theme), ...(appConfigLink.ui?.link || {}) }) export interface LinkProps extends NuxtLinkProps { /**