11import { loadLevel } from "./index" ;
2-
3- function block ( className , element = "div" ) {
4- let el = document . createElement ( element ) ;
5- el . className = className ;
6- return el ;
7- }
2+ import { block } from "../utils" ;
83
94function getPropertyBlock ( prop ) {
10- let item = block ( `item` ) ,
11- icon = block ( `icon ${ prop [ "Private" ] ? "private" : "public" } ` ) ,
12- text = block ( `label ` , `span ` ) ,
13- pName = block ( `name ` , `span ` ) ,
5+ let item = block ( `div` , ` item`) ,
6+ icon = block ( `div` , ` icon ${ prop [ "Private" ] ? "private" : "public" } `) ,
7+ text = block ( `span ` , `label ` ) ,
8+ pName = block ( `span ` , `name ` ) ,
149 type = prop [ "Type" ] || prop [ "ReturnType" ] || prop [ "MimeType" ] || "" ,
15- pTypeText = type ? block ( "" , " span" ) : null ,
16- pType = type ? block ( `type ` , `span ` ) : null ;
10+ pTypeText = type ? block ( ` span` ) : null ,
11+ pType = type ? block ( `span ` , `type ` ) : null ;
1712 item . appendChild ( icon ) ;
1813 pName . textContent = prop [ "Name" ] ;
1914 text . appendChild ( pName ) ;
@@ -29,11 +24,11 @@ function getPropertyBlock (prop) {
2924
3025function getBlock ( key , data ) {
3126
32- let section = block ( `section` ) , body , header ;
27+ let section = block ( `div` , ` section`) , body , header ;
3328 for ( let prop in data [ key ] ) {
34- header = block ( `header` ) ;
29+ header = block ( `div` , ` header`) ;
3530 header . textContent = key ;
36- body = block ( `body` ) ;
31+ body = block ( `div` , ` body`) ;
3732 section . appendChild ( header ) ;
3833 section . appendChild ( body ) ;
3934 break ;
@@ -51,10 +46,10 @@ function getBlock (key, data) {
5146 * @returns {HTMLElement }
5247 */
5348export function getCardElement ( data ) {
54- let card = block ( `card ${ data [ "_type" ] } ` ) ,
55- head = block ( `head` ) ,
56- headIcon = block ( `cardIcon ${ data [ "ClassType" ] || "" } ` ) ,
57- header = block ( `header` ) ;
49+ let card = block ( `div` , ` card ${ data [ "_type" ] } `) ,
50+ head = block ( `div` , ` head`) ,
51+ headIcon = block ( `div` , ` cardIcon ${ data [ "ClassType" ] || "" } `) ,
52+ header = block ( `div` , ` header`) ;
5853
5954 header . textContent = data [ "name" ] ;
6055 head . appendChild ( headIcon ) ;
0 commit comments