Comparing version 1.0.3 to 1.0.4
{ | ||
"name": "treeboxjs", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": " Display and navigate hierarchical views ", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -35,3 +35,3 @@ <div align="right"> | ||
```js | ||
import TreeBox from 'treeboxjs'; | ||
const TreeBox = require('treeboxjs'); | ||
@@ -59,3 +59,3 @@ ... | ||
```js | ||
import TreeBox from 'treeboxjs'; | ||
const TreeBox = require('treeboxjs'); | ||
@@ -73,9 +73,9 @@ const nodes = { | ||
file: { | ||
display: ` | ||
<div> | ||
<p>Another file</p> | ||
<p>Multiple elements must be wrapped in a single enclosing element</p> | ||
<a treebox-href="/directory/file">Link to /directory/file within treebox</a> | ||
</div> | ||
`, | ||
display: String.raw` | ||
<div> | ||
<p>Another file</p> | ||
<p>Multiple elements must be wrapped in a single enclosing element</p> | ||
<a treebox-href="/directory/file">Link to /directory/file within treebox</a> | ||
</div> | ||
`.trim(), | ||
}, | ||
@@ -85,3 +85,7 @@ }, | ||
const root = document.getElementById('myTreeBoxRoot'); | ||
// const root = document.getElementById('myTreeBoxRoot'); // if in the browser | ||
const root = { | ||
appendChild: (x) => console.log('Rendered:\n', x), | ||
removeChild: () => console.log('\nCleared\n'), | ||
}; | ||
@@ -93,2 +97,28 @@ const tb = new TreeBox({nodes, root}); // Initiate treebox and append it to the "root" element | ||
tb.navigate('/'); // This code will cause treebox to render the `display` HTML at `nodes.children` | ||
/* OUTPUT: */ | ||
/* | ||
* Rendered: | ||
* <h1>treebox example</h1> | ||
* | ||
* Cleared | ||
* | ||
* Rendered: | ||
* <div> | ||
* <p>Another file</p> | ||
* <p>Multiple elements must be wrapped in a single enclosing element</p> | ||
* <a treebox-href="/directory/file">Link to /directory/file within treebox</a> | ||
* </div> | ||
* | ||
* Cleared | ||
* | ||
* Rendered: | ||
* <p>A file</p> | ||
* | ||
* Cleared | ||
* | ||
* Rendered: | ||
* <h1>treebox example</h1> | ||
*/ | ||
``` |
9816
120