Skip to content

Commit 3a8010a

Browse files
committed
feat(app): link component DOM tree with directives founded
1 parent 3d3cd31 commit 3a8010a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/resources/js/tree.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,20 @@ document.addEventListener('DOMContentLoaded', function() {
6060
newNode.name = COMPONENTS[i].name;
6161
}
6262
}
63+
for(var i = 0; i < DIRECTIVES.length; i++) {
64+
if (value.attributes) {
65+
for(attr in value.attributes) {
66+
if (DIRECTIVES[i].selector.indexOf(attr) !== -1) {
67+
newNode.font = {
68+
multi: 'html'
69+
};
70+
newNode.label = '<b>' + newNode.label + '</b>';
71+
newNode.color = '#FF9800';
72+
newNode.name = DIRECTIVES[i].name;
73+
}
74+
}
75+
}
76+
}
6377
newNodes.push(newNode);
6478
newEdges.push({
6579
from: parentNode._parent._id,

src/resources/styles/compodoc.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,3 +686,6 @@ path.link {
686686
.tree-legend .component {
687687
background: #fb7e81;
688688
}
689+
.tree-legend .directive {
690+
background: #FF9800;
691+
}

src/templates/partials/component.hbs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
<div>
6565
<div class="color component"></div><span>Component</span>
6666
</div>
67+
<div>
68+
<div class="color directive"></div><span>Html element with directive</span>
69+
</div>
6770
</div>
6871
</div>
6972
</div>
@@ -78,6 +81,7 @@
7881
var COMPONENT_TEMPLATE = '<div>{{{escapeSimpleQuote component.templateData }}}</div>'
7982
{{/if}}
8083
var COMPONENTS = [{{#each components}}{'name': '{{name}}', 'selector': '{{selector}}'}{{#unless @last}},{{/unless}}{{/each}}];
84+
var DIRECTIVES = [{{#each directives}}{'name': '{{name}}', 'selector': '{{selector}}'}{{#unless @last}},{{/unless}}{{/each}}];
8185
var ACTUAL_COMPONENT = {'name': '{{ name }}'};
8286
</script>
8387
<script src="{{relativeURL depth pageType 'root'}}js/tree.js"></script>

0 commit comments

Comments
 (0)