import { Box } from './box.js'; import { Form } from './form.js'; export class Remark extends Box { constructor(doc, text, opts = {}) { super('Remark', opts.parentEl ?? doc.el, opts); this.setInnerHTML(text); } } /** * @example * ```typescript * const doc = new Document(); * const form1 = doc.form(); * ``` */ export class Document extends Box { elements = []; form(opts) { return this.addElement(new Form(this, opts)); } remark(text, opts) { return this.addElement(new Remark(this, text, opts)); } addElement(element) { this.elements.push(element); return this; } clear() { this.el.innerHTML = ''; this.elements = []; } get lastElement() { return this.elements[this.elements.length - 1]; } }