File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 240240 text-transform : uppercase;
241241 letter-spacing : 0.08em ;
242242 color : var (--text-imports-label );
243- margin-bottom : 4px ;
243+ cursor : pointer;
244+ list-style : none;
245+ }
246+
247+ .cd-imports__label ::-webkit-details-marker {
248+ display : none;
249+ }
250+
251+ .cd-imports__label ::before {
252+ content : "▶ " ;
253+ font-size : 9px ;
254+ }
255+
256+ .cd-imports [open ] > .cd-imports__label ::before {
257+ content : "▼ " ;
244258}
245259
246260.cd-imports__item {
398412 </ div >
399413 < div class ="cd-node__body ">
400414 {% if node.imports %}
401- < div class ="cd-imports ">
402- < div class ="cd-imports__label "> IMPORTS</ div >
415+ < details class ="cd-imports ">
416+ < summary class ="cd-imports__label "> IMPORTS ({{ node.imports | length }}) </ summary >
403417 {% for imp in node.imports %}
404418 < div class ="cd-imports__item "> → {{ imp }}</ div >
405419 {% endfor %}
406- </ div >
420+ </ details >
407421 {% endif %}
408422 {% if node.summary %}
409423 < div class ="cd-summary "> {{ node.summary }}</ div >
Original file line number Diff line number Diff line change 293293 text-transform : uppercase;
294294 letter-spacing : 0.08em ;
295295 color : var (--text-imports-label );
296- margin-bottom : 4px ;
296+ cursor : pointer;
297+ list-style : none;
298+ }
299+
300+ .cd-imports__label ::-webkit-details-marker {
301+ display : none;
302+ }
303+
304+ .cd-imports__label ::before {
305+ content : "▶ " ;
306+ font-size : 9px ;
307+ }
308+
309+ .cd-imports [open ] > .cd-imports__label ::before {
310+ content : "▼ " ;
297311}
298312
299313.cd-imports__item {
@@ -827,9 +841,9 @@ <h1 class="cd-header__title">codedocent</h1>
827841
828842 // Imports
829843 if ( node . imports && node . imports . length > 0 ) {
830- const imp = document . createElement ( 'div ' ) ;
844+ const imp = document . createElement ( 'details ' ) ;
831845 imp . className = 'cd-imports' ;
832- imp . innerHTML = '<div class="cd-imports__label">IMPORTS</div >' +
846+ imp . innerHTML = '<summary class="cd-imports__label">IMPORTS (' + node . imports . length + ')</summary >' +
833847 node . imports . map ( i => '<div class="cd-imports__item">\u2192 ' + escapeHtml ( i ) + '</div>' ) . join ( '' ) ;
834848 body . appendChild ( imp ) ;
835849 }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44
55[project ]
66name = " codedocent"
7- version = " 0.2.0 "
7+ version = " 0.2.1 "
88description = " Code visualization for non-programmers"
99license = " MIT"
1010requires-python = " >=3.10"
You can’t perform that action at this time.
0 commit comments