import { computed, ComputedRef, inject, provide, UnwrapRef } from 'vue'; import { ConfigProviderProps, defaultConfigProvider, SizeType } from '../../config-provider'; const sizeProvider = Symbol('SizeProvider'); const useProviderSize = (props: Record): ComputedRef => { const configProvider = inject>( 'configProvider', defaultConfigProvider, ); const size = computed(() => props.size || configProvider.componentSize); provide(sizeProvider, size); return size; }; const useInjectSize = (): ComputedRef => { const size: ComputedRef = inject( sizeProvider, computed(() => ('default' as unknown) as T), ); return size; }; export { useInjectSize, sizeProvider, useProviderSize }; export default useProviderSize;