Browse Source

Add missing embedded HTML elements (apart from PORTAL)

IFRAME, OBJECT, PARAM, PICTURE, SOURCE

see https://developer.mozilla.org/en-US/docs/Web/HTML/Element
MERGE_HTML_BUILDER 0.5.0-build225
Shagen Ogandzhanian 4 years ago
parent
commit
c83938374f
  1. 13
      web/core/src/jsMain/kotlin/androidx/compose/web/elements/Base.kt
  2. 78
      web/core/src/jsMain/kotlin/androidx/compose/web/elements/Elements.kt
  3. 13
      web/core/src/jsTest/kotlin/elements/ElementsTests.kt

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

@ -24,10 +24,12 @@ import org.w3c.dom.HTMLButtonElement
import org.w3c.dom.HTMLDataListElement import org.w3c.dom.HTMLDataListElement
import org.w3c.dom.HTMLDivElement import org.w3c.dom.HTMLDivElement
import org.w3c.dom.HTMLElement import org.w3c.dom.HTMLElement
import org.w3c.dom.HTMLEmbedElement
import org.w3c.dom.HTMLFieldSetElement import org.w3c.dom.HTMLFieldSetElement
import org.w3c.dom.HTMLFormElement import org.w3c.dom.HTMLFormElement
import org.w3c.dom.HTMLHRElement import org.w3c.dom.HTMLHRElement
import org.w3c.dom.HTMLHeadingElement import org.w3c.dom.HTMLHeadingElement
import org.w3c.dom.HTMLIFrameElement
import org.w3c.dom.HTMLImageElement import org.w3c.dom.HTMLImageElement
import org.w3c.dom.HTMLInputElement import org.w3c.dom.HTMLInputElement
import org.w3c.dom.HTMLLIElement import org.w3c.dom.HTMLLIElement
@ -36,13 +38,17 @@ import org.w3c.dom.HTMLLegendElement
import org.w3c.dom.HTMLMapElement import org.w3c.dom.HTMLMapElement
import org.w3c.dom.HTMLMeterElement import org.w3c.dom.HTMLMeterElement
import org.w3c.dom.HTMLOListElement import org.w3c.dom.HTMLOListElement
import org.w3c.dom.HTMLObjectElement
import org.w3c.dom.HTMLOptGroupElement import org.w3c.dom.HTMLOptGroupElement
import org.w3c.dom.HTMLOptionElement import org.w3c.dom.HTMLOptionElement
import org.w3c.dom.HTMLOutputElement import org.w3c.dom.HTMLOutputElement
import org.w3c.dom.HTMLParagraphElement import org.w3c.dom.HTMLParagraphElement
import org.w3c.dom.HTMLParamElement
import org.w3c.dom.HTMLPictureElement
import org.w3c.dom.HTMLPreElement import org.w3c.dom.HTMLPreElement
import org.w3c.dom.HTMLProgressElement import org.w3c.dom.HTMLProgressElement
import org.w3c.dom.HTMLSelectElement import org.w3c.dom.HTMLSelectElement
import org.w3c.dom.HTMLSourceElement
import org.w3c.dom.HTMLSpanElement import org.w3c.dom.HTMLSpanElement
import org.w3c.dom.HTMLStyleElement import org.w3c.dom.HTMLStyleElement
import org.w3c.dom.HTMLTableCaptionElement import org.w3c.dom.HTMLTableCaptionElement
@ -118,6 +124,13 @@ interface ElementBuilder<TElement : Element> {
val Output: ElementBuilder<HTMLOutputElement> = ElementBuilderImplementation("output") val Output: ElementBuilder<HTMLOutputElement> = ElementBuilderImplementation("output")
val Progress: ElementBuilder<HTMLProgressElement> = ElementBuilderImplementation("progress") 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 Div: ElementBuilder<HTMLDivElement> = ElementBuilderImplementation("div")
val A: ElementBuilder<HTMLAnchorElement> = ElementBuilderImplementation("a") val A: ElementBuilder<HTMLAnchorElement> = ElementBuilderImplementation("a")
val Input: ElementBuilder<HTMLInputElement> = ElementBuilderImplementation("input") val Input: ElementBuilder<HTMLInputElement> = ElementBuilderImplementation("input")

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

@ -23,10 +23,12 @@ import org.w3c.dom.HTMLButtonElement
import org.w3c.dom.HTMLDataListElement import org.w3c.dom.HTMLDataListElement
import org.w3c.dom.HTMLDivElement import org.w3c.dom.HTMLDivElement
import org.w3c.dom.HTMLElement import org.w3c.dom.HTMLElement
import org.w3c.dom.HTMLEmbedElement
import org.w3c.dom.HTMLFieldSetElement import org.w3c.dom.HTMLFieldSetElement
import org.w3c.dom.HTMLFormElement import org.w3c.dom.HTMLFormElement
import org.w3c.dom.HTMLHeadingElement import org.w3c.dom.HTMLHeadingElement
import org.w3c.dom.HTMLHRElement import org.w3c.dom.HTMLHRElement
import org.w3c.dom.HTMLIFrameElement
import org.w3c.dom.HTMLImageElement import org.w3c.dom.HTMLImageElement
import org.w3c.dom.HTMLInputElement import org.w3c.dom.HTMLInputElement
import org.w3c.dom.HTMLLIElement import org.w3c.dom.HTMLLIElement
@ -35,13 +37,17 @@ import org.w3c.dom.HTMLLegendElement
import org.w3c.dom.HTMLMapElement import org.w3c.dom.HTMLMapElement
import org.w3c.dom.HTMLMeterElement import org.w3c.dom.HTMLMeterElement
import org.w3c.dom.HTMLOListElement import org.w3c.dom.HTMLOListElement
import org.w3c.dom.HTMLObjectElement
import org.w3c.dom.HTMLOptGroupElement import org.w3c.dom.HTMLOptGroupElement
import org.w3c.dom.HTMLOptionElement import org.w3c.dom.HTMLOptionElement
import org.w3c.dom.HTMLOutputElement import org.w3c.dom.HTMLOutputElement
import org.w3c.dom.HTMLParagraphElement import org.w3c.dom.HTMLParagraphElement
import org.w3c.dom.HTMLParamElement
import org.w3c.dom.HTMLPictureElement
import org.w3c.dom.HTMLPreElement import org.w3c.dom.HTMLPreElement
import org.w3c.dom.HTMLProgressElement import org.w3c.dom.HTMLProgressElement
import org.w3c.dom.HTMLSelectElement import org.w3c.dom.HTMLSelectElement
import org.w3c.dom.HTMLSourceElement
import org.w3c.dom.HTMLSpanElement import org.w3c.dom.HTMLSpanElement
import org.w3c.dom.HTMLTableCaptionElement import org.w3c.dom.HTMLTableCaptionElement
import org.w3c.dom.HTMLTableCellElement import org.w3c.dom.HTMLTableCellElement
@ -238,6 +244,78 @@ fun Progress(
) )
} }
@Composable
fun Embed(
attrs: AttrBuilderContext<HTMLEmbedElement> = {},
content: ContentBuilder<HTMLEmbedElement>? = null
) {
TagElement(
elementBuilder = ElementBuilder.Embed,
applyAttrs = attrs,
content = content
)
}
@Composable
fun Iframe(
attrs: AttrBuilderContext<HTMLIFrameElement> = {},
content: ContentBuilder<HTMLIFrameElement>? = null
) {
TagElement(
elementBuilder = ElementBuilder.Iframe,
applyAttrs = attrs,
content = content
)
}
@Composable
fun Object(
attrs: AttrBuilderContext<HTMLObjectElement> = {},
content: ContentBuilder<HTMLObjectElement>? = null
) {
TagElement(
elementBuilder = ElementBuilder.Object,
applyAttrs = attrs,
content = content
)
}
@Composable
fun Param(
attrs: AttrBuilderContext<HTMLParamElement> = {},
content: ContentBuilder<HTMLParamElement>? = null
) {
TagElement(
elementBuilder = ElementBuilder.Param,
applyAttrs = attrs,
content = content
)
}
@Composable
fun Picture(
attrs: AttrBuilderContext<HTMLPictureElement> = {},
content: ContentBuilder<HTMLPictureElement>? = null
) {
TagElement(
elementBuilder = ElementBuilder.Picture,
applyAttrs = attrs,
content = content
)
}
@Composable
fun Source(
attrs: AttrBuilderContext<HTMLSourceElement> = {},
content: ContentBuilder<HTMLSourceElement>? = null
) {
TagElement(
elementBuilder = ElementBuilder.Source,
applyAttrs = attrs,
content = content
)
}
@Composable @Composable
fun Text(value: String) { fun Text(value: String) {
ComposeNode<DomNodeWrapper, DomApplier>( ComposeNode<DomNodeWrapper, DomApplier>(

13
web/core/src/jsTest/kotlin/elements/ElementsTests.kt

@ -25,6 +25,7 @@ import org.jetbrains.compose.web.dom.ContentBuilder
import org.jetbrains.compose.web.dom.Datalist import org.jetbrains.compose.web.dom.Datalist
import org.jetbrains.compose.web.dom.Div import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.Em import org.jetbrains.compose.web.dom.Em
import org.jetbrains.compose.web.dom.Embed
import org.jetbrains.compose.web.dom.Fieldset import org.jetbrains.compose.web.dom.Fieldset
import org.jetbrains.compose.web.dom.Footer import org.jetbrains.compose.web.dom.Footer
import org.jetbrains.compose.web.dom.Form import org.jetbrains.compose.web.dom.Form
@ -38,22 +39,27 @@ import org.jetbrains.compose.web.dom.HTMLMap
import org.jetbrains.compose.web.dom.Header import org.jetbrains.compose.web.dom.Header
import org.jetbrains.compose.web.dom.Hr import org.jetbrains.compose.web.dom.Hr
import org.jetbrains.compose.web.dom.I import org.jetbrains.compose.web.dom.I
import org.jetbrains.compose.web.dom.Iframe
import org.jetbrains.compose.web.dom.Img import org.jetbrains.compose.web.dom.Img
import org.jetbrains.compose.web.dom.Label import org.jetbrains.compose.web.dom.Label
import org.jetbrains.compose.web.dom.Legend import org.jetbrains.compose.web.dom.Legend
import org.jetbrains.compose.web.dom.Main import org.jetbrains.compose.web.dom.Main
import org.jetbrains.compose.web.dom.Meter import org.jetbrains.compose.web.dom.Meter
import org.jetbrains.compose.web.dom.Nav import org.jetbrains.compose.web.dom.Nav
import org.jetbrains.compose.web.dom.Object
import org.jetbrains.compose.web.dom.Ol import org.jetbrains.compose.web.dom.Ol
import org.jetbrains.compose.web.dom.OptGroup import org.jetbrains.compose.web.dom.OptGroup
import org.jetbrains.compose.web.dom.Option import org.jetbrains.compose.web.dom.Option
import org.jetbrains.compose.web.dom.Output import org.jetbrains.compose.web.dom.Output
import org.jetbrains.compose.web.dom.P import org.jetbrains.compose.web.dom.P
import org.jetbrains.compose.web.dom.Param
import org.jetbrains.compose.web.dom.Picture
import org.jetbrains.compose.web.dom.Pre import org.jetbrains.compose.web.dom.Pre
import org.jetbrains.compose.web.dom.Progress import org.jetbrains.compose.web.dom.Progress
import org.jetbrains.compose.web.dom.Section import org.jetbrains.compose.web.dom.Section
import org.jetbrains.compose.web.dom.Select import org.jetbrains.compose.web.dom.Select
import org.jetbrains.compose.web.dom.Small import org.jetbrains.compose.web.dom.Small
import org.jetbrains.compose.web.dom.Source
import org.jetbrains.compose.web.dom.Span import org.jetbrains.compose.web.dom.Span
import org.jetbrains.compose.web.dom.Table import org.jetbrains.compose.web.dom.Table
import org.jetbrains.compose.web.dom.TagElement import org.jetbrains.compose.web.dom.TagElement
@ -95,6 +101,13 @@ class ElementsTests {
Pair({ Output() }, "OUTPUT"), Pair({ Output() }, "OUTPUT"),
Pair({ Progress() }, "PROGRESS"), Pair({ Progress() }, "PROGRESS"),
Pair({ Embed() }, "EMBED"),
Pair({ Iframe() }, "IFRAME"),
Pair({ Object() }, "OBJECT"),
Pair({ Param() }, "PARAM"),
Pair({ Picture() }, "PICTURE"),
Pair({ Source() }, "SOURCE"),
Pair({ Div() }, "DIV"), Pair({ Div() }, "DIV"),
Pair({ A() }, "A"), Pair({ A() }, "A"),
Pair({ Button() }, "BUTTON"), Pair({ Button() }, "BUTTON"),

Loading…
Cancel
Save