import type { InjectionKey, Ref } from 'vue'; import { ref, inject, provide } from 'vue'; export interface HoverContextProps { startRow: Ref; endRow: Ref; onHover: (start: number, end: number) => void; } export const HoverContextKey: InjectionKey = Symbol('HoverContextProps'); export const useProvideHover = (props: HoverContextProps) => { provide(HoverContextKey, props); }; export const useInjectHover = () => { return inject(HoverContextKey, { startRow: ref(-1), endRow: ref(-1), onHover() {}, } as HoverContextProps); };