@ -16,46 +16,90 @@ const builder = {
openedChain : { }
} ,
componentFromHTML : function ( htmlText ) {
/ * *
* @ type { Object }
* /
extensions : { } ,
/ * *
*
* @ param { string } htmlText
* @ param { Modifier } modifier
* @ returns { Component }
* /
componentFromHTML : function ( htmlText , modifier = null ) {
/ * *
* @ type { Component }
* /
let compel = new Component ( new DOMParser ( ) . parseFromString ( htmlText , "text/html" ) ) ;
if ( modifier ) {
return compel . modifier ( modifier ) ;
}
return compel ;
} ,
/ * *
*
* @ param { HTMLElement } element
* @ param { Modifier } modifier
* @ returns { Component }
* /
componentFromHTMLElement : function ( element , modifier = null ) {
let newCompel = new Component ( element ) ;
if ( modifier ) {
return newCompel . modifier ( modifier ) ;
}
return newCompel ;
} ,
/ * *
*
* @ param { string } tag
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
genTag : function ( tag , attr = { } ) { return new Component ( document . createElement ( tag ) , attr ) . addStyleClass ( ` el- ${ tag } ` ) ; } ,
genTag : function ( tag , attr = { } , modifier = null ) {
let compel = new Component ( document . createElement ( tag ) , attr ) . addStyleClass ( ` el- ${ tag } ` ) ;
if ( modifier ) {
return compel . modifier ( modifier ) ;
}
return compel ;
} ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
anchor : function ( attr = { } ) { return builder . genTag ( "a" , attr ) ; } ,
anchor : function ( attr = { } , modifier = null ) { return builder . genTag ( "a" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
label : function ( attr = { } ) { return builder . genTag ( "label" , attr ) ; } ,
label : function ( attr = { } , modifier = null ) { return builder . genTag ( "label" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
button : function ( attr = { } ) { return builder . genTag ( "button" , attr ) ; } ,
button : function ( attr = { } , modifier = null ) { return builder . genTag ( "button" , attr , modifie r ) ; } ,
/ * *
*
* @ param { InputTypes | string } type
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
input : function ( type , attr = { } ) {
input : function ( type , attr = { } , modifier = null ) {
return new InputComponent (
document . createElement ( "input" ) ,
Object . assign ( { "type" : type } , attr )
Object . assign ( { "type" : type } , attr ) ,
modifier
)
. addStyleClass ( ` el-input ` ) ;
} ,
@ -64,111 +108,125 @@ const builder = {
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Function < Component > }
* /
inputTags : Object . freeze ( {
button : function ( attr = { } ) { return builder . input ( "button" , attr ) } ,
checkbox : function ( attr = { } ) { return builder . input ( "checkbox" , attr ) } ,
color : function ( attr = { } ) { return builder . input ( "color" , attr ) } ,
date : function ( attr = { } ) { return builder . input ( "date" , attr ) } ,
datetime : function ( attr = { } ) { return builder . input ( "datetime" , attr ) } ,
datetime_local : function ( attr = { } ) { return builder . input ( "datetime-local" , attr ) } ,
email : function ( attr = { } ) { return builder . input ( "email" , attr ) } ,
file : function ( attr = { } ) { return builder . input ( "file" , attr ) } ,
image : function ( attr = { } ) { return builder . input ( "image" , attr ) } ,
month : function ( attr = { } ) { return builder . input ( "month" , attr ) } ,
number : function ( attr = { } ) { return builder . input ( "number" , attr ) } ,
password : function ( attr = { } ) { return builder . input ( "password" , attr ) } ,
radio : function ( attr = { } ) { return builder . input ( "radio" , attr ) } ,
range : function ( attr = { } ) { return builder . input ( "range" , attr ) } ,
reset : function ( attr = { } ) { return builder . input ( "reset" , attr ) } ,
search : function ( attr = { } ) { return builder . input ( "search" , attr ) } ,
submit : function ( attr = { } ) { return builder . input ( "submit" , attr ) } ,
tel : function ( attr = { } ) { return builder . input ( "tel" , attr ) } ,
text : function ( attr = { } ) { return builder . input ( "text" , attr ) } ,
time : function ( attr = { } ) { return builder . input ( "time" , attr ) } ,
url : function ( attr = { } ) { return builder . input ( "url" , attr ) } ,
week : function ( attr = { } ) { return builder . input ( "week" , attr ) }
button : function ( attr = { } , modifier = null ) { return builder . input ( "button" , attr , modifie r ) } ,
checkbox : function ( attr = { } , modifier = null ) { return builder . input ( "checkbox" , attr , modifie r ) } ,
color : function ( attr = { } , modifier = null ) { return builder . input ( "color" , attr , modifie r ) } ,
date : function ( attr = { } , modifier = null ) { return builder . input ( "date" , attr , modifie r ) } ,
datetime : function ( attr = { } , modifier = null ) { return builder . input ( "datetime" , attr , modifie r ) } ,
datetime_local : function ( attr = { } , modifier = null ) { return builder . input ( "datetime-local" , attr , modifie r ) } ,
email : function ( attr = { } , modifier = null ) { return builder . input ( "email" , attr , modifie r ) } ,
file : function ( attr = { } , modifier = null ) { return builder . input ( "file" , attr , modifie r ) } ,
image : function ( attr = { } , modifier = null ) { return builder . input ( "image" , attr , modifie r ) } ,
month : function ( attr = { } , modifier = null ) { return builder . input ( "month" , attr , modifie r ) } ,
number : function ( attr = { } , modifier = null ) { return builder . input ( "number" , attr , modifie r ) } ,
password : function ( attr = { } , modifier = null ) { return builder . input ( "password" , attr , modifie r ) } ,
radio : function ( attr = { } , modifier = null ) { return builder . input ( "radio" , attr , modifie r ) } ,
range : function ( attr = { } , modifier = null ) { return builder . input ( "range" , attr , modifie r ) } ,
reset : function ( attr = { } , modifier = null ) { return builder . input ( "reset" , attr , modifie r ) } ,
search : function ( attr = { } , modifier = null ) { return builder . input ( "search" , attr , modifie r ) } ,
submit : function ( attr = { } , modifier = null ) { return builder . input ( "submit" , attr , modifie r ) } ,
tel : function ( attr = { } , modifier = null ) { return builder . input ( "tel" , attr , modifie r ) } ,
text : function ( attr = { } , modifier = null ) { return builder . input ( "text" , attr , modifie r ) } ,
time : function ( attr = { } , modifier = null ) { return builder . input ( "time" , attr , modifie r ) } ,
url : function ( attr = { } , modifier = null ) { return builder . input ( "url" , attr , modifie r ) } ,
week : function ( attr = { } , modifier = null ) { return builder . input ( "week" , attr , modifie r ) }
} ) ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
div : function ( attr = { } ) { return builder . genTag ( "div" , attr ) ; } ,
div : function ( attr = { } , modifier = null ) { return builder . genTag ( "div" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
span : function ( attr = { } ) { return builder . genTag ( "span" , attr ) ; } ,
span : function ( attr = { } , modifier = null ) { return builder . genTag ( "span" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
paragraph : function ( attr = { } ) { return builder . genTag ( "p" , attr ) ; } ,
paragraph : function ( attr = { } , modifier = null ) { return builder . genTag ( "p" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
header : function ( sizeGroup , attr = { } ) { return builder . genTag ( ` h ${ sizeGroup } ` , attr ) ; } ,
header : function ( sizeGroup , attr = { } , modifier = null ) { return builder . genTag ( ` h ${ sizeGroup } ` , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
checkbox : function ( attr = { } ) { return builder . input ( { "type" : "checkbox" } ) } ,
checkbox : function ( attr = { } , modifier = null ) { return builder . input ( { "type" : "checkbox" } , modifier ) } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
select : function ( attr = { } ) { return builder . genTag ( "select" , attr ) ; } ,
select : function ( attr = { } , modifier = null ) { return builder . genTag ( "select" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
option : function ( attr = { } ) { return builder . genTag ( "option" , attr ) ; } ,
option : function ( attr = { } , modifier = null ) { return builder . genTag ( "option" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
radioBtn : function ( attr = { } ) { return builder . genTag ( "radioBtn" , attr ) ; } ,
radioBtn : function ( attr = { } , modifier = null ) { return builder . genTag ( "radioBtn" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
icon : function ( attr = { } ) { return builder . genTag ( "icon" , attr ) ; } ,
icon : function ( attr = { } , modifier = null ) { return builder . genTag ( "icon" , attr , modifier ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
img : function ( attr = { } ) { return builder . genTag ( "img" , attr ) ; } ,
img : function ( attr = { } , modifier = null ) { return builder . genTag ( "img" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
textarea : function ( attr = { } ) {
textarea : function ( attr = { } , modifier = null ) {
return new InputComponent (
document . createElement ( "textarea" ) ,
attr
attr ,
modifier
)
. addStyleClass ( ` el-textarea ` ) ;
} ,
@ -176,10 +234,11 @@ const builder = {
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
table : function ( attr = { } ) {
return builder . genTag ( "table" , attr )
table : function ( attr = { } , modifier = null ) {
return builder . genTag ( "table" , attr , modifier )
. chainModifier ( )
. removeStyleRule ( "display" )
. toComponent ( ) ;
@ -188,38 +247,43 @@ const builder = {
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
tableRow : function ( attr = { } ) { return builder . genTag ( "tr" , attr ) ; } ,
tableRow : function ( attr = { } , modifier = null ) { return builder . genTag ( "tr" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
tableCell : function ( attr = { } ) { return builder . genTag ( "td" , attr ) ; } ,
tableCell : function ( attr = { } , modifier = null ) { return builder . genTag ( "td" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
tableCaption : function ( attr = { } ) { return builder . genTag ( "caption" , attr ) ; } ,
tableCaption : function ( attr = { } , modifier = null ) { return builder . genTag ( "caption" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
tableHeadCell : function ( attr = { } ) { return builder . genTag ( "th" , attr ) ; } ,
tableHeadCell : function ( attr = { } , modifier = null ) { return builder . genTag ( "th" , attr , modifie r ) ; } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
tableBody : function ( attr = { } ) {
return builder . genTag ( "tbody" , attr )
tableBody : function ( attr = { } , modifier = null ) {
return builder . genTag ( "tbody" , attr , modifier )
. chainModifier ( )
. removeStyleRule ( "display" )
. toComponent ( ) ;
@ -228,10 +292,11 @@ const builder = {
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
tableHead : function ( attr = { } ) {
return builder . genTag ( "thead" , attr )
tableHead : function ( attr = { } , modifier = null ) {
return builder . genTag ( "thead" , attr , modifier )
. chainModifier ( )
. removeStyleRule ( "display" )
. toComponent ( ) ;
@ -240,10 +305,11 @@ const builder = {
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
tableFooter : function ( attr = { } ) {
return builder . genTag ( "tfoot" , attr )
tableFooter : function ( attr = { } , modifier = null ) {
return builder . genTag ( "tfoot" , attr , modifier )
. chainModifier ( )
. removeStyleRule ( "display" )
. toComponent ( ) ;
@ -252,17 +318,19 @@ const builder = {
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
iframe : function ( attr = { } ) { return builder . genTag ( "iframe" , attr ) } ,
iframe : function ( attr = { } , modifier = null ) { return builder . genTag ( "iframe" , attr , modifie r ) } ,
/ * *
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Component }
* /
form : function ( attr = { } ) {
return builder . genTag ( "form" , attr )
form : function ( attr = { } , modifier = null ) {
return builder . genTag ( "form" , attr , modifier )
. addStyleClass ( "flex-container-component" )
. chainModifier ( )
. setStyleRule ( "flex-direction" , "column" )
@ -272,17 +340,21 @@ const builder = {
/ * *
*
* @ param { * } attr
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Row }
* /
row : function ( attr = { } ) { return new Row ( attr ) } ,
row : function ( attr = { } , modifier = null ) { return new Row ( attr , modifie r ) } ,
/ * *
*
* @ param { * } attr
*
* @ param { Map < string , string > } attr
* @ param { Modifier } modifier
* @ returns { Column }
* /
column : function ( attr = { } ) { return new Column ( attr ) } ,
column : function ( attr = { } , modifier = null ) { return new Column ( attr , modifie r ) } ,
/ * *
*
@ -297,6 +369,7 @@ const builder = {
main . parentElement . insertAdjacentElement (
"afterbegin" ,
builder . genTag ( "main" )
. isHigherComponent ( )
. alignment ( Alignment . CENTER )
. arrangement ( Arrangement . CENTER )
. childContext ( innerComponents )