@ -1,327 +1,300 @@
package org.jetbrains.compose.web.attributes
import org.w3c.dom.HTMLAnchorElement
import org.w3c.dom.HTMLButtonElement
import org.w3c.dom.HTMLFormElement
import org.w3c.dom.HTMLImageElement
import org.w3c.dom.HTMLInputElement
interface Tag {
object Div : Tag
object A : Tag
object Button : Tag
object Form : Tag
object Input : Tag
object Select : Tag
object Option : Tag
object OptGroup : Tag
object H : Tag
object Hr : Tag
object Ul : Tag
object Ol : Tag
object Li : Tag
object Img : Tag
object TextArea : Tag
object Nav : Tag
object Span : Tag
object P : Tag
object Br : Tag
object Style : Tag
object Pre : Tag
object Code : Tag
object Label : Tag
object Table : Tag
object Caption : Tag
object Col : Tag
object Colgroup : Tag
object Tr : Tag
object Thead : Tag
object Th : Tag
object Td : Tag
object Tbody : Tag
object Tfoot : Tag
}
/* Anchor <a> attributes */
fun AttrsBuilder < Tag . A > . href ( value : String ? ) =
import org.w3c.dom.HTMLLabelElement
import org.w3c.dom.HTMLOptGroupElement
import org.w3c.dom.HTMLOptionElement
import org.w3c.dom.HTMLSelectElement
import org.w3c.dom.HTMLTableCellElement
import org.w3c.dom.HTMLTableColElement
import org.w3c.dom.HTMLTextAreaElement
fun AttrsBuilder < HTMLAnchorElement > . href ( value : String ? ) =
attr ( " href " , value )
fun AttrsBuilder < Tag . A > . target ( value : ATarget = ATarget . Self ) =
fun AttrsBuilder < HTMLAnchorElement > . target ( value : ATarget = ATarget . Self ) =
attr ( " target " , value . targetStr )
fun AttrsBuilder < Tag . A > . ref ( value : ARel ) =
fun AttrsBuilder < HTMLAnchorElement > . ref ( value : ARel ) =
attr ( " rel " , value . relStr )
fun AttrsBuilder < Tag . A > . ping ( value : String ) =
fun AttrsBuilder < HTMLAnchorElement > . ping ( value : String ) =
attr ( " ping " , value )
fun AttrsBuilder < Tag . A > . ping ( vararg urls : String ) =
fun AttrsBuilder < HTMLAnchorElement > . ping ( vararg urls : String ) =
attr ( " ping " , urls . joinToString ( " " ) )
fun AttrsBuilder < Tag . A > . hreflang ( value : String ) =
fun AttrsBuilder < HTMLAnchorElement > . hreflang ( value : String ) =
attr ( " hreflang " , value )
fun AttrsBuilder < Tag . A > . download ( value : String = " " ) =
fun AttrsBuilder < HTMLAnchorElement > . download ( value : String = " " ) =
attr ( " download " , value )
/* Button attributes */
fun AttrsBuilder < Tag . Button > . autoFocus ( value : Boolean = true ) =
fun AttrsBuilder < HTMLButtonElement > . autoFocus ( value : Boolean = true ) =
attr ( " autofocus " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Button > . disabled ( value : Boolean = true ) =
fun AttrsBuilder < HTMLButtonElement > . disabled ( value : Boolean = true ) =
attr ( " disabled " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Button > . form ( formId : String ) =
fun AttrsBuilder < HTMLButtonElement > . form ( formId : String ) =
attr ( " form " , formId )
fun AttrsBuilder < Tag . Button > . formAction ( url : String ) =
fun AttrsBuilder < HTMLButtonElement > . formAction ( url : String ) =
attr ( " formaction " , url )
fun AttrsBuilder < Tag . Button > . formEncType ( value : ButtonFormEncType ) =
fun AttrsBuilder < HTMLButtonElement > . formEncType ( value : ButtonFormEncType ) =
attr ( " formenctype " , value . typeStr )
fun AttrsBuilder < Tag . Button > . formMethod ( value : ButtonFormMethod ) =
fun AttrsBuilder < HTMLButtonElement > . formMethod ( value : ButtonFormMethod ) =
attr ( " formmethod " , value . methodStr )
fun AttrsBuilder < Tag . Button > . formNoValidate ( value : Boolean = true ) =
fun AttrsBuilder < HTMLButtonElement > . formNoValidate ( value : Boolean = true ) =
attr ( " formnovalidate " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Button > . formTarget ( value : ButtonFormTarget ) =
fun AttrsBuilder < HTMLButtonElement > . formTarget ( value : ButtonFormTarget ) =
attr ( " formtarget " , value . targetStr )
fun AttrsBuilder < Tag . Button > . name ( value : String ) =
fun AttrsBuilder < HTMLButtonElement > . name ( value : String ) =
attr ( " name " , value )
fun AttrsBuilder < Tag . Button > . type ( value : ButtonType ) =
fun AttrsBuilder < HTMLButtonElement > . type ( value : ButtonType ) =
attr ( " type " , value . str )
fun AttrsBuilder < Tag . Button > . value ( value : String ) =
fun AttrsBuilder < HTMLButtonElement > . value ( value : String ) =
attr ( " value " , value )
/* Form attributes */
fun AttrsBuilder < Tag . Form > . action ( value : String ) =
fun AttrsBuilder < HTMLFormElement > . action ( value : String ) =
attr ( " action " , value )
fun AttrsBuilder < Tag . Form > . acceptCharset ( value : String ) =
fun AttrsBuilder < HTMLFormElement > . acceptCharset ( value : String ) =
attr ( " accept-charset " , value )
fun AttrsBuilder < Tag . Form > . autoComplete ( value : Boolean ) =
fun AttrsBuilder < HTMLFormElement > . autoComplete ( value : Boolean ) =
attr ( " autocomplete " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Form > . encType ( value : FormEncType ) =
fun AttrsBuilder < HTMLFormElement > . encType ( value : FormEncType ) =
attr ( " enctype " , value . typeStr )
fun AttrsBuilder < Tag . Form > . method ( value : FormMethod ) =
fun AttrsBuilder < HTMLFormElement > . method ( value : FormMethod ) =
attr ( " method " , value . methodStr )
fun AttrsBuilder < Tag . Form > . noValidate ( value : Boolean = true ) =
fun AttrsBuilder < HTMLFormElement > . noValidate ( value : Boolean = true ) =
attr ( " novalidate " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Form > . target ( value : FormTarget ) =
fun AttrsBuilder < HTMLFormElement > . target ( value : FormTarget ) =
attr ( " target " , value . targetStr )
/* Input attributes */
fun AttrsBuilder < Tag . Inpu t> . type ( value : InputType ) =
fun AttrsBuilder < HTMLInputElemen t> . type ( value : InputType ) =
attr ( " type " , value . typeStr )
fun AttrsBuilder < Tag . Inpu t> . accept ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . accept ( value : String ) =
attr ( " accept " , value ) // type: file only
fun AttrsBuilder < Tag . Inpu t> . alt ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . alt ( value : String ) =
attr ( " alt " , value ) // type: image only
fun AttrsBuilder < Tag . Inpu t> . autoComplete ( value : Boolean = true ) =
fun AttrsBuilder < HTMLInputElemen t> . autoComplete ( value : Boolean = true ) =
attr ( " autocomplete " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Inpu t> . autoFocus ( value : Boolean = true ) =
fun AttrsBuilder < HTMLInputElemen t> . autoFocus ( value : Boolean = true ) =
attr ( " autofocus " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Inpu t> . capture ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . capture ( value : String ) =
attr ( " capture " , value ) // type: file only
fun AttrsBuilder < Tag . Inpu t> . checked ( value : Boolean = true ) =
fun AttrsBuilder < HTMLInputElemen t> . checked ( value : Boolean = true ) =
attr ( " checked " , if ( value ) " " else null ) // radio, checkbox
fun AttrsBuilder < Tag . Inpu t> . dirName ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . dirName ( value : String ) =
attr ( " dirname " , value ) // text, search
fun AttrsBuilder < Tag . Inpu t> . disabled ( value : Boolean = true ) =
fun AttrsBuilder < HTMLInputElemen t> . disabled ( value : Boolean = true ) =
attr ( " disabled " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Inpu t> . form ( id : String ) =
fun AttrsBuilder < HTMLInputElemen t> . form ( id : String ) =
attr ( " form " , id )
fun AttrsBuilder < Tag . Inpu t> . formAction ( url : String ) =
fun AttrsBuilder < HTMLInputElemen t> . formAction ( url : String ) =
attr ( " formaction " , url )
fun AttrsBuilder < Tag . Inpu t> . formEncType ( value : InputFormEncType ) =
fun AttrsBuilder < HTMLInputElemen t> . formEncType ( value : InputFormEncType ) =
attr ( " formenctype " , value . typeStr )
fun AttrsBuilder < Tag . Inpu t> . formMethod ( value : InputFormMethod ) =
fun AttrsBuilder < HTMLInputElemen t> . formMethod ( value : InputFormMethod ) =
attr ( " formmethod " , value . methodStr )
fun AttrsBuilder < Tag . Inpu t> . formNoValidate ( value : Boolean = true ) =
fun AttrsBuilder < HTMLInputElemen t> . formNoValidate ( value : Boolean = true ) =
attr ( " formnovalidate " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Inpu t> . formTarget ( value : InputFormTarget ) =
fun AttrsBuilder < HTMLInputElemen t> . formTarget ( value : InputFormTarget ) =
attr ( " formtarget " , value . targetStr )
fun AttrsBuilder < Tag . Inpu t> . height ( value : Int ) =
fun AttrsBuilder < HTMLInputElemen t> . height ( value : Int ) =
attr ( " height " , value . toString ( ) ) // image only
fun AttrsBuilder < Tag . Inpu t> . width ( value : Int ) =
fun AttrsBuilder < HTMLInputElemen t> . width ( value : Int ) =
attr ( " width " , value . toString ( ) ) // image only
fun AttrsBuilder < Tag . Inpu t> . list ( dataListId : String ) =
fun AttrsBuilder < HTMLInputElemen t> . list ( dataListId : String ) =
attr ( " list " , dataListId )
fun AttrsBuilder < Tag . Inpu t> . max ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . max ( value : String ) =
attr ( " max " , value )
fun AttrsBuilder < Tag . Inpu t> . maxLength ( value : Int ) =
fun AttrsBuilder < HTMLInputElemen t> . maxLength ( value : Int ) =
attr ( " maxlength " , value . toString ( ) )
fun AttrsBuilder < Tag . Inpu t> . min ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . min ( value : String ) =
attr ( " min " , value )
fun AttrsBuilder < Tag . Inpu t> . minLength ( value : Int ) =
fun AttrsBuilder < HTMLInputElemen t> . minLength ( value : Int ) =
attr ( " minlength " , value . toString ( ) )
fun AttrsBuilder < Tag . Inpu t> . multiple ( value : Boolean = true ) =
fun AttrsBuilder < HTMLInputElemen t> . multiple ( value : Boolean = true ) =
attr ( " multiple " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Inpu t> . name ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . name ( value : String ) =
attr ( " name " , value )
fun AttrsBuilder < Tag . Inpu t> . pattern ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . pattern ( value : String ) =
attr ( " pattern " , value )
fun AttrsBuilder < Tag . Inpu t> . placeholder ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . placeholder ( value : String ) =
attr ( " placeholder " , value )
fun AttrsBuilder < Tag . Inpu t> . readOnly ( value : Boolean = true ) =
fun AttrsBuilder < HTMLInputElemen t> . readOnly ( value : Boolean = true ) =
attr ( " readonly " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Inpu t> . required ( value : Boolean = true ) =
fun AttrsBuilder < HTMLInputElemen t> . required ( value : Boolean = true ) =
attr ( " required " , value . toString ( ) )
fun AttrsBuilder < Tag . Inpu t> . size ( value : Int ) =
fun AttrsBuilder < HTMLInputElemen t> . size ( value : Int ) =
attr ( " size " , value . toString ( ) )
fun AttrsBuilder < Tag . Inpu t> . src ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . src ( value : String ) =
attr ( " src " , value . toString ( ) ) // image only
fun AttrsBuilder < Tag . Inpu t> . step ( value : Int ) =
fun AttrsBuilder < HTMLInputElemen t> . step ( value : Int ) =
attr ( " step " , value . toString ( ) ) // numeric types only
fun AttrsBuilder < Tag . Inpu t> . valueAttr ( value : String ) =
fun AttrsBuilder < HTMLInputElemen t> . valueAttr ( value : String ) =
attr ( " value " , value )
fun AttrsBuilder < Tag . Inpu t> . value ( value : String ) : AttrsBuilder < Tag . Inpu t> {
fun AttrsBuilder < HTMLInputElemen t> . value ( value : String ) : AttrsBuilder < HTMLInputElemen t> {
prop ( setInputValue , value )
return this
}
/* Option attributes */
fun AttrsBuilder < Tag . Option > . value ( value : String ) =
fun AttrsBuilder < HTMLOptionElement > . value ( value : String ) =
attr ( " value " , value )
fun AttrsBuilder < Tag . Option > . disabled ( value : Boolean = true ) =
fun AttrsBuilder < HTMLOptionElement > . disabled ( value : Boolean = true ) =
attr ( " disabled " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Option > . selected ( value : Boolean = true ) =
fun AttrsBuilder < HTMLOptionElement > . selected ( value : Boolean = true ) =
attr ( " selected " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Option > . label ( value : String ) =
fun AttrsBuilder < HTMLOptionElement > . label ( value : String ) =
attr ( " label " , value )
/* Select attributes */
fun AttrsBuilder < Tag . Selec t> . autocomplete ( value : String ) =
fun AttrsBuilder < HTMLSelectElemen t> . autocomplete ( value : String ) =
attr ( " autocomplete " , value )
fun AttrsBuilder < Tag . Selec t> . autofocus ( value : Boolean = true ) =
fun AttrsBuilder < HTMLSelectElemen t> . autofocus ( value : Boolean = true ) =
attr ( " autofocus " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Selec t> . disabled ( value : Boolean = true ) =
fun AttrsBuilder < HTMLSelectElemen t> . disabled ( value : Boolean = true ) =
attr ( " disabled " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Selec t> . form ( formId : String ) =
fun AttrsBuilder < HTMLSelectElemen t> . form ( formId : String ) =
attr ( " form " , formId )
fun AttrsBuilder < Tag . Selec t> . multiple ( value : Boolean = true ) =
fun AttrsBuilder < HTMLSelectElemen t> . multiple ( value : Boolean = true ) =
attr ( " multiple " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Selec t> . name ( value : String ) =
fun AttrsBuilder < HTMLSelectElemen t> . name ( value : String ) =
attr ( " name " , value )
fun AttrsBuilder < Tag . Selec t> . required ( value : Boolean = true ) =
fun AttrsBuilder < HTMLSelectElemen t> . required ( value : Boolean = true ) =
attr ( " required " , if ( value ) " " else null )
fun AttrsBuilder < Tag . Selec t> . size ( numberOfRows : Int ) =
fun AttrsBuilder < HTMLSelectElemen t> . size ( numberOfRows : Int ) =
attr ( " size " , numberOfRows . toString ( ) )
/* OptGroup attributes */
fun AttrsBuilder < Tag . OptGroup > . label ( value : String ) =
fun AttrsBuilder < HTMLOptGroupElement > . label ( value : String ) =
attr ( " label " , value )
fun AttrsBuilder < Tag . OptGroup > . disabled ( value : Boolean = true ) =
fun AttrsBuilder < HTMLOptGroupElement > . disabled ( value : Boolean = true ) =
attr ( " disabled " , if ( value ) " " else null )
/* TextArea attributes */
fun AttrsBuilder < Tag . TextArea > . autoComplete ( value : Boolean = true ) =
fun AttrsBuilder < HTMLTextAreaElement > . autoComplete ( value : Boolean = true ) =
attr ( " autocomplete " , if ( value ) " on " else " off " )
fun AttrsBuilder < Tag . TextArea > . autoFocus ( value : Boolean = true ) =
fun AttrsBuilder < HTMLTextAreaElement > . autoFocus ( value : Boolean = true ) =
attr ( " autofocus " , if ( value ) " " else null )
fun AttrsBuilder < Tag . TextArea > . cols ( value : Int ) =
fun AttrsBuilder < HTMLTextAreaElement > . cols ( value : Int ) =
attr ( " cols " , value . toString ( ) )
fun AttrsBuilder < Tag . TextArea > . disabled ( value : Boolean = true ) =
fun AttrsBuilder < HTMLTextAreaElement > . disabled ( value : Boolean = true ) =
attr ( " disabled " , if ( value ) " " else null )
fun AttrsBuilder < Tag . TextArea > . form ( formId : String ) =
fun AttrsBuilder < HTMLTextAreaElement > . form ( formId : String ) =
attr ( " form " , formId )
fun AttrsBuilder < Tag . TextArea > . maxLength ( value : Int ) =
fun AttrsBuilder < HTMLTextAreaElement > . maxLength ( value : Int ) =
attr ( " maxlength " , value . toString ( ) )
fun AttrsBuilder < Tag . TextArea > . minLength ( value : Int ) =
fun AttrsBuilder < HTMLTextAreaElement > . minLength ( value : Int ) =
attr ( " minlength " , value . toString ( ) )
fun AttrsBuilder < Tag . TextArea > . name ( value : String ) =
fun AttrsBuilder < HTMLTextAreaElement > . name ( value : String ) =
attr ( " name " , value )
fun AttrsBuilder < Tag . TextArea > . placeholder ( value : String ) =
fun AttrsBuilder < HTMLTextAreaElement > . placeholder ( value : String ) =
attr ( " placeholder " , value )
fun AttrsBuilder < Tag . TextArea > . readOnly ( value : Boolean = true ) =
fun AttrsBuilder < HTMLTextAreaElement > . readOnly ( value : Boolean = true ) =
attr ( " readonly " , if ( value ) " " else null )
fun AttrsBuilder < Tag . TextArea > . required ( value : Boolean = true ) =
fun AttrsBuilder < HTMLTextAreaElement > . required ( value : Boolean = true ) =
attr ( " required " , if ( value ) " " else null )
fun AttrsBuilder < Tag . TextArea > . rows ( value : Int ) =
fun AttrsBuilder < HTMLTextAreaElement > . rows ( value : Int ) =
attr ( " rows " , value . toString ( ) )
fun AttrsBuilder < Tag . TextArea > . wrap ( value : TextAreaWrap ) =
fun AttrsBuilder < HTMLTextAreaElement > . wrap ( value : TextAreaWrap ) =
attr ( " wrap " , value . str )
fun AttrsBuilder < Tag . TextArea > . value ( value : String ) : AttrsBuilder < Tag . TextArea > {
fun AttrsBuilder < HTMLTextAreaElement > . value ( value : String ) : AttrsBuilder < HTMLTextAreaElement > {
prop ( setInputValue , value )
return this
}
/* Img attributes */
fun AttrsBuilder < Tag . Img > . src ( value : String ? ) : AttrsBuilder < Tag . Img > =
fun AttrsBuilder < HTMLImageElement > . src ( value : String ? ) : AttrsBuilder < HTMLImageElement > =
attr ( " src " , value )
fun AttrsBuilder < Tag . Img > . alt ( value : String ? ) : AttrsBuilder < Tag . Img > =
fun AttrsBuilder < HTMLImageElement > . alt ( value : String ? ) : AttrsBuilder < HTMLImageElement > =
attr ( " alt " , value )
private val setInputValue : ( HTMLInputElement , String ) -> Unit = { e , v ->
@ -329,24 +302,19 @@ private val setInputValue: (HTMLInputElement, String) -> Unit = { e, v ->
}
/* Img attributes */
fun AttrsBuilder < Tag . Label > . forId ( value : String ? ) : AttrsBuilder < Tag . Label > =
fun AttrsBuilder < HTMLLabelElement > . forId ( value : String ? ) : AttrsBuilder < HTMLLabelElement > =
attr ( " for " , value )
/* Table attributes */
fun AttrsBuilder < Tag . Th > . scope ( value : Scope ? ) : AttrsBuilder < Tag . Th > =
attr ( " scope " , value ?. str )
fun AttrsBuilder < Tag . Col > . span ( value : Int ) : AttrsBuilder < Tag . Col > =
fun AttrsBuilder < HTMLTableColElement > . span ( value : Int ) : AttrsBuilder < HTMLTableColElement > =
attr ( " span " , value . toString ( ) )
fun AttrsBuilder < Tag . Th > . colspan ( value : Int ) : AttrsBuilder < Tag . Th > =
attr ( " colspan " , value . toString ( ) )
fun AttrsBuilder < Tag . Th > . rowspan ( value : Int ) : AttrsBuilder < Tag . Th > =
attr ( " rowspan " , value . toString ( ) )
fun AttrsBuilder < HTMLTableCellElement > . scope ( value : Scope ? ) : AttrsBuilder < HTMLTableCellElement > =
attr ( " scope " , value ?. str )
fun AttrsBuilder < Tag . Td > . colspan ( value : Int ) : AttrsBuilder < Tag . Td > =
fun AttrsBuilder < HTMLTableCellElement > . colspan ( value : Int ) : AttrsBuilder < HTMLTableCellElement > =
attr ( " colspan " , value . toString ( ) )
fun AttrsBuilder < Tag . Td > . rowspan ( value : Int ) : AttrsBuilder < Tag . Td > =
fun AttrsBuilder < HTMLTableCellElement > . rowspan ( value : Int ) : AttrsBuilder < HTMLTableCellElement > =
attr ( " rowspan " , value . toString ( ) )