import { Disposable } from '../types' ; import { $ , dispose , removeNode , } from '.' ; import { isString } from './is' ; export class Component implements Disposable { el : HTMLElement ; constructor ( container ? , desc ? , attrs ? , children ? , classPrefix ? ) { if ( desc && ! isString ( desc ) ) { this . el = desc ; } else { this . el = $ ( desc , attrs , children , classPrefix ) ; } if ( container ) container . appendChild ( this . el ) ; } applyStyle ( style ) { Object . assign ( this . el . style , style ) ; } dispose ( ) { removeNode ( this . el ) ; dispose ( this ) ; } }