const { Text } = require('xwindow')

class TextType
{
  /**
   * @param {string} data
   */
  constructor(data) {
    this.__data = String(data)
    this.node = null
  }

  /**
   * @return {string}
   */
  toString() {
    return this.node.data
  }

  /**
   * @param {Text} [node]
   * @private
   */
  __init(node) {
    this.node = node || new Text(this.__data)
  }

  /**
   * @param {boolean} keepNode
   * @private
   */
  __destroy(keepNode) {
    keepNode || this.node.remove()
  }

  /**
   * @return {Text|null}
   * @private
   */
  __getAnchorNode() {
    return this.node
  }

  /**
   * @return {string}
   */
  get data() {
    return this.node ? this.node.data : this.__data
  }

  /**
   * @param {string} data
   */
  set data(data) {
    this.node.data = data
  }
}

module.exports = TextType

@@ -66,36 +66,38 @@
 @param %7Bstring%7D 
+%5B
 data
+%5D
 %0A   */%0A  constru
@@ -101,24 +101,29 @@
 tructor(data
+ = ''
 ) %7B%0A    this
@@ -399,24 +399,25 @@
 oolean%7D 
+%5B
 keepNode
 %0A   * @p
@@ -408,16 +408,17 @@
 keepNode
+%5D
 %0A   * @p

support for instantiation without arguments