import ElementsLibraryTargetMapping from './ElementsLibraryTargetMapping' ; import Target from './Target' ; import { LibraryDefinition } from '../types' ; export default class ElementsLibrary { public name : string ; public version : string ; public type : string ; public elements : { [ key ] : object ; } ; public mappings : { [ key ] : ElementsLibraryTargetMapping ; } = { } ; public targets : { [ key ] : Target ; } = { } ; constructor ( libraryDefinition ) { const { name , version , type , elements } = libraryDefinition ; this . name = name ; this . version = version ; this . type = type ; this . elements = elements ; } param name public element ( name ) { return this . elements [ name ] ; } param mapping public useMapping ( mapping ) { this . mappings [ mapping . name ] = mapping ; const target = mapping . target as Target ; this . targets [ target . name ] = target ; mapping . setLibrary ( this ) ; } param targetName public target ( targetName ) { return this . targets [ targetName ] ; } }