import { useContext } from 'react' ; import type { IDataContext } from '../DataContext/IDataContext' ; import { useDataContext } from '../DataContext/useDataContext' ; import { CaptureViewContext } from '../View/CaptureViewContext' ; import { DATA_CONTEXT_MENU } from './DATA_CONTEXT_MENU' ; import type { IMenu } from './IMenu' ; export function useMenuContext ( menu , _menuContext ? ) { const viewContext = useContext ( CaptureViewContext ) ; const context = useDataContext ( _menuContext || viewContext ) ; context . set ( DATA_CONTEXT_MENU , menu ) ; return context ; }