import defaultTheme , { Theme } from "@chakra-ui/vue-theme" ; import { isFunction , mergeWith } from "@chakra-ui/utils" ; import { ColorHues } from "@chakra-ui/vue-theme" ; type ThemeExtensionTypeHints = { colors : Record < string , Partial < ColorHues > | Record < string , string > | string > ; } ; /**
 * Represents a loose but specific type for the theme override.
 * It provides autocomplete hints for extending the theme, but leaves room
 * for adding properties.
 */ type DeepThemeExtension < ThemeObject , TypeHints > = { [ Key in keyof ThemeObject ] ? : Omit < DeepThemeExtension < ThemeObject [ Key ] , TypeHints > , keyof TypeHints > | ( ThemeObject [ Key ] extends ( ... args : any [ ] ) => any ? Partial < ReturnType < ThemeObject [ Key ] > > : Partial < ThemeObject [ Key ] > ) ; } & Partial < TypeHints > & Record < string , any > ; export type ThemeOverride = DeepThemeExtension < Theme , ThemeExtensionTypeHints > ; param overrides param baseTheme export function extendTheme < T extends ThemeOverride > ( overrides , baseTheme = defaultTheme ) { function customizer ( source , override ) { if ( isFunction ( source ) ) { return ( ... args ) => { const sourceValue = source ( ... args ) ; const overrideValue = isFunction ( override ) ? override ( ... args ) : override ; return mergeWith ( { } , sourceValue , overrideValue , customizer ) ; } ; } return undefined ; } return mergeWith ( { } , baseTheme , overrides , customizer ) ; }