import type { MaybeDeref } from "@thi.ng/api" ; import type { IComponent , NumOrElement } from "./api.js" ; import { $compile } from "./compile.js" ; import { $attribs , $clear , $el , $html , $moveTo , $remove , $style , $text , $tree , } from "./dom.js" ; /**
 * Abstract base class /  IComponent implementation. Provides
 * additional convenience methods for DOM element creation &
 * manipulation.
  export abstract class Component < T = any > implements IComponent < T > { el ? : Element ; abstract mount ( parent , index ? , ... xs ) ; async unmount ( ) { this . $remove ( ) ; this . el = undefined ; } update ( state ? ) { } $el ( tag , attribs ? , body ? , parent = this . el , idx ? ) { return $el ( tag , attribs , body , parent , idx ) ; } $clear ( el = this . el ! ) { return $clear ( el ) ; } $compile ( tree ) { return $compile ( tree ) ; } $tree ( tree , root = this . el ! , index ? ) { return $tree ( tree , root , index ) ; } $text ( body ) { this . el && $text ( < any > this . el , body ) ; } $html ( body ) { this . el && $html ( < any > this . el , body ) ; } $attribs ( attribs , el = this . el ! ) { $attribs ( el , attribs ) ; } $style ( rules , el = this . el ! ) { $style ( el , rules ) ; } $remove ( el = this . el ! ) { $remove ( el ) ; } $moveTo ( newParent , el = this . el ! , idx ? ) { $moveTo ( newParent , el , idx ) ; } }