<commit_before>_[Demo and API docs](https://owox.github.io/brainy-tree/)_

# &lt;brainy-tree&gt;

`brainy-tree` is a Polymer 1.x data tree web component.

A fork of [nuxeo-tree](https://www.webcomponents.org/element/nuxeo/nuxeo-ui-elements/nuxeo-tree) with some changes related to handling external data mutations, and some useful methods regarding common UX patterns like adding and deleting nodes.

<!--
```
<custom-element-demo>
  <template>
    <script src="../webcomponentsjs/webcomponents-lite.js"></script>
    <link rel="import" href="../paper-icon-button/paper-icon-button.html">
    <link rel="import" href="../paper-input/paper-input.html">
    <link rel="import" href="../iron-icon/iron-icon.html">
    <link rel="import" href="../iron-icons/hardware-icons.html">
    <link rel="import" href="../iron-icons/iron-icons.html">
    <link rel="import" href="brainy-tree.html">
    <script src="demo/data.js"></script>
    <div>
      <template is="dom-bind">
        <next-code-block></next-code-block>
      </template>
      <script>
        (function() {
          'use strict';

          document.addEventListener('WebComponentsReady', function() {
            var scope = document.querySelector('template[is="dom-bind"]');
            var tree = document.querySelector('brainy-tree');
            scope.data = window.demoData;
            scope._onDeleteTap = function(e) {
              // get tree node from where delete was called
              var node = e.model.dataHost;
              var id = node.dataset.id;

              // get parent node
              var parent = tree.getParentById(id);

              // get path to given node
              var path = tree.getPathById('data', id);

              // get index for given node
              var index = tree.getChildNodeIndexById(parent, id);
<commit_msg>Add "cursor: pointer" for toggle icons in inline demo<commit_after>_[Demo and API docs](https://owox.github.io/brainy-tree/)_

# &lt;brainy-tree&gt;

`brainy-tree` is a Polymer 1.x data tree web component.

A fork of [nuxeo-tree](https://www.webcomponents.org/element/nuxeo/nuxeo-ui-elements/nuxeo-tree) with some changes related to handling external data mutations, and some useful methods regarding common UX patterns like adding and deleting nodes.

<!--
```
<custom-element-demo>
  <template>
    <script src="../webcomponentsjs/webcomponents-lite.js"></script>
    <link rel="import" href="../paper-icon-button/paper-icon-button.html">
    <link rel="import" href="../paper-input/paper-input.html">
    <link rel="import" href="../iron-icon/iron-icon.html">
    <link rel="import" href="../iron-icons/hardware-icons.html">
    <link rel="import" href="../iron-icons/iron-icons.html">
    <link rel="import" href="brainy-tree.html">
    <script src="demo/data.js"></script>
    <style is="custom-style">
      [toggle] {
        cursor: pointer;
      }
    </style>
    <div>
      <template is="dom-bind">
        <next-code-block></next-code-block>
      </template>
      <script>
        (function() {
          'use strict';

          document.addEventListener('WebComponentsReady', function() {
            var scope = document.querySelector('template[is="dom-bind"]');
            var tree = document.querySelector('brainy-tree');
            scope.data = window.demoData;
            scope._onDeleteTap = function(e) {
              // get tree node from where delete was called
              var node = e.model.dataHost;
              var id = node.dataset.id;

              // get parent node
              var parent = tree.getParentById(id);

              // get path to given node
              var path = tree.getPathById('data', id);

              // get index for given node
              var index = tree.getChildNodeIndexById(parent, id);

{'fraction_non_alphanumeric': 0.1474072124243222, 'fraction_numerical': 0.0005264543300868649, 'mean_word_length': 2.476669716376944, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 41, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '158187', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1093, 'n_words': 260}