import { computed , Plugin , ref , UnwrapRef } from "vue" ; import defaultTheme from "@chakra-ui/vue-theme" ; import type { ColorModeRef } from "@chakra-ui/c-color-mode" ; import { toCSSVar , WithCSSVar } from "@chakra-ui/styled-system" ; import { chakra , injectGlobal } from "@chakra-ui/vue-system" ; import internalIcons from "./icon.internals" ; import { extendTheme , ThemeOverride } from "./extend-theme" ; import { MergedIcons , parseIcons } from "./parse-icons" ; import { injectResetStyles , injectThemeGlobalStyles } from "./helpers/css-reset" ; import { mode } from "@chakra-ui/vue-theme-tools" ; import { ChakraPluginOptions } from "./helpers/plugin.types" ; /**
 * Helper function to extend Chakra plugin with options
 * It just returns its arguments with typescript types added
 */ export function chakraOptions ( options = { cssReset : true } ) { return options ; } const ChakraUIVuePlugin = { install ( app , options = { cssReset : true } ) { const theme = options . extendTheme || defaultTheme ; const computedTheme = computed < WithCSSVar < ThemeOverride > > ( ( ) => toCSSVar ( theme ) ) ; injectGlobal ( { ":root" : computedTheme . value . __cssVars , } ) ; const colorMode = theme . config ?. initialColorMode || "light" ; app . config . globalProperties . $initialColorMode = colorMode ; const colorModeRef = ref ( colorMode ) as ColorModeRef ; app . provide < ColorModeRef > ( "$chakraColorMode" , colorModeRef ) ; if ( options . cssReset ) { injectResetStyles ( ) ; } injectThemeGlobalStyles ( computedTheme . value , colorModeRef ) ; let libraryIcons = options . icons ?. library || { } ; let extendedIcons = options . icons ?. extend || { } ; app . config . globalProperties . $chakraTheme = computedTheme . value ; app . provide ( "$chakraTheme" , computedTheme . value as ThemeOverride ) ; libraryIcons = parseIcons ( libraryIcons ) ; const mergedIcons = { ... internalIcons , ... libraryIcons , ... extendedIcons , } ; app . provide ( "$chakraIcons" , mergedIcons ) ; app . config . globalProperties . $mode = mode ; } , } ; export type { ChakraPluginOptions } ; export interface ThemeProviderProps extends ThemeOverride { } export default ChakraUIVuePlugin ; export { extendTheme } ; export { chakra } ; /**
 *
 * Component exports
 * ==================
 *
 * Dear contributors,
 *
 * Please keep these exports in Alphabetical order :)
 */ export * from "@chakra-ui/c-accordion" ; export * from "@chakra-ui/c-alert" ; export * from "@chakra-ui/c-breadcrumb" ; export * from "@chakra-ui/c-button" ; export * from "@chakra-ui/c-color-mode" ; export * from "@chakra-ui/c-close-button" ; export * from "@chakra-ui/c-code" ; export * from "@chakra-ui/c-flex" ; export * from "@chakra-ui/c-focus-lock" ; export * from "@chakra-ui/c-form-control" ; export * from "@chakra-ui/c-icon" ; export * from "@chakra-ui/c-input" ; export * from "@chakra-ui/vue-layout" ; export * from "@chakra-ui/c-modal" ; export * from "@chakra-ui/c-motion" ; export * from "@chakra-ui/c-popper" ; export * from "@chakra-ui/c-portal" ; export * from "@chakra-ui/c-reset" ; export * from "@chakra-ui/c-spinner" ; export * from "@chakra-ui/c-scroll-lock" ; export * from "@chakra-ui/c-theme-provider" ; export * from "@chakra-ui/c-visually-hidden" ; export * from "@chakra-ui/vue-composables" ; export * from "@chakra-ui/vue-a11y" ; /**
 *
 * Directives exports
 * ==================
 *
 * Dear contributors,
 *
 * Please keep these exports in Alphabetical order :)
 */