import * as React from 'react' ; import { Chip } from '../interface' ; export class ChipManger { private chips ? : Chip [ ] ; private chipsCache = new Map < string , Chip > ( ) ; private frame : number = 0 ; constructor ( chips ? ) { this . chips = chips ; ( this . chips || [ ] ) . forEach ( chip => { this . chipsCache . set ( chip . path . join ( '___' ) , chip ) ; } ) ; } getChip ( path ? ) { return path && this . chipsCache . get ( path . join ( '___' ) ) ; } setFrame ( frame ) { this . frame = frame ; } } export interface SVGContextProps { chipManger : ChipManger ; theme ? : Record < string , string > ; } const SVGContext = React . createContext < SVGContextProps > ( { chipManger : new ChipManger ( ) , } ) ; export default SVGContext ;