<script lang="ts" setup>
import { provide, watch } from 'vue'
import type { NiConfig } from './types'
import defaultConfig from './defaultConfig'
import Message from '~/message/Message.vue'

const props = defineProps<{
  config?: Partial<NiConfig>
}>()

// 监听配置变化
watch(() => props.config, (newConfig) => {
  Object.assign(defaultConfig, newConfig)
})

// 提供配置
provide('ni-config', defaultConfig)
</script>
<template>
  <slot></slot>
  <Message/>
</template>