import { padStart } from "vdom-utils" ; import { Renderer } from "../renderSync" ; export default class CompactRenderer implements Renderer < string > { output : string = "" ; onProp ( name , value , depth ) { if ( value === true ) { this . output += " " + name ; return ; } this . output += " " + name + '="' + value + '"' ; } reset ( ) { this . output = "" ; } onOpenTag ( name , hasAttributes , isVoid , depth ) { this . output += "<" + name ; if ( ! hasAttributes ) { this . output += isVoid ? " />" : "" ; } } onOpenTagClose ( name , hasAttributes , isVoid , hasChildren , depth ) { if ( hasAttributes ) { this . output += isVoid ? " />" : ">" ; } else if ( ! isVoid ) { this . output += ">" ; } } onTextNode ( text , depth ) { this . output += text ; } onCloseTag ( name , isVoid , depth ) { if ( ! isVoid ) { this . output += "</" + name + ">" ; } } onDangerousInnerHTML ( html ) { this . output += html ; } }