import { type ComputedRef, inject, type InjectionKey, provide } from 'vue'; import type { UserSearchPrefer } from '../../typing'; export interface SearchPreferContext { selected: ComputedRef; options: ComputedRef; } const SearchPreferContextKey: InjectionKey = Symbol('SearchPreferContext'); export function useProviderSearchPreferContext(state: SearchPreferContext): void { provide(SearchPreferContextKey, state); } export function useInjectSearchPreferContext(): SearchPreferContext | undefined { return inject(SearchPreferContextKey); }