Browse Source

AttrBuilder is nullable by default

MASTER_WITH_NULLABLE_ATTRBUILDER
Shagen Ogandzhanian 3 years ago
parent
commit
c72bf65f39
  1. 8
      web/core/src/jsMain/kotlin/androidx/compose/web/elements/Base.kt
  2. 164
      web/core/src/jsMain/kotlin/androidx/compose/web/elements/Elements.kt

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

@ -194,7 +194,7 @@ interface ElementBuilder<TElement : Element> {
@Composable @Composable
fun <TElement : Element> TagElement( fun <TElement : Element> TagElement(
elementBuilder: ElementBuilder<TElement>, elementBuilder: ElementBuilder<TElement>,
applyAttrs: AttrsBuilder<TElement>.() -> Unit, applyAttrs: (AttrsBuilder<TElement>.() -> Unit)?,
content: (@Composable ElementScope<TElement>.() -> Unit)? content: (@Composable ElementScope<TElement>.() -> Unit)?
) { ) {
val scope = remember { ElementScopeImpl<TElement>() } val scope = remember { ElementScopeImpl<TElement>() }
@ -207,7 +207,11 @@ fun <TElement : Element> TagElement(
} }
}, },
attrsSkippableUpdate = { attrsSkippableUpdate = {
val attrsApplied = AttrsBuilder<TElement>().also { it.applyAttrs() } val attrsApplied = AttrsBuilder<TElement>().also {
if (applyAttrs != null) {
it.applyAttrs()
}
}
refEffect.effect = attrsApplied.refEffect refEffect.effect = attrsApplied.refEffect
val attrsCollected = attrsApplied.collect() val attrsCollected = attrsApplied.collect()
val events = attrsApplied.collectListeners() val events = attrsApplied.collectListeners()

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

@ -66,7 +66,7 @@ typealias ContentBuilder<T> = @Composable ElementScope<T>.() -> Unit
@Composable @Composable
fun Address( fun Address(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
@ -78,7 +78,7 @@ fun Address(
@Composable @Composable
fun Article( fun Article(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
@ -90,7 +90,7 @@ fun Article(
@Composable @Composable
fun Aside( fun Aside(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
@ -102,7 +102,7 @@ fun Aside(
@Composable @Composable
fun Header( fun Header(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
@ -114,7 +114,7 @@ fun Header(
@Composable @Composable
fun Area( fun Area(
attrs: AttrBuilderContext<HTMLAreaElement> = {}, attrs: AttrBuilderContext<HTMLAreaElement>? = null,
content: ContentBuilder<HTMLAreaElement>? = null content: ContentBuilder<HTMLAreaElement>? = null
) { ) {
TagElement( TagElement(
@ -126,7 +126,7 @@ fun Area(
@Composable @Composable
fun Audio( fun Audio(
attrs: AttrBuilderContext<HTMLAudioElement> = {}, attrs: AttrBuilderContext<HTMLAudioElement>? = null,
content: ContentBuilder<HTMLAudioElement>? = null content: ContentBuilder<HTMLAudioElement>? = null
) { ) {
TagElement( TagElement(
@ -138,7 +138,7 @@ fun Audio(
@Composable @Composable
fun HTMLMap( fun HTMLMap(
attrs: AttrBuilderContext<HTMLMapElement> = {}, attrs: AttrBuilderContext<HTMLMapElement>? = null,
content: ContentBuilder<HTMLMapElement>? = null content: ContentBuilder<HTMLMapElement>? = null
) { ) {
TagElement( TagElement(
@ -150,7 +150,7 @@ fun HTMLMap(
@Composable @Composable
fun Track( fun Track(
attrs: AttrBuilderContext<HTMLTrackElement> = {}, attrs: AttrBuilderContext<HTMLTrackElement>? = null,
content: ContentBuilder<HTMLTrackElement>? = null content: ContentBuilder<HTMLTrackElement>? = null
) { ) {
TagElement( TagElement(
@ -162,7 +162,7 @@ fun Track(
@Composable @Composable
fun Video( fun Video(
attrs: AttrBuilderContext<HTMLVideoElement> = {}, attrs: AttrBuilderContext<HTMLVideoElement>? = null,
content: ContentBuilder<HTMLVideoElement>? = null content: ContentBuilder<HTMLVideoElement>? = null
) { ) {
TagElement( TagElement(
@ -174,7 +174,7 @@ fun Video(
@Composable @Composable
fun Datalist( fun Datalist(
attrs: AttrBuilderContext<HTMLDataListElement> = {}, attrs: AttrBuilderContext<HTMLDataListElement>? = null,
content: ContentBuilder<HTMLDataListElement>? = null content: ContentBuilder<HTMLDataListElement>? = null
) { ) {
TagElement( TagElement(
@ -186,7 +186,7 @@ fun Datalist(
@Composable @Composable
fun Fieldset( fun Fieldset(
attrs: AttrBuilderContext<HTMLFieldSetElement> = {}, attrs: AttrBuilderContext<HTMLFieldSetElement>? = null,
content: ContentBuilder<HTMLFieldSetElement>? = null content: ContentBuilder<HTMLFieldSetElement>? = null
) { ) {
TagElement( TagElement(
@ -198,7 +198,7 @@ fun Fieldset(
@Composable @Composable
fun Legend( fun Legend(
attrs: AttrBuilderContext<HTMLLegendElement> = {}, attrs: AttrBuilderContext<HTMLLegendElement>? = null,
content: ContentBuilder<HTMLLegendElement>? = null content: ContentBuilder<HTMLLegendElement>? = null
) { ) {
TagElement( TagElement(
@ -210,7 +210,7 @@ fun Legend(
@Composable @Composable
fun Meter( fun Meter(
attrs: AttrBuilderContext<HTMLMeterElement> = {}, attrs: AttrBuilderContext<HTMLMeterElement>? = null,
content: ContentBuilder<HTMLMeterElement>? = null content: ContentBuilder<HTMLMeterElement>? = null
) { ) {
TagElement( TagElement(
@ -222,7 +222,7 @@ fun Meter(
@Composable @Composable
fun Output( fun Output(
attrs: AttrBuilderContext<HTMLOutputElement> = {}, attrs: AttrBuilderContext<HTMLOutputElement>? = null,
content: ContentBuilder<HTMLOutputElement>? = null content: ContentBuilder<HTMLOutputElement>? = null
) { ) {
TagElement( TagElement(
@ -234,7 +234,7 @@ fun Output(
@Composable @Composable
fun Progress( fun Progress(
attrs: AttrBuilderContext<HTMLProgressElement> = {}, attrs: AttrBuilderContext<HTMLProgressElement>? = null,
content: ContentBuilder<HTMLProgressElement>? = null content: ContentBuilder<HTMLProgressElement>? = null
) { ) {
TagElement( TagElement(
@ -246,7 +246,7 @@ fun Progress(
@Composable @Composable
fun Embed( fun Embed(
attrs: AttrBuilderContext<HTMLEmbedElement> = {}, attrs: AttrBuilderContext<HTMLEmbedElement>? = null,
content: ContentBuilder<HTMLEmbedElement>? = null content: ContentBuilder<HTMLEmbedElement>? = null
) { ) {
TagElement( TagElement(
@ -258,7 +258,7 @@ fun Embed(
@Composable @Composable
fun Iframe( fun Iframe(
attrs: AttrBuilderContext<HTMLIFrameElement> = {}, attrs: AttrBuilderContext<HTMLIFrameElement>? = null,
content: ContentBuilder<HTMLIFrameElement>? = null content: ContentBuilder<HTMLIFrameElement>? = null
) { ) {
TagElement( TagElement(
@ -270,7 +270,7 @@ fun Iframe(
@Composable @Composable
fun Object( fun Object(
attrs: AttrBuilderContext<HTMLObjectElement> = {}, attrs: AttrBuilderContext<HTMLObjectElement>? = null,
content: ContentBuilder<HTMLObjectElement>? = null content: ContentBuilder<HTMLObjectElement>? = null
) { ) {
TagElement( TagElement(
@ -282,7 +282,7 @@ fun Object(
@Composable @Composable
fun Param( fun Param(
attrs: AttrBuilderContext<HTMLParamElement> = {}, attrs: AttrBuilderContext<HTMLParamElement>? = null,
content: ContentBuilder<HTMLParamElement>? = null content: ContentBuilder<HTMLParamElement>? = null
) { ) {
TagElement( TagElement(
@ -294,7 +294,7 @@ fun Param(
@Composable @Composable
fun Picture( fun Picture(
attrs: AttrBuilderContext<HTMLPictureElement> = {}, attrs: AttrBuilderContext<HTMLPictureElement>? = null,
content: ContentBuilder<HTMLPictureElement>? = null content: ContentBuilder<HTMLPictureElement>? = null
) { ) {
TagElement( TagElement(
@ -306,7 +306,7 @@ fun Picture(
@Composable @Composable
fun Source( fun Source(
attrs: AttrBuilderContext<HTMLSourceElement> = {}, attrs: AttrBuilderContext<HTMLSourceElement>? = null,
content: ContentBuilder<HTMLSourceElement>? = null content: ContentBuilder<HTMLSourceElement>? = null
) { ) {
TagElement( TagElement(
@ -328,7 +328,7 @@ fun Text(value: String) {
@Composable @Composable
fun Div( fun Div(
attrs: AttrBuilderContext<HTMLDivElement> = {}, attrs: AttrBuilderContext<HTMLDivElement>? = null,
content: ContentBuilder<HTMLDivElement>? = null content: ContentBuilder<HTMLDivElement>? = null
) { ) {
TagElement( TagElement(
@ -341,7 +341,7 @@ fun Div(
@Composable @Composable
fun A( fun A(
href: String? = null, href: String? = null,
attrs: AttrBuilderContext<HTMLAnchorElement> = {}, attrs: AttrBuilderContext<HTMLAnchorElement>? = null,
content: ContentBuilder<HTMLAnchorElement>? = null content: ContentBuilder<HTMLAnchorElement>? = null
) { ) {
TagElement( TagElement(
@ -350,7 +350,9 @@ fun A(
if (href != null) { if (href != null) {
this.href(href) this.href(href)
} }
attrs() if (attrs != null) {
attrs()
}
}, },
content = content content = content
) )
@ -360,14 +362,16 @@ fun A(
fun Input( fun Input(
type: InputType = InputType.Text, type: InputType = InputType.Text,
value: String = "", value: String = "",
attrs: AttrBuilderContext<HTMLInputElement> = {} attrs: AttrBuilderContext<HTMLInputElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Input, elementBuilder = ElementBuilder.Input,
applyAttrs = { applyAttrs = {
type(type) type(type)
value(value) value(value)
attrs() if (attrs != null) {
attrs()
}
}, },
content = null content = null
) )
@ -375,107 +379,107 @@ fun Input(
@Composable @Composable
fun Button( fun Button(
attrs: AttrBuilderContext<HTMLButtonElement> = {}, attrs: AttrBuilderContext<HTMLButtonElement>? = null,
content: ContentBuilder<HTMLButtonElement>? = null content: ContentBuilder<HTMLButtonElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Button, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.Button, applyAttrs = attrs, content = content)
@Composable @Composable
fun H1( fun H1(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement>? = null,
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H1, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.H1, applyAttrs = attrs, content = content)
@Composable @Composable
fun H2( fun H2(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement>? = null,
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H2, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.H2, applyAttrs = attrs, content = content)
@Composable @Composable
fun H3( fun H3(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement>? = null,
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H3, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.H3, applyAttrs = attrs, content = content)
@Composable @Composable
fun H4( fun H4(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement>? = null,
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H4, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.H4, applyAttrs = attrs, content = content)
@Composable @Composable
fun H5( fun H5(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement>? = null,
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H5, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.H5, applyAttrs = attrs, content = content)
@Composable @Composable
fun H6( fun H6(
attrs: AttrBuilderContext<HTMLHeadingElement> = {}, attrs: AttrBuilderContext<HTMLHeadingElement>? = null,
content: ContentBuilder<HTMLHeadingElement>? = null content: ContentBuilder<HTMLHeadingElement>? = null
) = TagElement(elementBuilder = ElementBuilder.H6, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.H6, applyAttrs = attrs, content = content)
@Composable @Composable
fun P( fun P(
attrs: AttrBuilderContext<HTMLParagraphElement> = {}, attrs: AttrBuilderContext<HTMLParagraphElement>? = null,
content: ContentBuilder<HTMLParagraphElement>? = null content: ContentBuilder<HTMLParagraphElement>? = null
) = TagElement(elementBuilder = ElementBuilder.P, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.P, applyAttrs = attrs, content = content)
@Composable @Composable
fun Em( fun Em(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Em, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.Em, applyAttrs = attrs, content = content)
@Composable @Composable
fun I( fun I(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement(elementBuilder = ElementBuilder.I, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.I, applyAttrs = attrs, content = content)
@Composable @Composable
fun B( fun B(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement(elementBuilder = ElementBuilder.B, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.B, applyAttrs = attrs, content = content)
@Composable @Composable
fun Small( fun Small(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Small, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.Small, applyAttrs = attrs, content = content)
@Composable @Composable
fun Span( fun Span(
attrs: AttrBuilderContext<HTMLSpanElement> = {}, attrs: AttrBuilderContext<HTMLSpanElement>? = null,
content: ContentBuilder<HTMLSpanElement>? = null content: ContentBuilder<HTMLSpanElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Span, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.Span, applyAttrs = attrs, content = content)
@Composable @Composable
fun Br(attrs: AttrBuilderContext<HTMLBRElement> = {}) = fun Br(attrs: AttrBuilderContext<HTMLBRElement>? = null) =
TagElement(elementBuilder = ElementBuilder.Br, applyAttrs = attrs, content = null) TagElement(elementBuilder = ElementBuilder.Br, applyAttrs = attrs, content = null)
@Composable @Composable
fun Ul( fun Ul(
attrs: AttrBuilderContext<HTMLUListElement> = {}, attrs: AttrBuilderContext<HTMLUListElement>? = null,
content: ContentBuilder<HTMLUListElement>? = null content: ContentBuilder<HTMLUListElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Ul, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.Ul, applyAttrs = attrs, content = content)
@Composable @Composable
fun Ol( fun Ol(
attrs: AttrBuilderContext<HTMLOListElement> = {}, attrs: AttrBuilderContext<HTMLOListElement>? = null,
content: ContentBuilder<HTMLOListElement>? = null content: ContentBuilder<HTMLOListElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Ol, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.Ol, applyAttrs = attrs, content = content)
@Composable @Composable
fun DOMScope<HTMLOListElement>.Li( fun DOMScope<HTMLOListElement>.Li(
attrs: AttrBuilderContext<HTMLLIElement> = {}, attrs: AttrBuilderContext<HTMLLIElement>? = null,
content: ContentBuilder<HTMLLIElement>? = null content: ContentBuilder<HTMLLIElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Li, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.Li, applyAttrs = attrs, content = content)
@Composable @Composable
fun DOMScope<HTMLUListElement>.Li( fun DOMScope<HTMLUListElement>.Li(
attrs: AttrBuilderContext<HTMLLIElement> = {}, attrs: AttrBuilderContext<HTMLLIElement>? = null,
content: ContentBuilder<HTMLLIElement>? = null content: ContentBuilder<HTMLLIElement>? = null
) = TagElement(elementBuilder = ElementBuilder.Li, applyAttrs = attrs, content = content) ) = TagElement(elementBuilder = ElementBuilder.Li, applyAttrs = attrs, content = content)
@ -483,12 +487,14 @@ fun DOMScope<HTMLUListElement>.Li(
fun Img( fun Img(
src: String, src: String,
alt: String = "", alt: String = "",
attrs: AttrBuilderContext<HTMLImageElement> = {} attrs: AttrBuilderContext<HTMLImageElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Img, elementBuilder = ElementBuilder.Img,
applyAttrs = { applyAttrs = {
src(src).alt(alt) src(src).alt(alt)
attrs() if (attrs != null) {
attrs()
}
}, },
content = null content = null
) )
@ -496,20 +502,22 @@ fun Img(
@Composable @Composable
fun Form( fun Form(
action: String? = null, action: String? = null,
attrs: AttrBuilderContext<HTMLFormElement> = {}, attrs: AttrBuilderContext<HTMLFormElement>? = null,
content: ContentBuilder<HTMLFormElement>? = null content: ContentBuilder<HTMLFormElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Form, elementBuilder = ElementBuilder.Form,
applyAttrs = { applyAttrs = {
if (!action.isNullOrEmpty()) action(action) if (!action.isNullOrEmpty()) action(action)
attrs() if (attrs != null) {
attrs()
}
}, },
content = content content = content
) )
@Composable @Composable
fun Select( fun Select(
attrs: AttrBuilderContext<HTMLSelectElement> = {}, attrs: AttrBuilderContext<HTMLSelectElement>? = null,
content: ContentBuilder<HTMLSelectElement>? = null content: ContentBuilder<HTMLSelectElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Select, elementBuilder = ElementBuilder.Select,
@ -520,13 +528,15 @@ fun Select(
@Composable @Composable
fun Option( fun Option(
value: String, value: String,
attrs: AttrBuilderContext<HTMLOptionElement> = {}, attrs: AttrBuilderContext<HTMLOptionElement>? = null,
content: ContentBuilder<HTMLOptionElement>? = null content: ContentBuilder<HTMLOptionElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Option, elementBuilder = ElementBuilder.Option,
applyAttrs = { applyAttrs = {
value(value) value(value)
attrs() if (attrs != null) {
attrs()
}
}, },
content = content content = content
) )
@ -534,20 +544,22 @@ fun Option(
@Composable @Composable
fun OptGroup( fun OptGroup(
label: String, label: String,
attrs: AttrBuilderContext<HTMLOptGroupElement> = {}, attrs: AttrBuilderContext<HTMLOptGroupElement>? = null,
content: ContentBuilder<HTMLOptGroupElement>? = null content: ContentBuilder<HTMLOptGroupElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.OptGroup, elementBuilder = ElementBuilder.OptGroup,
applyAttrs = { applyAttrs = {
label(label) label(label)
attrs() if (attrs != null) {
attrs()
}
}, },
content = content content = content
) )
@Composable @Composable
fun Section( fun Section(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Section, elementBuilder = ElementBuilder.Section,
@ -557,13 +569,15 @@ fun Section(
@Composable @Composable
fun TextArea( fun TextArea(
attrs: AttrBuilderContext<HTMLTextAreaElement> = {}, attrs: AttrBuilderContext<HTMLTextAreaElement>? = null,
value: String value: String
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.TextArea, elementBuilder = ElementBuilder.TextArea,
applyAttrs = { applyAttrs = {
value(value) value(value)
attrs() if (attrs != null) {
attrs()
}
} }
) { ) {
Text(value) Text(value)
@ -571,7 +585,7 @@ fun TextArea(
@Composable @Composable
fun Nav( fun Nav(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) = TagElement( ) = TagElement(
elementBuilder = ElementBuilder.Nav, elementBuilder = ElementBuilder.Nav,
@ -581,7 +595,7 @@ fun Nav(
@Composable @Composable
fun Pre( fun Pre(
attrs: AttrBuilderContext<HTMLPreElement> = {}, attrs: AttrBuilderContext<HTMLPreElement>? = null,
content: ContentBuilder<HTMLPreElement>? = null content: ContentBuilder<HTMLPreElement>? = null
) { ) {
TagElement( TagElement(
@ -593,7 +607,7 @@ fun Pre(
@Composable @Composable
fun Code( fun Code(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
@ -605,7 +619,7 @@ fun Code(
@Composable @Composable
fun Main( fun Main(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
@ -617,7 +631,7 @@ fun Main(
@Composable @Composable
fun Footer( fun Footer(
attrs: AttrBuilderContext<HTMLElement> = {}, attrs: AttrBuilderContext<HTMLElement>? = null,
content: ContentBuilder<HTMLElement>? = null content: ContentBuilder<HTMLElement>? = null
) { ) {
TagElement( TagElement(
@ -629,7 +643,7 @@ fun Footer(
@Composable @Composable
fun Hr( fun Hr(
attrs: AttrBuilderContext<HTMLHRElement> = {} attrs: AttrBuilderContext<HTMLHRElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Hr, elementBuilder = ElementBuilder.Hr,
@ -641,7 +655,7 @@ fun Hr(
@Composable @Composable
fun Label( fun Label(
forId: String? = null, forId: String? = null,
attrs: AttrBuilderContext<HTMLLabelElement> = {}, attrs: AttrBuilderContext<HTMLLabelElement>? = null,
content: ContentBuilder<HTMLLabelElement>? = null content: ContentBuilder<HTMLLabelElement>? = null
) { ) {
TagElement( TagElement(
@ -650,7 +664,9 @@ fun Label(
if (forId != null) { if (forId != null) {
forId(forId) forId(forId)
} }
attrs() if (attrs != null) {
attrs()
}
}, },
content = content content = content
) )
@ -658,7 +674,7 @@ fun Label(
@Composable @Composable
fun Table( fun Table(
attrs: AttrBuilderContext<HTMLTableElement> = {}, attrs: AttrBuilderContext<HTMLTableElement>? = null,
content: ContentBuilder<HTMLTableElement>? = null content: ContentBuilder<HTMLTableElement>? = null
) { ) {
TagElement( TagElement(
@ -670,7 +686,7 @@ fun Table(
@Composable @Composable
fun Caption( fun Caption(
attrs: AttrBuilderContext<HTMLTableCaptionElement> = {}, attrs: AttrBuilderContext<HTMLTableCaptionElement>? = null,
content: ContentBuilder<HTMLTableCaptionElement>? = null content: ContentBuilder<HTMLTableCaptionElement>? = null
) { ) {
TagElement( TagElement(
@ -682,7 +698,7 @@ fun Caption(
@Composable @Composable
fun Col( fun Col(
attrs: AttrBuilderContext<HTMLTableColElement> = {} attrs: AttrBuilderContext<HTMLTableColElement>? = null
) { ) {
TagElement( TagElement(
elementBuilder = ElementBuilder.Col, elementBuilder = ElementBuilder.Col,
@ -693,7 +709,7 @@ fun Col(
@Composable @Composable
fun Colgroup( fun Colgroup(
attrs: AttrBuilderContext<HTMLTableColElement> = {}, attrs: AttrBuilderContext<HTMLTableColElement>? = null,
content: ContentBuilder<HTMLTableColElement>? = null content: ContentBuilder<HTMLTableColElement>? = null
) { ) {
TagElement( TagElement(
@ -705,7 +721,7 @@ fun Colgroup(
@Composable @Composable
fun Tr( fun Tr(
attrs: AttrBuilderContext<HTMLTableRowElement> = {}, attrs: AttrBuilderContext<HTMLTableRowElement>? = null,
content: ContentBuilder<HTMLTableRowElement>? = null content: ContentBuilder<HTMLTableRowElement>? = null
) { ) {
TagElement( TagElement(
@ -717,7 +733,7 @@ fun Tr(
@Composable @Composable
fun Thead( fun Thead(
attrs: AttrBuilderContext<HTMLTableSectionElement> = {}, attrs: AttrBuilderContext<HTMLTableSectionElement>? = null,
content: ContentBuilder<HTMLTableSectionElement>? = null content: ContentBuilder<HTMLTableSectionElement>? = null
) { ) {
TagElement( TagElement(
@ -729,7 +745,7 @@ fun Thead(
@Composable @Composable
fun Th( fun Th(
attrs: AttrBuilderContext<HTMLTableCellElement> = {}, attrs: AttrBuilderContext<HTMLTableCellElement>? = null,
content: ContentBuilder<HTMLTableCellElement>? = null content: ContentBuilder<HTMLTableCellElement>? = null
) { ) {
TagElement( TagElement(
@ -741,7 +757,7 @@ fun Th(
@Composable @Composable
fun Td( fun Td(
attrs: AttrBuilderContext<HTMLTableCellElement> = {}, attrs: AttrBuilderContext<HTMLTableCellElement>? = null,
content: ContentBuilder<HTMLTableCellElement>? = null content: ContentBuilder<HTMLTableCellElement>? = null
) { ) {
TagElement( TagElement(
@ -753,7 +769,7 @@ fun Td(
@Composable @Composable
fun Tbody( fun Tbody(
attrs: AttrBuilderContext<HTMLTableSectionElement> = {}, attrs: AttrBuilderContext<HTMLTableSectionElement>? = null,
content: ContentBuilder<HTMLTableSectionElement>? = null content: ContentBuilder<HTMLTableSectionElement>? = null
) { ) {
TagElement( TagElement(
@ -765,7 +781,7 @@ fun Tbody(
@Composable @Composable
fun Tfoot( fun Tfoot(
attrs: AttrBuilderContext<HTMLTableSectionElement> = {}, attrs: AttrBuilderContext<HTMLTableSectionElement>? = null,
content: ContentBuilder<HTMLTableSectionElement>? = null content: ContentBuilder<HTMLTableSectionElement>? = null
) { ) {
TagElement( TagElement(

Loading…
Cancel
Save