Browse Source

Switch to fun interface creation

FUN_INTERFACE
Shagen Ogandzhanian 3 years ago
parent
commit
409b4185f6
  1. 85
      web/core/src/jsMain/kotlin/androidx/compose/web/elements/Base.kt
  2. 132
      web/core/src/jsMain/kotlin/androidx/compose/web/elements/Elements.kt
  3. 2
      web/core/src/jsMain/kotlin/androidx/compose/web/elements/Style.kt

85
web/core/src/jsMain/kotlin/androidx/compose/web/elements/Base.kt

@ -102,6 +102,8 @@ private open class ElementBuilderImplementation<TElement : Element>(private val
override fun create(): TElement = DomProvider.get(tagName).cloneNode().unsafeCast<TElement>() override fun create(): TElement = DomProvider.get(tagName).cloneNode().unsafeCast<TElement>()
} }
internal fun <TElement : Element> createElement(nodeName: String): TElement = DomProvider.get(nodeName).cloneNode().unsafeCast<TElement>()
fun interface ElementBuilder<TElement : Element> { fun interface ElementBuilder<TElement : Element> {
fun create(): TElement fun create(): TElement
@ -109,89 +111,6 @@ fun interface ElementBuilder<TElement : Element> {
fun <TElement : Element> createBuilder(tagName: String): ElementBuilder<TElement> { fun <TElement : Element> createBuilder(tagName: String): ElementBuilder<TElement> {
return object : ElementBuilderImplementation<TElement>(tagName) {} return object : ElementBuilderImplementation<TElement>(tagName) {}
} }
val Address: ElementBuilder<HTMLElement> = ElementBuilderImplementation("address")
val Article: ElementBuilder<HTMLElement> = ElementBuilderImplementation("article")
val Aside: ElementBuilder<HTMLElement> = ElementBuilderImplementation("aside")
val Header: ElementBuilder<HTMLElement> = ElementBuilderImplementation("header")
val Area: ElementBuilder<HTMLAreaElement> = ElementBuilderImplementation("area")
val Audio: ElementBuilder<HTMLAudioElement> = ElementBuilderImplementation("audio")
val Map: ElementBuilder<HTMLMapElement> = ElementBuilderImplementation("map")
val Track: ElementBuilder<HTMLTrackElement> = ElementBuilderImplementation("track")
val Video: ElementBuilder<HTMLVideoElement> = ElementBuilderImplementation("video")
val Datalist: ElementBuilder<HTMLDataListElement> = ElementBuilderImplementation("datalist")
val Fieldset: ElementBuilder<HTMLFieldSetElement> = ElementBuilderImplementation("fieldset")
val Legend: ElementBuilder<HTMLLegendElement> = ElementBuilderImplementation("legend")
val Meter: ElementBuilder<HTMLMeterElement> = ElementBuilderImplementation("meter")
val Output: ElementBuilder<HTMLOutputElement> = ElementBuilderImplementation("output")
val Progress: ElementBuilder<HTMLProgressElement> = ElementBuilderImplementation("progress")
val Embed: ElementBuilder<HTMLEmbedElement> = ElementBuilderImplementation("embed")
val Iframe: ElementBuilder<HTMLIFrameElement> = ElementBuilderImplementation("iframe")
val Object: ElementBuilder<HTMLObjectElement> = ElementBuilderImplementation("object")
val Param: ElementBuilder<HTMLParamElement> = ElementBuilderImplementation("param")
val Picture: ElementBuilder<HTMLPictureElement> = ElementBuilderImplementation("picture")
val Source: ElementBuilder<HTMLSourceElement> = ElementBuilderImplementation("source")
val Div: ElementBuilder<HTMLDivElement> = ElementBuilderImplementation("div")
val A: ElementBuilder<HTMLAnchorElement> = ElementBuilderImplementation("a")
val Input: ElementBuilder<HTMLInputElement> = ElementBuilderImplementation("input")
val Button: ElementBuilder<HTMLButtonElement> = ElementBuilderImplementation("button")
val H1: ElementBuilder<HTMLHeadingElement> = ElementBuilderImplementation("h1")
val H2: ElementBuilder<HTMLHeadingElement> = ElementBuilderImplementation("h2")
val H3: ElementBuilder<HTMLHeadingElement> = ElementBuilderImplementation("h3")
val H4: ElementBuilder<HTMLHeadingElement> = ElementBuilderImplementation("h4")
val H5: ElementBuilder<HTMLHeadingElement> = ElementBuilderImplementation("h5")
val H6: ElementBuilder<HTMLHeadingElement> = ElementBuilderImplementation("h6")
val P: ElementBuilder<HTMLParagraphElement> = ElementBuilderImplementation<HTMLParagraphElement>("p")
val Em: ElementBuilder<HTMLElement> = ElementBuilderImplementation("em")
val I: ElementBuilder<HTMLElement> = ElementBuilderImplementation("i")
val B: ElementBuilder<HTMLElement> = ElementBuilderImplementation("b")
val Small: ElementBuilder<HTMLElement> = ElementBuilderImplementation("small")
val Span: ElementBuilder<HTMLSpanElement> = ElementBuilderImplementation("span")
val Br: ElementBuilder<HTMLBRElement> = ElementBuilderImplementation("br")
val Ul: ElementBuilder<HTMLUListElement> = ElementBuilderImplementation("ul")
val Ol: ElementBuilder<HTMLOListElement> = ElementBuilderImplementation("ol")
val Li: ElementBuilder<HTMLLIElement> = ElementBuilderImplementation("li")
val Img: ElementBuilder<HTMLImageElement> = ElementBuilderImplementation("img")
val Form: ElementBuilder<HTMLFormElement> = ElementBuilderImplementation("form")
val Select: ElementBuilder<HTMLSelectElement> = ElementBuilderImplementation("select")
val Option: ElementBuilder<HTMLOptionElement> = ElementBuilderImplementation("option")
val OptGroup: ElementBuilder<HTMLOptGroupElement> = ElementBuilderImplementation("optgroup")
val Section: ElementBuilder<HTMLElement> = ElementBuilderImplementation("section")
val TextArea: ElementBuilder<HTMLTextAreaElement> = ElementBuilderImplementation("textarea")
val Nav: ElementBuilder<HTMLElement> = ElementBuilderImplementation("nav")
val Pre: ElementBuilder<HTMLPreElement> = ElementBuilderImplementation("pre")
val Code: ElementBuilder<HTMLElement> = ElementBuilderImplementation("code")
val Main: ElementBuilder<HTMLElement> = ElementBuilderImplementation("main")
val Footer: ElementBuilder<HTMLElement> = ElementBuilderImplementation("footer")
val Hr: ElementBuilder<HTMLHRElement> = ElementBuilderImplementation("hr")
val Label: ElementBuilder<HTMLLabelElement> = ElementBuilderImplementation("label")
val Table: ElementBuilder<HTMLTableElement> = ElementBuilderImplementation("table")
val Caption: ElementBuilder<HTMLTableCaptionElement> = ElementBuilderImplementation("caption")
val Col: ElementBuilder<HTMLTableColElement> = ElementBuilderImplementation("col")
val Colgroup: ElementBuilder<HTMLTableColElement> = ElementBuilderImplementation("colgroup")
val Tr: ElementBuilder<HTMLTableRowElement> = ElementBuilderImplementation("tr")
val Thead: ElementBuilder<HTMLTableSectionElement> = ElementBuilderImplementation("thead")
val Th: ElementBuilder<HTMLTableCellElement> = ElementBuilderImplementation("th")
val Td: ElementBuilder<HTMLTableCellElement> = ElementBuilderImplementation("td")
val Tbody: ElementBuilder<HTMLTableSectionElement> = ElementBuilderImplementation("tbody")
val Tfoot: ElementBuilder<HTMLTableSectionElement> = ElementBuilderImplementation("tfoot")
val Style: ElementBuilder<HTMLStyleElement> = ElementBuilderImplementation("style")
} }
} }

