import * as React from "react" ; import * as ReactDOM from "react-dom" ; import { Menus } from "./Menus" ; import { MenusStoreDependencies , MenusStore } from "./MenusStore" ; /**
 * Dependencies to create a wrapping view in an element.
 */ export interface WrappingViewDependencies extends MenusStoreDependencies { /**
     * Element to create a view within.
     */ container : HTMLElement ; } param container param schema export type InitializeMenusView = ( dependencies : WrappingViewDependencies ) => Promise < void > ; remarks export interface InitializeMenusViewWrapper { /**
     * Creates a menus view in a container.
     */ initializeMenus : InitializeMenusView ; } param dependencies returns export const initializeMenus = async ( dependencies ) : Promise < void > => { const store = new MenusStore ( { classNames : dependencies . classNames , containerSize : dependencies . containerSize , menus : dependencies . menus , styles : dependencies . styles , } ) ; const menusContainerQuery = `.${ dependencies . classNames . menusOuterArea }` ; const menusContainer = dependencies . container . querySelector ( menusContainerQuery ) ; if ( menusContainer === null ) { throw new Error ( `Could not find menus container under '${ menusContainerQuery }'.` ) ; } await new Promise < void > ( ( resolve ) => { ReactDOM . render ( < Menus store = { store } / > , menusContainer , resolve ) ; } ) ; } ;