[
  {
    "__docId__": 0,
    "kind": "file",
    "name": "src/tree.js",
    "content": "import Events from 'eventemitter3'\nimport clicked from 'clicked'\n\nimport { Input } from './input'\nimport { defaults, styleDefaults } from './defaults'\nimport * as utils from './utils'\nimport { icons } from './icons'\n\nexport class Tree extends Events {\n    /**\n     * Create Tree\n     * @param {TreeData} tree - data for tree (see readme for description)\n     * @param {object} [options]\n     * @param {(HTMLElement|string)} [options.element] if a string then document.querySelector(element); if empty, it creates an element\n     * @param {(HTMLElement|string)} [options.parent] appends the element to this parent (if string then document.querySelector(parent))\n     * @param {boolean} [options.move=true] drag tree to rearrange\n     * @param {boolean} [options.select=true] click to select node (if false then nodes are not selected and tree.selection is always null)\n     * @param {number} [options.indentation=20] number of pixels to indent for each level\n     * @param {number} [options.threshold=10] number of pixels to move to start a drag\n     * @param {number} [options.holdTime=2000] number of milliseconds to press and hold name before editing starts (set to 0 to disable)\n     * @param {boolean} [options.expandOnClick=true] expand and collapse node on click without drag except (will select before expanding if select=true)\n     * @param {number} [options.dragOpacity=0.75] opacity setting for dragged item\n     * @param {string} [options.prefixClassName=yy-tree] first part of className for all DOM objects (e.g., yy-tree, yy-tree-indicator)\n     * @param {boolean} [options.addStyles=true] attaches a style sheet with default and overridden styles; set to false to use your own stylesheet\n     * @param {object} [styles]\n     * @param {string[]} [styles.nameStyles] use these to override individual styles for the name (will be included in the attached stylesheet)\n     * @param {string[]} [styles.contentStyles] use these to override individual styles for the content (will be included in the attached stylesheet)\n     * @param {string[]} [styles.indicatorStyles] use these to override individual styles for the move-line indicator (will be included in the attached stylesheet)\n     * @param {string[]} [styles.selectedStyles] use these to override individual styles for the selected item (will be included in the attached stylesheet)\n     * @fires render\n     * @fires clicked\n     * @fires expand\n     * @fires collapse\n     * @fires name-change\n     * @fires move\n     * @fires move-pending\n     * @fires update\n     */\n    constructor(tree, options, styles) {\n        super()\n        this._options = utils.options(options, defaults)\n        this._input = new Input(this)\n        if (typeof this._options.element === 'undefined') {\n            /**\n             * Main div holding tree\n             * @type {HTMLElement}\n             */\n            this.element = document.createElement('div')\n        } else {\n            this.element = utils.el(this._options.element)\n        }\n        if (this._options.parent) {\n            utils.el(this._options.parent).appendChild(this.element)\n        }\n        this.element.classList.add(this.prefixClassName)\n        this.element.data = tree\n        if (this._options.addStyles !== false) {\n            this._addStyles(styles)\n        }\n        this.update()\n    }\n\n    /**\n     * Selected data\n     * @type {*}\n     */\n    get selection() {\n        return this._selection.data\n    }\n    set selection(data) {\n    }\n\n    /**\n     * className's prefix (e.g., \"yy-tree\"-content)\n     * @type {string}\n     */\n    get prefixClassName() {\n        return this._options.prefixClassName\n    }\n    set prefixClassName(value) {\n        if (value !== this._options.prefixClassName) {\n            this._options.prefixClassName = value\n            this.update()\n        }\n    }\n\n    /**\n     * indentation for tree\n     * @type {number}\n     */\n    get indentation() {\n        return this._options.indentation\n    }\n    set indentation(value) {\n        if (value !== this._options.indentation) {\n            this._options.indentation = value\n            this._input._indicatorMarginLeft = value + 'px'\n            this.update()\n        }\n    }\n\n    /**\n     * number of milliseconds to press and hold name before editing starts (set to 0 to disable)\n     * @type {number}\n     */\n    get holdTime() {\n        return this._options.holdTime\n    }\n    set holdTime(value) {\n        if (value !== this._options.holdTime) {\n            this._options.holdTime = value\n        }\n    }\n\n    /**\n     * whether tree may be rearranged\n     * @type {boolean}\n     */\n    get move() {\n        return this._options.move\n    }\n    set move(value) {\n        this._options.move = value\n    }\n\n    /**\n     * expand and collapse node on click without drag except (will select before expanding if select=true)\n     * @type {boolean}\n     */\n    get expandOnClick() {\n        return this._options.expandOnClick\n    }\n    set expandOnClick(value) {\n        this._options.expandOnClick = value\n    }\n\n    /**\n     * click to select node (if false then nodes are not selected and tree.selection is always null)\n     * @type {boolean}\n     */\n    get select() {\n        return this._options.select\n    }\n    set select(value) {\n        this._options.select = value\n    }\n\n    /**\n     * opacity setting for dragged item\n     * @type {number}\n     */\n    get dragOpacity() {\n        return this._options.dragOpacity\n    }\n    set dragOpacity(value) {\n        this._options.dragOpacity = value\n    }\n\n    _leaf(data, level) {\n        const leaf = utils.html({ className: `${this.prefixClassName}-leaf` })\n        leaf.isLeaf = true\n        leaf.data = data\n        leaf.content = utils.html({ parent: leaf, className: `${this.prefixClassName}-content` })\n        leaf.style.marginLeft = this.indentation + 'px'\n        leaf.icon = utils.html({\n            parent: leaf.content,\n            html: data.expanded ? icons.open : icons.closed,\n            className: `${this.prefixClassName}-expand`\n        })\n        leaf.name = utils.html({ parent: leaf.content, html: data.name, className: `${this.prefixClassName}-name` })\n        leaf.name.addEventListener('mousedown', e => this._input._down(e))\n        leaf.name.addEventListener('touchstart', e => this._input._down(e))\n        for (let child of data.children) {\n            const add = this._leaf(child, level + 1)\n            add.data.parent = data\n            leaf.appendChild(add)\n            if (!data.expanded) {\n                add.style.display = 'none'\n            }\n        }\n        if (this._getChildren(leaf, true).length === 0) {\n            this._hideIcon(leaf)\n        }\n        clicked(leaf.icon, () => this.toggleExpand(leaf))\n        this.emit('render', leaf, this)\n        return leaf\n    }\n\n    _getChildren(leaf, all) {\n        leaf = leaf || this.element\n        const children = []\n        for (let child of leaf.children) {\n            if (child.isLeaf && (all || child.style.display !== 'none')) {\n                children.push(child)\n            }\n        }\n        return children\n    }\n\n    _hideIcon(leaf) {\n        if (leaf.isLeaf) {\n            leaf.icon.style.opacity = 0\n            leaf.icon.style.cursor = 'unset'\n        }\n    }\n\n    _showIcon(leaf) {\n        if (leaf.isLeaf) {\n            leaf.icon.style.opacity = 1\n            leaf.icon.style.cursor = this._options.cursorExpand\n        }\n    }\n\n    /** Expands all leaves */\n    expandAll() {\n        this._expandChildren(this.element)\n    }\n\n    _expandChildren(leaf) {\n        for (let child of this._getChildren(leaf, true)) {\n            this.expand(child)\n            this._expandChildren(child)\n        }\n    }\n\n    /** Collapses all leaves */\n    collapseAll() {\n        this._collapseChildren(this)\n    }\n\n    _collapseChildren(leaf) {\n        for (let child of this._getChildren(leaf, true)) {\n            this.collapse(child)\n            this._collapseChildren(child)\n        }\n    }\n\n    /**\n     * Toggles a leaf\n     * @param {HTMLElement} leaf\n     */\n    toggleExpand(leaf) {\n        if (leaf.icon.style.opacity !== '0') {\n            if (leaf.data.expanded) {\n                this.collapse(leaf)\n            } else {\n                this.expand(leaf)\n            }\n        }\n    }\n\n    /**\n     * Expands a leaf\n     * @param {HTMLElement} leaf\n     */\n    expand(leaf) {\n        if (leaf.isLeaf) {\n            const children = this._getChildren(leaf, true)\n            if (children.length) {\n                for (let child of children) {\n                    child.style.display = 'block'\n                }\n                leaf.data.expanded = true\n                leaf.icon.innerHTML = icons.open\n                this.emit('expand', leaf, this)\n                this.emit('update', leaf, this)\n            }\n        }\n    }\n\n    /**\n     * Collapses a leaf\n     * @param {HTMLElement} leaf\n     */\n    collapse(leaf) {\n        if (leaf.isLeaf) {\n            const children = this._getChildren(leaf, true)\n            if (children.length) {\n                for (let child of children) {\n                    child.style.display = 'none'\n                }\n                leaf.data.expanded = false\n                leaf.icon.innerHTML = icons.closed\n                this.emit('collapse', leaf, this)\n                this.emit('update', leaf, this)\n            }\n        }\n    }\n\n    /** call this after tree's data has been updated outside of this library */\n    update() {\n        const scroll = this.element.scrollTop\n        utils.removeChildren(this.element)\n        for (let leaf of this.element.data.children) {\n            const add = this._leaf(leaf, 0)\n            add.data.parent = this.element.data\n            this.element.appendChild(add)\n        }\n        this.element.scrollTop = scroll + 'px'\n    }\n\n    /**\n     * edit the name entry using the data\n     * @param {object} data element of leaf\n     */\n    editData(data) {\n        const children = this._getChildren(null, true)\n        for (let child of children) {\n            if (child.data === data) {\n                this.edit(child)\n            }\n        }\n    }\n\n    /**\n     * edit the name entry using the created element\n     * @param {HTMLElement} leaf\n     */\n    edit(leaf) {\n        this._editing = leaf\n        this._editInput = utils.html({ parent: this._editing.name.parentNode, type: 'input', className: `${this.prefixClassName}-name` })\n        const computed = window.getComputedStyle(this._editing.name)\n        this._editInput.style.boxSizing = 'content-box'\n        this._editInput.style.fontFamily = computed.getPropertyValue('font-family')\n        this._editInput.style.fontSize = computed.getPropertyValue('font-size')\n        this._editInput.value = this._editing.name.innerText\n        this._editInput.setSelectionRange(0, this._editInput.value.length)\n        this._editInput.focus()\n        this._editInput.addEventListener('update', () => {\n            this.nameChange(this._editing, this._editInput.value)\n            this._holdClose()\n        })\n        this._editInput.addEventListener('keyup', (e) => {\n            if (e.code === 'Escape') {\n                this._holdClose()\n            }\n            if (e.code === 'Enter') {\n                this.nameChange(this._editing, this._editInput.value)\n                this._holdClose()\n            }\n        })\n        this._editing.name.style.display = 'none'\n        this._target = null\n    }\n\n    _holdClose() {\n        if (this._editing) {\n            this._editInput.remove()\n            this._editing.name.style.display = 'block'\n            this._editing = this._editInput = null\n        }\n    }\n\n    /**\n     * change the name of a leaf\n     * @param {HTMLElement} leaf\n     * @param {string} name\n     */\n    nameChange(leaf, name) {\n        leaf.data.name = this._input.value\n        leaf.name.innerHTML = name\n        this.emit('name-change', leaf, this._input.value, this)\n        this.emit('update', leaf, this)\n    }\n\n    /**\n     * Find a leaf based using its data\n     * @param {object} leaf\n     * @param {HTMLElement} [root=this.element]\n     */\n    getLeaf(leaf, root = this.element) {\n        this.findInTree(root, data => data === leaf)\n    }\n\n    /**\n     * call the callback function on each node; returns the node if callback === true\n     * @param {*} leaf data\n     * @param {function} callback\n     */\n    findInTree(leaf, callback) {\n        for (const child of leaf.children) {\n            if (callback(child)) {\n                return child\n            }\n            const find = this.findInTree(child, callback)\n            if (find) {\n                return find\n            }\n        }\n    }\n\n    _getFirstChild(element, all) {\n        const children = this._getChildren(element, all)\n        if (children.length) {\n            return children[0]\n        }\n    }\n\n    _getLastChild(element, all) {\n        const children = this._getChildren(element, all)\n        if (children.length) {\n            return children[children.length - 1]\n        }\n    }\n\n    _getParent(element) {\n        element = element.parentNode\n        while (element.style.display === 'none') {\n            element = element.parentNode\n        }\n        return element\n    }\n\n    _addStyles(userStyles) {\n        const styles = utils.options(userStyles, styleDefaults)\n        let s = `.${this.prefixClassName}-name{`\n        for (const key in styles.nameStyles) {\n            s += `${key}:${styles.nameStyles[key]};`\n        }\n        s += `}.${this.prefixClassName}-content{`\n        for (const key in styles.contentStyles) {\n            s += `${key}:${styles.contentStyles[key]};`\n        }\n        s += `}.${this.prefixClassName}-indicator{`\n        for (const key in styles.indicatorStyles) {\n            s += `${key}:${styles.indicatorStyles[key]};`\n        }\n        s += `}.${this.prefixClassName}-expand{`\n        for (const key in styles.expandStyles) {\n            s += `${key}:${styles.expandStyles[key]};`\n        }\n        s += `}.${this.prefixClassName}-select{`\n        for (const key in styles.selectStyles) {\n            s += `${key}:${styles.selectStyles[key]};`\n        }\n        s + '}'\n        const style = document.createElement('style')\n        style.innerHTML = s\n        document.head.appendChild(style)\n    }\n}\n\n/**\n * @typedef {Object} Tree~TreeData\n * @property {TreeData[]} children\n * @property {string} name\n * @property {parent} [parent] if not provided then will traverse tree to find parent\n */\n\n/**\n  * trigger when expand is called either through UI interaction or Tree.expand()\n  * @event Tree~expand\n  * @type {object}\n  * @property {HTMLElement} tree element\n  * @property {Tree} Tree\n  */\n\n/**\n  * trigger when collapse is called either through UI interaction or Tree.expand()\n  * @event Tree~collapse\n  * @type {object}\n  * @property {HTMLElement} tree element\n  * @property {Tree} Tree\n  */\n\n/**\n  * trigger when name is change either through UI interaction or Tree.nameChange()\n  * @event Tree~name-change\n  * @type {object}\n  * @property {HTMLElement} tree element\n  * @property {string} name\n  * @property {Tree} Tree\n  */\n\n/**\n  * trigger when a leaf is picked up through UI interaction\n  * @event Tree~move-pending\n  * @type {object}\n  * @property {HTMLElement} tree element\n  * @property {Tree} Tree\n  */\n\n/**\n  * trigger when a leaf's location is changed\n  * @event Tree~move\n  * @type {object}\n  * @property {HTMLElement} tree element\n  * @property {Tree} Tree\n  */\n\n/**\n  * trigger when a leaf is clicked and not dragged or held\n  * @event Tree~clicked\n  * @type {object}\n  * @property {HTMLElement} tree element\n  * @property {UIEvent} event\n  * @property {Tree} Tree\n  */\n\n/**\n  * trigger when a leaf is changed (i.e., moved, name-change)\n  * @event Tree~update\n  * @type {object}\n  * @property {HTMLElement} tree element\n  * @property {Tree} Tree\n  */\n\n/**\n  * trigger when a leaf's div is created\n  * @event Tree~render\n  * @type {object}\n  * @property {HTMLElement} tree element\n  * @property {Tree} Tree\n  */",
    "static": true,
    "longname": "C:/Users/dsfig/programming/components/tree/src/tree.js",
    "access": "public",
    "description": null,
    "lineNumber": 1
  },
  {
    "__docId__": 1,
    "kind": "class",
    "name": "Tree",
    "memberof": "src/tree.js",
    "static": true,
    "longname": "src/tree.js~Tree",
    "access": "public",
    "export": true,
    "importPath": "yy-tree/src/tree.js",
    "importStyle": "{Tree}",
    "description": null,
    "lineNumber": 9,
    "undocument": true,
    "interface": false,
    "extends": [
      "eventemitter3~Events"
    ]
  },
  {
    "__docId__": 2,
    "kind": "typedef",
    "name": "Tree~TreeData",
    "memberof": "src/tree.js",
    "static": true,
    "longname": "src/tree.js~Tree~TreeData",
    "access": "public",
    "description": "",
    "properties": [
      {
        "nullable": null,
        "types": [
          "TreeData[]"
        ],
        "spread": false,
        "optional": false,
        "name": "children",
        "description": ""
      },
      {
        "nullable": null,
        "types": [
          "string"
        ],
        "spread": false,
        "optional": false,
        "name": "name",
        "description": ""
      },
      {
        "nullable": null,
        "types": [
          "parent"
        ],
        "spread": false,
        "optional": true,
        "name": "parent",
        "description": "if not provided then will traverse tree to find parent"
      }
    ],
    "type": {
      "types": [
        "Object"
      ],
      "optional": false,
      "name": "Tree~TreeData"
    }
  },
  {
    "__docId__": 3,
    "kind": "constructor",
    "name": "constructor",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#constructor",
    "access": "public",
    "description": "Create Tree",
    "lineNumber": 39,
    "unknown": [
      {
        "tagName": "@fires",
        "tagValue": "render"
      },
      {
        "tagName": "@fires",
        "tagValue": "clicked"
      },
      {
        "tagName": "@fires",
        "tagValue": "expand"
      },
      {
        "tagName": "@fires",
        "tagValue": "collapse"
      },
      {
        "tagName": "@fires",
        "tagValue": "name-change"
      },
      {
        "tagName": "@fires",
        "tagValue": "move"
      },
      {
        "tagName": "@fires",
        "tagValue": "move-pending"
      },
      {
        "tagName": "@fires",
        "tagValue": "update"
      }
    ],
    "params": [
      {
        "nullable": null,
        "types": [
          "TreeData"
        ],
        "spread": false,
        "optional": false,
        "name": "tree",
        "description": "data for tree (see readme for description)"
      },
      {
        "nullable": null,
        "types": [
          "object"
        ],
        "spread": false,
        "optional": true,
        "name": "options",
        "description": ""
      },
      {
        "nullable": null,
        "types": [
          "HTMLElement",
          "string"
        ],
        "spread": false,
        "optional": true,
        "name": "options.element",
        "description": "if a string then document.querySelector(element); if empty, it creates an element"
      },
      {
        "nullable": null,
        "types": [
          "HTMLElement",
          "string"
        ],
        "spread": false,
        "optional": true,
        "name": "options.parent",
        "description": "appends the element to this parent (if string then document.querySelector(parent))"
      },
      {
        "nullable": null,
        "types": [
          "boolean"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "true",
        "defaultRaw": true,
        "name": "options.move",
        "description": "drag tree to rearrange"
      },
      {
        "nullable": null,
        "types": [
          "boolean"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "true",
        "defaultRaw": true,
        "name": "options.select",
        "description": "click to select node (if false then nodes are not selected and tree.selection is always null)"
      },
      {
        "nullable": null,
        "types": [
          "number"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "20",
        "defaultRaw": 20,
        "name": "options.indentation",
        "description": "number of pixels to indent for each level"
      },
      {
        "nullable": null,
        "types": [
          "number"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "10",
        "defaultRaw": 10,
        "name": "options.threshold",
        "description": "number of pixels to move to start a drag"
      },
      {
        "nullable": null,
        "types": [
          "number"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "2000",
        "defaultRaw": 2000,
        "name": "options.holdTime",
        "description": "number of milliseconds to press and hold name before editing starts (set to 0 to disable)"
      },
      {
        "nullable": null,
        "types": [
          "boolean"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "true",
        "defaultRaw": true,
        "name": "options.expandOnClick",
        "description": "expand and collapse node on click without drag except (will select before expanding if select=true)"
      },
      {
        "nullable": null,
        "types": [
          "number"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "0.75",
        "defaultRaw": 0.75,
        "name": "options.dragOpacity",
        "description": "opacity setting for dragged item"
      },
      {
        "nullable": null,
        "types": [
          "string"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "yy-tree",
        "defaultRaw": "yy-tree",
        "name": "options.prefixClassName",
        "description": "first part of className for all DOM objects (e.g., yy-tree, yy-tree-indicator)"
      },
      {
        "nullable": null,
        "types": [
          "boolean"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "true",
        "defaultRaw": true,
        "name": "options.addStyles",
        "description": "attaches a style sheet with default and overridden styles; set to false to use your own stylesheet"
      },
      {
        "nullable": null,
        "types": [
          "object"
        ],
        "spread": false,
        "optional": true,
        "name": "styles",
        "description": ""
      },
      {
        "nullable": null,
        "types": [
          "string[]"
        ],
        "spread": false,
        "optional": true,
        "name": "styles.nameStyles",
        "description": "use these to override individual styles for the name (will be included in the attached stylesheet)"
      },
      {
        "nullable": null,
        "types": [
          "string[]"
        ],
        "spread": false,
        "optional": true,
        "name": "styles.contentStyles",
        "description": "use these to override individual styles for the content (will be included in the attached stylesheet)"
      },
      {
        "nullable": null,
        "types": [
          "string[]"
        ],
        "spread": false,
        "optional": true,
        "name": "styles.indicatorStyles",
        "description": "use these to override individual styles for the move-line indicator (will be included in the attached stylesheet)"
      },
      {
        "nullable": null,
        "types": [
          "string[]"
        ],
        "spread": false,
        "optional": true,
        "name": "styles.selectedStyles",
        "description": "use these to override individual styles for the selected item (will be included in the attached stylesheet)"
      }
    ]
  },
  {
    "__docId__": 4,
    "kind": "member",
    "name": "_options",
    "memberof": "src/tree.js~Tree",
    "static": false,
    "longname": "src/tree.js~Tree#_options",
    "access": "private",
    "description": null,
    "lineNumber": 41,
    "undocument": true,
    "ignore": true,
    "type": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 5,
    "kind": "member",
    "name": "_input",
    "memberof": "src/tree.js~Tree",
    "static": false,
    "longname": "src/tree.js~Tree#_input",
    "access": "private",
    "description": null,
    "lineNumber": 42,
    "undocument": true,
    "ignore": true,
    "type": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 6,
    "kind": "member",
    "name": "element",
    "memberof": "src/tree.js~Tree",
    "static": false,
    "longname": "src/tree.js~Tree#element",
    "access": "public",
    "description": "Main div holding tree",
    "lineNumber": 48,
    "type": {
      "nullable": null,
      "types": [
        "HTMLElement"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 8,
    "kind": "get",
    "name": "selection",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#selection",
    "access": "public",
    "description": "Selected data",
    "lineNumber": 67,
    "type": {
      "nullable": null,
      "types": [
        "*"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 9,
    "kind": "set",
    "name": "selection",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#selection",
    "access": "public",
    "description": null,
    "lineNumber": 70,
    "undocument": true
  },
  {
    "__docId__": 10,
    "kind": "get",
    "name": "prefixClassName",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#prefixClassName",
    "access": "public",
    "description": "className's prefix (e.g., \"yy-tree\"-content)",
    "lineNumber": 77,
    "type": {
      "nullable": null,
      "types": [
        "string"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 11,
    "kind": "set",
    "name": "prefixClassName",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#prefixClassName",
    "access": "public",
    "description": null,
    "lineNumber": 80,
    "undocument": true
  },
  {
    "__docId__": 12,
    "kind": "get",
    "name": "indentation",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#indentation",
    "access": "public",
    "description": "indentation for tree",
    "lineNumber": 91,
    "type": {
      "nullable": null,
      "types": [
        "number"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 13,
    "kind": "set",
    "name": "indentation",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#indentation",
    "access": "public",
    "description": null,
    "lineNumber": 94,
    "undocument": true
  },
  {
    "__docId__": 14,
    "kind": "get",
    "name": "holdTime",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#holdTime",
    "access": "public",
    "description": "number of milliseconds to press and hold name before editing starts (set to 0 to disable)",
    "lineNumber": 106,
    "type": {
      "nullable": null,
      "types": [
        "number"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 15,
    "kind": "set",
    "name": "holdTime",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#holdTime",
    "access": "public",
    "description": null,
    "lineNumber": 109,
    "undocument": true
  },
  {
    "__docId__": 16,
    "kind": "get",
    "name": "move",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#move",
    "access": "public",
    "description": "whether tree may be rearranged",
    "lineNumber": 119,
    "type": {
      "nullable": null,
      "types": [
        "boolean"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 17,
    "kind": "set",
    "name": "move",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#move",
    "access": "public",
    "description": null,
    "lineNumber": 122,
    "undocument": true
  },
  {
    "__docId__": 18,
    "kind": "get",
    "name": "expandOnClick",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#expandOnClick",
    "access": "public",
    "description": "expand and collapse node on click without drag except (will select before expanding if select=true)",
    "lineNumber": 130,
    "type": {
      "nullable": null,
      "types": [
        "boolean"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 19,
    "kind": "set",
    "name": "expandOnClick",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#expandOnClick",
    "access": "public",
    "description": null,
    "lineNumber": 133,
    "undocument": true
  },
  {
    "__docId__": 20,
    "kind": "get",
    "name": "select",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#select",
    "access": "public",
    "description": "click to select node (if false then nodes are not selected and tree.selection is always null)",
    "lineNumber": 141,
    "type": {
      "nullable": null,
      "types": [
        "boolean"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 21,
    "kind": "set",
    "name": "select",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#select",
    "access": "public",
    "description": null,
    "lineNumber": 144,
    "undocument": true
  },
  {
    "__docId__": 22,
    "kind": "get",
    "name": "dragOpacity",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#dragOpacity",
    "access": "public",
    "description": "opacity setting for dragged item",
    "lineNumber": 152,
    "type": {
      "nullable": null,
      "types": [
        "number"
      ],
      "spread": false,
      "description": null
    }
  },
  {
    "__docId__": 23,
    "kind": "set",
    "name": "dragOpacity",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#dragOpacity",
    "access": "public",
    "description": null,
    "lineNumber": 155,
    "undocument": true
  },
  {
    "__docId__": 24,
    "kind": "method",
    "name": "_leaf",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_leaf",
    "access": "private",
    "description": null,
    "lineNumber": 159,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "data",
        "types": [
          "*"
        ]
      },
      {
        "name": "level",
        "types": [
          "*"
        ]
      }
    ],
    "return": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 25,
    "kind": "method",
    "name": "_getChildren",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_getChildren",
    "access": "private",
    "description": null,
    "lineNumber": 189,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "leaf",
        "types": [
          "*"
        ]
      },
      {
        "name": "all",
        "types": [
          "*"
        ]
      }
    ],
    "return": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 26,
    "kind": "method",
    "name": "_hideIcon",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_hideIcon",
    "access": "private",
    "description": null,
    "lineNumber": 200,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "leaf",
        "types": [
          "*"
        ]
      }
    ],
    "return": null
  },
  {
    "__docId__": 27,
    "kind": "method",
    "name": "_showIcon",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_showIcon",
    "access": "private",
    "description": null,
    "lineNumber": 207,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "leaf",
        "types": [
          "*"
        ]
      }
    ],
    "return": null
  },
  {
    "__docId__": 28,
    "kind": "method",
    "name": "expandAll",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#expandAll",
    "access": "public",
    "description": "Expands all leaves",
    "lineNumber": 215,
    "params": [],
    "return": null
  },
  {
    "__docId__": 29,
    "kind": "method",
    "name": "_expandChildren",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_expandChildren",
    "access": "private",
    "description": null,
    "lineNumber": 219,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "leaf",
        "types": [
          "*"
        ]
      }
    ],
    "return": null
  },
  {
    "__docId__": 30,
    "kind": "method",
    "name": "collapseAll",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#collapseAll",
    "access": "public",
    "description": "Collapses all leaves",
    "lineNumber": 227,
    "params": [],
    "return": null
  },
  {
    "__docId__": 31,
    "kind": "method",
    "name": "_collapseChildren",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_collapseChildren",
    "access": "private",
    "description": null,
    "lineNumber": 231,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "leaf",
        "types": [
          "*"
        ]
      }
    ],
    "return": null
  },
  {
    "__docId__": 32,
    "kind": "method",
    "name": "toggleExpand",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#toggleExpand",
    "access": "public",
    "description": "Toggles a leaf",
    "lineNumber": 242,
    "params": [
      {
        "nullable": null,
        "types": [
          "HTMLElement"
        ],
        "spread": false,
        "optional": false,
        "name": "leaf",
        "description": ""
      }
    ],
    "return": null
  },
  {
    "__docId__": 33,
    "kind": "method",
    "name": "expand",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#expand",
    "access": "public",
    "description": "Expands a leaf",
    "lineNumber": 256,
    "params": [
      {
        "nullable": null,
        "types": [
          "HTMLElement"
        ],
        "spread": false,
        "optional": false,
        "name": "leaf",
        "description": ""
      }
    ],
    "return": null
  },
  {
    "__docId__": 34,
    "kind": "method",
    "name": "collapse",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#collapse",
    "access": "public",
    "description": "Collapses a leaf",
    "lineNumber": 275,
    "params": [
      {
        "nullable": null,
        "types": [
          "HTMLElement"
        ],
        "spread": false,
        "optional": false,
        "name": "leaf",
        "description": ""
      }
    ],
    "return": null
  },
  {
    "__docId__": 35,
    "kind": "method",
    "name": "update",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#update",
    "access": "public",
    "description": "call this after tree's data has been updated outside of this library",
    "lineNumber": 291,
    "params": [],
    "return": null
  },
  {
    "__docId__": 36,
    "kind": "method",
    "name": "editData",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#editData",
    "access": "public",
    "description": "edit the name entry using the data",
    "lineNumber": 306,
    "params": [
      {
        "nullable": null,
        "types": [
          "object"
        ],
        "spread": false,
        "optional": false,
        "name": "data",
        "description": "element of leaf"
      }
    ],
    "return": null
  },
  {
    "__docId__": 37,
    "kind": "method",
    "name": "edit",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#edit",
    "access": "public",
    "description": "edit the name entry using the created element",
    "lineNumber": 319,
    "params": [
      {
        "nullable": null,
        "types": [
          "HTMLElement"
        ],
        "spread": false,
        "optional": false,
        "name": "leaf",
        "description": ""
      }
    ],
    "return": null
  },
  {
    "__docId__": 38,
    "kind": "member",
    "name": "_editing",
    "memberof": "src/tree.js~Tree",
    "static": false,
    "longname": "src/tree.js~Tree#_editing",
    "access": "private",
    "description": null,
    "lineNumber": 320,
    "undocument": true,
    "ignore": true,
    "type": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 39,
    "kind": "member",
    "name": "_editInput",
    "memberof": "src/tree.js~Tree",
    "static": false,
    "longname": "src/tree.js~Tree#_editInput",
    "access": "private",
    "description": null,
    "lineNumber": 321,
    "undocument": true,
    "ignore": true,
    "type": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 40,
    "kind": "member",
    "name": "_target",
    "memberof": "src/tree.js~Tree",
    "static": false,
    "longname": "src/tree.js~Tree#_target",
    "access": "private",
    "description": null,
    "lineNumber": 343,
    "undocument": true,
    "ignore": true,
    "type": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 41,
    "kind": "method",
    "name": "_holdClose",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_holdClose",
    "access": "private",
    "description": null,
    "lineNumber": 346,
    "undocument": true,
    "ignore": true,
    "params": [],
    "return": null
  },
  {
    "__docId__": 43,
    "kind": "method",
    "name": "nameChange",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#nameChange",
    "access": "public",
    "description": "change the name of a leaf",
    "lineNumber": 359,
    "params": [
      {
        "nullable": null,
        "types": [
          "HTMLElement"
        ],
        "spread": false,
        "optional": false,
        "name": "leaf",
        "description": ""
      },
      {
        "nullable": null,
        "types": [
          "string"
        ],
        "spread": false,
        "optional": false,
        "name": "name",
        "description": ""
      }
    ],
    "return": null
  },
  {
    "__docId__": 44,
    "kind": "method",
    "name": "getLeaf",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#getLeaf",
    "access": "public",
    "description": "Find a leaf based using its data",
    "lineNumber": 371,
    "params": [
      {
        "nullable": null,
        "types": [
          "object"
        ],
        "spread": false,
        "optional": false,
        "name": "leaf",
        "description": ""
      },
      {
        "nullable": null,
        "types": [
          "HTMLElement"
        ],
        "spread": false,
        "optional": true,
        "defaultValue": "this.element",
        "defaultRaw": "this.element",
        "name": "root",
        "description": ""
      }
    ],
    "return": null
  },
  {
    "__docId__": 45,
    "kind": "method",
    "name": "findInTree",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#findInTree",
    "access": "public",
    "description": "call the callback function on each node; returns the node if callback === true",
    "lineNumber": 380,
    "params": [
      {
        "nullable": null,
        "types": [
          "*"
        ],
        "spread": false,
        "optional": false,
        "name": "leaf",
        "description": "data"
      },
      {
        "nullable": null,
        "types": [
          "function"
        ],
        "spread": false,
        "optional": false,
        "name": "callback",
        "description": ""
      }
    ],
    "return": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 46,
    "kind": "method",
    "name": "_getFirstChild",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_getFirstChild",
    "access": "private",
    "description": null,
    "lineNumber": 392,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "element",
        "types": [
          "*"
        ]
      },
      {
        "name": "all",
        "types": [
          "*"
        ]
      }
    ],
    "return": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 47,
    "kind": "method",
    "name": "_getLastChild",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_getLastChild",
    "access": "private",
    "description": null,
    "lineNumber": 399,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "element",
        "types": [
          "*"
        ]
      },
      {
        "name": "all",
        "types": [
          "*"
        ]
      }
    ],
    "return": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 48,
    "kind": "method",
    "name": "_getParent",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_getParent",
    "access": "private",
    "description": null,
    "lineNumber": 406,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "element",
        "types": [
          "*"
        ]
      }
    ],
    "return": {
      "types": [
        "*"
      ]
    }
  },
  {
    "__docId__": 49,
    "kind": "method",
    "name": "_addStyles",
    "memberof": "src/tree.js~Tree",
    "generator": false,
    "async": false,
    "static": false,
    "longname": "src/tree.js~Tree#_addStyles",
    "access": "private",
    "description": null,
    "lineNumber": 414,
    "undocument": true,
    "ignore": true,
    "params": [
      {
        "name": "userStyles",
        "types": [
          "*"
        ]
      }
    ],
    "return": null
  },
  {
    "kind": "index",
    "content": "# tree\nVanilla drag-and-drop UI tree\n\n## Rationale\nI needed a tree components for my tools. Most of the available visual tree APIs require vue or react. And so yy-tree was created.\n\n## Super Simple Example\n```js\nconst data = {\n    children: [\n        { name: 'fruits', children: [\n            { name: 'apples', children: [] },\n            { name: 'oranges', children: [\n                { name: 'tangerines', children: [] },\n                { name: 'mandarins', children: [] },\n                { name: 'pomelo', children: [] },\n                { name: 'blood orange', children: [] },\n            ] }\n        ]},\n        { name: 'vegetables', children: [\n            { name: 'brocolli', children: [] },\n        ] },\n    ]\n}\n\nconst tree = new Tree(data, { parent: document.body })\n```\n\n## Live Examples\nhttps://davidfig.github.io/tree/\n\n## API Documentation\nhttps://davidfig.github.io/tree/jsdoc/\n\n## Installation\n\n    npm i yy-tree\n\n## license\nMIT License\n(c) 2021 [YOPEY YOPEY LLC](https://yopeyopey.com/) by [David Figatner](https://twitter.com/yopey_yopey/)\n",
    "longname": "C:\\Users\\dsfig\\programming\\components\\tree\\README.md",
    "name": "./README.md",
    "static": true,
    "access": "public"
  }
]