132
web/core/src/jsMain/kotlin/androidx/compose/web/elements/Elements.kt

@ -70,7 +70,7 @@ fun Address(
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Address, elementBuilder = { createElement("address") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -82,7 +82,7 @@ fun Article(
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Article, elementBuilder = { createElement("article") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -94,7 +94,7 @@ fun Aside(
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Aside, elementBuilder = { createElement("aside") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -106,7 +106,7 @@ fun Header(
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Header, elementBuilder = { createElement("header") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -118,7 +118,7 @@ fun Area(
content: ContentBuilder<HTMLAreaElement>? = null content: ContentBuilder<HTMLAreaElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Area, elementBuilder = { createElement("area") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -130,7 +130,7 @@ fun Audio(
content: ContentBuilder<HTMLAudioElement>? = null content: ContentBuilder<HTMLAudioElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Audio, elementBuilder = { createElement("audio") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -142,7 +142,7 @@ fun HTMLMap(
content: ContentBuilder<HTMLMapElement>? = null content: ContentBuilder<HTMLMapElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Map, elementBuilder = { createElement("map") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -154,7 +154,7 @@ fun Track(
content: ContentBuilder<HTMLTrackElement>? = null content: ContentBuilder<HTMLTrackElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Track, elementBuilder = { createElement("track") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -166,7 +166,7 @@ fun Video(
content: ContentBuilder<HTMLVideoElement>? = null content: ContentBuilder<HTMLVideoElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Video, elementBuilder = { createElement("video") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -178,7 +178,7 @@ fun Datalist(
content: ContentBuilder<HTMLDataListElement>? = null content: ContentBuilder<HTMLDataListElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Datalist, elementBuilder = { createElement("datalist") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -190,7 +190,7 @@ fun Fieldset(
content: ContentBuilder<HTMLFieldSetElement>? = null content: ContentBuilder<HTMLFieldSetElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Fieldset, elementBuilder = { createElement("fieldset") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -202,7 +202,7 @@ fun Legend(
content: ContentBuilder<HTMLLegendElement>? = null content: ContentBuilder<HTMLLegendElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Legend, elementBuilder = { createElement("legend") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -214,7 +214,7 @@ fun Meter(
content: ContentBuilder<HTMLMeterElement>? = null content: ContentBuilder<HTMLMeterElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Meter, elementBuilder = { createElement("meter") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -226,7 +226,7 @@ fun Output(
content: ContentBuilder<HTMLOutputElement>? = null content: ContentBuilder<HTMLOutputElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Output, elementBuilder = { createElement("output") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -238,7 +238,7 @@ fun Progress(
content: ContentBuilder<HTMLProgressElement>? = null content: ContentBuilder<HTMLProgressElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Progress, elementBuilder = { createElement("progress") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -250,7 +250,7 @@ fun Embed(
content: ContentBuilder<HTMLEmbedElement>? = null content: ContentBuilder<HTMLEmbedElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Embed, elementBuilder = { createElement("embed") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -262,7 +262,7 @@ fun Iframe(
content: ContentBuilder<HTMLIFrameElement>? = null content: ContentBuilder<HTMLIFrameElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Iframe, elementBuilder = { createElement("iframe") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -274,7 +274,7 @@ fun Object(
content: ContentBuilder<HTMLObjectElement>? = null content: ContentBuilder<HTMLObjectElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Object, elementBuilder = { createElement("object") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -286,7 +286,7 @@ fun Param(
content: ContentBuilder<HTMLParamElement>? = null content: ContentBuilder<HTMLParamElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Param, elementBuilder = { createElement("param") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -298,7 +298,7 @@ fun Picture(
content: ContentBuilder<HTMLPictureElement>? = null content: ContentBuilder<HTMLPictureElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Picture, elementBuilder = { createElement("picture") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -310,7 +310,7 @@ fun Source(
content: ContentBuilder<HTMLSourceElement>? = null content: ContentBuilder<HTMLSourceElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Source, elementBuilder = { createElement("source") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -332,7 +332,7 @@ fun Div(
content: ContentBuilder<HTMLDivElement>? = null content: ContentBuilder<HTMLDivElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Div, elementBuilder = { createElement("div") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -345,7 +345,7 @@ fun A(
content: ContentBuilder<HTMLAnchorElement>? = null content: ContentBuilder<HTMLAnchorElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.A, elementBuilder = { createElement("a") },
applyAttrs = { applyAttrs = {
if (href != null) { if (href != null) {
this.href(href) this.href(href)
@ -363,7 +363,7 @@ fun Input(
attrs: AttrBuilderContext<HTMLInputElement> = {} attrs: AttrBuilderContext<HTMLInputElement> = {}
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Input, elementBuilder = { createElement<HTMLInputElement>("input") },
applyAttrs = { applyAttrs = {
type(type) type(type)
value(value) value(value)
@ -377,107 +377,107 @@ fun Input(
fun Button( fun Button(
attrs: AttrBuilderContext<HTMLButtonElement> = {}, attrs: AttrBuilderContext<HTMLButtonElement> = {},
content: ContentBuilder<HTMLButtonElement>? = null content: ContentBuilder<HTMLButtonElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Button, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("button") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun H1( fun H1(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement> = {},
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H1, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("h1") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun H2( fun H2(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement> = {},
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H2, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("h2") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun H3( fun H3(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement> = {},
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H3, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("h3") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun H4( fun H4(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement> = {},
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H4, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("h4") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun H5( fun H5(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement> = {},
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H5, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("h5") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun H6( fun H6(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement> = {},
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H6, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("h6") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun P( fun P(
attrs: AttrBuilderContext<HTMLParagraphElement> = {}, attrs: AttrBuilderContext<HTMLParagraphElement> = {},
content: ContentBuilder<HTMLParagraphElement>? = null content: ContentBuilder<HTMLParagraphElement>? = null
) = TagElement(elementBuilder = ElementBuilder.P, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("p") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun Em( fun Em(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement> = {},
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Em, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("em") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun I( fun I(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement> = {},
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement(elementBuilder = ElementBuilder.I, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("i") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun B( fun B(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement> = {},
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement(elementBuilder = ElementBuilder.B, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("b") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun Small( fun Small(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement> = {},
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Small, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("small") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun Span( fun Span(
attrs: AttrBuilderContext<HTMLSpanElement> = {}, attrs: AttrBuilderContext<HTMLSpanElement> = {},
content: ContentBuilder<HTMLSpanElement>? = null content: ContentBuilder<HTMLSpanElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Span, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("span") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun Br(attrs: AttrBuilderContext<HTMLBRElement> = {}) = fun Br(attrs: AttrBuilderContext<HTMLBRElement> = {}) =
TagElement(elementBuilder = ElementBuilder.Br, applyAttrs = attrs, content = null) TagElement(elementBuilder = { createElement("br") }, applyAttrs = attrs, content = null)
@Composable @Composable
fun Ul( fun Ul(
attrs: AttrBuilderContext<HTMLUListElement> = {}, attrs: AttrBuilderContext<HTMLUListElement> = {},
content: ContentBuilder<HTMLUListElement>? = null content: ContentBuilder<HTMLUListElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Ul, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("ul") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun Ol( fun Ol(
attrs: AttrBuilderContext<HTMLOListElement> = {}, attrs: AttrBuilderContext<HTMLOListElement> = {},
content: ContentBuilder<HTMLOListElement>? = null content: ContentBuilder<HTMLOListElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Ol, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("ol") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun DOMScope<HTMLOListElement>.Li( fun DOMScope<HTMLOListElement>.Li(
attrs: AttrBuilderContext<HTMLLIElement> = {}, attrs: AttrBuilderContext<HTMLLIElement> = {},
content: ContentBuilder<HTMLLIElement>? = null content: ContentBuilder<HTMLLIElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Li, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("li") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun DOMScope<HTMLUListElement>.Li( fun DOMScope<HTMLUListElement>.Li(
attrs: AttrBuilderContext<HTMLLIElement> = {}, attrs: AttrBuilderContext<HTMLLIElement> = {},
content: ContentBuilder<HTMLLIElement>? = null content: ContentBuilder<HTMLLIElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Li, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = { createElement("li") }, applyAttrs = attrs, content = content)
@Composable @Composable
fun Img( fun Img(
@ -485,7 +485,7 @@ fun Img(
alt: String = "", alt: String = "",
attrs: AttrBuilderContext<HTMLImageElement> = {} attrs: AttrBuilderContext<HTMLImageElement> = {}
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Img, elementBuilder = { createElement<HTMLImageElement>("img") },
applyAttrs = { applyAttrs = {
src(src).alt(alt) src(src).alt(alt)
attrs() attrs()
@ -499,7 +499,7 @@ fun Form(
attrs: AttrBuilderContext<HTMLFormElement> = {}, attrs: AttrBuilderContext<HTMLFormElement> = {},
content: ContentBuilder<HTMLFormElement>? = null content: ContentBuilder<HTMLFormElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Form, elementBuilder = { createElement("form") },
applyAttrs = { applyAttrs = {
if (!action.isNullOrEmpty()) action(action) if (!action.isNullOrEmpty()) action(action)
attrs() attrs()
@ -512,7 +512,7 @@ fun Select(
attrs: AttrBuilderContext<HTMLSelectElement> = {}, attrs: AttrBuilderContext<HTMLSelectElement> = {},
content: ContentBuilder<HTMLSelectElement>? = null content: ContentBuilder<HTMLSelectElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Select, elementBuilder = { createElement("select") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -523,7 +523,7 @@ fun Option(
attrs: AttrBuilderContext<HTMLOptionElement> = {}, attrs: AttrBuilderContext<HTMLOptionElement> = {},
content: ContentBuilder<HTMLOptionElement>? = null content: ContentBuilder<HTMLOptionElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Option, elementBuilder = { createElement("option") },
applyAttrs = { applyAttrs = {
value(value) value(value)
attrs() attrs()
@ -537,7 +537,7 @@ fun OptGroup(
attrs: AttrBuilderContext<HTMLOptGroupElement> = {}, attrs: AttrBuilderContext<HTMLOptGroupElement> = {},
content: ContentBuilder<HTMLOptGroupElement>? = null content: ContentBuilder<HTMLOptGroupElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.OptGroup, elementBuilder = { createElement("optgroup") },
applyAttrs = { applyAttrs = {
label(label) label(label)
attrs() attrs()
@ -550,7 +550,7 @@ fun Section(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement> = {},
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Section, elementBuilder = { createElement("section") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -560,7 +560,7 @@ fun TextArea(
attrs: AttrBuilderContext<HTMLTextAreaElement> = {}, attrs: AttrBuilderContext<HTMLTextAreaElement> = {},
value: String value: String
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.TextArea, elementBuilder = { createElement<HTMLTextAreaElement>("textarea") },
applyAttrs = { applyAttrs = {
value(value) value(value)
attrs() attrs()
@ -574,7 +574,7 @@ fun Nav(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement> = {},
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Nav, elementBuilder = { createElement("nav") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -585,7 +585,7 @@ fun Pre(
content: ContentBuilder<HTMLPreElement>? = null content: ContentBuilder<HTMLPreElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Pre, elementBuilder = { createElement("pre") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -597,7 +597,7 @@ fun Code(
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Code, elementBuilder = { createElement("code") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -609,7 +609,7 @@ fun Main(
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Main, elementBuilder = { createElement("main") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -621,7 +621,7 @@ fun Footer(
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Footer, elementBuilder = { createElement("footer") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -632,7 +632,7 @@ fun Hr(
attrs: AttrBuilderContext<HTMLHRElement> = {} attrs: AttrBuilderContext<HTMLHRElement> = {}
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Hr, elementBuilder = { createElement("hr") },
applyAttrs = attrs, applyAttrs = attrs,
content = null content = null
) )
@ -645,7 +645,7 @@ fun Label(
content: ContentBuilder<HTMLLabelElement>? = null content: ContentBuilder<HTMLLabelElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Label, elementBuilder = { createElement("label") },
applyAttrs = { applyAttrs = {
if (forId != null) { if (forId != null) {
forId(forId) forId(forId)
@ -662,7 +662,7 @@ fun Table(
content: ContentBuilder<HTMLTableElement>? = null content: ContentBuilder<HTMLTableElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Table, elementBuilder = { createElement("table") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -674,7 +674,7 @@ fun Caption(
content: ContentBuilder<HTMLTableCaptionElement>? = null content: ContentBuilder<HTMLTableCaptionElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Caption, elementBuilder = { createElement("caption") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -685,7 +685,7 @@ fun Col(
attrs: AttrBuilderContext<HTMLTableColElement> = {} attrs: AttrBuilderContext<HTMLTableColElement> = {}
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Col, elementBuilder = { createElement("col") },
applyAttrs = attrs, applyAttrs = attrs,
content = null content = null
) )
@ -697,7 +697,7 @@ fun Colgroup(
content: ContentBuilder<HTMLTableColElement>? = null content: ContentBuilder<HTMLTableColElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Colgroup, elementBuilder = { createElement("colgroup") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -709,7 +709,7 @@ fun Tr(
content: ContentBuilder<HTMLTableRowElement>? = null content: ContentBuilder<HTMLTableRowElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Tr, elementBuilder = { createElement("tr") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -721,7 +721,7 @@ fun Thead(
content: ContentBuilder<HTMLTableSectionElement>? = null content: ContentBuilder<HTMLTableSectionElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Thead, elementBuilder = { createElement("thead") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -733,7 +733,7 @@ fun Th(
content: ContentBuilder<HTMLTableCellElement>? = null content: ContentBuilder<HTMLTableCellElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Th, elementBuilder = { createElement("th") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -745,7 +745,7 @@ fun Td(
content: ContentBuilder<HTMLTableCellElement>? = null content: ContentBuilder<HTMLTableCellElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Td, elementBuilder = { createElement("td") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -757,7 +757,7 @@ fun Tbody(
content: ContentBuilder<HTMLTableSectionElement>? = null content: ContentBuilder<HTMLTableSectionElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Tbody, elementBuilder = { createElement("tbody") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )
@ -769,7 +769,7 @@ fun Tfoot(
content: ContentBuilder<HTMLTableSectionElement>? = null content: ContentBuilder<HTMLTableSectionElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Tfoot, elementBuilder = { createElement("tfoot") },
applyAttrs = attrs, applyAttrs = attrs,
content = content content = content
) )

2
web/core/src/jsMain/kotlin/androidx/compose/web/elements/Style.kt

@ -37,7 +37,7 @@ fun Style(
cssRules: CSSRuleDeclarationList cssRules: CSSRuleDeclarationList
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Style, elementBuilder = { createElement<HTMLStyleElement>("style") },
applyAttrs = { applyAttrs = {
applyAttrs() applyAttrs()
}, },

Loading…
Cancel
Save