diff --git a/build.gradle.kts b/build.gradle.kts index 5e231171..5d6ce43f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,14 @@ import Build_gradle.MavenPomFile import kotlinx.html.js.packageJson +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl /** * This build script supports following parameters: * -PversionTag - works together with "branch-build" profile and overrides "-SNAPSHOT" suffix of the version. */ plugins { - kotlin("multiplatform") version "1.9.21" + kotlin("multiplatform") version "1.9.22" id("maven-publish") id("signing") } @@ -90,7 +92,7 @@ kotlin { } } } - js(IR) { + js { moduleName = project.name browser { testTask { @@ -105,6 +107,16 @@ kotlin { pom { name by "${project.name}-js" } } } + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + moduleName = project.name + browser() + + mavenPublication { + groupId = group as String + pom { name by "${project.name}-wasm-js" } + } + } mingwX64() linuxX64() @@ -123,6 +135,17 @@ kotlin { macosX64() macosArm64() + @OptIn(ExperimentalKotlinGradlePluginApi::class) + applyDefaultHierarchyTemplate { + common { + group("jsCommon") { + withJs() + // TODO: switch to `withWasmJs()` after upgrade to Kotlin 2.0 + withWasm() + } + } + } + metadata { mavenPublication { groupId = group as String @@ -140,7 +163,7 @@ kotlin { sourceSets { commonMain { dependencies { - implementation(kotlin("stdlib-common")) + implementation(kotlin("stdlib")) } } @@ -150,61 +173,6 @@ kotlin { } } - val jsMain by getting { - dependencies { - implementation(kotlin("stdlib-js")) - } - } - - val jsTest by getting { - dependencies { - implementation(kotlin("test-js")) - } - } - - val jvmMain by getting { - dependencies { - implementation(kotlin("stdlib")) - } - } - - val jvmTest by getting { - dependencies { - implementation(kotlin("test-junit")) - } - } - - val nativeMain by creating - val nativeTest by creating - - val nativeTargets = listOf( - "mingwX64", - "linuxX64", - "linuxArm64", - "iosX64", - "iosArm64", - "iosArm32", - "iosSimulatorArm64", - "watchosX86", - "watchosX64", - "watchosArm32", - "watchosArm64", - "watchosSimulatorArm64", - "tvosX64", - "tvosArm64", - "tvosSimulatorArm64", - "macosX64", - "macosArm64", - "watchosDeviceArm64", - ) - - val commonMain by getting - nativeMain.dependsOn(commonMain) - - nativeTargets.forEach { target -> - findByName("${target}Main")?.dependsOn(nativeMain) - findByName("${target}Test")?.dependsOn(nativeTest) - } } } @@ -226,9 +194,14 @@ tasks.register("generate") { doLast { kotlinx.html.generate.generate( - "kotlinx.html", - "src/commonMain/kotlin/generated", - "src/jsMain/kotlin/generated" + pkg = "kotlinx.html", + todir = "src/commonMain/kotlin/generated", + jsdir = "src/jsMain/kotlin/generated", + wasmJsDir = "src/wasmJsMain/kotlin/generated" + ) + kotlinx.html.generate.generateJsTagTests( + jsdir = "src/jsTest/kotlin/generated", + wasmJsDir = "src/wasmJsTest/kotlin/generated", ) } } @@ -342,3 +315,5 @@ rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlu rootProject.the().ignoreScripts = false } +tasks.getByName("jsBrowserTest").dependsOn("wasmJsTestTestDevelopmentExecutableCompileSync") +tasks.getByName("wasmJsBrowserTest").dependsOn("jsTestTestDevelopmentExecutableCompileSync") \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index de9ec918..a4d8dec2 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -9,4 +9,5 @@ repositories { dependencies { implementation(kotlin("stdlib")) implementation("com.sun.xsom:xsom:20140925") + implementation("com.squareup:kotlinpoet:1.15.3") } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt index 07ab8462..f100086e 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/attributes.kt @@ -1,5 +1,12 @@ package kotlinx.html.generate +import com.squareup.kotlinpoet.ClassName +import com.squareup.kotlinpoet.FunSpec +import com.squareup.kotlinpoet.LambdaTypeName +import com.squareup.kotlinpoet.ParameterSpec +import com.squareup.kotlinpoet.PropertySpec +import com.squareup.kotlinpoet.TypeName + fun String.quote() = "\"$this\"" fun Appendable.attributePseudoDelegate(request: AttributeRequest) { @@ -52,13 +59,15 @@ fun Appendable.facade(repository: Repository, facade: AttributeFacade) { } } -fun Appendable.eventProperty(parent: String, attribute: AttributeInfo) { +fun Appendable.eventProperty(parent: String, attribute: AttributeInfo, shouldUnsafeCast: Boolean) { val type = "(org.w3c.dom.events.Event) -> Unit" - variable(receiver = parent, variable = Var( + variable( + receiver = parent, variable = Var( name = attribute.fieldName + "Function", type = type, mutable = true - )) + ) + ) emptyLine() getter().defineIs(StringBuilder().apply { @@ -67,11 +76,48 @@ fun Appendable.eventProperty(parent: String, attribute: AttributeInfo) { }) setter { receiverDot("consumer") - functionCall("onTagEvent", listOf( + val newValue = if (shouldUnsafeCast) { + "newValue.unsafeCast<(Event) -> Unit>()" + } else { + "newValue" + } + functionCall( + "onTagEvent", listOf( "this", attribute.name.quote(), - "newValue.unsafeCast<(Event) -> Unit>()" - )) + newValue + ) + ) } emptyLine() } + +fun eventProperty(parent: TypeName, attribute: AttributeInfo, shouldUnsafeCast: Boolean): PropertySpec { + val propertyType = LambdaTypeName.get( + returnType = ClassName("kotlin", "Unit"), + parameters = listOf(ParameterSpec.unnamed(ClassName("kotlinx.html.org.w3c.dom.events", "Event"))), + ) + return PropertySpec.builder(attribute.fieldName + "Function", propertyType) + .mutable() + .receiver(parent) + .getter( + FunSpec.getterBuilder() + .addStatement("throw UnsupportedOperationException(\"You can't read variable ${attribute.fieldName}\")") + .build() + ) + .setter( + FunSpec.setterBuilder() + .addParameter("newValue", propertyType) + .addStatement( + "consumer.onTagEvent(this, %S, %L)", + attribute.name, + if (shouldUnsafeCast) { + "newValue.unsafeCast<(Event) -> Unit>()" + } else { + "newValue" + } + ) + .build() + ) + .build() +} diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt index a6a1f17c..33319c8d 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/codegen.kt @@ -1,32 +1,30 @@ package kotlinx.html.generate -import java.util.* - interface Const -data class StringConst(val value : String) : Const -data class ReferenceConst(val propertyName : String) : Const +data class StringConst(val value: String) : Const +data class ReferenceConst(val propertyName: String) : Const -val Const<*>.asFieldPart : String +val Const<*>.asFieldPart: String get() = when (this) { is StringConst -> value.humanize() is ReferenceConst -> propertyName else -> throw UnsupportedOperationException("Value $this of type ${javaClass.name} is not supported") } -val Const<*>.asValue : String +val Const<*>.asValue: String get() = when (this) { is StringConst -> value.quote() is ReferenceConst -> propertyName else -> throw UnsupportedOperationException("Value $this of type ${javaClass.name} is not supported") } -fun Appendable.packg(name : String) { +fun Appendable.packg(name: String) { append("package ") append(name) append("\n") } -fun Appendable.import(name : String) { +fun Appendable.import(name: String) { append("import ") append(name) append("\n") @@ -44,14 +42,32 @@ fun Appendable.doNotEditWarning() { append("/") } -fun Appendable.const(value : Const<*>) { +fun Appendable.const(value: Const<*>) { append(value.asValue) } -data class Var(val name : String, val type : String, val mutable : Boolean = false, val override : Boolean = false, val forceOmitValVar : Boolean = false, val defaultValue : String = "") -data class Clazz(val name: String, val parameters: List = listOf(), val variables: List = listOf(), val parents: List = listOf(), val isPublic: Boolean = true, val isAbstract: Boolean = false, val isOpen: Boolean = false, val isObject: Boolean = false, val isInterface: Boolean = false) - -fun Appendable.variable(variable : Var, omitValVar : Boolean = false, receiver : String = "") { +data class Var( + val name: String, + val type: String, + val mutable: Boolean = false, + val override: Boolean = false, + val forceOmitValVar: Boolean = false, + val defaultValue: String = "", +) + +data class Clazz( + val name: String, + val parameters: List = listOf(), + val variables: List = listOf(), + val parents: List = listOf(), + val isPublic: Boolean = true, + val isAbstract: Boolean = false, + val isOpen: Boolean = false, + val isObject: Boolean = false, + val isInterface: Boolean = false, +) + +fun Appendable.variable(variable: Var, omitValVar: Boolean = false, receiver: String = "") { if (!omitValVar && !variable.forceOmitValVar) { if (variable.override) { append("override ") @@ -84,7 +100,7 @@ fun Appendable.enumEntry(name: String, deprecated: String?, arguments: List O.getter(): O { return this } -fun O.setter(block : O.() -> Unit) : O { +fun O.setter(block: O.() -> Unit): O { append(" set(newValue) {") block() append("}\n") @@ -103,7 +119,7 @@ fun O.setter(block : O.() -> Unit) : O { return this } -fun O.clazz(clazz : Clazz, block : O.() -> Unit) : O { +fun O.clazz(clazz: Clazz, block: O.() -> Unit): O { val tokens = ArrayList() if (clazz.isPublic) { //tokens.add("public") // TODO we need to check !isPublic @@ -115,11 +131,13 @@ fun O.clazz(clazz : Clazz, block : O.() -> Unit) : O { tokens.add("open") } - tokens.add(when { - clazz.isObject -> "object" - clazz.isInterface -> "interface" - else -> "class" - }) + tokens.add( + when { + clazz.isObject -> "object" + clazz.isInterface -> "interface" + else -> "class" + } + ) tokens.add(clazz.name) tokens.joinTo(this, " ") @@ -148,16 +166,23 @@ fun O.clazz(clazz : Clazz, block : O.() -> Unit) : O { return this } -fun Appendable.functionCall(name : String, arguments : List) { +fun Appendable.functionCall(name: String, arguments: List) { append(name) arguments.joinTo(this, ", ", "(", ")") } -fun Appendable.functionCallConsts(name : String, arguments : List>) { - functionCall(name, arguments.map {it.asValue}) +fun Appendable.functionCallConsts(name: String, arguments: List>) { + functionCall(name, arguments.map { it.asValue }) } -fun Appendable.function(name : String, arguments : List = emptyList(), returnType : String = "Unit", generics : List = emptyList(), receiver : String = "", modifiers: List = emptyList()) { +fun Appendable.function( + name: String, + arguments: List = emptyList(), + returnType: String = "Unit", + generics: List = emptyList(), + receiver: String = "", + modifiers: List = emptyList(), +) { (modifiers + "fun").joinTo(this, separator = " ", postfix = " ") if (generics.isNotEmpty()) { @@ -184,18 +209,18 @@ fun Appendable.function(name : String, arguments : List = emptyList(), retu } } -fun Appendable.receiverDot(receiver : String) { +fun Appendable.receiverDot(receiver: String) { append(receiver) append('.') } -fun O.blockShort(block : O.() -> Unit) : O = with { +fun O.blockShort(block: O.() -> Unit): O = with { append("{ ") block() append(" }\n") } -fun O.block(block : O.() -> Unit) : O { +fun O.block(block: O.() -> Unit): O { append(" {\n") block() append("}\n") @@ -203,7 +228,7 @@ fun O.block(block : O.() -> Unit) : O { return this } -fun O.defineIs(expression : CharSequence) : O { +fun O.defineIs(expression: CharSequence): O { append(" = ") append(expression) append("\n") @@ -211,9 +236,11 @@ fun O.defineIs(expression : CharSequence) : O { return this } -fun Appendable.emptyLine() { appendLine() } +fun Appendable.emptyLine() { + appendLine() +} -fun T.with(block : T.() -> Unit) : T { +fun T.with(block: T.() -> Unit): T { block() return this } diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/kdoc.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/kdoc.kt index fb98b00e..525ca5d1 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/kdoc.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/kdoc.kt @@ -1,8 +1,9 @@ package kotlinx.html.generate -import org.w3c.dom.* -import java.net.* -import javax.xml.parsers.* +import java.net.URL +import javax.xml.parsers.DocumentBuilderFactory +import org.w3c.dom.Node +import org.w3c.dom.NodeList private val HTML_TABLE_URL = "htmltable.xml".asResourceUrl() private val HTML5_TABLE_URL = "html5table.xml".asResourceUrl() @@ -11,7 +12,11 @@ object KdocRepository { lateinit var tags: Map } +private var kdocRepositoryFilled = false + fun fillKdocRepositoryExtension() { + if (kdocRepositoryFilled) return + kdocRepositoryFilled = true KdocRepository.tags = parseDocInfos() } @@ -40,7 +45,7 @@ private fun parseDocInfo(xmlPath: URL): List { data class KDocInfo( val name: String, val description: String, - val helpref: String + val helpref: String, ) private fun NodeList.asList() = (0 until length).map { item(it) } diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/main.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/main.kt index bb95c635..96d8858a 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/main.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/main.kt @@ -1,58 +1,42 @@ package kotlinx.html.generate -import java.io.* - -fun generate(packg: String, todir: String, jsdir: String) { +import com.squareup.kotlinpoet.ClassName +import com.squareup.kotlinpoet.FileSpec +import com.squareup.kotlinpoet.FunSpec +import com.squareup.kotlinpoet.TypeSpec +import java.io.File +import java.io.FileOutputStream +import java.io.InputStreamReader + +fun generate(pkg: String, todir: String, jsdir: String, wasmJsDir: String) { val repository = Repository() fillRepository(repository) fillKdocRepositoryExtension() File(todir).mkdirs() File(jsdir).mkdirs() + File(wasmJsDir).mkdirs() - FileOutputStream("$todir/gen-attr-traits.kt").writer().use { - it.with { - packg(packg) - emptyLine() - import("kotlinx.html.*") - import("kotlinx.html.impl.*") - emptyLine() + writeIntoFile("$todir/gen-attr-traits.kt") { + packg(pkg) + emptyLine() + import("kotlinx.html.*") + import("kotlinx.html.impl.*") + emptyLine() - doNotEditWarning() - emptyLine() - emptyLine() + doNotEditWarning() + emptyLine() + emptyLine() - repository.attributeFacades.values.forEach { - facade(repository, it) - emptyLine() - } + repository.attributeFacades.values.forEach { + facade(repository,it) + emptyLine() } } repository.tags.values.filterIgnored().groupBy { it.name[0] }.entries.forEach { e -> - FileOutputStream("$todir/gen-tags-${e.key}.kt").writer(Charsets.UTF_8).use { - it.with { - packg(packg) - emptyLine() - import("kotlinx.html.*") - import("kotlinx.html.impl.*") - import("kotlinx.html.attributes.*") - emptyLine() - - doNotEditWarning() - emptyLine() - emptyLine() - - e.value.forEach { - tagClass(repository, it, emptySet()) - } - } - } - } - - FileOutputStream("$todir/gen-consumer-tags.kt").writer(Charsets.UTF_8).use { - it.with { - packg(packg) + writeIntoFile("$todir/gen-tags-${e.key}.kt") { + packg(pkg) emptyLine() import("kotlinx.html.*") import("kotlinx.html.impl.*") @@ -63,73 +47,29 @@ fun generate(packg: String, todir: String, jsdir: String) { emptyLine() emptyLine() - repository.tags.values.filterIgnored().forEach { - val contentlessTag = it.name.lowercase() in contentlessTags - if (it.possibleChildren.isEmpty() && it.name.lowercase() !in emptyTags && !contentlessTag) { - consumerBuilderShared(it, false) - } else if (contentlessTag) { - deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") - suppress("DEPRECATION") - consumerBuilderShared(it, false) - } - consumerBuilderShared(it, true) - emptyLine() + e.value.forEach { + tagClass(repository, it, emptySet()) } } } - FileOutputStream("$jsdir/gen-consumer-tags-js.kt").writer(Charsets.UTF_8).use { - it.with { - packg(packg + ".js") - emptyLine() - import("kotlinx.html.*") - import("kotlinx.html.impl.*") - import("kotlinx.html.attributes.*") - import("org.w3c.dom.*") - emptyLine() - - doNotEditWarning() - emptyLine() - emptyLine() - - repository.tags.values.filterIgnored().forEach { - val contentlessTag = it.name.lowercase() in contentlessTags - if (it.possibleChildren.isEmpty() && it.name.lowercase() !in emptyTags && !contentlessTag) { - consumerBuilderJS(it, false) - } else if (contentlessTag) { - deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") - suppress("DEPRECATION") - consumerBuilderJS(it, false) - } - consumerBuilderJS(it, true) - emptyLine() - } - } + generateConsumerTags(repository, "$todir/gen-consumer-tags.kt", pkg) { tag, blockOrContent -> + consumerBuilderSharedPoet(tag, blockOrContent) } - FileOutputStream("$jsdir/gen-event-attrs-js.kt").writer(Charsets.UTF_8).use { - it.with { - packg(packg + ".js") - emptyLine() - import("kotlinx.html.*") - import("kotlinx.html.org.w3c.dom.events.Event") - emptyLine() - - doNotEditWarning() - emptyLine() - emptyLine() + generateConsumerTags(repository, "$jsdir/gen-consumer-tags-js.kt", "$pkg.js") { tag, blockOrContent -> + consumerBuilderJsPoet(tag, blockOrContent, "HTMLElement") + } + generateEventAttrs(repository, "$jsdir/gen-event-attrs-js.kt", "$pkg.js") - repository.attributeFacades.filter { it.value.attributeNames.any { it.startsWith("on") } }.forEach { facade -> - facade.value.attributes.filter { it.name.startsWith("on") }.forEach { - eventProperty(facade.value.name.capitalize() + "Facade", it) - } - } - } + generateConsumerTags(repository, "$wasmJsDir/gen-consumer-tags-wasm-js.kt", "$pkg.js") { tag, blockOrContent -> + consumerBuilderJsPoet(tag, blockOrContent, "Element") } + generateEventAttrs(repository, "$wasmJsDir/gen-event-attrs-wasm-js.kt", "$pkg.js") FileOutputStream("$todir/gen-enums.kt").writer(Charsets.UTF_8).use { it.with { - packg(packg) + packg(pkg) emptyLine() import("kotlinx.html.*") emptyLine() @@ -149,22 +89,24 @@ fun generate(packg: String, todir: String, jsdir: String) { } repository.attributeFacades.values.forEach { facade -> - facade.attributes.filter { it.enumValues.isNotEmpty() }.filter { !isAttributeExcluded(it.name) }.forEach { attribute -> - genEnumAttribute(attribute) - } + facade.attributes.filter { it.enumValues.isNotEmpty() }.filter { !isAttributeExcluded(it.name) } + .forEach { attribute -> + genEnumAttribute(attribute) + } } repository.tags.values.filterIgnored().forEach { tag -> - tag.attributes.filter { it.enumValues.isNotEmpty() }.filter { !isAttributeExcluded(it.name) }.forEach { attribute -> - genEnumAttribute(attribute) - } + tag.attributes.filter { it.enumValues.isNotEmpty() }.filter { !isAttributeExcluded(it.name) } + .forEach { attribute -> + genEnumAttribute(attribute) + } } } } FileOutputStream("$todir/gen-attributes.kt").writer(Charsets.UTF_8).use { it.with { - packg(packg) + packg(pkg) emptyLine() import("kotlinx.html.*") import("kotlinx.html.attributes.*") @@ -182,7 +124,7 @@ fun generate(packg: String, todir: String, jsdir: String) { FileOutputStream("$todir/gen-tag-unions.kt").writer(Charsets.UTF_8).use { with(it) { - packg(packg) + packg(pkg) emptyLine() import("kotlinx.html.*") import("kotlinx.html.impl.*") @@ -194,11 +136,13 @@ fun generate(packg: String, todir: String, jsdir: String) { emptyLine() repository.groupUnions.values.forEach { union -> - clazz(Clazz( + clazz( + Clazz( name = union.name, isInterface = true, parents = union.superGroups + "Tag" - )) {} + ) + ) {} emptyLine() } @@ -207,9 +151,10 @@ fun generate(packg: String, todir: String, jsdir: String) { emptyLine() repository.groupUnions.values.forEach { union -> - (union.additionalTags + union.ambiguityTags).mapNotNull { repository.tags[it] }.filterIgnored().forEach { tag -> - htmlTagBuilders(union.name, tag) - } + (union.additionalTags + union.ambiguityTags).mapNotNull { repository.tags[it] }.filterIgnored() + .forEach { tag -> + htmlTagBuilders(union.name, tag) + } emptyLine() } @@ -218,7 +163,7 @@ fun generate(packg: String, todir: String, jsdir: String) { FileOutputStream("$todir/gen-tag-groups.kt").writer(Charsets.UTF_8).use { with(it) { - packg(packg) + packg(pkg) emptyLine() import("kotlinx.html.*") import("kotlinx.html.impl.*") @@ -241,16 +186,17 @@ fun generate(packg: String, todir: String, jsdir: String) { val receiver = group.typeName val unions = repository.unionsByGroups[group.name].orEmpty() - group.tags.mapNotNull { repository.tags[it] }.filterIgnored().filter { tag -> unions.count { tag.name in it.intersectionTags } == 0 }.forEach { - htmlTagBuilders(receiver, it) - } + group.tags.mapNotNull { repository.tags[it] }.filterIgnored() + .filter { tag -> unions.count { tag.name in it.intersectionTags } == 0 }.forEach { + htmlTagBuilders(receiver, it) + } } } } FileOutputStream("$todir/gen-entities.kt").writer(Charsets.UTF_8).use { it.with { - packg(packg) + packg(pkg) emptyLine() import("kotlinx.html.*") emptyLine() @@ -291,5 +237,151 @@ fun generate(packg: String, todir: String, jsdir: String) { } } - generateParentInterfaces(repository, todir, packg) + generateParentInterfaces(repository, todir, pkg) +} + +fun generateJsTagTests(jsdir: String, wasmJsDir: String) { + val repository = Repository() + fillRepository(repository) + fillKdocRepositoryExtension() + + File(jsdir).mkdirs() + File(wasmJsDir).mkdirs() + + generateTagTests(repository, "$jsdir/gen-tag-tests.kt", "HTMLElement") + generateTagTests(repository, "$wasmJsDir/gen-tag-tests.kt", "Element") +} + +private fun generateTagTests(repository: Repository, filePath: String, defaultTagConsumer: String) { + val wrapper = FunSpec.builder("wrapper") + .returns(tagConsumerJs(defaultTagConsumer)) + .addStatement("return document.body!!.append") + .build() + + val testFunctions = repository.tags.values.filterIgnored().map { tag -> + FunSpec.builder("test${tag.memberName.capitalize()}") + .addAnnotation(ClassName("kotlin.test", "Test")) + .addStatement("wrapper().${tag.memberName} {}") + .build() + } + + + writeIntoFile(filePath) { + import("kotlinx.html.js.*") + emptyLine() + doNotEditWarning() + emptyLine() + + writeKotlinPoet { + addImport("kotlinx.browser", "document") + addImport("kotlinx.html.dom", "append") + addAliasedImport(ClassName("kotlin.test", "Test"), "test") + addType( + TypeSpec + .classBuilder("JsTagCastTests") + .addFunction(wrapper) + .addFunctions(testFunctions) + .build() + ) + } + } +} + +fun interface ConsumerBuilder { + operator fun invoke(tag: TagInfo, blockOrContent: Boolean): FunSpec } + +private fun generateConsumerTags( + repository: Repository, + filePath: String, + pkg: String, + consumerBuilder: ConsumerBuilder, +) { + val functions = sequence { + repository.tags.values.filterIgnored().forEach { tag -> + val lowercaseTag = tag.name.lowercase() + val contentlessTag = lowercaseTag in contentlessTags + val hasNoPossibleChildren = tag.possibleChildren.isEmpty() + val isNotEmpty = lowercaseTag !in emptyTags + + if (hasNoPossibleChildren && isNotEmpty && !contentlessTag) { + yield(consumerBuilder(tag, false)) + } else if (contentlessTag) { + yield( + consumerBuilder(tag, false) + .toBuilder() + .addSuppressAnnotation("DEPRECATION") + .addDeprecatedAnnotation("This tag doesn't support content or requires unsafe (try unsafe {})") + .build() + ) + } + + yield(consumerBuilder(tag, true)) + } + } + + writeIntoFile(filePath) { + doNotEditWarning() + emptyLine() + packg(pkg) + emptyLine() + import("kotlinx.html.*") + import("kotlinx.html.attributes.*") + + emptyLine() + + writeKotlinPoet { + functions.forEach { func -> + addFunction(func) + } + } + } +} + +private fun generateEventAttrs(repository: Repository, file: String, pkg: String) { + val isEventAttribute = { attributeName: String -> + attributeName.startsWith("on") + } + val properties = sequence { + repository + .attributeFacades + .filter { facade -> facade.value.attributeNames.any(isEventAttribute) } + .forEach { facade -> + facade.value.attributes.filter { it.name.startsWith("on") }.forEach { + val parentName = facade.value.name.capitalize() + "Facade" + val parent = ClassName("kotlinx.html", parentName) + + yield(eventProperty(parent, it, shouldUnsafeCast = false)) + } + } + } + + writeIntoFile(file) { + packg(pkg) + emptyLine() + doNotEditWarning() + emptyLine() + + writeKotlinPoet { + properties.forEach { property -> + addProperty(property) + } + } + } +} + +private fun writeIntoFile(file: String, contentWriter: Appendable.() -> Unit) { + FileOutputStream(file).writer(Charsets.UTF_8).use { + it.with { + contentWriter() + } + } +} + +private fun Appendable.writeKotlinPoet(builder: FileSpec.Builder.() -> Unit) { + FileSpec + .builder("", "") + .apply(builder) + .build() + .writeTo(this) +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/model.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/model.kt index 11c17529..be98ff03 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/model.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/model.kt @@ -1,18 +1,21 @@ package kotlinx.html.generate +import com.squareup.kotlinpoet.ClassName +import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy +import com.squareup.kotlinpoet.TypeName import java.util.* -import kotlin.collections.HashMap class Repository { val tags = TreeMap() - val attributeDelegateRequests = TreeSet ( - Comparator { a, b -> a.type.compareTo(b.type) } - .thenComparator { a, b -> a.enumTypeName.compareTo(b.enumTypeName) } - .thenComparator { a, b -> a.options.size.compareTo(b.options.size) } - .thenComparator { a, b -> - a.options.zip(b.options).map { it.first.asValue.compareTo(it.second.asValue) }.firstOrNull { it != 0 } ?: 0 - } + val attributeDelegateRequests = TreeSet( + Comparator { a, b -> a.type.compareTo(b.type) } + .thenComparator { a, b -> a.enumTypeName.compareTo(b.enumTypeName) } + .thenComparator { a, b -> a.options.size.compareTo(b.options.size) } + .thenComparator { a, b -> + a.options.zip(b.options).map { it.first.asValue.compareTo(it.second.asValue) }.firstOrNull { it != 0 } + ?: 0 + } ) val attributeFacades = TreeMap() @@ -23,66 +26,90 @@ class Repository { var unionsByGroups: Map> = emptyMap() } -data class AttributeFacade(val name : String, val attributes : List, val required : Set) { - val attributeNames = attributes.map {it.name}.toSet() +data class AttributeFacade(val name: String, val attributes: List, val required: Set) { + val attributeNames = attributes.map { it.name }.toSet() } -data class AttributeEnumValue ( - val realName : String, - val fieldName : String +data class AttributeEnumValue( + val realName: String, + val fieldName: String, ) -enum class AttributeType(val classPrefix : String, val typeName : String) { - STRING("String", "String"), - STRING_SET("StringSet", "Set"), - BOOLEAN("Boolean", "Boolean"), - TICKER("Ticker", "Boolean"), - ENUM("Enum", "???") +enum class AttributeType(val classPrefix: String, val typeName: String, val poetTypeName: TypeName) { + STRING("String", "String", ClassName("kotlin", "String")), + STRING_SET( + "StringSet", + "Set", + ClassName("kotlin.collections", "Set").parameterizedBy(ClassName("kotlin", "String")) + ), + BOOLEAN("Boolean", "Boolean", ClassName("kotlin", "Boolean")), + TICKER("Ticker", "Boolean", ClassName("kotlin", "Boolean")), + ENUM("Enum", "???", ClassName("kotlin", "Nothing")), } -data class GroupUnion(val members: List, val intersectionTags: Set, val additionalTags: List, val ambiguityTags: List, val superGroups: List) { +data class GroupUnion( + val members: List, + val intersectionTags: Set, + val additionalTags: List, + val ambiguityTags: List, + val superGroups: List, +) { val name = unionName(members) } interface HasType { - val type : AttributeType - val enumTypeName : String + val type: AttributeType + val enumTypeName: String + val poetEnumTypeName: TypeName } data class AttributeRequest( - override val type : AttributeType, - override val enumTypeName : String, - val options : List> = emptyList() + override val type: AttributeType, + override val enumTypeName: String, + override val poetEnumTypeName: TypeName, + val options: List> = emptyList(), ) : HasType -val AttributeRequest.delegatePropertyName : String - get() = "attribute${typeName.humanize().capitalize()}${type.classPrefix}${options.map {it.asFieldPart.humanize().capitalize()}.joinToString("")}" +val AttributeRequest.delegatePropertyName: String + get() = "attribute${typeName.humanize().capitalize()}${type.classPrefix}${ + options.map { + it.asFieldPart.humanize().capitalize() + }.joinToString("") + }" data class AttributeInfo( - val name : String, - override val type : AttributeType, - val trueFalse : List = listOf(), - override val enumTypeName : String = "", - val required : Boolean = false, - val enumValues : List = emptyList() + val name: String, + override val type: AttributeType, + val trueFalse: List = listOf(), + override val enumTypeName: String = "", + override val poetEnumTypeName: TypeName = if (enumTypeName.isNotBlank()) { + ClassName("kotlinx.html", enumTypeName) + } else { + ClassName("kotlin", "Nothing") + }, + val required: Boolean = false, + val enumValues: List = emptyList(), ) : HasType { val fieldName: String = attributeReplacements.firstOrNull { it.first.matches(name) }?.second - ?: name.humanize().replaceIfReserved() + ?: name.humanize().replaceIfReserved() } -val HasType.typeName : String +val HasType.typeName: String get() = if (type == AttributeType.ENUM) enumTypeName else type.typeName +val HasType.poetTypeName: TypeName + get() = if (type == AttributeType.ENUM) poetEnumTypeName else type.poetTypeName + fun String.isLowerCase() = this.lowercase() == this data class TagInfo( - val name : String, - val possibleChildren : List, - val directChildren : List, - val attributeGroups : List, - val attributes : List, - val suggestedAttributes : Set, - val tagGroupNames: List + val name: String, + val possibleChildren: List, + val directChildren: List, + val attributeGroups: List, + val attributes: List, + val suggestedAttributes: Set, + val tagGroupNames: List, ) { val className: String = name.humanize().uppercase() val memberName: String = name.humanize().replaceIfReserved() @@ -91,8 +118,9 @@ data class TagInfo( fun TagInfo.mergeAttributes() = attributes + attributeGroups.flatMap { it.attributes } data class TagGroup( - val name : String, - val tags : List) { + val name: String, + val tags: List, +) { val memberName: String = name.humanize() val typeName: String = memberName.capitalize() diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt index b87f88e6..7d38d59e 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/tagsgen.kt @@ -1,9 +1,19 @@ package kotlinx.html.generate +import com.squareup.kotlinpoet.AnnotationSpec +import com.squareup.kotlinpoet.ClassName +import com.squareup.kotlinpoet.FunSpec +import com.squareup.kotlinpoet.KModifier +import com.squareup.kotlinpoet.LambdaTypeName +import com.squareup.kotlinpoet.ParameterSpec +import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy +import com.squareup.kotlinpoet.TypeName +import com.squareup.kotlinpoet.TypeVariableName +import com.squareup.kotlinpoet.asTypeName import java.util.* -fun Appendable.tagClass(repository: Repository, tag: TagInfo, excludeAttributes : Set) { - val parentAttributeIfaces = tag.attributeGroups.map {it.name.capitalize() + "Facade"} +fun Appendable.tagClass(repository: Repository, tag: TagInfo, excludeAttributes: Set) { + val parentAttributeIfaces = tag.attributeGroups.map { it.name.capitalize() + "Facade" } val parentElementIfaces = tag.tagGroupNames.map { it.humanize().capitalize() } val allParentIfaces = parentAttributeIfaces + parentElementIfaces val betterParentIfaces = humanizeJoin(allParentIfaces) @@ -31,22 +41,22 @@ fun Appendable.tagClass(repository: Repository, tag: TagInfo, excludeAttributes appendLine("@Suppress(\"unused\")") clazz(Clazz( - name = tag.className, - variables = parameters, - parents = listOf( - buildString { - functionCall("HTMLTag", superConstructorArguments) - } - ) + when { - allParentIfaces.isNotEmpty() -> listOf(betterParentIfaces).map { renames[it] ?: it } - else -> emptyList() - }, - isOpen = true + name = tag.className, + variables = parameters, + parents = listOf( + buildString { + functionCall("HTMLTag", superConstructorArguments) + } + ) + when { + allParentIfaces.isNotEmpty() -> listOf(betterParentIfaces).map { renames[it] ?: it } + else -> emptyList() + }, + isOpen = true )) { - val lowerCasedNames = tag.attributes.map {it.name.lowercase()}.toSet() - val attributes = tag.attributes.filter {it.name !in excludeAttributes} + val lowerCasedNames = tag.attributes.map { it.name.lowercase() }.toSet() + val attributes = tag.attributes.filter { it.name !in excludeAttributes } - attributes.filter {!isAttributeExcluded(it.name) }.forEach { attribute -> + attributes.filter { !isAttributeExcluded(it.name) }.forEach { attribute -> if (attribute.name[0].isLowerCase() || attribute.name.lowercase() !in lowerCasedNames) { attributeProperty(repository, attribute) } @@ -126,12 +136,13 @@ fun Appendable.tagClass(repository: Repository, tag: TagInfo, excludeAttributes emptyLine() } - tag.directChildren.map {repository.tags[it]}.filterNotNull().filterIgnored().forEach { children -> + tag.directChildren.map { repository.tags[it] }.filterNotNull().filterIgnored().forEach { children -> htmlTagBuilders(tag.className, children) } if (parentElementIfaces.size > 1) { - val commons = tag.tagGroupNames.map {repository.tagGroups[it]?.tags?.toSet()}.filterNotNull().reduce { a, b -> a.intersect(b) } + val commons = tag.tagGroupNames.map { repository.tagGroups[it]?.tags?.toSet() }.filterNotNull() + .reduce { a, b -> a.intersect(b) } if (commons.isNotEmpty()) { parentElementIfaces.forEach { group -> variable(Var(name = "as" + group, type = group), receiver = tag.className) @@ -147,10 +158,9 @@ fun Appendable.tagClass(repository: Repository, tag: TagInfo, excludeAttributes } internal fun Appendable.tagAttributeVar( - repository: Repository, - attribute: AttributeInfo, + repository: Repository, attribute: AttributeInfo, receiver: String?, - indent: Int = 1 + indent: Int = 1, ): AttributeRequest { val options = LinkedList>() @@ -160,7 +170,12 @@ internal fun Appendable.tagAttributeVar( options.addAll(attribute.trueFalse.map(::StringConst)) } - val attributeRequest = AttributeRequest(attribute.type, if (attribute.type == AttributeType.ENUM) attribute.enumTypeName else "", options) + val attributeRequest = AttributeRequest( + attribute.type, + if (attribute.type == AttributeType.ENUM) attribute.enumTypeName else "", + attribute.poetEnumTypeName, + options + ) repository.attributeDelegateRequests.add(attributeRequest) indent(indent) @@ -168,78 +183,132 @@ internal fun Appendable.tagAttributeVar( return attributeRequest } -fun probeType(htmlClassName : String) : Boolean = htmlClassName in knownTagClasses +fun probeType(htmlClassName: String): Boolean = htmlClassName in knownTagClasses -private fun tagCandidates(tag : TagInfo) = (listOf(tag.memberName) + tagReplacements.map { tag.memberName.replace(it.first.toRegex(), it.second) }).flatMap { listOf(it.capitalize(), it.uppercase()) }.distinct() +private fun tagCandidates(tag: TagInfo) = (listOf(tag.memberName) + tagReplacements.map { + tag.memberName.replace( + it.first.toRegex(), + it.second + ) +}).flatMap { listOf(it.capitalize(), it.uppercase()) }.distinct() -fun getTagResultClass(tag: TagInfo) = - tagCandidates(tag) - .map { "HTML${it}Element" } - .firstOrNull { probeType(it) } ?: "HTMLElement" +fun getTagResultClass(tag: TagInfo): String? = + tagCandidates(tag) + .map { "HTML${it}Element" } + .firstOrNull { probeType(it) } -fun contentArgumentValue(tag : TagInfo, blockOrContent : Boolean) = when { +fun contentArgumentValue(tag: TagInfo, blockOrContent: Boolean) = when { tag.name.lowercase() in emptyTags -> "block" blockOrContent -> "block" else -> "{+content}" } -fun Appendable.consumerBuilderJS(tag : TagInfo, blockOrContent : Boolean) { - val resultType = getTagResultClass(tag) +fun tagConsumerJs(parameter: String): TypeName = + ClassName("kotlinx.html", "TagConsumer") + .parameterizedBy(ClassName("org.w3c.dom", parameter)) - val constructorArgs = mutableListOf( - buildSuggestedAttributesArgument(tag), - "this" +fun tagConsumer(parameter: TypeName): TypeName = + ClassName("kotlinx.html", "TagConsumer") + .parameterizedBy(parameter) + +fun FunSpec.Builder.addSuppressAnnotation(suppress: String) = + addAnnotation( + AnnotationSpec + .builder(Suppress::class) + .addMember("%S", suppress) + .build() ) - if (tag.name.lowercase() in tagsWithCustomizableNamespace) { - constructorArgs.add("namespace") - } +fun FunSpec.Builder.addDeprecatedAnnotation(reason: String) = + addAnnotation( + AnnotationSpec + .builder(Deprecated::class) + .addMember("%S", reason) + .build() + ) - tagKdoc(tag) - htmlDslMarker() - append("public ") - if (tagBuilderCouldBeInline(tag, blockOrContent)) append("inline ") - function(tag.memberName, tagBuilderFunctionArguments(tag, blockOrContent), resultType, receiver = "TagConsumer") - defineIs(buildString { - functionCall(tag.className, constructorArgs) - append(".") - functionCall("visitAndFinalize", listOf( - "this", - contentArgumentValue(tag, blockOrContent) - )) - - if (resultType != "HTMLElement") { - append(" as ") - append(resultType) + +fun consumerBuilderJsPoet( + tag: TagInfo, + blockOrContent: Boolean, + defaultTagConsumer: String, +): FunSpec { + val constructorArgs = listOfNotNull( + buildSuggestedAttributesArgument(tag), + "this", + "namespace".takeIf { tag.name.lowercase() in tagsWithCustomizableNamespace } + ) + + val tagResultClass = getTagResultClass(tag) + val cast = if (tagResultClass != null) " as $tagResultClass" else "" + val tagClass = ClassName("kotlinx.html", tag.className) + return FunSpec + .builder(tag.memberName) + .returns(ClassName("org.w3c.dom", tagResultClass ?: defaultTagConsumer)) + .addModifiers(KModifier.PUBLIC) + .receiver(tagConsumerJs(defaultTagConsumer)) + .addKdoc(tag) + .addAnnotation(ClassName("kotlinx.html", "HtmlTagMarker")) + .addTagBuilderFunctionArguments(tag, tagClass, blockOrContent) + .apply { + if (tagBuilderCouldBeInline(tag, blockOrContent)) { + addModifiers(KModifier.INLINE) + } } - }) + .addCode( + """ + |return %T(${constructorArgs.joinToString(", ")}) + | .visitAndFinalize(this, ${contentArgumentValue(tag, blockOrContent)}) $cast + """.trimMargin(), + tagClass, + ) + .build() } -fun Appendable.consumerBuilderShared(tag : TagInfo, blockOrContent : Boolean) { - val constructorArgs = mutableListOf( +fun consumerBuilderSharedPoet( + tag: TagInfo, + blockOrContent: Boolean, +): FunSpec { + val constructorArgs = listOfNotNull( buildSuggestedAttributesArgument(tag), - "this" + "this", + "namespace".takeIf { tag.name.lowercase() in tagsWithCustomizableNamespace } ) - if (tag.name.lowercase() in tagsWithCustomizableNamespace) { - constructorArgs.add("namespace") - } + val tagClass = ClassName("kotlinx.html", tag.className) + val typeVariableT = TypeVariableName("T") + val typeVariableC = TypeVariableName("C", tagConsumer(typeVariableT)) + return FunSpec + .builder(tag.memberName) + .returns(typeVariableT) + .addTypeVariable(typeVariableT) + .addTypeVariable(typeVariableC) + .receiver(typeVariableC) + .addKdoc(tag) + .addAnnotation(ClassName("kotlinx.html", "HtmlTagMarker")) + .addTagBuilderFunctionArguments(tag, tagClass, blockOrContent) + .apply { + if (tagBuilderCouldBeInline(tag, blockOrContent)) { + addModifiers(KModifier.INLINE) + } + } + .addCode( + """ + |return %T(${constructorArgs.joinToString(", ")}) + | .visitAndFinalize(this, ${contentArgumentValue(tag, blockOrContent)}) + """.trimMargin(), + tagClass, + ) + .build() +} - tagKdoc(tag) - htmlDslMarker() - if (tagBuilderCouldBeInline(tag, blockOrContent)) append("inline ") - function(tag.memberName, tagBuilderFunctionArguments(tag, blockOrContent), "T", listOf("T", "C : TagConsumer"), "C") - defineIs(buildString { - functionCall(tag.className, constructorArgs) - append(".") - functionCall("visitAndFinalize", listOf( - "this", - contentArgumentValue(tag, blockOrContent) - )) - }) +private fun FunSpec.Builder.addKdoc(tag: TagInfo): FunSpec.Builder { + val kdoc = tag.kdoc?.description ?: return this + addKdoc("%L", kdoc) + return this } -fun Appendable.htmlTagBuilderMethod(receiver : String, tag : TagInfo, blockOrContent : Boolean) { +fun Appendable.htmlTagBuilderMethod(receiver: String, tag: TagInfo, blockOrContent: Boolean) { val arguments = tagBuilderFunctionArguments(tag, blockOrContent) val constructorArgs = mutableListOf( @@ -262,16 +331,25 @@ fun Appendable.htmlTagBuilderMethod(receiver : String, tag : TagInfo, blockOrCon }) } -fun Appendable.htmlTagEnumBuilderMethod(receiver : String, tag : TagInfo, blockOrContent : Boolean, enumAttribute : AttributeInfo, indent : Int) { +fun Appendable.htmlTagEnumBuilderMethod( + receiver: String, + tag: TagInfo, + blockOrContent: Boolean, + enumAttribute: AttributeInfo, + indent: Int, +) { require(enumAttribute.enumValues.isNotEmpty()) - val arguments = tagBuilderFunctionArguments(tag, blockOrContent).filter {it.name != enumAttribute.fieldName} + val arguments = tagBuilderFunctionArguments(tag, blockOrContent).filter { it.name != enumAttribute.fieldName } enumAttribute.enumValues.forEach { enumValue -> val deprecation = findEnumDeprecation(enumAttribute, enumValue) val constructorArgs = mutableListOf( - buildSuggestedAttributesArgument(tag, mapOf(enumAttribute.fieldName to enumAttribute.typeName + "." + enumValue.fieldName + ".realValue")), + buildSuggestedAttributesArgument( + tag, + mapOf(enumAttribute.fieldName to enumAttribute.typeName + "." + enumValue.fieldName + ".realValue") + ), "consumer" ) if (tag.name.lowercase() in tagsWithCustomizableNamespace) { @@ -295,14 +373,14 @@ fun Appendable.htmlTagEnumBuilderMethod(receiver : String, tag : TagInfo, blockO } } -fun Appendable.indent(stops : Int = 1) { +fun Appendable.indent(stops: Int = 1) { for (i in 0 until stops) { append(" ") } } -private fun buildSuggestedAttributesArgument(tag: TagInfo, predefinedValues : Map = emptyMap()) : String = - tag.mergeAttributes().filter {it.name in tag.suggestedAttributes}.map { attribute -> +private fun buildSuggestedAttributesArgument(tag: TagInfo, predefinedValues: Map = emptyMap()): String = + tag.mergeAttributes().filter { it.name in tag.suggestedAttributes }.map { attribute -> val name = attribute.fieldName val encoded = if (name in predefinedValues) predefinedValues[name] else when (attribute.type) { @@ -322,17 +400,74 @@ private fun buildSuggestedAttributesArgument(tag: TagInfo, predefinedValues : Ma } private fun tagBuilderCouldBeInline(tag: TagInfo, blockOrContent: Boolean): Boolean = when { - tag.name.lowercase() in emptyTags -> true - blockOrContent -> true - else -> false + tag.name.lowercase() in emptyTags -> true + blockOrContent -> true + else -> false } -private fun tagBuilderFunctionArguments(tag: TagInfo, blockOrContent : Boolean) : ArrayList { +private fun FunSpec.Builder.addTagBuilderFunctionArguments( + tag: TagInfo, + tagClass: ClassName, + blockOrContent: Boolean, +): FunSpec.Builder { + val customizableNamespace = tag.name.lowercase() in tagsWithCustomizableNamespace + val defaultNamespace: String = tagNamespaces[tag.name.lowercase()]?.quote().toString() + + val attributeParameters = + tag.mergeAttributes().filter { it.name in tag.suggestedAttributes }.map { attribute -> + val type = when (attribute.type) { + AttributeType.STRING_SET -> String::class.asTypeName() + else -> attribute.poetTypeName + } + + ParameterSpec.builder(attribute.fieldName, type.copy(nullable = true)) + .defaultValue("null") + .build() + } + + val namespaceParameter = + if (customizableNamespace) { + ParameterSpec.builder("namespace", String::class.asTypeName().copy(nullable = true)) + .defaultValue(defaultNamespace) + .build() + } else { + null + } + + val blockParameter = + ParameterSpec.builder( + "block", + LambdaTypeName.get(receiver = tagClass, returnType = Unit::class.asTypeName()), + KModifier.CROSSINLINE + ) + .defaultValue("{}") + .build() + + val contentParameter = + ParameterSpec.builder("content", String::class.asTypeName()) + .defaultValue("\"\"") + .build() + + val isEmptyTag = tag.name.lowercase() in emptyTags + val additionalParameters = + when { + isEmptyTag || blockOrContent -> listOfNotNull(namespaceParameter, blockParameter) + + else -> listOfNotNull(contentParameter, namespaceParameter) + } + + addParameters(attributeParameters) + addParameters(additionalParameters) + + return this +} + +private fun tagBuilderFunctionArguments(tag: TagInfo, blockOrContent: Boolean): ArrayList { val arguments = ArrayList() val customizableNamespace = tag.name.lowercase() in tagsWithCustomizableNamespace val defaultNamespace: String = tagNamespaces[tag.name.lowercase()]?.quote().toString() - tag.mergeAttributes().filter {it.name in tag.suggestedAttributes}.forEach { attribute -> + tag.mergeAttributes().filter { it.name in tag.suggestedAttributes }.forEach { attribute -> val type = when (attribute.type) { AttributeType.STRING_SET -> "String" else -> attribute.typeName @@ -359,6 +494,7 @@ private fun tagBuilderFunctionArguments(tag: TagInfo, blockOrContent : Boolean) addNamespaceParameter() addBlockParameter() } + else -> { addContentParameter() addNamespaceParameter() diff --git a/buildSrc/src/main/kotlin/kotlinx/html/generate/xsdparser.kt b/buildSrc/src/main/kotlin/kotlinx/html/generate/xsdparser.kt index c4e3544c..971796d3 100644 --- a/buildSrc/src/main/kotlin/kotlinx/html/generate/xsdparser.kt +++ b/buildSrc/src/main/kotlin/kotlinx/html/generate/xsdparser.kt @@ -1,9 +1,11 @@ package kotlinx.html.generate -import com.sun.xml.xsom.* -import com.sun.xml.xsom.parser.* +import com.sun.xml.xsom.XSAttGroupDecl +import com.sun.xml.xsom.XSAttributeDecl +import com.sun.xml.xsom.XSTerm +import com.sun.xml.xsom.parser.XSOMParser import java.util.* -import javax.xml.parsers.* +import javax.xml.parsers.SAXParserFactory val SCHEME_URL = "html_5.xsd".asResourceUrl() const val HTML_NAMESPACE = "html-5" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1f017e4e..d0d403e2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/commonMain/kotlin/generated/gen-consumer-tags.kt b/src/commonMain/kotlin/generated/gen-consumer-tags.kt index 5e93cc79..3c451377 100644 --- a/src/commonMain/kotlin/generated/gen-consumer-tags.kt +++ b/src/commonMain/kotlin/generated/gen-consumer-tags.kt @@ -1,719 +1,1189 @@ +/******************************************************************************* + DO NOT EDIT + This file was generated by module generate +*******************************************************************************/ package kotlinx.html import kotlinx.html.* -import kotlinx.html.impl.* import kotlinx.html.attributes.* -/******************************************************************************* - DO NOT EDIT - This file was generated by module generate -*******************************************************************************/ +import kotlin.Deprecated +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlinx.html.A +import kotlinx.html.ABBR +import kotlinx.html.ADDRESS +import kotlinx.html.AREA +import kotlinx.html.ARTICLE +import kotlinx.html.ASIDE +import kotlinx.html.AUDIO +import kotlinx.html.AreaShape +import kotlinx.html.B +import kotlinx.html.BASE +import kotlinx.html.BDI +import kotlinx.html.BDO +import kotlinx.html.BLOCKQUOTE +import kotlinx.html.BODY +import kotlinx.html.BR +import kotlinx.html.BUTTON +import kotlinx.html.ButtonFormEncType +import kotlinx.html.ButtonFormMethod +import kotlinx.html.ButtonType +import kotlinx.html.CANVAS +import kotlinx.html.CAPTION +import kotlinx.html.CITE +import kotlinx.html.CODE +import kotlinx.html.COL +import kotlinx.html.COLGROUP +import kotlinx.html.COMMAND +import kotlinx.html.CommandType +import kotlinx.html.DATALIST +import kotlinx.html.DD +import kotlinx.html.DEL +import kotlinx.html.DETAILS +import kotlinx.html.DFN +import kotlinx.html.DIALOG +import kotlinx.html.DIV +import kotlinx.html.DL +import kotlinx.html.DT +import kotlinx.html.EM +import kotlinx.html.EMBED +import kotlinx.html.FIELDSET +import kotlinx.html.FIGCAPTION +import kotlinx.html.FIGURE +import kotlinx.html.FOOTER +import kotlinx.html.FORM +import kotlinx.html.FormEncType +import kotlinx.html.FormMethod +import kotlinx.html.H1 +import kotlinx.html.H2 +import kotlinx.html.H3 +import kotlinx.html.H4 +import kotlinx.html.H5 +import kotlinx.html.H6 +import kotlinx.html.HEAD +import kotlinx.html.HEADER +import kotlinx.html.HGROUP +import kotlinx.html.HR +import kotlinx.html.HTML +import kotlinx.html.HtmlTagMarker +import kotlinx.html.I +import kotlinx.html.IFRAME +import kotlinx.html.IMG +import kotlinx.html.INPUT +import kotlinx.html.INS +import kotlinx.html.IframeSandbox +import kotlinx.html.InputFormEncType +import kotlinx.html.InputFormMethod +import kotlinx.html.InputType +import kotlinx.html.KBD +import kotlinx.html.KEYGEN +import kotlinx.html.KeyGenKeyType +import kotlinx.html.LABEL +import kotlinx.html.LEGEND +import kotlinx.html.LI +import kotlinx.html.LINK +import kotlinx.html.MAIN +import kotlinx.html.MAP +import kotlinx.html.MARK +import kotlinx.html.MATH +import kotlinx.html.MATHML +import kotlinx.html.META +import kotlinx.html.METER +import kotlinx.html.NAV +import kotlinx.html.NOSCRIPT +import kotlinx.html.OBJECT +import kotlinx.html.OL +import kotlinx.html.OPTGROUP +import kotlinx.html.OPTION +import kotlinx.html.OUTPUT +import kotlinx.html.P +import kotlinx.html.PARAM +import kotlinx.html.PICTURE +import kotlinx.html.PRE +import kotlinx.html.PROGRESS +import kotlinx.html.Q +import kotlinx.html.RP +import kotlinx.html.RT +import kotlinx.html.RUBY +import kotlinx.html.S +import kotlinx.html.SAMP +import kotlinx.html.SCRIPT +import kotlinx.html.SECTION +import kotlinx.html.SELECT +import kotlinx.html.SMALL +import kotlinx.html.SOURCE +import kotlinx.html.SPAN +import kotlinx.html.STRONG +import kotlinx.html.STYLE +import kotlinx.html.SUB +import kotlinx.html.SUMMARY +import kotlinx.html.SUP +import kotlinx.html.SVG +import kotlinx.html.ScriptCrossorigin +import kotlinx.html.TABLE +import kotlinx.html.TBODY +import kotlinx.html.TD +import kotlinx.html.TEXTAREA +import kotlinx.html.TFOOT +import kotlinx.html.TH +import kotlinx.html.THEAD +import kotlinx.html.TIME +import kotlinx.html.TITLE +import kotlinx.html.TR +import kotlinx.html.TagConsumer +import kotlinx.html.TextAreaWrap +import kotlinx.html.ThScope +import kotlinx.html.U +import kotlinx.html.UL +import kotlinx.html.VAR +import kotlinx.html.VIDEO /** * Anchor */ @HtmlTagMarker -inline fun > C.a(href : String? = null, target : String? = null, classes : String? = null, crossinline block : A.() -> Unit = {}) : T = A(attributesMapOf("href", href,"target", target,"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.a( + href: String? = null, + target: String? = null, + classes: String? = null, + crossinline block: A.() -> Unit = {}, +): T = A(attributesMapOf("href", href,"target", target,"class", classes), this) + .visitAndFinalize(this, block) /** * Abbreviated form (e.g., WWW, HTTP,etc.) */ @HtmlTagMarker -inline fun > C.abbr(classes : String? = null, crossinline block : ABBR.() -> Unit = {}) : T = ABBR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.abbr(classes: String? = null, crossinline + block: ABBR.() -> Unit = {}): T = ABBR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Information on author */ @HtmlTagMarker -inline fun > C.address(classes : String? = null, crossinline block : ADDRESS.() -> Unit = {}) : T = ADDRESS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.address(classes: String? = null, crossinline + block: ADDRESS.() -> Unit = {}): T = ADDRESS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Client-side image map area */ @HtmlTagMarker -inline fun > C.area(shape : AreaShape? = null, alt : String? = null, classes : String? = null, crossinline block : AREA.() -> Unit = {}) : T = AREA(attributesMapOf("Shape", shape?.enumEncode(),"alt", alt,"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.area( + shape: AreaShape? = null, + alt: String? = null, + classes: String? = null, + crossinline block: AREA.() -> Unit = {}, +): T = AREA(attributesMapOf("Shape", shape?.enumEncode(),"alt", alt,"class", classes), this) + .visitAndFinalize(this, block) /** * Self-contained syndicatable or reusable composition */ @HtmlTagMarker -inline fun > C.article(classes : String? = null, crossinline block : ARTICLE.() -> Unit = {}) : T = ARTICLE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.article(classes: String? = null, crossinline + block: ARTICLE.() -> Unit = {}): T = ARTICLE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Sidebar for tangentially related content */ @HtmlTagMarker -inline fun > C.aside(classes : String? = null, crossinline block : ASIDE.() -> Unit = {}) : T = ASIDE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.aside(classes: String? = null, crossinline + block: ASIDE.() -> Unit = {}): T = ASIDE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Audio player */ @HtmlTagMarker -inline fun > C.audio(classes : String? = null, crossinline block : AUDIO.() -> Unit = {}) : T = AUDIO(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.audio(classes: String? = null, crossinline + block: AUDIO.() -> Unit = {}): T = AUDIO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Bold text style */ @HtmlTagMarker -inline fun > C.b(classes : String? = null, crossinline block : B.() -> Unit = {}) : T = B(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.b(classes: String? = null, crossinline + block: B.() -> Unit = {}): T = B(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Document base URI */ @HtmlTagMarker -inline fun > C.base(classes : String? = null, crossinline block : BASE.() -> Unit = {}) : T = BASE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.base(classes: String? = null, crossinline + block: BASE.() -> Unit = {}): T = BASE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Text directionality isolation */ @HtmlTagMarker -inline fun > C.bdi(classes : String? = null, crossinline block : BDI.() -> Unit = {}) : T = BDI(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.bdi(classes: String? = null, crossinline + block: BDI.() -> Unit = {}): T = BDI(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * I18N BiDi over-ride */ @HtmlTagMarker -inline fun > C.bdo(classes : String? = null, crossinline block : BDO.() -> Unit = {}) : T = BDO(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.bdo(classes: String? = null, crossinline + block: BDO.() -> Unit = {}): T = BDO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Long quotation */ @HtmlTagMarker -inline fun > C.blockQuote(classes : String? = null, crossinline block : BLOCKQUOTE.() -> Unit = {}) : T = BLOCKQUOTE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.blockQuote(classes: String? = null, crossinline + block: BLOCKQUOTE.() -> Unit = {}): T = BLOCKQUOTE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Document body */ @HtmlTagMarker -inline fun > C.body(classes : String? = null, crossinline block : BODY.() -> Unit = {}) : T = BODY(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.body(classes: String? = null, crossinline + block: BODY.() -> Unit = {}): T = BODY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Forced line break */ @HtmlTagMarker -inline fun > C.br(classes : String? = null, crossinline block : BR.() -> Unit = {}) : T = BR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.br(classes: String? = null, crossinline + block: BR.() -> Unit = {}): T = BR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Push button */ @HtmlTagMarker -inline fun > C.button(formEncType : ButtonFormEncType? = null, formMethod : ButtonFormMethod? = null, name : String? = null, type : ButtonType? = null, classes : String? = null, crossinline block : BUTTON.() -> Unit = {}) : T = BUTTON(attributesMapOf("formenctype", formEncType?.enumEncode(),"formmethod", formMethod?.enumEncode(),"name", name,"type", type?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.button( + formEncType: ButtonFormEncType? = null, + formMethod: ButtonFormMethod? = null, + name: String? = null, + type: ButtonType? = null, + classes: String? = null, + crossinline block: BUTTON.() -> Unit = {}, +): T = BUTTON(attributesMapOf("formenctype", formEncType?.enumEncode(),"formmethod", + formMethod?.enumEncode(),"name", name,"type", type?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Scriptable bitmap canvas */ @HtmlTagMarker -fun > C.canvas(classes : String? = null, content : String = "") : T = CANVAS(attributesMapOf("class", classes), this).visitAndFinalize(this, {+content}) +public fun > C.canvas(classes: String? = null, content: String = ""): T = + CANVAS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) + /** * Scriptable bitmap canvas */ @HtmlTagMarker -inline fun > C.canvas(classes : String? = null, crossinline block : CANVAS.() -> Unit = {}) : T = CANVAS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.canvas(classes: String? = null, crossinline + block: CANVAS.() -> Unit = {}): T = CANVAS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Table caption */ @HtmlTagMarker -inline fun > C.caption(classes : String? = null, crossinline block : CAPTION.() -> Unit = {}) : T = CAPTION(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.caption(classes: String? = null, crossinline + block: CAPTION.() -> Unit = {}): T = CAPTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Citation */ @HtmlTagMarker -inline fun > C.cite(classes : String? = null, crossinline block : CITE.() -> Unit = {}) : T = CITE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.cite(classes: String? = null, crossinline + block: CITE.() -> Unit = {}): T = CITE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Computer code fragment */ @HtmlTagMarker -inline fun > C.code(classes : String? = null, crossinline block : CODE.() -> Unit = {}) : T = CODE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.code(classes: String? = null, crossinline + block: CODE.() -> Unit = {}): T = CODE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Table column */ @HtmlTagMarker -inline fun > C.col(classes : String? = null, crossinline block : COL.() -> Unit = {}) : T = COL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.col(classes: String? = null, crossinline + block: COL.() -> Unit = {}): T = COL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Table column group */ @HtmlTagMarker -inline fun > C.colGroup(classes : String? = null, crossinline block : COLGROUP.() -> Unit = {}) : T = COLGROUP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.colGroup(classes: String? = null, crossinline + block: COLGROUP.() -> Unit = {}): T = COLGROUP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -inline fun > C.command(type : CommandType? = null, classes : String? = null, crossinline block : COMMAND.() -> Unit = {}) : T = COMMAND(attributesMapOf("type", type?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.command( + type: CommandType? = null, + classes: String? = null, + crossinline block: COMMAND.() -> Unit = {}, +): T = COMMAND(attributesMapOf("type", type?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Container for options for */ @HtmlTagMarker -inline fun > C.dataList(classes : String? = null, crossinline block : DATALIST.() -> Unit = {}) : T = DATALIST(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.dataList(classes: String? = null, crossinline + block: DATALIST.() -> Unit = {}): T = DATALIST(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Definition description */ @HtmlTagMarker -inline fun > C.dd(classes : String? = null, crossinline block : DD.() -> Unit = {}) : T = DD(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.dd(classes: String? = null, crossinline + block: DD.() -> Unit = {}): T = DD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Deleted text */ @HtmlTagMarker -inline fun > C.del(classes : String? = null, crossinline block : DEL.() -> Unit = {}) : T = DEL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.del(classes: String? = null, crossinline + block: DEL.() -> Unit = {}): T = DEL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Disclosure control for hiding details */ @HtmlTagMarker -inline fun > C.details(classes : String? = null, crossinline block : DETAILS.() -> Unit = {}) : T = DETAILS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.details(classes: String? = null, crossinline + block: DETAILS.() -> Unit = {}): T = DETAILS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Instance definition */ @HtmlTagMarker -inline fun > C.dfn(classes : String? = null, crossinline block : DFN.() -> Unit = {}) : T = DFN(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.dfn(classes: String? = null, crossinline + block: DFN.() -> Unit = {}): T = DFN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Dialog box or window */ @HtmlTagMarker -inline fun > C.dialog(classes : String? = null, crossinline block : DIALOG.() -> Unit = {}) : T = DIALOG(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.dialog(classes: String? = null, crossinline + block: DIALOG.() -> Unit = {}): T = DIALOG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Generic language/style container */ @HtmlTagMarker -inline fun > C.div(classes : String? = null, crossinline block : DIV.() -> Unit = {}) : T = DIV(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.div(classes: String? = null, crossinline + block: DIV.() -> Unit = {}): T = DIV(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Definition list */ @HtmlTagMarker -inline fun > C.dl(classes : String? = null, crossinline block : DL.() -> Unit = {}) : T = DL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.dl(classes: String? = null, crossinline + block: DL.() -> Unit = {}): T = DL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Definition term */ @HtmlTagMarker -inline fun > C.dt(classes : String? = null, crossinline block : DT.() -> Unit = {}) : T = DT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.dt(classes: String? = null, crossinline + block: DT.() -> Unit = {}): T = DT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Emphasis */ @HtmlTagMarker -inline fun > C.em(classes : String? = null, crossinline block : EM.() -> Unit = {}) : T = EM(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.em(classes: String? = null, crossinline + block: EM.() -> Unit = {}): T = EM(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Plugin */ @HtmlTagMarker -inline fun > C.embed(classes : String? = null, crossinline block : EMBED.() -> Unit = {}) : T = EMBED(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.embed(classes: String? = null, crossinline + block: EMBED.() -> Unit = {}): T = EMBED(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Form control group */ @HtmlTagMarker -inline fun > C.fieldSet(classes : String? = null, crossinline block : FIELDSET.() -> Unit = {}) : T = FIELDSET(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.fieldSet(classes: String? = null, crossinline + block: FIELDSET.() -> Unit = {}): T = FIELDSET(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Caption for */ @HtmlTagMarker -inline fun > C.figcaption(classes : String? = null, crossinline block : FIGCAPTION.() -> Unit = {}) : T = FIGCAPTION(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.figcaption(classes: String? = null, crossinline + block: FIGCAPTION.() -> Unit = {}): T = FIGCAPTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Figure with optional caption */ @HtmlTagMarker -inline fun > C.figure(classes : String? = null, crossinline block : FIGURE.() -> Unit = {}) : T = FIGURE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.figure(classes: String? = null, crossinline + block: FIGURE.() -> Unit = {}): T = FIGURE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Footer for a page or section */ @HtmlTagMarker -inline fun > C.footer(classes : String? = null, crossinline block : FOOTER.() -> Unit = {}) : T = FOOTER(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.footer(classes: String? = null, crossinline + block: FOOTER.() -> Unit = {}): T = FOOTER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Interactive form */ @HtmlTagMarker -inline fun > C.form(action : String? = null, encType : FormEncType? = null, method : FormMethod? = null, classes : String? = null, crossinline block : FORM.() -> Unit = {}) : T = FORM(attributesMapOf("action", action,"enctype", encType?.enumEncode(),"method", method?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.form( + action: String? = null, + encType: FormEncType? = null, + method: FormMethod? = null, + classes: String? = null, + crossinline block: FORM.() -> Unit = {}, +): T = FORM(attributesMapOf("action", action,"enctype", encType?.enumEncode(),"method", + method?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Heading */ @HtmlTagMarker -inline fun > C.h1(classes : String? = null, crossinline block : H1.() -> Unit = {}) : T = H1(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.h1(classes: String? = null, crossinline + block: H1.() -> Unit = {}): T = H1(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Heading */ @HtmlTagMarker -inline fun > C.h2(classes : String? = null, crossinline block : H2.() -> Unit = {}) : T = H2(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.h2(classes: String? = null, crossinline + block: H2.() -> Unit = {}): T = H2(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Heading */ @HtmlTagMarker -inline fun > C.h3(classes : String? = null, crossinline block : H3.() -> Unit = {}) : T = H3(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.h3(classes: String? = null, crossinline + block: H3.() -> Unit = {}): T = H3(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Heading */ @HtmlTagMarker -inline fun > C.h4(classes : String? = null, crossinline block : H4.() -> Unit = {}) : T = H4(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.h4(classes: String? = null, crossinline + block: H4.() -> Unit = {}): T = H4(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Heading */ @HtmlTagMarker -inline fun > C.h5(classes : String? = null, crossinline block : H5.() -> Unit = {}) : T = H5(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.h5(classes: String? = null, crossinline + block: H5.() -> Unit = {}): T = H5(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Heading */ @HtmlTagMarker -inline fun > C.h6(classes : String? = null, crossinline block : H6.() -> Unit = {}) : T = H6(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.h6(classes: String? = null, crossinline + block: H6.() -> Unit = {}): T = H6(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) -@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") -@Suppress("DEPRECATION") /** * Document head */ @HtmlTagMarker -fun > C.head(content : String = "") : T = HEAD(emptyMap, this).visitAndFinalize(this, {+content}) +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun > C.head(content: String = ""): T = HEAD(emptyMap, this) + .visitAndFinalize(this, {+content}) + /** * Document head */ @HtmlTagMarker -inline fun > C.head(crossinline block : HEAD.() -> Unit = {}) : T = HEAD(emptyMap, this).visitAndFinalize(this, block) +public inline fun > C.head(crossinline block: HEAD.() -> Unit = {}): T = + HEAD(emptyMap, this) + .visitAndFinalize(this, block) /** * Introductory or navigational aids for a page or section */ @HtmlTagMarker -inline fun > C.header(classes : String? = null, crossinline block : HEADER.() -> Unit = {}) : T = HEADER(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.`header`(classes: String? = null, crossinline + block: HEADER.() -> Unit = {}): T = HEADER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -inline fun > C.hGroup(classes : String? = null, crossinline block : HGROUP.() -> Unit = {}) : T = HGROUP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.hGroup(classes: String? = null, crossinline + block: HGROUP.() -> Unit = {}): T = HGROUP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Horizontal rule */ @HtmlTagMarker -inline fun > C.hr(classes : String? = null, crossinline block : HR.() -> Unit = {}) : T = HR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.hr(classes: String? = null, crossinline + block: HR.() -> Unit = {}): T = HR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) -@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") -@Suppress("DEPRECATION") /** * Document root element */ @HtmlTagMarker -fun > C.html(content : String = "", namespace : String? = null) : T = HTML(emptyMap, this, namespace).visitAndFinalize(this, {+content}) +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun > C.html(content: String = "", namespace: String? = null): T = + HTML(emptyMap, this, namespace) + .visitAndFinalize(this, {+content}) + /** * Document root element */ @HtmlTagMarker -inline fun > C.html(namespace : String? = null, crossinline block : HTML.() -> Unit = {}) : T = HTML(emptyMap, this, namespace).visitAndFinalize(this, block) +public inline fun > C.html(namespace: String? = null, crossinline + block: HTML.() -> Unit = {}): T = HTML(emptyMap, this, namespace) + .visitAndFinalize(this, block) /** * Italic text style */ @HtmlTagMarker -inline fun > C.i(classes : String? = null, crossinline block : I.() -> Unit = {}) : T = I(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.i(classes: String? = null, crossinline + block: I.() -> Unit = {}): T = I(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Inline subwindow */ @HtmlTagMarker -fun > C.iframe(sandbox : IframeSandbox? = null, classes : String? = null, content : String = "") : T = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this).visitAndFinalize(this, {+content}) +public fun > C.iframe( + sandbox: IframeSandbox? = null, + classes: String? = null, + content: String = "", +): T = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, {+content}) + /** * Inline subwindow */ @HtmlTagMarker -inline fun > C.iframe(sandbox : IframeSandbox? = null, classes : String? = null, crossinline block : IFRAME.() -> Unit = {}) : T = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.iframe( + sandbox: IframeSandbox? = null, + classes: String? = null, + crossinline block: IFRAME.() -> Unit = {}, +): T = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Embedded image */ @HtmlTagMarker -inline fun > C.img(alt : String? = null, src : String? = null, classes : String? = null, crossinline block : IMG.() -> Unit = {}) : T = IMG(attributesMapOf("alt", alt,"src", src,"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.img( + alt: String? = null, + src: String? = null, + classes: String? = null, + crossinline block: IMG.() -> Unit = {}, +): T = IMG(attributesMapOf("alt", alt,"src", src,"class", classes), this) + .visitAndFinalize(this, block) /** * Form control */ @HtmlTagMarker -inline fun > C.input(type : InputType? = null, formEncType : InputFormEncType? = null, formMethod : InputFormMethod? = null, name : String? = null, classes : String? = null, crossinline block : INPUT.() -> Unit = {}) : T = INPUT(attributesMapOf("type", type?.enumEncode(),"formenctype", formEncType?.enumEncode(),"formmethod", formMethod?.enumEncode(),"name", name,"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.input( + type: InputType? = null, + formEncType: InputFormEncType? = null, + formMethod: InputFormMethod? = null, + name: String? = null, + classes: String? = null, + crossinline block: INPUT.() -> Unit = {}, +): T = INPUT(attributesMapOf("type", type?.enumEncode(),"formenctype", + formEncType?.enumEncode(),"formmethod", formMethod?.enumEncode(),"name", name,"class", classes), + this) + .visitAndFinalize(this, block) /** * Inserted text */ @HtmlTagMarker -inline fun > C.ins(classes : String? = null, crossinline block : INS.() -> Unit = {}) : T = INS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.ins(classes: String? = null, crossinline + block: INS.() -> Unit = {}): T = INS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Text to be entered by the user */ @HtmlTagMarker -inline fun > C.kbd(classes : String? = null, crossinline block : KBD.() -> Unit = {}) : T = KBD(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.kbd(classes: String? = null, crossinline + block: KBD.() -> Unit = {}): T = KBD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Cryptographic key-pair generator form control */ @HtmlTagMarker -inline fun > C.keyGen(keyType : KeyGenKeyType? = null, classes : String? = null, crossinline block : KEYGEN.() -> Unit = {}) : T = KEYGEN(attributesMapOf("keytype", keyType?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.keyGen( + keyType: KeyGenKeyType? = null, + classes: String? = null, + crossinline block: KEYGEN.() -> Unit = {}, +): T = KEYGEN(attributesMapOf("keytype", keyType?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Form field label text */ @HtmlTagMarker -inline fun > C.label(classes : String? = null, crossinline block : LABEL.() -> Unit = {}) : T = LABEL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.label(classes: String? = null, crossinline + block: LABEL.() -> Unit = {}): T = LABEL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Fieldset legend */ @HtmlTagMarker -inline fun > C.legend(classes : String? = null, crossinline block : LEGEND.() -> Unit = {}) : T = LEGEND(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.legend(classes: String? = null, crossinline + block: LEGEND.() -> Unit = {}): T = LEGEND(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * List item */ @HtmlTagMarker -inline fun > C.li(classes : String? = null, crossinline block : LI.() -> Unit = {}) : T = LI(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.li(classes: String? = null, crossinline + block: LI.() -> Unit = {}): T = LI(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * A media-independent link */ @HtmlTagMarker -inline fun > C.link(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : T = LINK(attributesMapOf("href", href,"rel", rel,"type", type), this).visitAndFinalize(this, block) +public inline fun > C.link( + href: String? = null, + rel: String? = null, + type: String? = null, + crossinline block: LINK.() -> Unit = {}, +): T = LINK(attributesMapOf("href", href,"rel", rel,"type", type), this) + .visitAndFinalize(this, block) /** * Container for the dominant contents of another element */ @HtmlTagMarker -inline fun > C.main(classes : String? = null, crossinline block : MAIN.() -> Unit = {}) : T = MAIN(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.main(classes: String? = null, crossinline + block: MAIN.() -> Unit = {}): T = MAIN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Client-side image map */ @HtmlTagMarker -inline fun > C.map(name : String? = null, classes : String? = null, crossinline block : MAP.() -> Unit = {}) : T = MAP(attributesMapOf("name", name,"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.map( + name: String? = null, + classes: String? = null, + crossinline block: MAP.() -> Unit = {}, +): T = MAP(attributesMapOf("name", name,"class", classes), this) + .visitAndFinalize(this, block) /** * Highlight */ @HtmlTagMarker -inline fun > C.mark(classes : String? = null, crossinline block : MARK.() -> Unit = {}) : T = MARK(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.mark(classes: String? = null, crossinline + block: MARK.() -> Unit = {}): T = MARK(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -inline fun > C.math(classes : String? = null, crossinline block : MATH.() -> Unit = {}) : T = MATH(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.math(classes: String? = null, crossinline + block: MATH.() -> Unit = {}): T = MATH(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -fun > C.mathml(classes : String? = null, content : String = "") : T = MATHML(attributesMapOf("class", classes), this).visitAndFinalize(this, {+content}) +public fun > C.mathml(classes: String? = null, content: String = ""): T = + MATHML(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) + @HtmlTagMarker -inline fun > C.mathml(classes : String? = null, crossinline block : MATHML.() -> Unit = {}) : T = MATHML(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.mathml(classes: String? = null, crossinline + block: MATHML.() -> Unit = {}): T = MATHML(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Generic metainformation */ @HtmlTagMarker -inline fun > C.meta(name : String? = null, content : String? = null, charset : String? = null, crossinline block : META.() -> Unit = {}) : T = META(attributesMapOf("name", name,"content", content,"charset", charset), this).visitAndFinalize(this, block) +public inline fun > C.meta( + name: String? = null, + content: String? = null, + charset: String? = null, + crossinline block: META.() -> Unit = {}, +): T = META(attributesMapOf("name", name,"content", content,"charset", charset), this) + .visitAndFinalize(this, block) /** * Gauge */ @HtmlTagMarker -inline fun > C.meter(classes : String? = null, crossinline block : METER.() -> Unit = {}) : T = METER(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.meter(classes: String? = null, crossinline + block: METER.() -> Unit = {}): T = METER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Section with navigational links */ @HtmlTagMarker -inline fun > C.nav(classes : String? = null, crossinline block : NAV.() -> Unit = {}) : T = NAV(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.nav(classes: String? = null, crossinline + block: NAV.() -> Unit = {}): T = NAV(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Generic metainformation */ @HtmlTagMarker -inline fun > C.noScript(classes : String? = null, crossinline block : NOSCRIPT.() -> Unit = {}) : T = NOSCRIPT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.noScript(classes: String? = null, crossinline + block: NOSCRIPT.() -> Unit = {}): T = NOSCRIPT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Generic embedded object */ @HtmlTagMarker -inline fun > C.htmlObject(classes : String? = null, crossinline block : OBJECT.() -> Unit = {}) : T = OBJECT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.htmlObject(classes: String? = null, crossinline + block: OBJECT.() -> Unit = {}): T = OBJECT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Ordered list */ @HtmlTagMarker -inline fun > C.ol(classes : String? = null, crossinline block : OL.() -> Unit = {}) : T = OL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.ol(classes: String? = null, crossinline + block: OL.() -> Unit = {}): T = OL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Option group */ @HtmlTagMarker -inline fun > C.optGroup(label : String? = null, classes : String? = null, crossinline block : OPTGROUP.() -> Unit = {}) : T = OPTGROUP(attributesMapOf("label", label,"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.optGroup( + label: String? = null, + classes: String? = null, + crossinline block: OPTGROUP.() -> Unit = {}, +): T = OPTGROUP(attributesMapOf("label", label,"class", classes), this) + .visitAndFinalize(this, block) /** * Selectable choice */ @HtmlTagMarker -fun > C.option(classes : String? = null, content : String = "") : T = OPTION(attributesMapOf("class", classes), this).visitAndFinalize(this, {+content}) +public fun > C.option(classes: String? = null, content: String = ""): T = + OPTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) + /** * Selectable choice */ @HtmlTagMarker -inline fun > C.option(classes : String? = null, crossinline block : OPTION.() -> Unit = {}) : T = OPTION(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.option(classes: String? = null, crossinline + block: OPTION.() -> Unit = {}): T = OPTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Calculated output value */ @HtmlTagMarker -inline fun > C.output(classes : String? = null, crossinline block : OUTPUT.() -> Unit = {}) : T = OUTPUT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.output(classes: String? = null, crossinline + block: OUTPUT.() -> Unit = {}): T = OUTPUT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Paragraph */ @HtmlTagMarker -inline fun > C.p(classes : String? = null, crossinline block : P.() -> Unit = {}) : T = P(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.p(classes: String? = null, crossinline + block: P.() -> Unit = {}): T = P(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Named property value */ @HtmlTagMarker -inline fun > C.param(name : String? = null, value : String? = null, crossinline block : PARAM.() -> Unit = {}) : T = PARAM(attributesMapOf("name", name,"value", value), this).visitAndFinalize(this, block) +public inline fun > C.`param`( + name: String? = null, + `value`: String? = null, + crossinline block: PARAM.() -> Unit = {}, +): T = PARAM(attributesMapOf("name", name,"value", value), this) + .visitAndFinalize(this, block) /** * Pictures container */ @HtmlTagMarker -inline fun > C.picture(crossinline block : PICTURE.() -> Unit = {}) : T = PICTURE(emptyMap, this).visitAndFinalize(this, block) +public inline fun > C.picture(crossinline block: PICTURE.() -> Unit = {}): T = + PICTURE(emptyMap, this) + .visitAndFinalize(this, block) /** * Preformatted text */ @HtmlTagMarker -inline fun > C.pre(classes : String? = null, crossinline block : PRE.() -> Unit = {}) : T = PRE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.pre(classes: String? = null, crossinline + block: PRE.() -> Unit = {}): T = PRE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Progress bar */ @HtmlTagMarker -inline fun > C.progress(classes : String? = null, crossinline block : PROGRESS.() -> Unit = {}) : T = PROGRESS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.progress(classes: String? = null, crossinline + block: PROGRESS.() -> Unit = {}): T = PROGRESS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Short inline quotation */ @HtmlTagMarker -inline fun > C.q(classes : String? = null, crossinline block : Q.() -> Unit = {}) : T = Q(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.q(classes: String? = null, crossinline + block: Q.() -> Unit = {}): T = Q(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Parenthesis for ruby annotation text */ @HtmlTagMarker -inline fun > C.rp(classes : String? = null, crossinline block : RP.() -> Unit = {}) : T = RP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.rp(classes: String? = null, crossinline + block: RP.() -> Unit = {}): T = RP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Ruby annotation text */ @HtmlTagMarker -inline fun > C.rt(classes : String? = null, crossinline block : RT.() -> Unit = {}) : T = RT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.rt(classes: String? = null, crossinline + block: RT.() -> Unit = {}): T = RT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Ruby annotation(s) */ @HtmlTagMarker -inline fun > C.ruby(classes : String? = null, crossinline block : RUBY.() -> Unit = {}) : T = RUBY(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.ruby(classes: String? = null, crossinline + block: RUBY.() -> Unit = {}): T = RUBY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Strike-through text style */ @HtmlTagMarker -inline fun > C.s(classes : String? = null, crossinline block : S.() -> Unit = {}) : T = S(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.s(classes: String? = null, crossinline + block: S.() -> Unit = {}): T = S(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Computer output text style */ @HtmlTagMarker -inline fun > C.samp(classes : String? = null, crossinline block : SAMP.() -> Unit = {}) : T = SAMP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.samp(classes: String? = null, crossinline + block: SAMP.() -> Unit = {}): T = SAMP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) -@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") -@Suppress("DEPRECATION") /** * Script statements */ @HtmlTagMarker -fun > C.script(type : String? = null, src : String? = null, crossorigin : ScriptCrossorigin? = null, content : String = "") : T = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", crossorigin?.enumEncode()), this).visitAndFinalize(this, {+content}) +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun > C.script( + type: String? = null, + src: String? = null, + crossorigin: ScriptCrossorigin? = null, + content: String = "", +): T = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", crossorigin?.enumEncode()), + this) + .visitAndFinalize(this, {+content}) + /** * Script statements */ @HtmlTagMarker -inline fun > C.script(type : String? = null, src : String? = null, crossorigin : ScriptCrossorigin? = null, crossinline block : SCRIPT.() -> Unit = {}) : T = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", crossorigin?.enumEncode()), this).visitAndFinalize(this, block) +public inline fun > C.script( + type: String? = null, + src: String? = null, + crossorigin: ScriptCrossorigin? = null, + crossinline block: SCRIPT.() -> Unit = {}, +): T = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", crossorigin?.enumEncode()), + this) + .visitAndFinalize(this, block) /** * Generic document or application section */ @HtmlTagMarker -inline fun > C.section(classes : String? = null, crossinline block : SECTION.() -> Unit = {}) : T = SECTION(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.section(classes: String? = null, crossinline + block: SECTION.() -> Unit = {}): T = SECTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Option selector */ @HtmlTagMarker -inline fun > C.select(classes : String? = null, crossinline block : SELECT.() -> Unit = {}) : T = SELECT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.select(classes: String? = null, crossinline + block: SELECT.() -> Unit = {}): T = SELECT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Small text style */ @HtmlTagMarker -inline fun > C.small(classes : String? = null, crossinline block : SMALL.() -> Unit = {}) : T = SMALL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.small(classes: String? = null, crossinline + block: SMALL.() -> Unit = {}): T = SMALL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Media source for */ @HtmlTagMarker -inline fun > C.source(classes : String? = null, crossinline block : SOURCE.() -> Unit = {}) : T = SOURCE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.source(classes: String? = null, crossinline + block: SOURCE.() -> Unit = {}): T = SOURCE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Generic language/style container */ @HtmlTagMarker -inline fun > C.span(classes : String? = null, crossinline block : SPAN.() -> Unit = {}) : T = SPAN(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.span(classes: String? = null, crossinline + block: SPAN.() -> Unit = {}): T = SPAN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Strong emphasis */ @HtmlTagMarker -inline fun > C.strong(classes : String? = null, crossinline block : STRONG.() -> Unit = {}) : T = STRONG(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.strong(classes: String? = null, crossinline + block: STRONG.() -> Unit = {}): T = STRONG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) -@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") -@Suppress("DEPRECATION") /** * Style info */ @HtmlTagMarker -fun > C.style(type : String? = null, content : String = "") : T = STYLE(attributesMapOf("type", type), this).visitAndFinalize(this, {+content}) +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun > C.style(type: String? = null, content: String = ""): T = + STYLE(attributesMapOf("type", type), this) + .visitAndFinalize(this, {+content}) + /** * Style info */ @HtmlTagMarker -inline fun > C.style(type : String? = null, crossinline block : STYLE.() -> Unit = {}) : T = STYLE(attributesMapOf("type", type), this).visitAndFinalize(this, block) +public inline fun > C.style(type: String? = null, crossinline + block: STYLE.() -> Unit = {}): T = STYLE(attributesMapOf("type", type), this) + .visitAndFinalize(this, block) /** * Subscript */ @HtmlTagMarker -inline fun > C.sub(classes : String? = null, crossinline block : SUB.() -> Unit = {}) : T = SUB(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.sub(classes: String? = null, crossinline + block: SUB.() -> Unit = {}): T = SUB(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Caption for */ @HtmlTagMarker -inline fun > C.summary(classes : String? = null, crossinline block : SUMMARY.() -> Unit = {}) : T = SUMMARY(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.summary(classes: String? = null, crossinline + block: SUMMARY.() -> Unit = {}): T = SUMMARY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Superscript */ @HtmlTagMarker -inline fun > C.sup(classes : String? = null, crossinline block : SUP.() -> Unit = {}) : T = SUP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.sup(classes: String? = null, crossinline + block: SUP.() -> Unit = {}): T = SUP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -fun > C.svg(classes : String? = null, content : String = "") : T = SVG(attributesMapOf("class", classes), this).visitAndFinalize(this, {+content}) +public fun > C.svg(classes: String? = null, content: String = ""): T = + SVG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) + @HtmlTagMarker -inline fun > C.svg(classes : String? = null, crossinline block : SVG.() -> Unit = {}) : T = SVG(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.svg(classes: String? = null, crossinline + block: SVG.() -> Unit = {}): T = SVG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** - * + * */ @HtmlTagMarker -inline fun > C.table(classes : String? = null, crossinline block : TABLE.() -> Unit = {}) : T = TABLE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.table(classes: String? = null, crossinline + block: TABLE.() -> Unit = {}): T = TABLE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Table body */ @HtmlTagMarker -inline fun > C.tbody(classes : String? = null, crossinline block : TBODY.() -> Unit = {}) : T = TBODY(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.tbody(classes: String? = null, crossinline + block: TBODY.() -> Unit = {}): T = TBODY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Table data cell */ @HtmlTagMarker -inline fun > C.td(classes : String? = null, crossinline block : TD.() -> Unit = {}) : T = TD(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.td(classes: String? = null, crossinline + block: TD.() -> Unit = {}): T = TD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Multi-line text field */ @HtmlTagMarker -fun > C.textArea(rows : String? = null, cols : String? = null, wrap : TextAreaWrap? = null, classes : String? = null, content : String = "") : T = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", wrap?.enumEncode(),"class", classes), this).visitAndFinalize(this, {+content}) +public fun > C.textArea( + rows: String? = null, + cols: String? = null, + wrap: TextAreaWrap? = null, + classes: String? = null, + content: String = "", +): T = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", wrap?.enumEncode(),"class", + classes), this) + .visitAndFinalize(this, {+content}) + /** * Multi-line text field */ @HtmlTagMarker -inline fun > C.textArea(rows : String? = null, cols : String? = null, wrap : TextAreaWrap? = null, classes : String? = null, crossinline block : TEXTAREA.() -> Unit = {}) : T = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", wrap?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.textArea( + rows: String? = null, + cols: String? = null, + wrap: TextAreaWrap? = null, + classes: String? = null, + crossinline block: TEXTAREA.() -> Unit = {}, +): T = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", wrap?.enumEncode(),"class", + classes), this) + .visitAndFinalize(this, block) /** * Table footer */ @HtmlTagMarker -inline fun > C.tfoot(classes : String? = null, crossinline block : TFOOT.() -> Unit = {}) : T = TFOOT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.tfoot(classes: String? = null, crossinline + block: TFOOT.() -> Unit = {}): T = TFOOT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Table header cell */ @HtmlTagMarker -inline fun > C.th(scope : ThScope? = null, classes : String? = null, crossinline block : TH.() -> Unit = {}) : T = TH(attributesMapOf("scope", scope?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun > C.th( + scope: ThScope? = null, + classes: String? = null, + crossinline block: TH.() -> Unit = {}, +): T = TH(attributesMapOf("scope", scope?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Table header */ @HtmlTagMarker -inline fun > C.thead(classes : String? = null, crossinline block : THEAD.() -> Unit = {}) : T = THEAD(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.thead(classes: String? = null, crossinline + block: THEAD.() -> Unit = {}): T = THEAD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Machine-readable equivalent of date- or time-related data */ @HtmlTagMarker -inline fun > C.time(classes : String? = null, crossinline block : TIME.() -> Unit = {}) : T = TIME(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.time(classes: String? = null, crossinline + block: TIME.() -> Unit = {}): T = TIME(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Document title */ @HtmlTagMarker -fun > C.title(content : String = "") : T = TITLE(emptyMap, this).visitAndFinalize(this, {+content}) +public fun > C.title(content: String = ""): T = TITLE(emptyMap, this) + .visitAndFinalize(this, {+content}) + /** * Document title */ @HtmlTagMarker -inline fun > C.title(crossinline block : TITLE.() -> Unit = {}) : T = TITLE(emptyMap, this).visitAndFinalize(this, block) +public inline fun > C.title(crossinline block: TITLE.() -> Unit = {}): T = + TITLE(emptyMap, this) + .visitAndFinalize(this, block) /** * Table row */ @HtmlTagMarker -inline fun > C.tr(classes : String? = null, crossinline block : TR.() -> Unit = {}) : T = TR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.tr(classes: String? = null, crossinline + block: TR.() -> Unit = {}): T = TR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Underlined text style */ @HtmlTagMarker -inline fun > C.u(classes : String? = null, crossinline block : U.() -> Unit = {}) : T = U(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.u(classes: String? = null, crossinline + block: U.() -> Unit = {}): T = U(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Unordered list */ @HtmlTagMarker -inline fun > C.ul(classes : String? = null, crossinline block : UL.() -> Unit = {}) : T = UL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.ul(classes: String? = null, crossinline + block: UL.() -> Unit = {}): T = UL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Unordered list */ @HtmlTagMarker -inline fun > C.htmlVar(classes : String? = null, crossinline block : VAR.() -> Unit = {}) : T = VAR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun > C.htmlVar(classes: String? = null, crossinline + block: VAR.() -> Unit = {}): T = VAR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Video player */ @HtmlTagMarker -inline fun > C.video(classes : String? = null, crossinline block : VIDEO.() -> Unit = {}) : T = VIDEO(attributesMapOf("class", classes), this).visitAndFinalize(this, block) - +public inline fun > C.video(classes: String? = null, crossinline + block: VIDEO.() -> Unit = {}): T = VIDEO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) diff --git a/src/jsMain/kotlin/generated/gen-consumer-tags-js.kt b/src/jsMain/kotlin/generated/gen-consumer-tags-js.kt index f597719a..698c3ca9 100644 --- a/src/jsMain/kotlin/generated/gen-consumer-tags-js.kt +++ b/src/jsMain/kotlin/generated/gen-consumer-tags-js.kt @@ -1,720 +1,1261 @@ +/******************************************************************************* + DO NOT EDIT + This file was generated by module generate +*******************************************************************************/ package kotlinx.html.js import kotlinx.html.* -import kotlinx.html.impl.* import kotlinx.html.attributes.* -import org.w3c.dom.* -/******************************************************************************* - DO NOT EDIT - This file was generated by module generate -*******************************************************************************/ +import kotlin.Deprecated +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlinx.html.A +import kotlinx.html.ABBR +import kotlinx.html.ADDRESS +import kotlinx.html.AREA +import kotlinx.html.ARTICLE +import kotlinx.html.ASIDE +import kotlinx.html.AUDIO +import kotlinx.html.AreaShape +import kotlinx.html.B +import kotlinx.html.BASE +import kotlinx.html.BDI +import kotlinx.html.BDO +import kotlinx.html.BLOCKQUOTE +import kotlinx.html.BODY +import kotlinx.html.BR +import kotlinx.html.BUTTON +import kotlinx.html.ButtonFormEncType +import kotlinx.html.ButtonFormMethod +import kotlinx.html.ButtonType +import kotlinx.html.CANVAS +import kotlinx.html.CAPTION +import kotlinx.html.CITE +import kotlinx.html.CODE +import kotlinx.html.COL +import kotlinx.html.COLGROUP +import kotlinx.html.COMMAND +import kotlinx.html.CommandType +import kotlinx.html.DATALIST +import kotlinx.html.DD +import kotlinx.html.DEL +import kotlinx.html.DETAILS +import kotlinx.html.DFN +import kotlinx.html.DIALOG +import kotlinx.html.DIV +import kotlinx.html.DL +import kotlinx.html.DT +import kotlinx.html.EM +import kotlinx.html.EMBED +import kotlinx.html.FIELDSET +import kotlinx.html.FIGCAPTION +import kotlinx.html.FIGURE +import kotlinx.html.FOOTER +import kotlinx.html.FORM +import kotlinx.html.FormEncType +import kotlinx.html.FormMethod +import kotlinx.html.H1 +import kotlinx.html.H2 +import kotlinx.html.H3 +import kotlinx.html.H4 +import kotlinx.html.H5 +import kotlinx.html.H6 +import kotlinx.html.HEAD +import kotlinx.html.HEADER +import kotlinx.html.HGROUP +import kotlinx.html.HR +import kotlinx.html.HTML +import kotlinx.html.HtmlTagMarker +import kotlinx.html.I +import kotlinx.html.IFRAME +import kotlinx.html.IMG +import kotlinx.html.INPUT +import kotlinx.html.INS +import kotlinx.html.IframeSandbox +import kotlinx.html.InputFormEncType +import kotlinx.html.InputFormMethod +import kotlinx.html.InputType +import kotlinx.html.KBD +import kotlinx.html.KEYGEN +import kotlinx.html.KeyGenKeyType +import kotlinx.html.LABEL +import kotlinx.html.LEGEND +import kotlinx.html.LI +import kotlinx.html.LINK +import kotlinx.html.MAIN +import kotlinx.html.MAP +import kotlinx.html.MARK +import kotlinx.html.MATH +import kotlinx.html.MATHML +import kotlinx.html.META +import kotlinx.html.METER +import kotlinx.html.NAV +import kotlinx.html.NOSCRIPT +import kotlinx.html.OBJECT +import kotlinx.html.OL +import kotlinx.html.OPTGROUP +import kotlinx.html.OPTION +import kotlinx.html.OUTPUT +import kotlinx.html.P +import kotlinx.html.PARAM +import kotlinx.html.PICTURE +import kotlinx.html.PRE +import kotlinx.html.PROGRESS +import kotlinx.html.Q +import kotlinx.html.RP +import kotlinx.html.RT +import kotlinx.html.RUBY +import kotlinx.html.S +import kotlinx.html.SAMP +import kotlinx.html.SCRIPT +import kotlinx.html.SECTION +import kotlinx.html.SELECT +import kotlinx.html.SMALL +import kotlinx.html.SOURCE +import kotlinx.html.SPAN +import kotlinx.html.STRONG +import kotlinx.html.STYLE +import kotlinx.html.SUB +import kotlinx.html.SUMMARY +import kotlinx.html.SUP +import kotlinx.html.SVG +import kotlinx.html.ScriptCrossorigin +import kotlinx.html.TABLE +import kotlinx.html.TBODY +import kotlinx.html.TD +import kotlinx.html.TEXTAREA +import kotlinx.html.TFOOT +import kotlinx.html.TH +import kotlinx.html.THEAD +import kotlinx.html.TIME +import kotlinx.html.TITLE +import kotlinx.html.TR +import kotlinx.html.TagConsumer +import kotlinx.html.TextAreaWrap +import kotlinx.html.ThScope +import kotlinx.html.U +import kotlinx.html.UL +import kotlinx.html.VAR +import kotlinx.html.VIDEO +import org.w3c.dom.HTMLAnchorElement +import org.w3c.dom.HTMLAreaElement +import org.w3c.dom.HTMLAudioElement +import org.w3c.dom.HTMLBRElement +import org.w3c.dom.HTMLBaseElement +import org.w3c.dom.HTMLBodyElement +import org.w3c.dom.HTMLButtonElement +import org.w3c.dom.HTMLCanvasElement +import org.w3c.dom.HTMLDataListElement +import org.w3c.dom.HTMLDetailsElement +import org.w3c.dom.HTMLDialogElement +import org.w3c.dom.HTMLDivElement +import org.w3c.dom.HTMLElement +import org.w3c.dom.HTMLEmbedElement +import org.w3c.dom.HTMLFieldSetElement +import org.w3c.dom.HTMLFormElement +import org.w3c.dom.HTMLHRElement +import org.w3c.dom.HTMLHeadElement +import org.w3c.dom.HTMLHeadingElement +import org.w3c.dom.HTMLHtmlElement +import org.w3c.dom.HTMLImageElement +import org.w3c.dom.HTMLInputElement +import org.w3c.dom.HTMLLIElement +import org.w3c.dom.HTMLLabelElement +import org.w3c.dom.HTMLLegendElement +import org.w3c.dom.HTMLLinkElement +import org.w3c.dom.HTMLMapElement +import org.w3c.dom.HTMLMetaElement +import org.w3c.dom.HTMLMeterElement +import org.w3c.dom.HTMLOptGroupElement +import org.w3c.dom.HTMLOptionElement +import org.w3c.dom.HTMLOutputElement +import org.w3c.dom.HTMLParagraphElement +import org.w3c.dom.HTMLParamElement +import org.w3c.dom.HTMLPictureElement +import org.w3c.dom.HTMLPreElement +import org.w3c.dom.HTMLProgressElement +import org.w3c.dom.HTMLScriptElement +import org.w3c.dom.HTMLSelectElement +import org.w3c.dom.HTMLSourceElement +import org.w3c.dom.HTMLSpanElement +import org.w3c.dom.HTMLStyleElement +import org.w3c.dom.HTMLTableCellElement +import org.w3c.dom.HTMLTableColElement +import org.w3c.dom.HTMLTableElement +import org.w3c.dom.HTMLTableRowElement +import org.w3c.dom.HTMLTableSectionElement +import org.w3c.dom.HTMLTextAreaElement +import org.w3c.dom.HTMLTimeElement +import org.w3c.dom.HTMLTitleElement +import org.w3c.dom.HTMLVideoElement /** * Anchor */ @HtmlTagMarker -public inline fun TagConsumer.a(href : String? = null, target : String? = null, classes : String? = null, crossinline block : A.() -> Unit = {}) : HTMLAnchorElement = A(attributesMapOf("href", href,"target", target,"class", classes), this).visitAndFinalize(this, block) as HTMLAnchorElement +public inline fun TagConsumer.a( + href: String? = null, + target: String? = null, + classes: String? = null, + crossinline block: A.() -> Unit = {}, +): HTMLAnchorElement = A(attributesMapOf("href", href,"target", target,"class", classes), this) + .visitAndFinalize(this, block) as HTMLAnchorElement /** * Abbreviated form (e.g., WWW, HTTP,etc.) */ @HtmlTagMarker -public inline fun TagConsumer.abbr(classes : String? = null, crossinline block : ABBR.() -> Unit = {}) : HTMLElement = ABBR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.abbr(classes: String? = null, crossinline + block: ABBR.() -> Unit = {}): HTMLElement = ABBR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Information on author */ @HtmlTagMarker -public inline fun TagConsumer.address(classes : String? = null, crossinline block : ADDRESS.() -> Unit = {}) : HTMLElement = ADDRESS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.address(classes: String? = null, crossinline + block: ADDRESS.() -> Unit = {}): HTMLElement = ADDRESS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Client-side image map area */ @HtmlTagMarker -public inline fun TagConsumer.area(shape : AreaShape? = null, alt : String? = null, classes : String? = null, crossinline block : AREA.() -> Unit = {}) : HTMLAreaElement = AREA(attributesMapOf("Shape", shape?.enumEncode(),"alt", alt,"class", classes), this).visitAndFinalize(this, block) as HTMLAreaElement +public inline fun TagConsumer.area( + shape: AreaShape? = null, + alt: String? = null, + classes: String? = null, + crossinline block: AREA.() -> Unit = {}, +): HTMLAreaElement = AREA(attributesMapOf("Shape", shape?.enumEncode(),"alt", alt,"class", classes), + this) + .visitAndFinalize(this, block) as HTMLAreaElement /** * Self-contained syndicatable or reusable composition */ @HtmlTagMarker -public inline fun TagConsumer.article(classes : String? = null, crossinline block : ARTICLE.() -> Unit = {}) : HTMLElement = ARTICLE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.article(classes: String? = null, crossinline + block: ARTICLE.() -> Unit = {}): HTMLElement = ARTICLE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Sidebar for tangentially related content */ @HtmlTagMarker -public inline fun TagConsumer.aside(classes : String? = null, crossinline block : ASIDE.() -> Unit = {}) : HTMLElement = ASIDE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.aside(classes: String? = null, crossinline + block: ASIDE.() -> Unit = {}): HTMLElement = ASIDE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Audio player */ @HtmlTagMarker -public inline fun TagConsumer.audio(classes : String? = null, crossinline block : AUDIO.() -> Unit = {}) : HTMLAudioElement = AUDIO(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLAudioElement +public inline fun TagConsumer.audio(classes: String? = null, crossinline + block: AUDIO.() -> Unit = {}): HTMLAudioElement = AUDIO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLAudioElement /** * Bold text style */ @HtmlTagMarker -public inline fun TagConsumer.b(classes : String? = null, crossinline block : B.() -> Unit = {}) : HTMLElement = B(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.b(classes: String? = null, crossinline + block: B.() -> Unit = {}): HTMLElement = B(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Document base URI */ @HtmlTagMarker -public inline fun TagConsumer.base(classes : String? = null, crossinline block : BASE.() -> Unit = {}) : HTMLBaseElement = BASE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLBaseElement +public inline fun TagConsumer.base(classes: String? = null, crossinline + block: BASE.() -> Unit = {}): HTMLBaseElement = BASE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLBaseElement /** * Text directionality isolation */ @HtmlTagMarker -public inline fun TagConsumer.bdi(classes : String? = null, crossinline block : BDI.() -> Unit = {}) : HTMLElement = BDI(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.bdi(classes: String? = null, crossinline + block: BDI.() -> Unit = {}): HTMLElement = BDI(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * I18N BiDi over-ride */ @HtmlTagMarker -public inline fun TagConsumer.bdo(classes : String? = null, crossinline block : BDO.() -> Unit = {}) : HTMLElement = BDO(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.bdo(classes: String? = null, crossinline + block: BDO.() -> Unit = {}): HTMLElement = BDO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Long quotation */ @HtmlTagMarker -public inline fun TagConsumer.blockQuote(classes : String? = null, crossinline block : BLOCKQUOTE.() -> Unit = {}) : HTMLElement = BLOCKQUOTE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.blockQuote(classes: String? = null, crossinline + block: BLOCKQUOTE.() -> Unit = {}): HTMLElement = BLOCKQUOTE(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) /** * Document body */ @HtmlTagMarker -public inline fun TagConsumer.body(classes : String? = null, crossinline block : BODY.() -> Unit = {}) : HTMLBodyElement = BODY(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLBodyElement +public inline fun TagConsumer.body(classes: String? = null, crossinline + block: BODY.() -> Unit = {}): HTMLBodyElement = BODY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLBodyElement /** * Forced line break */ @HtmlTagMarker -public inline fun TagConsumer.br(classes : String? = null, crossinline block : BR.() -> Unit = {}) : HTMLBRElement = BR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLBRElement +public inline fun TagConsumer.br(classes: String? = null, crossinline + block: BR.() -> Unit = {}): HTMLBRElement = BR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLBRElement /** * Push button */ @HtmlTagMarker -public inline fun TagConsumer.button(formEncType : ButtonFormEncType? = null, formMethod : ButtonFormMethod? = null, name : String? = null, type : ButtonType? = null, classes : String? = null, crossinline block : BUTTON.() -> Unit = {}) : HTMLButtonElement = BUTTON(attributesMapOf("formenctype", formEncType?.enumEncode(),"formmethod", formMethod?.enumEncode(),"name", name,"type", type?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) as HTMLButtonElement +public inline fun TagConsumer.button( + formEncType: ButtonFormEncType? = null, + formMethod: ButtonFormMethod? = null, + name: String? = null, + type: ButtonType? = null, + classes: String? = null, + crossinline block: BUTTON.() -> Unit = {}, +): HTMLButtonElement = BUTTON(attributesMapOf("formenctype", formEncType?.enumEncode(),"formmethod", + formMethod?.enumEncode(),"name", name,"type", type?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) as HTMLButtonElement /** * Scriptable bitmap canvas */ @HtmlTagMarker -public fun TagConsumer.canvas(classes : String? = null, content : String = "") : HTMLCanvasElement = CANVAS(attributesMapOf("class", classes), this).visitAndFinalize(this, {+content}) as HTMLCanvasElement +public fun TagConsumer.canvas(classes: String? = null, content: String = ""): + HTMLCanvasElement = CANVAS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) as HTMLCanvasElement + /** * Scriptable bitmap canvas */ @HtmlTagMarker -public inline fun TagConsumer.canvas(classes : String? = null, crossinline block : CANVAS.() -> Unit = {}) : HTMLCanvasElement = CANVAS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLCanvasElement +public inline fun TagConsumer.canvas(classes: String? = null, crossinline + block: CANVAS.() -> Unit = {}): HTMLCanvasElement = CANVAS(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLCanvasElement /** * Table caption */ @HtmlTagMarker -public inline fun TagConsumer.caption(classes : String? = null, crossinline block : CAPTION.() -> Unit = {}) : HTMLElement = CAPTION(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.caption(classes: String? = null, crossinline + block: CAPTION.() -> Unit = {}): HTMLElement = CAPTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Citation */ @HtmlTagMarker -public inline fun TagConsumer.cite(classes : String? = null, crossinline block : CITE.() -> Unit = {}) : HTMLElement = CITE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.cite(classes: String? = null, crossinline + block: CITE.() -> Unit = {}): HTMLElement = CITE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Computer code fragment */ @HtmlTagMarker -public inline fun TagConsumer.code(classes : String? = null, crossinline block : CODE.() -> Unit = {}) : HTMLElement = CODE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.code(classes: String? = null, crossinline + block: CODE.() -> Unit = {}): HTMLElement = CODE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Table column */ @HtmlTagMarker -public inline fun TagConsumer.col(classes : String? = null, crossinline block : COL.() -> Unit = {}) : HTMLTableColElement = COL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTableColElement +public inline fun TagConsumer.col(classes: String? = null, crossinline + block: COL.() -> Unit = {}): HTMLTableColElement = COL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTableColElement /** * Table column group */ @HtmlTagMarker -public inline fun TagConsumer.colGroup(classes : String? = null, crossinline block : COLGROUP.() -> Unit = {}) : HTMLTableColElement = COLGROUP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTableColElement +public inline fun TagConsumer.colGroup(classes: String? = null, crossinline + block: COLGROUP.() -> Unit = {}): HTMLTableColElement = COLGROUP(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLTableColElement @HtmlTagMarker -public inline fun TagConsumer.command(type : CommandType? = null, classes : String? = null, crossinline block : COMMAND.() -> Unit = {}) : HTMLElement = COMMAND(attributesMapOf("type", type?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.command( + type: CommandType? = null, + classes: String? = null, + crossinline block: COMMAND.() -> Unit = {}, +): HTMLElement = COMMAND(attributesMapOf("type", type?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Container for options for */ @HtmlTagMarker -public inline fun TagConsumer.dataList(classes : String? = null, crossinline block : DATALIST.() -> Unit = {}) : HTMLDataListElement = DATALIST(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLDataListElement +public inline fun TagConsumer.dataList(classes: String? = null, crossinline + block: DATALIST.() -> Unit = {}): HTMLDataListElement = DATALIST(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLDataListElement /** * Definition description */ @HtmlTagMarker -public inline fun TagConsumer.dd(classes : String? = null, crossinline block : DD.() -> Unit = {}) : HTMLElement = DD(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.dd(classes: String? = null, crossinline + block: DD.() -> Unit = {}): HTMLElement = DD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Deleted text */ @HtmlTagMarker -public inline fun TagConsumer.del(classes : String? = null, crossinline block : DEL.() -> Unit = {}) : HTMLElement = DEL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.del(classes: String? = null, crossinline + block: DEL.() -> Unit = {}): HTMLElement = DEL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Disclosure control for hiding details */ @HtmlTagMarker -public inline fun TagConsumer.details(classes : String? = null, crossinline block : DETAILS.() -> Unit = {}) : HTMLDetailsElement = DETAILS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLDetailsElement +public inline fun TagConsumer.details(classes: String? = null, crossinline + block: DETAILS.() -> Unit = {}): HTMLDetailsElement = DETAILS(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLDetailsElement /** * Instance definition */ @HtmlTagMarker -public inline fun TagConsumer.dfn(classes : String? = null, crossinline block : DFN.() -> Unit = {}) : HTMLElement = DFN(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.dfn(classes: String? = null, crossinline + block: DFN.() -> Unit = {}): HTMLElement = DFN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Dialog box or window */ @HtmlTagMarker -public inline fun TagConsumer.dialog(classes : String? = null, crossinline block : DIALOG.() -> Unit = {}) : HTMLDialogElement = DIALOG(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLDialogElement +public inline fun TagConsumer.dialog(classes: String? = null, crossinline + block: DIALOG.() -> Unit = {}): HTMLDialogElement = DIALOG(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLDialogElement /** * Generic language/style container */ @HtmlTagMarker -public inline fun TagConsumer.div(classes : String? = null, crossinline block : DIV.() -> Unit = {}) : HTMLDivElement = DIV(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLDivElement +public inline fun TagConsumer.div(classes: String? = null, crossinline + block: DIV.() -> Unit = {}): HTMLDivElement = DIV(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLDivElement /** * Definition list */ @HtmlTagMarker -public inline fun TagConsumer.dl(classes : String? = null, crossinline block : DL.() -> Unit = {}) : HTMLElement = DL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.dl(classes: String? = null, crossinline + block: DL.() -> Unit = {}): HTMLElement = DL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Definition term */ @HtmlTagMarker -public inline fun TagConsumer.dt(classes : String? = null, crossinline block : DT.() -> Unit = {}) : HTMLElement = DT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.dt(classes: String? = null, crossinline + block: DT.() -> Unit = {}): HTMLElement = DT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Emphasis */ @HtmlTagMarker -public inline fun TagConsumer.em(classes : String? = null, crossinline block : EM.() -> Unit = {}) : HTMLElement = EM(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.em(classes: String? = null, crossinline + block: EM.() -> Unit = {}): HTMLElement = EM(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Plugin */ @HtmlTagMarker -public inline fun TagConsumer.embed(classes : String? = null, crossinline block : EMBED.() -> Unit = {}) : HTMLEmbedElement = EMBED(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLEmbedElement +public inline fun TagConsumer.embed(classes: String? = null, crossinline + block: EMBED.() -> Unit = {}): HTMLEmbedElement = EMBED(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLEmbedElement /** * Form control group */ @HtmlTagMarker -public inline fun TagConsumer.fieldSet(classes : String? = null, crossinline block : FIELDSET.() -> Unit = {}) : HTMLFieldSetElement = FIELDSET(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLFieldSetElement +public inline fun TagConsumer.fieldSet(classes: String? = null, crossinline + block: FIELDSET.() -> Unit = {}): HTMLFieldSetElement = FIELDSET(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLFieldSetElement /** * Caption for */ @HtmlTagMarker -public inline fun TagConsumer.figcaption(classes : String? = null, crossinline block : FIGCAPTION.() -> Unit = {}) : HTMLElement = FIGCAPTION(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.figcaption(classes: String? = null, crossinline + block: FIGCAPTION.() -> Unit = {}): HTMLElement = FIGCAPTION(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) /** * Figure with optional caption */ @HtmlTagMarker -public inline fun TagConsumer.figure(classes : String? = null, crossinline block : FIGURE.() -> Unit = {}) : HTMLElement = FIGURE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.figure(classes: String? = null, crossinline + block: FIGURE.() -> Unit = {}): HTMLElement = FIGURE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Footer for a page or section */ @HtmlTagMarker -public inline fun TagConsumer.footer(classes : String? = null, crossinline block : FOOTER.() -> Unit = {}) : HTMLElement = FOOTER(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.footer(classes: String? = null, crossinline + block: FOOTER.() -> Unit = {}): HTMLElement = FOOTER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Interactive form */ @HtmlTagMarker -public inline fun TagConsumer.form(action : String? = null, encType : FormEncType? = null, method : FormMethod? = null, classes : String? = null, crossinline block : FORM.() -> Unit = {}) : HTMLFormElement = FORM(attributesMapOf("action", action,"enctype", encType?.enumEncode(),"method", method?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) as HTMLFormElement +public inline fun TagConsumer.form( + action: String? = null, + encType: FormEncType? = null, + method: FormMethod? = null, + classes: String? = null, + crossinline block: FORM.() -> Unit = {}, +): HTMLFormElement = FORM(attributesMapOf("action", action,"enctype", + encType?.enumEncode(),"method", method?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) as HTMLFormElement /** * Heading */ @HtmlTagMarker -public inline fun TagConsumer.h1(classes : String? = null, crossinline block : H1.() -> Unit = {}) : HTMLHeadingElement = H1(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLHeadingElement +public inline fun TagConsumer.h1(classes: String? = null, crossinline + block: H1.() -> Unit = {}): HTMLHeadingElement = H1(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement /** * Heading */ @HtmlTagMarker -public inline fun TagConsumer.h2(classes : String? = null, crossinline block : H2.() -> Unit = {}) : HTMLHeadingElement = H2(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLHeadingElement +public inline fun TagConsumer.h2(classes: String? = null, crossinline + block: H2.() -> Unit = {}): HTMLHeadingElement = H2(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement /** * Heading */ @HtmlTagMarker -public inline fun TagConsumer.h3(classes : String? = null, crossinline block : H3.() -> Unit = {}) : HTMLHeadingElement = H3(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLHeadingElement +public inline fun TagConsumer.h3(classes: String? = null, crossinline + block: H3.() -> Unit = {}): HTMLHeadingElement = H3(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement /** * Heading */ @HtmlTagMarker -public inline fun TagConsumer.h4(classes : String? = null, crossinline block : H4.() -> Unit = {}) : HTMLHeadingElement = H4(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLHeadingElement +public inline fun TagConsumer.h4(classes: String? = null, crossinline + block: H4.() -> Unit = {}): HTMLHeadingElement = H4(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement /** * Heading */ @HtmlTagMarker -public inline fun TagConsumer.h5(classes : String? = null, crossinline block : H5.() -> Unit = {}) : HTMLHeadingElement = H5(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLHeadingElement +public inline fun TagConsumer.h5(classes: String? = null, crossinline + block: H5.() -> Unit = {}): HTMLHeadingElement = H5(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement /** * Heading */ @HtmlTagMarker -public inline fun TagConsumer.h6(classes : String? = null, crossinline block : H6.() -> Unit = {}) : HTMLHeadingElement = H6(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLHeadingElement +public inline fun TagConsumer.h6(classes: String? = null, crossinline + block: H6.() -> Unit = {}): HTMLHeadingElement = H6(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement -@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") -@Suppress("DEPRECATION") /** * Document head */ @HtmlTagMarker -public fun TagConsumer.head(content : String = "") : HTMLHeadElement = HEAD(emptyMap, this).visitAndFinalize(this, {+content}) as HTMLHeadElement +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun TagConsumer.head(content: String = ""): HTMLHeadElement = HEAD(emptyMap, + this) + .visitAndFinalize(this, {+content}) as HTMLHeadElement + /** * Document head */ @HtmlTagMarker -public inline fun TagConsumer.head(crossinline block : HEAD.() -> Unit = {}) : HTMLHeadElement = HEAD(emptyMap, this).visitAndFinalize(this, block) as HTMLHeadElement +public inline fun TagConsumer.head(crossinline block: HEAD.() -> Unit = {}): + HTMLHeadElement = HEAD(emptyMap, this) + .visitAndFinalize(this, block) as HTMLHeadElement /** * Introductory or navigational aids for a page or section */ @HtmlTagMarker -public inline fun TagConsumer.header(classes : String? = null, crossinline block : HEADER.() -> Unit = {}) : HTMLElement = HEADER(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.`header`(classes: String? = null, crossinline + block: HEADER.() -> Unit = {}): HTMLElement = HEADER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -public inline fun TagConsumer.hGroup(classes : String? = null, crossinline block : HGROUP.() -> Unit = {}) : HTMLElement = HGROUP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.hGroup(classes: String? = null, crossinline + block: HGROUP.() -> Unit = {}): HTMLElement = HGROUP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Horizontal rule */ @HtmlTagMarker -public inline fun TagConsumer.hr(classes : String? = null, crossinline block : HR.() -> Unit = {}) : HTMLHRElement = HR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLHRElement +public inline fun TagConsumer.hr(classes: String? = null, crossinline + block: HR.() -> Unit = {}): HTMLHRElement = HR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHRElement -@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") -@Suppress("DEPRECATION") /** * Document root element */ @HtmlTagMarker -public fun TagConsumer.html(content : String = "", namespace : String? = null) : HTMLHtmlElement = HTML(emptyMap, this, namespace).visitAndFinalize(this, {+content}) as HTMLHtmlElement +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun TagConsumer.html(content: String = "", namespace: String? = null): + HTMLHtmlElement = HTML(emptyMap, this, namespace) + .visitAndFinalize(this, {+content}) as HTMLHtmlElement + /** * Document root element */ @HtmlTagMarker -public inline fun TagConsumer.html(namespace : String? = null, crossinline block : HTML.() -> Unit = {}) : HTMLHtmlElement = HTML(emptyMap, this, namespace).visitAndFinalize(this, block) as HTMLHtmlElement +public inline fun TagConsumer.html(namespace: String? = null, crossinline + block: HTML.() -> Unit = {}): HTMLHtmlElement = HTML(emptyMap, this, namespace) + .visitAndFinalize(this, block) as HTMLHtmlElement /** * Italic text style */ @HtmlTagMarker -public inline fun TagConsumer.i(classes : String? = null, crossinline block : I.() -> Unit = {}) : HTMLElement = I(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.i(classes: String? = null, crossinline + block: I.() -> Unit = {}): HTMLElement = I(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Inline subwindow */ @HtmlTagMarker -public fun TagConsumer.iframe(sandbox : IframeSandbox? = null, classes : String? = null, content : String = "") : HTMLElement = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this).visitAndFinalize(this, {+content}) +public fun TagConsumer.iframe( + sandbox: IframeSandbox? = null, + classes: String? = null, + content: String = "", +): HTMLElement = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, {+content}) + /** * Inline subwindow */ @HtmlTagMarker -public inline fun TagConsumer.iframe(sandbox : IframeSandbox? = null, classes : String? = null, crossinline block : IFRAME.() -> Unit = {}) : HTMLElement = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.iframe( + sandbox: IframeSandbox? = null, + classes: String? = null, + crossinline block: IFRAME.() -> Unit = {}, +): HTMLElement = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Embedded image */ @HtmlTagMarker -public inline fun TagConsumer.img(alt : String? = null, src : String? = null, classes : String? = null, crossinline block : IMG.() -> Unit = {}) : HTMLImageElement = IMG(attributesMapOf("alt", alt,"src", src,"class", classes), this).visitAndFinalize(this, block) as HTMLImageElement +public inline fun TagConsumer.img( + alt: String? = null, + src: String? = null, + classes: String? = null, + crossinline block: IMG.() -> Unit = {}, +): HTMLImageElement = IMG(attributesMapOf("alt", alt,"src", src,"class", classes), this) + .visitAndFinalize(this, block) as HTMLImageElement /** * Form control */ @HtmlTagMarker -public inline fun TagConsumer.input(type : InputType? = null, formEncType : InputFormEncType? = null, formMethod : InputFormMethod? = null, name : String? = null, classes : String? = null, crossinline block : INPUT.() -> Unit = {}) : HTMLInputElement = INPUT(attributesMapOf("type", type?.enumEncode(),"formenctype", formEncType?.enumEncode(),"formmethod", formMethod?.enumEncode(),"name", name,"class", classes), this).visitAndFinalize(this, block) as HTMLInputElement +public inline fun TagConsumer.input( + type: InputType? = null, + formEncType: InputFormEncType? = null, + formMethod: InputFormMethod? = null, + name: String? = null, + classes: String? = null, + crossinline block: INPUT.() -> Unit = {}, +): HTMLInputElement = INPUT(attributesMapOf("type", type?.enumEncode(),"formenctype", + formEncType?.enumEncode(),"formmethod", formMethod?.enumEncode(),"name", name,"class", classes), + this) + .visitAndFinalize(this, block) as HTMLInputElement /** * Inserted text */ @HtmlTagMarker -public inline fun TagConsumer.ins(classes : String? = null, crossinline block : INS.() -> Unit = {}) : HTMLElement = INS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.ins(classes: String? = null, crossinline + block: INS.() -> Unit = {}): HTMLElement = INS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Text to be entered by the user */ @HtmlTagMarker -public inline fun TagConsumer.kbd(classes : String? = null, crossinline block : KBD.() -> Unit = {}) : HTMLElement = KBD(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.kbd(classes: String? = null, crossinline + block: KBD.() -> Unit = {}): HTMLElement = KBD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Cryptographic key-pair generator form control */ @HtmlTagMarker -public inline fun TagConsumer.keyGen(keyType : KeyGenKeyType? = null, classes : String? = null, crossinline block : KEYGEN.() -> Unit = {}) : HTMLElement = KEYGEN(attributesMapOf("keytype", keyType?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.keyGen( + keyType: KeyGenKeyType? = null, + classes: String? = null, + crossinline block: KEYGEN.() -> Unit = {}, +): HTMLElement = KEYGEN(attributesMapOf("keytype", keyType?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) /** * Form field label text */ @HtmlTagMarker -public inline fun TagConsumer.label(classes : String? = null, crossinline block : LABEL.() -> Unit = {}) : HTMLLabelElement = LABEL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLLabelElement +public inline fun TagConsumer.label(classes: String? = null, crossinline + block: LABEL.() -> Unit = {}): HTMLLabelElement = LABEL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLLabelElement /** * Fieldset legend */ @HtmlTagMarker -public inline fun TagConsumer.legend(classes : String? = null, crossinline block : LEGEND.() -> Unit = {}) : HTMLLegendElement = LEGEND(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLLegendElement +public inline fun TagConsumer.legend(classes: String? = null, crossinline + block: LEGEND.() -> Unit = {}): HTMLLegendElement = LEGEND(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLLegendElement /** * List item */ @HtmlTagMarker -public inline fun TagConsumer.li(classes : String? = null, crossinline block : LI.() -> Unit = {}) : HTMLLIElement = LI(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLLIElement +public inline fun TagConsumer.li(classes: String? = null, crossinline + block: LI.() -> Unit = {}): HTMLLIElement = LI(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLLIElement /** * A media-independent link */ @HtmlTagMarker -public inline fun TagConsumer.link(href : String? = null, rel : String? = null, type : String? = null, crossinline block : LINK.() -> Unit = {}) : HTMLLinkElement = LINK(attributesMapOf("href", href,"rel", rel,"type", type), this).visitAndFinalize(this, block) as HTMLLinkElement +public inline fun TagConsumer.link( + href: String? = null, + rel: String? = null, + type: String? = null, + crossinline block: LINK.() -> Unit = {}, +): HTMLLinkElement = LINK(attributesMapOf("href", href,"rel", rel,"type", type), this) + .visitAndFinalize(this, block) as HTMLLinkElement /** * Container for the dominant contents of another element */ @HtmlTagMarker -public inline fun TagConsumer.main(classes : String? = null, crossinline block : MAIN.() -> Unit = {}) : HTMLElement = MAIN(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.main(classes: String? = null, crossinline + block: MAIN.() -> Unit = {}): HTMLElement = MAIN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Client-side image map */ @HtmlTagMarker -public inline fun TagConsumer.map(name : String? = null, classes : String? = null, crossinline block : MAP.() -> Unit = {}) : HTMLMapElement = MAP(attributesMapOf("name", name,"class", classes), this).visitAndFinalize(this, block) as HTMLMapElement +public inline fun TagConsumer.map( + name: String? = null, + classes: String? = null, + crossinline block: MAP.() -> Unit = {}, +): HTMLMapElement = MAP(attributesMapOf("name", name,"class", classes), this) + .visitAndFinalize(this, block) as HTMLMapElement /** * Highlight */ @HtmlTagMarker -public inline fun TagConsumer.mark(classes : String? = null, crossinline block : MARK.() -> Unit = {}) : HTMLElement = MARK(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.mark(classes: String? = null, crossinline + block: MARK.() -> Unit = {}): HTMLElement = MARK(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -public inline fun TagConsumer.math(classes : String? = null, crossinline block : MATH.() -> Unit = {}) : HTMLElement = MATH(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.math(classes: String? = null, crossinline + block: MATH.() -> Unit = {}): HTMLElement = MATH(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -public fun TagConsumer.mathml(classes : String? = null, content : String = "") : HTMLElement = MATHML(attributesMapOf("class", classes), this).visitAndFinalize(this, {+content}) +public fun TagConsumer.mathml(classes: String? = null, content: String = ""): + HTMLElement = MATHML(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) + @HtmlTagMarker -public inline fun TagConsumer.mathml(classes : String? = null, crossinline block : MATHML.() -> Unit = {}) : HTMLElement = MATHML(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.mathml(classes: String? = null, crossinline + block: MATHML.() -> Unit = {}): HTMLElement = MATHML(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Generic metainformation */ @HtmlTagMarker -public inline fun TagConsumer.meta(name : String? = null, content : String? = null, charset : String? = null, crossinline block : META.() -> Unit = {}) : HTMLMetaElement = META(attributesMapOf("name", name,"content", content,"charset", charset), this).visitAndFinalize(this, block) as HTMLMetaElement +public inline fun TagConsumer.meta( + name: String? = null, + content: String? = null, + charset: String? = null, + crossinline block: META.() -> Unit = {}, +): HTMLMetaElement = META(attributesMapOf("name", name,"content", content,"charset", charset), this) + .visitAndFinalize(this, block) as HTMLMetaElement /** * Gauge */ @HtmlTagMarker -public inline fun TagConsumer.meter(classes : String? = null, crossinline block : METER.() -> Unit = {}) : HTMLMeterElement = METER(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLMeterElement +public inline fun TagConsumer.meter(classes: String? = null, crossinline + block: METER.() -> Unit = {}): HTMLMeterElement = METER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLMeterElement /** * Section with navigational links */ @HtmlTagMarker -public inline fun TagConsumer.nav(classes : String? = null, crossinline block : NAV.() -> Unit = {}) : HTMLElement = NAV(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.nav(classes: String? = null, crossinline + block: NAV.() -> Unit = {}): HTMLElement = NAV(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Generic metainformation */ @HtmlTagMarker -public inline fun TagConsumer.noScript(classes : String? = null, crossinline block : NOSCRIPT.() -> Unit = {}) : HTMLElement = NOSCRIPT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.noScript(classes: String? = null, crossinline + block: NOSCRIPT.() -> Unit = {}): HTMLElement = NOSCRIPT(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) /** * Generic embedded object */ @HtmlTagMarker -public inline fun TagConsumer.htmlObject(classes : String? = null, crossinline block : OBJECT.() -> Unit = {}) : HTMLElement = OBJECT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.htmlObject(classes: String? = null, crossinline + block: OBJECT.() -> Unit = {}): HTMLElement = OBJECT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Ordered list */ @HtmlTagMarker -public inline fun TagConsumer.ol(classes : String? = null, crossinline block : OL.() -> Unit = {}) : HTMLElement = OL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.ol(classes: String? = null, crossinline + block: OL.() -> Unit = {}): HTMLElement = OL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Option group */ @HtmlTagMarker -public inline fun TagConsumer.optGroup(label : String? = null, classes : String? = null, crossinline block : OPTGROUP.() -> Unit = {}) : HTMLOptGroupElement = OPTGROUP(attributesMapOf("label", label,"class", classes), this).visitAndFinalize(this, block) as HTMLOptGroupElement +public inline fun TagConsumer.optGroup( + label: String? = null, + classes: String? = null, + crossinline block: OPTGROUP.() -> Unit = {}, +): HTMLOptGroupElement = OPTGROUP(attributesMapOf("label", label,"class", classes), this) + .visitAndFinalize(this, block) as HTMLOptGroupElement /** * Selectable choice */ @HtmlTagMarker -public fun TagConsumer.option(classes : String? = null, content : String = "") : HTMLOptionElement = OPTION(attributesMapOf("class", classes), this).visitAndFinalize(this, {+content}) as HTMLOptionElement +public fun TagConsumer.option(classes: String? = null, content: String = ""): + HTMLOptionElement = OPTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) as HTMLOptionElement + /** * Selectable choice */ @HtmlTagMarker -public inline fun TagConsumer.option(classes : String? = null, crossinline block : OPTION.() -> Unit = {}) : HTMLOptionElement = OPTION(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLOptionElement +public inline fun TagConsumer.option(classes: String? = null, crossinline + block: OPTION.() -> Unit = {}): HTMLOptionElement = OPTION(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLOptionElement /** * Calculated output value */ @HtmlTagMarker -public inline fun TagConsumer.output(classes : String? = null, crossinline block : OUTPUT.() -> Unit = {}) : HTMLOutputElement = OUTPUT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLOutputElement +public inline fun TagConsumer.output(classes: String? = null, crossinline + block: OUTPUT.() -> Unit = {}): HTMLOutputElement = OUTPUT(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLOutputElement /** * Paragraph */ @HtmlTagMarker -public inline fun TagConsumer.p(classes : String? = null, crossinline block : P.() -> Unit = {}) : HTMLParagraphElement = P(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLParagraphElement +public inline fun TagConsumer.p(classes: String? = null, crossinline + block: P.() -> Unit = {}): HTMLParagraphElement = P(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLParagraphElement /** * Named property value */ @HtmlTagMarker -public inline fun TagConsumer.param(name : String? = null, value : String? = null, crossinline block : PARAM.() -> Unit = {}) : HTMLParamElement = PARAM(attributesMapOf("name", name,"value", value), this).visitAndFinalize(this, block) as HTMLParamElement +public inline fun TagConsumer.`param`( + name: String? = null, + `value`: String? = null, + crossinline block: PARAM.() -> Unit = {}, +): HTMLParamElement = PARAM(attributesMapOf("name", name,"value", value), this) + .visitAndFinalize(this, block) as HTMLParamElement /** * Pictures container */ @HtmlTagMarker -public inline fun TagConsumer.picture(crossinline block : PICTURE.() -> Unit = {}) : HTMLPictureElement = PICTURE(emptyMap, this).visitAndFinalize(this, block) as HTMLPictureElement +public inline fun TagConsumer.picture(crossinline block: PICTURE.() -> Unit = {}): + HTMLPictureElement = PICTURE(emptyMap, this) + .visitAndFinalize(this, block) as HTMLPictureElement /** * Preformatted text */ @HtmlTagMarker -public inline fun TagConsumer.pre(classes : String? = null, crossinline block : PRE.() -> Unit = {}) : HTMLPreElement = PRE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLPreElement +public inline fun TagConsumer.pre(classes: String? = null, crossinline + block: PRE.() -> Unit = {}): HTMLPreElement = PRE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLPreElement /** * Progress bar */ @HtmlTagMarker -public inline fun TagConsumer.progress(classes : String? = null, crossinline block : PROGRESS.() -> Unit = {}) : HTMLProgressElement = PROGRESS(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLProgressElement +public inline fun TagConsumer.progress(classes: String? = null, crossinline + block: PROGRESS.() -> Unit = {}): HTMLProgressElement = PROGRESS(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLProgressElement /** * Short inline quotation */ @HtmlTagMarker -public inline fun TagConsumer.q(classes : String? = null, crossinline block : Q.() -> Unit = {}) : HTMLElement = Q(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.q(classes: String? = null, crossinline + block: Q.() -> Unit = {}): HTMLElement = Q(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Parenthesis for ruby annotation text */ @HtmlTagMarker -public inline fun TagConsumer.rp(classes : String? = null, crossinline block : RP.() -> Unit = {}) : HTMLElement = RP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.rp(classes: String? = null, crossinline + block: RP.() -> Unit = {}): HTMLElement = RP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Ruby annotation text */ @HtmlTagMarker -public inline fun TagConsumer.rt(classes : String? = null, crossinline block : RT.() -> Unit = {}) : HTMLElement = RT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.rt(classes: String? = null, crossinline + block: RT.() -> Unit = {}): HTMLElement = RT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Ruby annotation(s) */ @HtmlTagMarker -public inline fun TagConsumer.ruby(classes : String? = null, crossinline block : RUBY.() -> Unit = {}) : HTMLElement = RUBY(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.ruby(classes: String? = null, crossinline + block: RUBY.() -> Unit = {}): HTMLElement = RUBY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Strike-through text style */ @HtmlTagMarker -public inline fun TagConsumer.s(classes : String? = null, crossinline block : S.() -> Unit = {}) : HTMLElement = S(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.s(classes: String? = null, crossinline + block: S.() -> Unit = {}): HTMLElement = S(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Computer output text style */ @HtmlTagMarker -public inline fun TagConsumer.samp(classes : String? = null, crossinline block : SAMP.() -> Unit = {}) : HTMLElement = SAMP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.samp(classes: String? = null, crossinline + block: SAMP.() -> Unit = {}): HTMLElement = SAMP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) -@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") -@Suppress("DEPRECATION") /** * Script statements */ @HtmlTagMarker -public fun TagConsumer.script(type : String? = null, src : String? = null, crossorigin : ScriptCrossorigin? = null, content : String = "") : HTMLScriptElement = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", crossorigin?.enumEncode()), this).visitAndFinalize(this, {+content}) as HTMLScriptElement +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun TagConsumer.script( + type: String? = null, + src: String? = null, + crossorigin: ScriptCrossorigin? = null, + content: String = "", +): HTMLScriptElement = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", + crossorigin?.enumEncode()), this) + .visitAndFinalize(this, {+content}) as HTMLScriptElement + /** * Script statements */ @HtmlTagMarker -public inline fun TagConsumer.script(type : String? = null, src : String? = null, crossorigin : ScriptCrossorigin? = null, crossinline block : SCRIPT.() -> Unit = {}) : HTMLScriptElement = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", crossorigin?.enumEncode()), this).visitAndFinalize(this, block) as HTMLScriptElement +public inline fun TagConsumer.script( + type: String? = null, + src: String? = null, + crossorigin: ScriptCrossorigin? = null, + crossinline block: SCRIPT.() -> Unit = {}, +): HTMLScriptElement = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", + crossorigin?.enumEncode()), this) + .visitAndFinalize(this, block) as HTMLScriptElement /** * Generic document or application section */ @HtmlTagMarker -public inline fun TagConsumer.section(classes : String? = null, crossinline block : SECTION.() -> Unit = {}) : HTMLElement = SECTION(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.section(classes: String? = null, crossinline + block: SECTION.() -> Unit = {}): HTMLElement = SECTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Option selector */ @HtmlTagMarker -public inline fun TagConsumer.select(classes : String? = null, crossinline block : SELECT.() -> Unit = {}) : HTMLSelectElement = SELECT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLSelectElement +public inline fun TagConsumer.select(classes: String? = null, crossinline + block: SELECT.() -> Unit = {}): HTMLSelectElement = SELECT(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLSelectElement /** * Small text style */ @HtmlTagMarker -public inline fun TagConsumer.small(classes : String? = null, crossinline block : SMALL.() -> Unit = {}) : HTMLElement = SMALL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.small(classes: String? = null, crossinline + block: SMALL.() -> Unit = {}): HTMLElement = SMALL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Media source for */ @HtmlTagMarker -public inline fun TagConsumer.source(classes : String? = null, crossinline block : SOURCE.() -> Unit = {}) : HTMLSourceElement = SOURCE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLSourceElement +public inline fun TagConsumer.source(classes: String? = null, crossinline + block: SOURCE.() -> Unit = {}): HTMLSourceElement = SOURCE(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLSourceElement /** * Generic language/style container */ @HtmlTagMarker -public inline fun TagConsumer.span(classes : String? = null, crossinline block : SPAN.() -> Unit = {}) : HTMLSpanElement = SPAN(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLSpanElement +public inline fun TagConsumer.span(classes: String? = null, crossinline + block: SPAN.() -> Unit = {}): HTMLSpanElement = SPAN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLSpanElement /** * Strong emphasis */ @HtmlTagMarker -public inline fun TagConsumer.strong(classes : String? = null, crossinline block : STRONG.() -> Unit = {}) : HTMLElement = STRONG(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.strong(classes: String? = null, crossinline + block: STRONG.() -> Unit = {}): HTMLElement = STRONG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) -@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") -@Suppress("DEPRECATION") /** * Style info */ @HtmlTagMarker -public fun TagConsumer.style(type : String? = null, content : String = "") : HTMLStyleElement = STYLE(attributesMapOf("type", type), this).visitAndFinalize(this, {+content}) as HTMLStyleElement +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun TagConsumer.style(type: String? = null, content: String = ""): + HTMLStyleElement = STYLE(attributesMapOf("type", type), this) + .visitAndFinalize(this, {+content}) as HTMLStyleElement + /** * Style info */ @HtmlTagMarker -public inline fun TagConsumer.style(type : String? = null, crossinline block : STYLE.() -> Unit = {}) : HTMLStyleElement = STYLE(attributesMapOf("type", type), this).visitAndFinalize(this, block) as HTMLStyleElement +public inline fun TagConsumer.style(type: String? = null, crossinline + block: STYLE.() -> Unit = {}): HTMLStyleElement = STYLE(attributesMapOf("type", type), this) + .visitAndFinalize(this, block) as HTMLStyleElement /** * Subscript */ @HtmlTagMarker -public inline fun TagConsumer.sub(classes : String? = null, crossinline block : SUB.() -> Unit = {}) : HTMLElement = SUB(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.sub(classes: String? = null, crossinline + block: SUB.() -> Unit = {}): HTMLElement = SUB(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Caption for */ @HtmlTagMarker -public inline fun TagConsumer.summary(classes : String? = null, crossinline block : SUMMARY.() -> Unit = {}) : HTMLElement = SUMMARY(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.summary(classes: String? = null, crossinline + block: SUMMARY.() -> Unit = {}): HTMLElement = SUMMARY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Superscript */ @HtmlTagMarker -public inline fun TagConsumer.sup(classes : String? = null, crossinline block : SUP.() -> Unit = {}) : HTMLElement = SUP(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.sup(classes: String? = null, crossinline + block: SUP.() -> Unit = {}): HTMLElement = SUP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) @HtmlTagMarker -public fun TagConsumer.svg(classes : String? = null, content : String = "") : HTMLElement = SVG(attributesMapOf("class", classes), this).visitAndFinalize(this, {+content}) +public fun TagConsumer.svg(classes: String? = null, content: String = ""): HTMLElement + = SVG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) + @HtmlTagMarker -public inline fun TagConsumer.svg(classes : String? = null, crossinline block : SVG.() -> Unit = {}) : HTMLElement = SVG(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.svg(classes: String? = null, crossinline + block: SVG.() -> Unit = {}): HTMLElement = SVG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** - * + * */ @HtmlTagMarker -public inline fun TagConsumer.table(classes : String? = null, crossinline block : TABLE.() -> Unit = {}) : HTMLTableElement = TABLE(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTableElement +public inline fun TagConsumer.table(classes: String? = null, crossinline + block: TABLE.() -> Unit = {}): HTMLTableElement = TABLE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTableElement /** * Table body */ @HtmlTagMarker -public inline fun TagConsumer.tbody(classes : String? = null, crossinline block : TBODY.() -> Unit = {}) : HTMLTableSectionElement = TBODY(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTableSectionElement +public inline fun TagConsumer.tbody(classes: String? = null, crossinline + block: TBODY.() -> Unit = {}): HTMLTableSectionElement = TBODY(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLTableSectionElement /** * Table data cell */ @HtmlTagMarker -public inline fun TagConsumer.td(classes : String? = null, crossinline block : TD.() -> Unit = {}) : HTMLTableCellElement = TD(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTableCellElement +public inline fun TagConsumer.td(classes: String? = null, crossinline + block: TD.() -> Unit = {}): HTMLTableCellElement = TD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTableCellElement /** * Multi-line text field */ @HtmlTagMarker -public fun TagConsumer.textArea(rows : String? = null, cols : String? = null, wrap : TextAreaWrap? = null, classes : String? = null, content : String = "") : HTMLTextAreaElement = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", wrap?.enumEncode(),"class", classes), this).visitAndFinalize(this, {+content}) as HTMLTextAreaElement +public fun TagConsumer.textArea( + rows: String? = null, + cols: String? = null, + wrap: TextAreaWrap? = null, + classes: String? = null, + content: String = "", +): HTMLTextAreaElement = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", + wrap?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, {+content}) as HTMLTextAreaElement + /** * Multi-line text field */ @HtmlTagMarker -public inline fun TagConsumer.textArea(rows : String? = null, cols : String? = null, wrap : TextAreaWrap? = null, classes : String? = null, crossinline block : TEXTAREA.() -> Unit = {}) : HTMLTextAreaElement = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", wrap?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) as HTMLTextAreaElement +public inline fun TagConsumer.textArea( + rows: String? = null, + cols: String? = null, + wrap: TextAreaWrap? = null, + classes: String? = null, + crossinline block: TEXTAREA.() -> Unit = {}, +): HTMLTextAreaElement = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", + wrap?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) as HTMLTextAreaElement /** * Table footer */ @HtmlTagMarker -public inline fun TagConsumer.tfoot(classes : String? = null, crossinline block : TFOOT.() -> Unit = {}) : HTMLTableSectionElement = TFOOT(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTableSectionElement +public inline fun TagConsumer.tfoot(classes: String? = null, crossinline + block: TFOOT.() -> Unit = {}): HTMLTableSectionElement = TFOOT(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLTableSectionElement /** * Table header cell */ @HtmlTagMarker -public inline fun TagConsumer.th(scope : ThScope? = null, classes : String? = null, crossinline block : TH.() -> Unit = {}) : HTMLTableCellElement = TH(attributesMapOf("scope", scope?.enumEncode(),"class", classes), this).visitAndFinalize(this, block) as HTMLTableCellElement +public inline fun TagConsumer.th( + scope: ThScope? = null, + classes: String? = null, + crossinline block: TH.() -> Unit = {}, +): HTMLTableCellElement = TH(attributesMapOf("scope", scope?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) as HTMLTableCellElement /** * Table header */ @HtmlTagMarker -public inline fun TagConsumer.thead(classes : String? = null, crossinline block : THEAD.() -> Unit = {}) : HTMLTableSectionElement = THEAD(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTableSectionElement +public inline fun TagConsumer.thead(classes: String? = null, crossinline + block: THEAD.() -> Unit = {}): HTMLTableSectionElement = THEAD(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLTableSectionElement /** * Machine-readable equivalent of date- or time-related data */ @HtmlTagMarker -public inline fun TagConsumer.time(classes : String? = null, crossinline block : TIME.() -> Unit = {}) : HTMLTimeElement = TIME(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTimeElement +public inline fun TagConsumer.time(classes: String? = null, crossinline + block: TIME.() -> Unit = {}): HTMLTimeElement = TIME(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTimeElement /** * Document title */ @HtmlTagMarker -public fun TagConsumer.title(content : String = "") : HTMLTitleElement = TITLE(emptyMap, this).visitAndFinalize(this, {+content}) as HTMLTitleElement +public fun TagConsumer.title(content: String = ""): HTMLTitleElement = TITLE(emptyMap, + this) + .visitAndFinalize(this, {+content}) as HTMLTitleElement + /** * Document title */ @HtmlTagMarker -public inline fun TagConsumer.title(crossinline block : TITLE.() -> Unit = {}) : HTMLTitleElement = TITLE(emptyMap, this).visitAndFinalize(this, block) as HTMLTitleElement +public inline fun TagConsumer.title(crossinline block: TITLE.() -> Unit = {}): + HTMLTitleElement = TITLE(emptyMap, this) + .visitAndFinalize(this, block) as HTMLTitleElement /** * Table row */ @HtmlTagMarker -public inline fun TagConsumer.tr(classes : String? = null, crossinline block : TR.() -> Unit = {}) : HTMLTableRowElement = TR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLTableRowElement +public inline fun TagConsumer.tr(classes: String? = null, crossinline + block: TR.() -> Unit = {}): HTMLTableRowElement = TR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTableRowElement /** * Underlined text style */ @HtmlTagMarker -public inline fun TagConsumer.u(classes : String? = null, crossinline block : U.() -> Unit = {}) : HTMLElement = U(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.u(classes: String? = null, crossinline + block: U.() -> Unit = {}): HTMLElement = U(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Unordered list */ @HtmlTagMarker -public inline fun TagConsumer.ul(classes : String? = null, crossinline block : UL.() -> Unit = {}) : HTMLElement = UL(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.ul(classes: String? = null, crossinline + block: UL.() -> Unit = {}): HTMLElement = UL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Unordered list */ @HtmlTagMarker -public inline fun TagConsumer.htmlVar(classes : String? = null, crossinline block : VAR.() -> Unit = {}) : HTMLElement = VAR(attributesMapOf("class", classes), this).visitAndFinalize(this, block) +public inline fun TagConsumer.htmlVar(classes: String? = null, crossinline + block: VAR.() -> Unit = {}): HTMLElement = VAR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) /** * Video player */ @HtmlTagMarker -public inline fun TagConsumer.video(classes : String? = null, crossinline block : VIDEO.() -> Unit = {}) : HTMLVideoElement = VIDEO(attributesMapOf("class", classes), this).visitAndFinalize(this, block) as HTMLVideoElement - +public inline fun TagConsumer.video(classes: String? = null, crossinline + block: VIDEO.() -> Unit = {}): HTMLVideoElement = VIDEO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLVideoElement diff --git a/src/jsMain/kotlin/generated/gen-event-attrs-js.kt b/src/jsMain/kotlin/generated/gen-event-attrs-js.kt index cfa3cd65..a565f901 100644 --- a/src/jsMain/kotlin/generated/gen-event-attrs-js.kt +++ b/src/jsMain/kotlin/generated/gen-event-attrs-js.kt @@ -1,258 +1,381 @@ package kotlinx.html.js -import kotlinx.html.* -import kotlinx.html.org.w3c.dom.events.Event - /******************************************************************************* DO NOT EDIT This file was generated by module generate *******************************************************************************/ +import kotlin.Unit +import kotlinx.html.CommonAttributeGroupFacade +import kotlinx.html.org.w3c.dom.events.Event -var CommonAttributeGroupFacade.onAbortFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onAbort") - set(newValue) {consumer.onTagEvent(this, "onabort", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onBlurFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onBlur") - set(newValue) {consumer.onTagEvent(this, "onblur", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onCanPlayFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onCanPlay") - set(newValue) {consumer.onTagEvent(this, "oncanplay", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onCanPlayThroughFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onCanPlayThrough") - set(newValue) {consumer.onTagEvent(this, "oncanplaythrough", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onChangeFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onChange") - set(newValue) {consumer.onTagEvent(this, "onchange", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onClickFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onClick") - set(newValue) {consumer.onTagEvent(this, "onclick", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onContextMenuFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onContextMenu") - set(newValue) {consumer.onTagEvent(this, "oncontextmenu", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDoubleClickFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDoubleClick") - set(newValue) {consumer.onTagEvent(this, "ondblclick", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDragFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDrag") - set(newValue) {consumer.onTagEvent(this, "ondrag", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDragEndFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDragEnd") - set(newValue) {consumer.onTagEvent(this, "ondragend", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDragEnterFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDragEnter") - set(newValue) {consumer.onTagEvent(this, "ondragenter", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDragLeaveFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDragLeave") - set(newValue) {consumer.onTagEvent(this, "ondragleave", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDragOverFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDragOver") - set(newValue) {consumer.onTagEvent(this, "ondragover", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDragStartFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDragStart") - set(newValue) {consumer.onTagEvent(this, "ondragstart", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDropFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDrop") - set(newValue) {consumer.onTagEvent(this, "ondrop", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onDurationChangeFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onDurationChange") - set(newValue) {consumer.onTagEvent(this, "ondurationchange", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onEmptiedFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onEmptied") - set(newValue) {consumer.onTagEvent(this, "onemptied", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onEndedFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onEnded") - set(newValue) {consumer.onTagEvent(this, "onended", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onErrorFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onError") - set(newValue) {consumer.onTagEvent(this, "onerror", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onFocusFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onFocus") - set(newValue) {consumer.onTagEvent(this, "onfocus", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onFocusInFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onFocusIn") - set(newValue) {consumer.onTagEvent(this, "onfocusin", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onFocusOutFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onFocusOut") - set(newValue) {consumer.onTagEvent(this, "onfocusout", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onFormChangeFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onFormChange") - set(newValue) {consumer.onTagEvent(this, "onformchange", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onFormInputFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onFormInput") - set(newValue) {consumer.onTagEvent(this, "onforminput", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onInputFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onInput") - set(newValue) {consumer.onTagEvent(this, "oninput", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onInvalidFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onInvalid") - set(newValue) {consumer.onTagEvent(this, "oninvalid", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onKeyDownFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onKeyDown") - set(newValue) {consumer.onTagEvent(this, "onkeydown", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onKeyPressFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onKeyPress") - set(newValue) {consumer.onTagEvent(this, "onkeypress", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onKeyUpFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onKeyUp") - set(newValue) {consumer.onTagEvent(this, "onkeyup", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onLoadFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onLoad") - set(newValue) {consumer.onTagEvent(this, "onload", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onLoadedDataFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onLoadedData") - set(newValue) {consumer.onTagEvent(this, "onloadeddata", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onLoadedMetaDataFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onLoadedMetaData") - set(newValue) {consumer.onTagEvent(this, "onloadedmetadata", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onLoadStartFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onLoadStart") - set(newValue) {consumer.onTagEvent(this, "onloadstart", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onMouseDownFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onMouseDown") - set(newValue) {consumer.onTagEvent(this, "onmousedown", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onMouseMoveFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onMouseMove") - set(newValue) {consumer.onTagEvent(this, "onmousemove", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onMouseOutFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onMouseOut") - set(newValue) {consumer.onTagEvent(this, "onmouseout", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onMouseOverFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onMouseOver") - set(newValue) {consumer.onTagEvent(this, "onmouseover", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onMouseUpFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onMouseUp") - set(newValue) {consumer.onTagEvent(this, "onmouseup", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onMouseWheelFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onMouseWheel") - set(newValue) {consumer.onTagEvent(this, "onmousewheel", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onPauseFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onPause") - set(newValue) {consumer.onTagEvent(this, "onpause", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onPlayFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onPlay") - set(newValue) {consumer.onTagEvent(this, "onplay", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onPlayingFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onPlaying") - set(newValue) {consumer.onTagEvent(this, "onplaying", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onProgressFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onProgress") - set(newValue) {consumer.onTagEvent(this, "onprogress", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onRateChangeFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onRateChange") - set(newValue) {consumer.onTagEvent(this, "onratechange", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onReadyStateChangeFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onReadyStateChange") - set(newValue) {consumer.onTagEvent(this, "onreadystatechange", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onScrollFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onScroll") - set(newValue) {consumer.onTagEvent(this, "onscroll", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onSearchFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onSearch") - set(newValue) {consumer.onTagEvent(this, "onsearch", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onSeekedFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onSeeked") - set(newValue) {consumer.onTagEvent(this, "onseeked", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onSeekingFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onSeeking") - set(newValue) {consumer.onTagEvent(this, "onseeking", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onSelectFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onSelect") - set(newValue) {consumer.onTagEvent(this, "onselect", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onShowFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onShow") - set(newValue) {consumer.onTagEvent(this, "onshow", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onStalledFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onStalled") - set(newValue) {consumer.onTagEvent(this, "onstalled", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onSubmitFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onSubmit") - set(newValue) {consumer.onTagEvent(this, "onsubmit", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onSuspendFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onSuspend") - set(newValue) {consumer.onTagEvent(this, "onsuspend", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onTimeUpdateFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onTimeUpdate") - set(newValue) {consumer.onTagEvent(this, "ontimeupdate", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onTouchCancelFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onTouchCancel") - set(newValue) {consumer.onTagEvent(this, "ontouchcancel", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onTouchEndFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onTouchEnd") - set(newValue) {consumer.onTagEvent(this, "ontouchend", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onTouchMoveFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onTouchMove") - set(newValue) {consumer.onTagEvent(this, "ontouchmove", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onTouchStartFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onTouchStart") - set(newValue) {consumer.onTagEvent(this, "ontouchstart", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onVolumeChangeFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onVolumeChange") - set(newValue) {consumer.onTagEvent(this, "onvolumechange", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onWaitingFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onWaiting") - set(newValue) {consumer.onTagEvent(this, "onwaiting", newValue.unsafeCast<(Event) -> Unit>())} - -var CommonAttributeGroupFacade.onWheelFunction : (org.w3c.dom.events.Event) -> Unit - get() = throw UnsupportedOperationException("You can't read variable onWheel") - set(newValue) {consumer.onTagEvent(this, "onwheel", newValue.unsafeCast<(Event) -> Unit>())} - +public var CommonAttributeGroupFacade.onAbortFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onAbort") + set(newValue) { + consumer.onTagEvent(this, "onabort", newValue) + } + +public var CommonAttributeGroupFacade.onBlurFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onBlur") + set(newValue) { + consumer.onTagEvent(this, "onblur", newValue) + } + +public var CommonAttributeGroupFacade.onCanPlayFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onCanPlay") + set(newValue) { + consumer.onTagEvent(this, "oncanplay", newValue) + } + +public var CommonAttributeGroupFacade.onCanPlayThroughFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onCanPlayThrough") + set(newValue) { + consumer.onTagEvent(this, "oncanplaythrough", newValue) + } + +public var CommonAttributeGroupFacade.onChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onChange") + set(newValue) { + consumer.onTagEvent(this, "onchange", newValue) + } + +public var CommonAttributeGroupFacade.onClickFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onClick") + set(newValue) { + consumer.onTagEvent(this, "onclick", newValue) + } + +public var CommonAttributeGroupFacade.onContextMenuFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onContextMenu") + set(newValue) { + consumer.onTagEvent(this, "oncontextmenu", newValue) + } + +public var CommonAttributeGroupFacade.onDoubleClickFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDoubleClick") + set(newValue) { + consumer.onTagEvent(this, "ondblclick", newValue) + } + +public var CommonAttributeGroupFacade.onDragFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDrag") + set(newValue) { + consumer.onTagEvent(this, "ondrag", newValue) + } + +public var CommonAttributeGroupFacade.onDragEndFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragEnd") + set(newValue) { + consumer.onTagEvent(this, "ondragend", newValue) + } + +public var CommonAttributeGroupFacade.onDragEnterFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragEnter") + set(newValue) { + consumer.onTagEvent(this, "ondragenter", newValue) + } + +public var CommonAttributeGroupFacade.onDragLeaveFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragLeave") + set(newValue) { + consumer.onTagEvent(this, "ondragleave", newValue) + } + +public var CommonAttributeGroupFacade.onDragOverFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragOver") + set(newValue) { + consumer.onTagEvent(this, "ondragover", newValue) + } + +public var CommonAttributeGroupFacade.onDragStartFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragStart") + set(newValue) { + consumer.onTagEvent(this, "ondragstart", newValue) + } + +public var CommonAttributeGroupFacade.onDropFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDrop") + set(newValue) { + consumer.onTagEvent(this, "ondrop", newValue) + } + +public var CommonAttributeGroupFacade.onDurationChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDurationChange") + set(newValue) { + consumer.onTagEvent(this, "ondurationchange", newValue) + } + +public var CommonAttributeGroupFacade.onEmptiedFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onEmptied") + set(newValue) { + consumer.onTagEvent(this, "onemptied", newValue) + } + +public var CommonAttributeGroupFacade.onEndedFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onEnded") + set(newValue) { + consumer.onTagEvent(this, "onended", newValue) + } + +public var CommonAttributeGroupFacade.onErrorFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onError") + set(newValue) { + consumer.onTagEvent(this, "onerror", newValue) + } + +public var CommonAttributeGroupFacade.onFocusFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFocus") + set(newValue) { + consumer.onTagEvent(this, "onfocus", newValue) + } + +public var CommonAttributeGroupFacade.onFocusInFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFocusIn") + set(newValue) { + consumer.onTagEvent(this, "onfocusin", newValue) + } + +public var CommonAttributeGroupFacade.onFocusOutFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFocusOut") + set(newValue) { + consumer.onTagEvent(this, "onfocusout", newValue) + } + +public var CommonAttributeGroupFacade.onFormChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFormChange") + set(newValue) { + consumer.onTagEvent(this, "onformchange", newValue) + } + +public var CommonAttributeGroupFacade.onFormInputFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFormInput") + set(newValue) { + consumer.onTagEvent(this, "onforminput", newValue) + } + +public var CommonAttributeGroupFacade.onInputFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onInput") + set(newValue) { + consumer.onTagEvent(this, "oninput", newValue) + } + +public var CommonAttributeGroupFacade.onInvalidFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onInvalid") + set(newValue) { + consumer.onTagEvent(this, "oninvalid", newValue) + } + +public var CommonAttributeGroupFacade.onKeyDownFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onKeyDown") + set(newValue) { + consumer.onTagEvent(this, "onkeydown", newValue) + } + +public var CommonAttributeGroupFacade.onKeyPressFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onKeyPress") + set(newValue) { + consumer.onTagEvent(this, "onkeypress", newValue) + } + +public var CommonAttributeGroupFacade.onKeyUpFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onKeyUp") + set(newValue) { + consumer.onTagEvent(this, "onkeyup", newValue) + } + +public var CommonAttributeGroupFacade.onLoadFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onLoad") + set(newValue) { + consumer.onTagEvent(this, "onload", newValue) + } + +public var CommonAttributeGroupFacade.onLoadedDataFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onLoadedData") + set(newValue) { + consumer.onTagEvent(this, "onloadeddata", newValue) + } + +public var CommonAttributeGroupFacade.onLoadedMetaDataFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onLoadedMetaData") + set(newValue) { + consumer.onTagEvent(this, "onloadedmetadata", newValue) + } + +public var CommonAttributeGroupFacade.onLoadStartFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onLoadStart") + set(newValue) { + consumer.onTagEvent(this, "onloadstart", newValue) + } + +public var CommonAttributeGroupFacade.onMouseDownFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseDown") + set(newValue) { + consumer.onTagEvent(this, "onmousedown", newValue) + } + +public var CommonAttributeGroupFacade.onMouseMoveFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseMove") + set(newValue) { + consumer.onTagEvent(this, "onmousemove", newValue) + } + +public var CommonAttributeGroupFacade.onMouseOutFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseOut") + set(newValue) { + consumer.onTagEvent(this, "onmouseout", newValue) + } + +public var CommonAttributeGroupFacade.onMouseOverFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseOver") + set(newValue) { + consumer.onTagEvent(this, "onmouseover", newValue) + } + +public var CommonAttributeGroupFacade.onMouseUpFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseUp") + set(newValue) { + consumer.onTagEvent(this, "onmouseup", newValue) + } + +public var CommonAttributeGroupFacade.onMouseWheelFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseWheel") + set(newValue) { + consumer.onTagEvent(this, "onmousewheel", newValue) + } + +public var CommonAttributeGroupFacade.onPauseFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onPause") + set(newValue) { + consumer.onTagEvent(this, "onpause", newValue) + } + +public var CommonAttributeGroupFacade.onPlayFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onPlay") + set(newValue) { + consumer.onTagEvent(this, "onplay", newValue) + } + +public var CommonAttributeGroupFacade.onPlayingFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onPlaying") + set(newValue) { + consumer.onTagEvent(this, "onplaying", newValue) + } + +public var CommonAttributeGroupFacade.onProgressFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onProgress") + set(newValue) { + consumer.onTagEvent(this, "onprogress", newValue) + } + +public var CommonAttributeGroupFacade.onRateChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onRateChange") + set(newValue) { + consumer.onTagEvent(this, "onratechange", newValue) + } + +public var CommonAttributeGroupFacade.onReadyStateChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onReadyStateChange") + set(newValue) { + consumer.onTagEvent(this, "onreadystatechange", newValue) + } + +public var CommonAttributeGroupFacade.onScrollFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onScroll") + set(newValue) { + consumer.onTagEvent(this, "onscroll", newValue) + } + +public var CommonAttributeGroupFacade.onSearchFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSearch") + set(newValue) { + consumer.onTagEvent(this, "onsearch", newValue) + } + +public var CommonAttributeGroupFacade.onSeekedFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSeeked") + set(newValue) { + consumer.onTagEvent(this, "onseeked", newValue) + } + +public var CommonAttributeGroupFacade.onSeekingFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSeeking") + set(newValue) { + consumer.onTagEvent(this, "onseeking", newValue) + } + +public var CommonAttributeGroupFacade.onSelectFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSelect") + set(newValue) { + consumer.onTagEvent(this, "onselect", newValue) + } + +public var CommonAttributeGroupFacade.onShowFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onShow") + set(newValue) { + consumer.onTagEvent(this, "onshow", newValue) + } + +public var CommonAttributeGroupFacade.onStalledFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onStalled") + set(newValue) { + consumer.onTagEvent(this, "onstalled", newValue) + } + +public var CommonAttributeGroupFacade.onSubmitFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSubmit") + set(newValue) { + consumer.onTagEvent(this, "onsubmit", newValue) + } + +public var CommonAttributeGroupFacade.onSuspendFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSuspend") + set(newValue) { + consumer.onTagEvent(this, "onsuspend", newValue) + } + +public var CommonAttributeGroupFacade.onTimeUpdateFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTimeUpdate") + set(newValue) { + consumer.onTagEvent(this, "ontimeupdate", newValue) + } + +public var CommonAttributeGroupFacade.onTouchCancelFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTouchCancel") + set(newValue) { + consumer.onTagEvent(this, "ontouchcancel", newValue) + } + +public var CommonAttributeGroupFacade.onTouchEndFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTouchEnd") + set(newValue) { + consumer.onTagEvent(this, "ontouchend", newValue) + } + +public var CommonAttributeGroupFacade.onTouchMoveFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTouchMove") + set(newValue) { + consumer.onTagEvent(this, "ontouchmove", newValue) + } + +public var CommonAttributeGroupFacade.onTouchStartFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTouchStart") + set(newValue) { + consumer.onTagEvent(this, "ontouchstart", newValue) + } + +public var CommonAttributeGroupFacade.onVolumeChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onVolumeChange") + set(newValue) { + consumer.onTagEvent(this, "onvolumechange", newValue) + } + +public var CommonAttributeGroupFacade.onWaitingFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onWaiting") + set(newValue) { + consumer.onTagEvent(this, "onwaiting", newValue) + } + +public var CommonAttributeGroupFacade.onWheelFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onWheel") + set(newValue) { + consumer.onTagEvent(this, "onwheel", newValue) + } diff --git a/src/jsTest/kotlin/generated/gen-tag-tests.kt b/src/jsTest/kotlin/generated/gen-tag-tests.kt new file mode 100644 index 00000000..62c1e6b4 --- /dev/null +++ b/src/jsTest/kotlin/generated/gen-tag-tests.kt @@ -0,0 +1,570 @@ +import kotlinx.html.js.* + +/******************************************************************************* + DO NOT EDIT + This file was generated by module generate +*******************************************************************************/ +import kotlinx.browser.document +import kotlinx.html.TagConsumer +import kotlinx.html.dom.append +import org.w3c.dom.HTMLElement +import kotlin.test.Test as test + +public class JsTagCastTests { + public fun wrapper(): TagConsumer = document.body!!.append + + @test + public fun testA() { + wrapper().a {} + } + + @test + public fun testAbbr() { + wrapper().abbr {} + } + + @test + public fun testAddress() { + wrapper().address {} + } + + @test + public fun testArea() { + wrapper().area {} + } + + @test + public fun testArticle() { + wrapper().article {} + } + + @test + public fun testAside() { + wrapper().aside {} + } + + @test + public fun testAudio() { + wrapper().audio {} + } + + @test + public fun testB() { + wrapper().b {} + } + + @test + public fun testBase() { + wrapper().base {} + } + + @test + public fun testBdi() { + wrapper().bdi {} + } + + @test + public fun testBdo() { + wrapper().bdo {} + } + + @test + public fun testBlockQuote() { + wrapper().blockQuote {} + } + + @test + public fun testBody() { + wrapper().body {} + } + + @test + public fun testBr() { + wrapper().br {} + } + + @test + public fun testButton() { + wrapper().button {} + } + + @test + public fun testCanvas() { + wrapper().canvas {} + } + + @test + public fun testCaption() { + wrapper().caption {} + } + + @test + public fun testCite() { + wrapper().cite {} + } + + @test + public fun testCode() { + wrapper().code {} + } + + @test + public fun testCol() { + wrapper().col {} + } + + @test + public fun testColGroup() { + wrapper().colGroup {} + } + + @test + public fun testCommand() { + wrapper().command {} + } + + @test + public fun testDataList() { + wrapper().dataList {} + } + + @test + public fun testDd() { + wrapper().dd {} + } + + @test + public fun testDel() { + wrapper().del {} + } + + @test + public fun testDetails() { + wrapper().details {} + } + + @test + public fun testDfn() { + wrapper().dfn {} + } + + @test + public fun testDialog() { + wrapper().dialog {} + } + + @test + public fun testDiv() { + wrapper().div {} + } + + @test + public fun testDl() { + wrapper().dl {} + } + + @test + public fun testDt() { + wrapper().dt {} + } + + @test + public fun testEm() { + wrapper().em {} + } + + @test + public fun testEmbed() { + wrapper().embed {} + } + + @test + public fun testFieldSet() { + wrapper().fieldSet {} + } + + @test + public fun testFigcaption() { + wrapper().figcaption {} + } + + @test + public fun testFigure() { + wrapper().figure {} + } + + @test + public fun testFooter() { + wrapper().footer {} + } + + @test + public fun testForm() { + wrapper().form {} + } + + @test + public fun testH1() { + wrapper().h1 {} + } + + @test + public fun testH2() { + wrapper().h2 {} + } + + @test + public fun testH3() { + wrapper().h3 {} + } + + @test + public fun testH4() { + wrapper().h4 {} + } + + @test + public fun testH5() { + wrapper().h5 {} + } + + @test + public fun testH6() { + wrapper().h6 {} + } + + @test + public fun testHead() { + wrapper().head {} + } + + @test + public fun testHeader() { + wrapper().header {} + } + + @test + public fun testHGroup() { + wrapper().hGroup {} + } + + @test + public fun testHr() { + wrapper().hr {} + } + + @test + public fun testHtml() { + wrapper().html {} + } + + @test + public fun testI() { + wrapper().i {} + } + + @test + public fun testIframe() { + wrapper().iframe {} + } + + @test + public fun testImg() { + wrapper().img {} + } + + @test + public fun testInput() { + wrapper().input {} + } + + @test + public fun testIns() { + wrapper().ins {} + } + + @test + public fun testKbd() { + wrapper().kbd {} + } + + @test + public fun testKeyGen() { + wrapper().keyGen {} + } + + @test + public fun testLabel() { + wrapper().label {} + } + + @test + public fun testLegend() { + wrapper().legend {} + } + + @test + public fun testLi() { + wrapper().li {} + } + + @test + public fun testLink() { + wrapper().link {} + } + + @test + public fun testMain() { + wrapper().main {} + } + + @test + public fun testMap() { + wrapper().map {} + } + + @test + public fun testMark() { + wrapper().mark {} + } + + @test + public fun testMath() { + wrapper().math {} + } + + @test + public fun testMathml() { + wrapper().mathml {} + } + + @test + public fun testMeta() { + wrapper().meta {} + } + + @test + public fun testMeter() { + wrapper().meter {} + } + + @test + public fun testNav() { + wrapper().nav {} + } + + @test + public fun testNoScript() { + wrapper().noScript {} + } + + @test + public fun testHtmlObject() { + wrapper().htmlObject {} + } + + @test + public fun testOl() { + wrapper().ol {} + } + + @test + public fun testOptGroup() { + wrapper().optGroup {} + } + + @test + public fun testOption() { + wrapper().option {} + } + + @test + public fun testOutput() { + wrapper().output {} + } + + @test + public fun testP() { + wrapper().p {} + } + + @test + public fun testParam() { + wrapper().param {} + } + + @test + public fun testPicture() { + wrapper().picture {} + } + + @test + public fun testPre() { + wrapper().pre {} + } + + @test + public fun testProgress() { + wrapper().progress {} + } + + @test + public fun testQ() { + wrapper().q {} + } + + @test + public fun testRp() { + wrapper().rp {} + } + + @test + public fun testRt() { + wrapper().rt {} + } + + @test + public fun testRuby() { + wrapper().ruby {} + } + + @test + public fun testS() { + wrapper().s {} + } + + @test + public fun testSamp() { + wrapper().samp {} + } + + @test + public fun testScript() { + wrapper().script {} + } + + @test + public fun testSection() { + wrapper().section {} + } + + @test + public fun testSelect() { + wrapper().select {} + } + + @test + public fun testSmall() { + wrapper().small {} + } + + @test + public fun testSource() { + wrapper().source {} + } + + @test + public fun testSpan() { + wrapper().span {} + } + + @test + public fun testStrong() { + wrapper().strong {} + } + + @test + public fun testStyle() { + wrapper().style {} + } + + @test + public fun testSub() { + wrapper().sub {} + } + + @test + public fun testSummary() { + wrapper().summary {} + } + + @test + public fun testSup() { + wrapper().sup {} + } + + @test + public fun testSvg() { + wrapper().svg {} + } + + @test + public fun testTable() { + wrapper().table {} + } + + @test + public fun testTbody() { + wrapper().tbody {} + } + + @test + public fun testTd() { + wrapper().td {} + } + + @test + public fun testTextArea() { + wrapper().textArea {} + } + + @test + public fun testTfoot() { + wrapper().tfoot {} + } + + @test + public fun testTh() { + wrapper().th {} + } + + @test + public fun testThead() { + wrapper().thead {} + } + + @test + public fun testTime() { + wrapper().time {} + } + + @test + public fun testTitle() { + wrapper().title {} + } + + @test + public fun testTr() { + wrapper().tr {} + } + + @test + public fun testU() { + wrapper().u {} + } + + @test + public fun testUl() { + wrapper().ul {} + } + + @test + public fun testHtmlVar() { + wrapper().htmlVar {} + } + + @test + public fun testVideo() { + wrapper().video {} + } +} diff --git a/src/wasmJsMain/kotlin/EventJs.kt b/src/wasmJsMain/kotlin/EventJs.kt new file mode 100644 index 00000000..c815f064 --- /dev/null +++ b/src/wasmJsMain/kotlin/EventJs.kt @@ -0,0 +1,4 @@ +package kotlinx.html.org.w3c.dom.events // ktlint-disable filename + + +actual typealias Event = org.w3c.dom.events.Event diff --git a/src/wasmJsMain/kotlin/compatibility-js.kt b/src/wasmJsMain/kotlin/compatibility-js.kt new file mode 100644 index 00000000..a9a8ff3a --- /dev/null +++ b/src/wasmJsMain/kotlin/compatibility-js.kt @@ -0,0 +1,26 @@ +package kotlinx.html.js + +import kotlinx.html.LEGEND +import kotlinx.html.OBJECT +import kotlinx.html.TagConsumer +import kotlinx.html.VAR +import org.w3c.dom.Element +import org.w3c.dom.HTMLElement +import org.w3c.dom.HTMLLegendElement + +@Deprecated("Use legend instead", ReplaceWith("legend(classes, block)")) +inline fun TagConsumer.legEnd( + classes: String? = null, + crossinline block: LEGEND.() -> Unit = {}, +): HTMLLegendElement = legend(classes, block) + +@Deprecated("Use htmlObject instead", ReplaceWith("htmlObject(classes, block)", "kotlinx.html.js.htmlObject")) +inline fun TagConsumer.object_( + classes: String? = null, + crossinline block: OBJECT.() -> Unit = {}, +): Element = + htmlObject(classes, block) + +@Deprecated("Use htmlVar instead", ReplaceWith("htmlVar(classes, block)", "kotlinx.html.js.htmlVar")) +inline fun TagConsumer.var_(classes: String? = null, crossinline block: VAR.() -> Unit = {}): Element = + htmlVar(classes, block) diff --git a/src/wasmJsMain/kotlin/dom-js.kt b/src/wasmJsMain/kotlin/dom-js.kt new file mode 100644 index 00000000..0d2d73dc --- /dev/null +++ b/src/wasmJsMain/kotlin/dom-js.kt @@ -0,0 +1,170 @@ +package kotlinx.html.dom + +import kotlinx.html.DefaultUnsafe +import kotlinx.html.Entities +import kotlinx.html.Tag +import kotlinx.html.TagConsumer +import kotlinx.html.Unsafe +import kotlinx.html.consumers.onFinalize +import kotlinx.html.org.w3c.dom.events.Event +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.HTMLElement +import org.w3c.dom.Node +import org.w3c.dom.asList + +private inline fun Element.setEvent(name: String, noinline callback: (Event) -> Unit): Unit { + val eventName = name.removePrefix("on") + addEventListener(eventName, callback) +} + +class JSDOMBuilder(val document: Document) : TagConsumer { + private val path = arrayListOf() + private var lastLeaved: Element? = null + + override fun onTagStart(tag: Tag) { + val namespace = tag.namespace + val element: Element = + if (namespace != null) { + document.createElementNS(namespace, tag.tagName) + } else { + document.createElement(tag.tagName) + } + + tag.attributesEntries.forEach { + element.setAttribute(it.key, it.value) + } + + if (path.isNotEmpty()) { + path.last().appendChild(element) + } + + path.add(element) + } + + override fun onTagAttributeChange(tag: Tag, attribute: String, value: String?) { + when { + path.isEmpty() -> throw IllegalStateException("No current tag") + path.last().tagName.lowercase() != tag.tagName.lowercase() -> throw IllegalStateException("Wrong current tag") + else -> path.last().let { node -> + if (value == null) { + node.removeAttribute(attribute) + } else { + node.setAttribute(attribute, value) + } + } + } + } + + override fun onTagEvent(tag: Tag, event: String, value: (Event) -> Unit) { + when { + path.isEmpty() -> throw IllegalStateException("No current tag") + path.last().tagName.lowercase() != tag.tagName.lowercase() -> throw IllegalStateException("Wrong current tag") + else -> path.last().setEvent(event, value) + } + } + + override fun onTagEnd(tag: Tag) { + if (path.isEmpty() || path.last().tagName.lowercase() != tag.tagName.lowercase()) { + throw IllegalStateException("We haven't entered tag ${tag.tagName} but trying to leave") + } + + lastLeaved = path.removeAt(path.lastIndex) + } + + override fun onTagContent(content: CharSequence) { + if (path.isEmpty()) { + throw IllegalStateException("No current DOM node") + } + + path.last().appendChild(document.createTextNode(content.toString())) + } + + override fun onTagContentEntity(entity: Entities) { + if (path.isEmpty()) { + throw IllegalStateException("No current DOM node") + } + + // stupid hack as browsers doesn't support createEntityReference + val s = document.createElement("span") as HTMLElement + s.innerHTML = entity.text + path.last().appendChild(s.childNodes.asList().filter { it.nodeType == Node.TEXT_NODE }.first()) + + // other solution would be +// pathLast().innerHTML += entity.text + } + + override fun onTagContentUnsafe(block: Unsafe.() -> Unit) { + with(DefaultUnsafe()) { + block() + + path.last().innerHTML += toString() + } + } + + + override fun onTagComment(content: CharSequence) { + if (path.isEmpty()) { + throw IllegalStateException("No current DOM node") + } + + path.last().appendChild(document.createComment(content.toString())) + } + + override fun finalize(): R = + lastLeaved?.asR() ?: throw IllegalStateException("We can't finalize as there was no tags") + + private inline fun Element.asR(): R { + return jsCast(this) + } + +} + +fun jsCast(any: JsAny): T = js("(any)") + +fun Document.createTree(): TagConsumer = JSDOMBuilder(this) +val Document.create: TagConsumer + get() = JSDOMBuilder(this) + +fun Node.append(block: TagConsumer.() -> Unit): List = + ArrayList().let { result -> + ownerDocumentExt.createTree().onFinalize { it, partial -> + if (!partial) { + result.add(it); appendChild(it) + } + }.block() + + result + } + +fun Node.prepend(block: TagConsumer.() -> Unit): List = + ArrayList().let { result -> + ownerDocumentExt.createTree().onFinalize { it, partial -> + if (!partial) { + result.add(it) + insertBefore(it, firstChild) + } + }.block() + + result + } + +val Element.append: TagConsumer + get() = ownerDocumentExt.createTree().onFinalize { element, partial -> + if (!partial) { + this@append.appendChild(element) + } + } + +val Element.prepend: TagConsumer + get() = ownerDocumentExt.createTree().onFinalize { element, partial -> + if (!partial) { + this@prepend.insertBefore(element, this@prepend.firstChild) + } + } + +private val Node.ownerDocumentExt: Document + get() = when { + this is Document -> this + else -> ownerDocument ?: throw IllegalStateException("Node has no ownerDocument") + } diff --git a/src/wasmJsMain/kotlin/generated/gen-consumer-tags-wasm-js.kt b/src/wasmJsMain/kotlin/generated/gen-consumer-tags-wasm-js.kt new file mode 100644 index 00000000..62e6d856 --- /dev/null +++ b/src/wasmJsMain/kotlin/generated/gen-consumer-tags-wasm-js.kt @@ -0,0 +1,1259 @@ +/******************************************************************************* + DO NOT EDIT + This file was generated by module generate +*******************************************************************************/ +package kotlinx.html.js + +import kotlinx.html.* +import kotlinx.html.attributes.* + +import kotlin.Deprecated +import kotlin.String +import kotlin.Suppress +import kotlin.Unit +import kotlinx.html.A +import kotlinx.html.ABBR +import kotlinx.html.ADDRESS +import kotlinx.html.AREA +import kotlinx.html.ARTICLE +import kotlinx.html.ASIDE +import kotlinx.html.AUDIO +import kotlinx.html.AreaShape +import kotlinx.html.B +import kotlinx.html.BASE +import kotlinx.html.BDI +import kotlinx.html.BDO +import kotlinx.html.BLOCKQUOTE +import kotlinx.html.BODY +import kotlinx.html.BR +import kotlinx.html.BUTTON +import kotlinx.html.ButtonFormEncType +import kotlinx.html.ButtonFormMethod +import kotlinx.html.ButtonType +import kotlinx.html.CANVAS +import kotlinx.html.CAPTION +import kotlinx.html.CITE +import kotlinx.html.CODE +import kotlinx.html.COL +import kotlinx.html.COLGROUP +import kotlinx.html.COMMAND +import kotlinx.html.CommandType +import kotlinx.html.DATALIST +import kotlinx.html.DD +import kotlinx.html.DEL +import kotlinx.html.DETAILS +import kotlinx.html.DFN +import kotlinx.html.DIALOG +import kotlinx.html.DIV +import kotlinx.html.DL +import kotlinx.html.DT +import kotlinx.html.EM +import kotlinx.html.EMBED +import kotlinx.html.FIELDSET +import kotlinx.html.FIGCAPTION +import kotlinx.html.FIGURE +import kotlinx.html.FOOTER +import kotlinx.html.FORM +import kotlinx.html.FormEncType +import kotlinx.html.FormMethod +import kotlinx.html.H1 +import kotlinx.html.H2 +import kotlinx.html.H3 +import kotlinx.html.H4 +import kotlinx.html.H5 +import kotlinx.html.H6 +import kotlinx.html.HEAD +import kotlinx.html.HEADER +import kotlinx.html.HGROUP +import kotlinx.html.HR +import kotlinx.html.HTML +import kotlinx.html.HtmlTagMarker +import kotlinx.html.I +import kotlinx.html.IFRAME +import kotlinx.html.IMG +import kotlinx.html.INPUT +import kotlinx.html.INS +import kotlinx.html.IframeSandbox +import kotlinx.html.InputFormEncType +import kotlinx.html.InputFormMethod +import kotlinx.html.InputType +import kotlinx.html.KBD +import kotlinx.html.KEYGEN +import kotlinx.html.KeyGenKeyType +import kotlinx.html.LABEL +import kotlinx.html.LEGEND +import kotlinx.html.LI +import kotlinx.html.LINK +import kotlinx.html.MAIN +import kotlinx.html.MAP +import kotlinx.html.MARK +import kotlinx.html.MATH +import kotlinx.html.MATHML +import kotlinx.html.META +import kotlinx.html.METER +import kotlinx.html.NAV +import kotlinx.html.NOSCRIPT +import kotlinx.html.OBJECT +import kotlinx.html.OL +import kotlinx.html.OPTGROUP +import kotlinx.html.OPTION +import kotlinx.html.OUTPUT +import kotlinx.html.P +import kotlinx.html.PARAM +import kotlinx.html.PICTURE +import kotlinx.html.PRE +import kotlinx.html.PROGRESS +import kotlinx.html.Q +import kotlinx.html.RP +import kotlinx.html.RT +import kotlinx.html.RUBY +import kotlinx.html.S +import kotlinx.html.SAMP +import kotlinx.html.SCRIPT +import kotlinx.html.SECTION +import kotlinx.html.SELECT +import kotlinx.html.SMALL +import kotlinx.html.SOURCE +import kotlinx.html.SPAN +import kotlinx.html.STRONG +import kotlinx.html.STYLE +import kotlinx.html.SUB +import kotlinx.html.SUMMARY +import kotlinx.html.SUP +import kotlinx.html.SVG +import kotlinx.html.ScriptCrossorigin +import kotlinx.html.TABLE +import kotlinx.html.TBODY +import kotlinx.html.TD +import kotlinx.html.TEXTAREA +import kotlinx.html.TFOOT +import kotlinx.html.TH +import kotlinx.html.THEAD +import kotlinx.html.TIME +import kotlinx.html.TITLE +import kotlinx.html.TR +import kotlinx.html.TagConsumer +import kotlinx.html.TextAreaWrap +import kotlinx.html.ThScope +import kotlinx.html.U +import kotlinx.html.UL +import kotlinx.html.VAR +import kotlinx.html.VIDEO +import org.w3c.dom.Element +import org.w3c.dom.HTMLAnchorElement +import org.w3c.dom.HTMLAreaElement +import org.w3c.dom.HTMLAudioElement +import org.w3c.dom.HTMLBRElement +import org.w3c.dom.HTMLBaseElement +import org.w3c.dom.HTMLBodyElement +import org.w3c.dom.HTMLButtonElement +import org.w3c.dom.HTMLCanvasElement +import org.w3c.dom.HTMLDataListElement +import org.w3c.dom.HTMLDetailsElement +import org.w3c.dom.HTMLDialogElement +import org.w3c.dom.HTMLDivElement +import org.w3c.dom.HTMLEmbedElement +import org.w3c.dom.HTMLFieldSetElement +import org.w3c.dom.HTMLFormElement +import org.w3c.dom.HTMLHRElement +import org.w3c.dom.HTMLHeadElement +import org.w3c.dom.HTMLHeadingElement +import org.w3c.dom.HTMLHtmlElement +import org.w3c.dom.HTMLImageElement +import org.w3c.dom.HTMLInputElement +import org.w3c.dom.HTMLLIElement +import org.w3c.dom.HTMLLabelElement +import org.w3c.dom.HTMLLegendElement +import org.w3c.dom.HTMLLinkElement +import org.w3c.dom.HTMLMapElement +import org.w3c.dom.HTMLMetaElement +import org.w3c.dom.HTMLMeterElement +import org.w3c.dom.HTMLOptGroupElement +import org.w3c.dom.HTMLOptionElement +import org.w3c.dom.HTMLOutputElement +import org.w3c.dom.HTMLParagraphElement +import org.w3c.dom.HTMLParamElement +import org.w3c.dom.HTMLPictureElement +import org.w3c.dom.HTMLPreElement +import org.w3c.dom.HTMLProgressElement +import org.w3c.dom.HTMLScriptElement +import org.w3c.dom.HTMLSelectElement +import org.w3c.dom.HTMLSourceElement +import org.w3c.dom.HTMLSpanElement +import org.w3c.dom.HTMLStyleElement +import org.w3c.dom.HTMLTableCellElement +import org.w3c.dom.HTMLTableColElement +import org.w3c.dom.HTMLTableElement +import org.w3c.dom.HTMLTableRowElement +import org.w3c.dom.HTMLTableSectionElement +import org.w3c.dom.HTMLTextAreaElement +import org.w3c.dom.HTMLTimeElement +import org.w3c.dom.HTMLTitleElement +import org.w3c.dom.HTMLVideoElement + +/** + * Anchor + */ +@HtmlTagMarker +public inline fun TagConsumer.a( + href: String? = null, + target: String? = null, + classes: String? = null, + crossinline block: A.() -> Unit = {}, +): HTMLAnchorElement = A(attributesMapOf("href", href,"target", target,"class", classes), this) + .visitAndFinalize(this, block) as HTMLAnchorElement + +/** + * Abbreviated form (e.g., WWW, HTTP,etc.) + */ +@HtmlTagMarker +public inline fun TagConsumer.abbr(classes: String? = null, crossinline + block: ABBR.() -> Unit = {}): Element = ABBR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Information on author + */ +@HtmlTagMarker +public inline fun TagConsumer.address(classes: String? = null, crossinline + block: ADDRESS.() -> Unit = {}): Element = ADDRESS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Client-side image map area + */ +@HtmlTagMarker +public inline fun TagConsumer.area( + shape: AreaShape? = null, + alt: String? = null, + classes: String? = null, + crossinline block: AREA.() -> Unit = {}, +): HTMLAreaElement = AREA(attributesMapOf("Shape", shape?.enumEncode(),"alt", alt,"class", classes), + this) + .visitAndFinalize(this, block) as HTMLAreaElement + +/** + * Self-contained syndicatable or reusable composition + */ +@HtmlTagMarker +public inline fun TagConsumer.article(classes: String? = null, crossinline + block: ARTICLE.() -> Unit = {}): Element = ARTICLE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Sidebar for tangentially related content + */ +@HtmlTagMarker +public inline fun TagConsumer.aside(classes: String? = null, crossinline + block: ASIDE.() -> Unit = {}): Element = ASIDE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Audio player + */ +@HtmlTagMarker +public inline fun TagConsumer.audio(classes: String? = null, crossinline + block: AUDIO.() -> Unit = {}): HTMLAudioElement = AUDIO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLAudioElement + +/** + * Bold text style + */ +@HtmlTagMarker +public inline fun TagConsumer.b(classes: String? = null, crossinline block: B.() -> Unit = + {}): Element = B(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Document base URI + */ +@HtmlTagMarker +public inline fun TagConsumer.base(classes: String? = null, crossinline + block: BASE.() -> Unit = {}): HTMLBaseElement = BASE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLBaseElement + +/** + * Text directionality isolation + */ +@HtmlTagMarker +public inline fun TagConsumer.bdi(classes: String? = null, crossinline + block: BDI.() -> Unit = {}): Element = BDI(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * I18N BiDi over-ride + */ +@HtmlTagMarker +public inline fun TagConsumer.bdo(classes: String? = null, crossinline + block: BDO.() -> Unit = {}): Element = BDO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Long quotation + */ +@HtmlTagMarker +public inline fun TagConsumer.blockQuote(classes: String? = null, crossinline + block: BLOCKQUOTE.() -> Unit = {}): Element = BLOCKQUOTE(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) + +/** + * Document body + */ +@HtmlTagMarker +public inline fun TagConsumer.body(classes: String? = null, crossinline + block: BODY.() -> Unit = {}): HTMLBodyElement = BODY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLBodyElement + +/** + * Forced line break + */ +@HtmlTagMarker +public inline fun TagConsumer.br(classes: String? = null, crossinline block: BR.() -> Unit + = {}): HTMLBRElement = BR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLBRElement + +/** + * Push button + */ +@HtmlTagMarker +public inline fun TagConsumer.button( + formEncType: ButtonFormEncType? = null, + formMethod: ButtonFormMethod? = null, + name: String? = null, + type: ButtonType? = null, + classes: String? = null, + crossinline block: BUTTON.() -> Unit = {}, +): HTMLButtonElement = BUTTON(attributesMapOf("formenctype", formEncType?.enumEncode(),"formmethod", + formMethod?.enumEncode(),"name", name,"type", type?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) as HTMLButtonElement + +/** + * Scriptable bitmap canvas + */ +@HtmlTagMarker +public fun TagConsumer.canvas(classes: String? = null, content: String = ""): + HTMLCanvasElement = CANVAS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) as HTMLCanvasElement + +/** + * Scriptable bitmap canvas + */ +@HtmlTagMarker +public inline fun TagConsumer.canvas(classes: String? = null, crossinline + block: CANVAS.() -> Unit = {}): HTMLCanvasElement = CANVAS(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLCanvasElement + +/** + * Table caption + */ +@HtmlTagMarker +public inline fun TagConsumer.caption(classes: String? = null, crossinline + block: CAPTION.() -> Unit = {}): Element = CAPTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Citation + */ +@HtmlTagMarker +public inline fun TagConsumer.cite(classes: String? = null, crossinline + block: CITE.() -> Unit = {}): Element = CITE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Computer code fragment + */ +@HtmlTagMarker +public inline fun TagConsumer.code(classes: String? = null, crossinline + block: CODE.() -> Unit = {}): Element = CODE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Table column + */ +@HtmlTagMarker +public inline fun TagConsumer.col(classes: String? = null, crossinline + block: COL.() -> Unit = {}): HTMLTableColElement = COL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTableColElement + +/** + * Table column group + */ +@HtmlTagMarker +public inline fun TagConsumer.colGroup(classes: String? = null, crossinline + block: COLGROUP.() -> Unit = {}): HTMLTableColElement = COLGROUP(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLTableColElement + +@HtmlTagMarker +public inline fun TagConsumer.command( + type: CommandType? = null, + classes: String? = null, + crossinline block: COMMAND.() -> Unit = {}, +): Element = COMMAND(attributesMapOf("type", type?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) + +/** + * Container for options for + */ +@HtmlTagMarker +public inline fun TagConsumer.dataList(classes: String? = null, crossinline + block: DATALIST.() -> Unit = {}): HTMLDataListElement = DATALIST(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLDataListElement + +/** + * Definition description + */ +@HtmlTagMarker +public inline fun TagConsumer.dd(classes: String? = null, crossinline block: DD.() -> Unit + = {}): Element = DD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Deleted text + */ +@HtmlTagMarker +public inline fun TagConsumer.del(classes: String? = null, crossinline + block: DEL.() -> Unit = {}): Element = DEL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Disclosure control for hiding details + */ +@HtmlTagMarker +public inline fun TagConsumer.details(classes: String? = null, crossinline + block: DETAILS.() -> Unit = {}): HTMLDetailsElement = DETAILS(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLDetailsElement + +/** + * Instance definition + */ +@HtmlTagMarker +public inline fun TagConsumer.dfn(classes: String? = null, crossinline + block: DFN.() -> Unit = {}): Element = DFN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Dialog box or window + */ +@HtmlTagMarker +public inline fun TagConsumer.dialog(classes: String? = null, crossinline + block: DIALOG.() -> Unit = {}): HTMLDialogElement = DIALOG(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLDialogElement + +/** + * Generic language/style container + */ +@HtmlTagMarker +public inline fun TagConsumer.div(classes: String? = null, crossinline + block: DIV.() -> Unit = {}): HTMLDivElement = DIV(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLDivElement + +/** + * Definition list + */ +@HtmlTagMarker +public inline fun TagConsumer.dl(classes: String? = null, crossinline block: DL.() -> Unit + = {}): Element = DL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Definition term + */ +@HtmlTagMarker +public inline fun TagConsumer.dt(classes: String? = null, crossinline block: DT.() -> Unit + = {}): Element = DT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Emphasis + */ +@HtmlTagMarker +public inline fun TagConsumer.em(classes: String? = null, crossinline block: EM.() -> Unit + = {}): Element = EM(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Plugin + */ +@HtmlTagMarker +public inline fun TagConsumer.embed(classes: String? = null, crossinline + block: EMBED.() -> Unit = {}): HTMLEmbedElement = EMBED(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLEmbedElement + +/** + * Form control group + */ +@HtmlTagMarker +public inline fun TagConsumer.fieldSet(classes: String? = null, crossinline + block: FIELDSET.() -> Unit = {}): HTMLFieldSetElement = FIELDSET(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLFieldSetElement + +/** + * Caption for + */ +@HtmlTagMarker +public inline fun TagConsumer.figcaption(classes: String? = null, crossinline + block: FIGCAPTION.() -> Unit = {}): Element = FIGCAPTION(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) + +/** + * Figure with optional caption + */ +@HtmlTagMarker +public inline fun TagConsumer.figure(classes: String? = null, crossinline + block: FIGURE.() -> Unit = {}): Element = FIGURE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Footer for a page or section + */ +@HtmlTagMarker +public inline fun TagConsumer.footer(classes: String? = null, crossinline + block: FOOTER.() -> Unit = {}): Element = FOOTER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Interactive form + */ +@HtmlTagMarker +public inline fun TagConsumer.form( + action: String? = null, + encType: FormEncType? = null, + method: FormMethod? = null, + classes: String? = null, + crossinline block: FORM.() -> Unit = {}, +): HTMLFormElement = FORM(attributesMapOf("action", action,"enctype", + encType?.enumEncode(),"method", method?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) as HTMLFormElement + +/** + * Heading + */ +@HtmlTagMarker +public inline fun TagConsumer.h1(classes: String? = null, crossinline block: H1.() -> Unit + = {}): HTMLHeadingElement = H1(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement + +/** + * Heading + */ +@HtmlTagMarker +public inline fun TagConsumer.h2(classes: String? = null, crossinline block: H2.() -> Unit + = {}): HTMLHeadingElement = H2(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement + +/** + * Heading + */ +@HtmlTagMarker +public inline fun TagConsumer.h3(classes: String? = null, crossinline block: H3.() -> Unit + = {}): HTMLHeadingElement = H3(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement + +/** + * Heading + */ +@HtmlTagMarker +public inline fun TagConsumer.h4(classes: String? = null, crossinline block: H4.() -> Unit + = {}): HTMLHeadingElement = H4(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement + +/** + * Heading + */ +@HtmlTagMarker +public inline fun TagConsumer.h5(classes: String? = null, crossinline block: H5.() -> Unit + = {}): HTMLHeadingElement = H5(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement + +/** + * Heading + */ +@HtmlTagMarker +public inline fun TagConsumer.h6(classes: String? = null, crossinline block: H6.() -> Unit + = {}): HTMLHeadingElement = H6(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHeadingElement + +/** + * Document head + */ +@HtmlTagMarker +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun TagConsumer.head(content: String = ""): HTMLHeadElement = HEAD(emptyMap, this) + .visitAndFinalize(this, {+content}) as HTMLHeadElement + +/** + * Document head + */ +@HtmlTagMarker +public inline fun TagConsumer.head(crossinline block: HEAD.() -> Unit = {}): + HTMLHeadElement = HEAD(emptyMap, this) + .visitAndFinalize(this, block) as HTMLHeadElement + +/** + * Introductory or navigational aids for a page or section + */ +@HtmlTagMarker +public inline fun TagConsumer.`header`(classes: String? = null, crossinline + block: HEADER.() -> Unit = {}): Element = HEADER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +@HtmlTagMarker +public inline fun TagConsumer.hGroup(classes: String? = null, crossinline + block: HGROUP.() -> Unit = {}): Element = HGROUP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Horizontal rule + */ +@HtmlTagMarker +public inline fun TagConsumer.hr(classes: String? = null, crossinline block: HR.() -> Unit + = {}): HTMLHRElement = HR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLHRElement + +/** + * Document root element + */ +@HtmlTagMarker +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun TagConsumer.html(content: String = "", namespace: String? = null): + HTMLHtmlElement = HTML(emptyMap, this, namespace) + .visitAndFinalize(this, {+content}) as HTMLHtmlElement + +/** + * Document root element + */ +@HtmlTagMarker +public inline fun TagConsumer.html(namespace: String? = null, crossinline + block: HTML.() -> Unit = {}): HTMLHtmlElement = HTML(emptyMap, this, namespace) + .visitAndFinalize(this, block) as HTMLHtmlElement + +/** + * Italic text style + */ +@HtmlTagMarker +public inline fun TagConsumer.i(classes: String? = null, crossinline block: I.() -> Unit = + {}): Element = I(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Inline subwindow + */ +@HtmlTagMarker +public fun TagConsumer.iframe( + sandbox: IframeSandbox? = null, + classes: String? = null, + content: String = "", +): Element = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, {+content}) + +/** + * Inline subwindow + */ +@HtmlTagMarker +public inline fun TagConsumer.iframe( + sandbox: IframeSandbox? = null, + classes: String? = null, + crossinline block: IFRAME.() -> Unit = {}, +): Element = IFRAME(attributesMapOf("sandbox", sandbox?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) + +/** + * Embedded image + */ +@HtmlTagMarker +public inline fun TagConsumer.img( + alt: String? = null, + src: String? = null, + classes: String? = null, + crossinline block: IMG.() -> Unit = {}, +): HTMLImageElement = IMG(attributesMapOf("alt", alt,"src", src,"class", classes), this) + .visitAndFinalize(this, block) as HTMLImageElement + +/** + * Form control + */ +@HtmlTagMarker +public inline fun TagConsumer.input( + type: InputType? = null, + formEncType: InputFormEncType? = null, + formMethod: InputFormMethod? = null, + name: String? = null, + classes: String? = null, + crossinline block: INPUT.() -> Unit = {}, +): HTMLInputElement = INPUT(attributesMapOf("type", type?.enumEncode(),"formenctype", + formEncType?.enumEncode(),"formmethod", formMethod?.enumEncode(),"name", name,"class", classes), + this) + .visitAndFinalize(this, block) as HTMLInputElement + +/** + * Inserted text + */ +@HtmlTagMarker +public inline fun TagConsumer.ins(classes: String? = null, crossinline + block: INS.() -> Unit = {}): Element = INS(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Text to be entered by the user + */ +@HtmlTagMarker +public inline fun TagConsumer.kbd(classes: String? = null, crossinline + block: KBD.() -> Unit = {}): Element = KBD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Cryptographic key-pair generator form control + */ +@HtmlTagMarker +public inline fun TagConsumer.keyGen( + keyType: KeyGenKeyType? = null, + classes: String? = null, + crossinline block: KEYGEN.() -> Unit = {}, +): Element = KEYGEN(attributesMapOf("keytype", keyType?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) + +/** + * Form field label text + */ +@HtmlTagMarker +public inline fun TagConsumer.label(classes: String? = null, crossinline + block: LABEL.() -> Unit = {}): HTMLLabelElement = LABEL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLLabelElement + +/** + * Fieldset legend + */ +@HtmlTagMarker +public inline fun TagConsumer.legend(classes: String? = null, crossinline + block: LEGEND.() -> Unit = {}): HTMLLegendElement = LEGEND(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLLegendElement + +/** + * List item + */ +@HtmlTagMarker +public inline fun TagConsumer.li(classes: String? = null, crossinline block: LI.() -> Unit + = {}): HTMLLIElement = LI(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLLIElement + +/** + * A media-independent link + */ +@HtmlTagMarker +public inline fun TagConsumer.link( + href: String? = null, + rel: String? = null, + type: String? = null, + crossinline block: LINK.() -> Unit = {}, +): HTMLLinkElement = LINK(attributesMapOf("href", href,"rel", rel,"type", type), this) + .visitAndFinalize(this, block) as HTMLLinkElement + +/** + * Container for the dominant contents of another element + */ +@HtmlTagMarker +public inline fun TagConsumer.main(classes: String? = null, crossinline + block: MAIN.() -> Unit = {}): Element = MAIN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Client-side image map + */ +@HtmlTagMarker +public inline fun TagConsumer.map( + name: String? = null, + classes: String? = null, + crossinline block: MAP.() -> Unit = {}, +): HTMLMapElement = MAP(attributesMapOf("name", name,"class", classes), this) + .visitAndFinalize(this, block) as HTMLMapElement + +/** + * Highlight + */ +@HtmlTagMarker +public inline fun TagConsumer.mark(classes: String? = null, crossinline + block: MARK.() -> Unit = {}): Element = MARK(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +@HtmlTagMarker +public inline fun TagConsumer.math(classes: String? = null, crossinline + block: MATH.() -> Unit = {}): Element = MATH(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +@HtmlTagMarker +public fun TagConsumer.mathml(classes: String? = null, content: String = ""): Element = + MATHML(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) + +@HtmlTagMarker +public inline fun TagConsumer.mathml(classes: String? = null, crossinline + block: MATHML.() -> Unit = {}): Element = MATHML(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Generic metainformation + */ +@HtmlTagMarker +public inline fun TagConsumer.meta( + name: String? = null, + content: String? = null, + charset: String? = null, + crossinline block: META.() -> Unit = {}, +): HTMLMetaElement = META(attributesMapOf("name", name,"content", content,"charset", charset), this) + .visitAndFinalize(this, block) as HTMLMetaElement + +/** + * Gauge + */ +@HtmlTagMarker +public inline fun TagConsumer.meter(classes: String? = null, crossinline + block: METER.() -> Unit = {}): HTMLMeterElement = METER(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLMeterElement + +/** + * Section with navigational links + */ +@HtmlTagMarker +public inline fun TagConsumer.nav(classes: String? = null, crossinline + block: NAV.() -> Unit = {}): Element = NAV(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Generic metainformation + */ +@HtmlTagMarker +public inline fun TagConsumer.noScript(classes: String? = null, crossinline + block: NOSCRIPT.() -> Unit = {}): Element = NOSCRIPT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Generic embedded object + */ +@HtmlTagMarker +public inline fun TagConsumer.htmlObject(classes: String? = null, crossinline + block: OBJECT.() -> Unit = {}): Element = OBJECT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Ordered list + */ +@HtmlTagMarker +public inline fun TagConsumer.ol(classes: String? = null, crossinline block: OL.() -> Unit + = {}): Element = OL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Option group + */ +@HtmlTagMarker +public inline fun TagConsumer.optGroup( + label: String? = null, + classes: String? = null, + crossinline block: OPTGROUP.() -> Unit = {}, +): HTMLOptGroupElement = OPTGROUP(attributesMapOf("label", label,"class", classes), this) + .visitAndFinalize(this, block) as HTMLOptGroupElement + +/** + * Selectable choice + */ +@HtmlTagMarker +public fun TagConsumer.option(classes: String? = null, content: String = ""): + HTMLOptionElement = OPTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) as HTMLOptionElement + +/** + * Selectable choice + */ +@HtmlTagMarker +public inline fun TagConsumer.option(classes: String? = null, crossinline + block: OPTION.() -> Unit = {}): HTMLOptionElement = OPTION(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLOptionElement + +/** + * Calculated output value + */ +@HtmlTagMarker +public inline fun TagConsumer.output(classes: String? = null, crossinline + block: OUTPUT.() -> Unit = {}): HTMLOutputElement = OUTPUT(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLOutputElement + +/** + * Paragraph + */ +@HtmlTagMarker +public inline fun TagConsumer.p(classes: String? = null, crossinline block: P.() -> Unit = + {}): HTMLParagraphElement = P(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLParagraphElement + +/** + * Named property value + */ +@HtmlTagMarker +public inline fun TagConsumer.`param`( + name: String? = null, + `value`: String? = null, + crossinline block: PARAM.() -> Unit = {}, +): HTMLParamElement = PARAM(attributesMapOf("name", name,"value", value), this) + .visitAndFinalize(this, block) as HTMLParamElement + +/** + * Pictures container + */ +@HtmlTagMarker +public inline fun TagConsumer.picture(crossinline block: PICTURE.() -> Unit = {}): + HTMLPictureElement = PICTURE(emptyMap, this) + .visitAndFinalize(this, block) as HTMLPictureElement + +/** + * Preformatted text + */ +@HtmlTagMarker +public inline fun TagConsumer.pre(classes: String? = null, crossinline + block: PRE.() -> Unit = {}): HTMLPreElement = PRE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLPreElement + +/** + * Progress bar + */ +@HtmlTagMarker +public inline fun TagConsumer.progress(classes: String? = null, crossinline + block: PROGRESS.() -> Unit = {}): HTMLProgressElement = PROGRESS(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLProgressElement + +/** + * Short inline quotation + */ +@HtmlTagMarker +public inline fun TagConsumer.q(classes: String? = null, crossinline block: Q.() -> Unit = + {}): Element = Q(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Parenthesis for ruby annotation text + */ +@HtmlTagMarker +public inline fun TagConsumer.rp(classes: String? = null, crossinline block: RP.() -> Unit + = {}): Element = RP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Ruby annotation text + */ +@HtmlTagMarker +public inline fun TagConsumer.rt(classes: String? = null, crossinline block: RT.() -> Unit + = {}): Element = RT(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Ruby annotation(s) + */ +@HtmlTagMarker +public inline fun TagConsumer.ruby(classes: String? = null, crossinline + block: RUBY.() -> Unit = {}): Element = RUBY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Strike-through text style + */ +@HtmlTagMarker +public inline fun TagConsumer.s(classes: String? = null, crossinline block: S.() -> Unit = + {}): Element = S(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Computer output text style + */ +@HtmlTagMarker +public inline fun TagConsumer.samp(classes: String? = null, crossinline + block: SAMP.() -> Unit = {}): Element = SAMP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Script statements + */ +@HtmlTagMarker +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun TagConsumer.script( + type: String? = null, + src: String? = null, + crossorigin: ScriptCrossorigin? = null, + content: String = "", +): HTMLScriptElement = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", + crossorigin?.enumEncode()), this) + .visitAndFinalize(this, {+content}) as HTMLScriptElement + +/** + * Script statements + */ +@HtmlTagMarker +public inline fun TagConsumer.script( + type: String? = null, + src: String? = null, + crossorigin: ScriptCrossorigin? = null, + crossinline block: SCRIPT.() -> Unit = {}, +): HTMLScriptElement = SCRIPT(attributesMapOf("type", type,"src", src,"crossorigin", + crossorigin?.enumEncode()), this) + .visitAndFinalize(this, block) as HTMLScriptElement + +/** + * Generic document or application section + */ +@HtmlTagMarker +public inline fun TagConsumer.section(classes: String? = null, crossinline + block: SECTION.() -> Unit = {}): Element = SECTION(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Option selector + */ +@HtmlTagMarker +public inline fun TagConsumer.select(classes: String? = null, crossinline + block: SELECT.() -> Unit = {}): HTMLSelectElement = SELECT(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLSelectElement + +/** + * Small text style + */ +@HtmlTagMarker +public inline fun TagConsumer.small(classes: String? = null, crossinline + block: SMALL.() -> Unit = {}): Element = SMALL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Media source for + */ +@HtmlTagMarker +public inline fun TagConsumer.source(classes: String? = null, crossinline + block: SOURCE.() -> Unit = {}): HTMLSourceElement = SOURCE(attributesMapOf("class", classes), + this) + .visitAndFinalize(this, block) as HTMLSourceElement + +/** + * Generic language/style container + */ +@HtmlTagMarker +public inline fun TagConsumer.span(classes: String? = null, crossinline + block: SPAN.() -> Unit = {}): HTMLSpanElement = SPAN(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLSpanElement + +/** + * Strong emphasis + */ +@HtmlTagMarker +public inline fun TagConsumer.strong(classes: String? = null, crossinline + block: STRONG.() -> Unit = {}): Element = STRONG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Style info + */ +@HtmlTagMarker +@Suppress("DEPRECATION") +@Deprecated("This tag doesn't support content or requires unsafe (try unsafe {})") +public fun TagConsumer.style(type: String? = null, content: String = ""): HTMLStyleElement + = STYLE(attributesMapOf("type", type), this) + .visitAndFinalize(this, {+content}) as HTMLStyleElement + +/** + * Style info + */ +@HtmlTagMarker +public inline fun TagConsumer.style(type: String? = null, crossinline + block: STYLE.() -> Unit = {}): HTMLStyleElement = STYLE(attributesMapOf("type", type), this) + .visitAndFinalize(this, block) as HTMLStyleElement + +/** + * Subscript + */ +@HtmlTagMarker +public inline fun TagConsumer.sub(classes: String? = null, crossinline + block: SUB.() -> Unit = {}): Element = SUB(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Caption for + */ +@HtmlTagMarker +public inline fun TagConsumer.summary(classes: String? = null, crossinline + block: SUMMARY.() -> Unit = {}): Element = SUMMARY(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Superscript + */ +@HtmlTagMarker +public inline fun TagConsumer.sup(classes: String? = null, crossinline + block: SUP.() -> Unit = {}): Element = SUP(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +@HtmlTagMarker +public fun TagConsumer.svg(classes: String? = null, content: String = ""): Element = + SVG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, {+content}) + +@HtmlTagMarker +public inline fun TagConsumer.svg(classes: String? = null, crossinline + block: SVG.() -> Unit = {}): Element = SVG(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * + */ +@HtmlTagMarker +public inline fun TagConsumer.table(classes: String? = null, crossinline + block: TABLE.() -> Unit = {}): HTMLTableElement = TABLE(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTableElement + +/** + * Table body + */ +@HtmlTagMarker +public inline fun TagConsumer.tbody(classes: String? = null, crossinline + block: TBODY.() -> Unit = {}): HTMLTableSectionElement = TBODY(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLTableSectionElement + +/** + * Table data cell + */ +@HtmlTagMarker +public inline fun TagConsumer.td(classes: String? = null, crossinline block: TD.() -> Unit + = {}): HTMLTableCellElement = TD(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTableCellElement + +/** + * Multi-line text field + */ +@HtmlTagMarker +public fun TagConsumer.textArea( + rows: String? = null, + cols: String? = null, + wrap: TextAreaWrap? = null, + classes: String? = null, + content: String = "", +): HTMLTextAreaElement = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", + wrap?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, {+content}) as HTMLTextAreaElement + +/** + * Multi-line text field + */ +@HtmlTagMarker +public inline fun TagConsumer.textArea( + rows: String? = null, + cols: String? = null, + wrap: TextAreaWrap? = null, + classes: String? = null, + crossinline block: TEXTAREA.() -> Unit = {}, +): HTMLTextAreaElement = TEXTAREA(attributesMapOf("rows", rows,"cols", cols,"wrap", + wrap?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) as HTMLTextAreaElement + +/** + * Table footer + */ +@HtmlTagMarker +public inline fun TagConsumer.tfoot(classes: String? = null, crossinline + block: TFOOT.() -> Unit = {}): HTMLTableSectionElement = TFOOT(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLTableSectionElement + +/** + * Table header cell + */ +@HtmlTagMarker +public inline fun TagConsumer.th( + scope: ThScope? = null, + classes: String? = null, + crossinline block: TH.() -> Unit = {}, +): HTMLTableCellElement = TH(attributesMapOf("scope", scope?.enumEncode(),"class", classes), this) + .visitAndFinalize(this, block) as HTMLTableCellElement + +/** + * Table header + */ +@HtmlTagMarker +public inline fun TagConsumer.thead(classes: String? = null, crossinline + block: THEAD.() -> Unit = {}): HTMLTableSectionElement = THEAD(attributesMapOf("class", + classes), this) + .visitAndFinalize(this, block) as HTMLTableSectionElement + +/** + * Machine-readable equivalent of date- or time-related data + */ +@HtmlTagMarker +public inline fun TagConsumer.time(classes: String? = null, crossinline + block: TIME.() -> Unit = {}): HTMLTimeElement = TIME(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTimeElement + +/** + * Document title + */ +@HtmlTagMarker +public fun TagConsumer.title(content: String = ""): HTMLTitleElement = TITLE(emptyMap, + this) + .visitAndFinalize(this, {+content}) as HTMLTitleElement + +/** + * Document title + */ +@HtmlTagMarker +public inline fun TagConsumer.title(crossinline block: TITLE.() -> Unit = {}): + HTMLTitleElement = TITLE(emptyMap, this) + .visitAndFinalize(this, block) as HTMLTitleElement + +/** + * Table row + */ +@HtmlTagMarker +public inline fun TagConsumer.tr(classes: String? = null, crossinline block: TR.() -> Unit + = {}): HTMLTableRowElement = TR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLTableRowElement + +/** + * Underlined text style + */ +@HtmlTagMarker +public inline fun TagConsumer.u(classes: String? = null, crossinline block: U.() -> Unit = + {}): Element = U(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Unordered list + */ +@HtmlTagMarker +public inline fun TagConsumer.ul(classes: String? = null, crossinline block: UL.() -> Unit + = {}): Element = UL(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Unordered list + */ +@HtmlTagMarker +public inline fun TagConsumer.htmlVar(classes: String? = null, crossinline + block: VAR.() -> Unit = {}): Element = VAR(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) + +/** + * Video player + */ +@HtmlTagMarker +public inline fun TagConsumer.video(classes: String? = null, crossinline + block: VIDEO.() -> Unit = {}): HTMLVideoElement = VIDEO(attributesMapOf("class", classes), this) + .visitAndFinalize(this, block) as HTMLVideoElement diff --git a/src/wasmJsMain/kotlin/generated/gen-event-attrs-wasm-js.kt b/src/wasmJsMain/kotlin/generated/gen-event-attrs-wasm-js.kt new file mode 100644 index 00000000..a565f901 --- /dev/null +++ b/src/wasmJsMain/kotlin/generated/gen-event-attrs-wasm-js.kt @@ -0,0 +1,381 @@ +package kotlinx.html.js + +/******************************************************************************* + DO NOT EDIT + This file was generated by module generate +*******************************************************************************/ +import kotlin.Unit +import kotlinx.html.CommonAttributeGroupFacade +import kotlinx.html.org.w3c.dom.events.Event + +public var CommonAttributeGroupFacade.onAbortFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onAbort") + set(newValue) { + consumer.onTagEvent(this, "onabort", newValue) + } + +public var CommonAttributeGroupFacade.onBlurFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onBlur") + set(newValue) { + consumer.onTagEvent(this, "onblur", newValue) + } + +public var CommonAttributeGroupFacade.onCanPlayFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onCanPlay") + set(newValue) { + consumer.onTagEvent(this, "oncanplay", newValue) + } + +public var CommonAttributeGroupFacade.onCanPlayThroughFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onCanPlayThrough") + set(newValue) { + consumer.onTagEvent(this, "oncanplaythrough", newValue) + } + +public var CommonAttributeGroupFacade.onChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onChange") + set(newValue) { + consumer.onTagEvent(this, "onchange", newValue) + } + +public var CommonAttributeGroupFacade.onClickFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onClick") + set(newValue) { + consumer.onTagEvent(this, "onclick", newValue) + } + +public var CommonAttributeGroupFacade.onContextMenuFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onContextMenu") + set(newValue) { + consumer.onTagEvent(this, "oncontextmenu", newValue) + } + +public var CommonAttributeGroupFacade.onDoubleClickFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDoubleClick") + set(newValue) { + consumer.onTagEvent(this, "ondblclick", newValue) + } + +public var CommonAttributeGroupFacade.onDragFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDrag") + set(newValue) { + consumer.onTagEvent(this, "ondrag", newValue) + } + +public var CommonAttributeGroupFacade.onDragEndFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragEnd") + set(newValue) { + consumer.onTagEvent(this, "ondragend", newValue) + } + +public var CommonAttributeGroupFacade.onDragEnterFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragEnter") + set(newValue) { + consumer.onTagEvent(this, "ondragenter", newValue) + } + +public var CommonAttributeGroupFacade.onDragLeaveFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragLeave") + set(newValue) { + consumer.onTagEvent(this, "ondragleave", newValue) + } + +public var CommonAttributeGroupFacade.onDragOverFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragOver") + set(newValue) { + consumer.onTagEvent(this, "ondragover", newValue) + } + +public var CommonAttributeGroupFacade.onDragStartFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDragStart") + set(newValue) { + consumer.onTagEvent(this, "ondragstart", newValue) + } + +public var CommonAttributeGroupFacade.onDropFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDrop") + set(newValue) { + consumer.onTagEvent(this, "ondrop", newValue) + } + +public var CommonAttributeGroupFacade.onDurationChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onDurationChange") + set(newValue) { + consumer.onTagEvent(this, "ondurationchange", newValue) + } + +public var CommonAttributeGroupFacade.onEmptiedFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onEmptied") + set(newValue) { + consumer.onTagEvent(this, "onemptied", newValue) + } + +public var CommonAttributeGroupFacade.onEndedFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onEnded") + set(newValue) { + consumer.onTagEvent(this, "onended", newValue) + } + +public var CommonAttributeGroupFacade.onErrorFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onError") + set(newValue) { + consumer.onTagEvent(this, "onerror", newValue) + } + +public var CommonAttributeGroupFacade.onFocusFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFocus") + set(newValue) { + consumer.onTagEvent(this, "onfocus", newValue) + } + +public var CommonAttributeGroupFacade.onFocusInFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFocusIn") + set(newValue) { + consumer.onTagEvent(this, "onfocusin", newValue) + } + +public var CommonAttributeGroupFacade.onFocusOutFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFocusOut") + set(newValue) { + consumer.onTagEvent(this, "onfocusout", newValue) + } + +public var CommonAttributeGroupFacade.onFormChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFormChange") + set(newValue) { + consumer.onTagEvent(this, "onformchange", newValue) + } + +public var CommonAttributeGroupFacade.onFormInputFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onFormInput") + set(newValue) { + consumer.onTagEvent(this, "onforminput", newValue) + } + +public var CommonAttributeGroupFacade.onInputFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onInput") + set(newValue) { + consumer.onTagEvent(this, "oninput", newValue) + } + +public var CommonAttributeGroupFacade.onInvalidFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onInvalid") + set(newValue) { + consumer.onTagEvent(this, "oninvalid", newValue) + } + +public var CommonAttributeGroupFacade.onKeyDownFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onKeyDown") + set(newValue) { + consumer.onTagEvent(this, "onkeydown", newValue) + } + +public var CommonAttributeGroupFacade.onKeyPressFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onKeyPress") + set(newValue) { + consumer.onTagEvent(this, "onkeypress", newValue) + } + +public var CommonAttributeGroupFacade.onKeyUpFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onKeyUp") + set(newValue) { + consumer.onTagEvent(this, "onkeyup", newValue) + } + +public var CommonAttributeGroupFacade.onLoadFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onLoad") + set(newValue) { + consumer.onTagEvent(this, "onload", newValue) + } + +public var CommonAttributeGroupFacade.onLoadedDataFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onLoadedData") + set(newValue) { + consumer.onTagEvent(this, "onloadeddata", newValue) + } + +public var CommonAttributeGroupFacade.onLoadedMetaDataFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onLoadedMetaData") + set(newValue) { + consumer.onTagEvent(this, "onloadedmetadata", newValue) + } + +public var CommonAttributeGroupFacade.onLoadStartFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onLoadStart") + set(newValue) { + consumer.onTagEvent(this, "onloadstart", newValue) + } + +public var CommonAttributeGroupFacade.onMouseDownFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseDown") + set(newValue) { + consumer.onTagEvent(this, "onmousedown", newValue) + } + +public var CommonAttributeGroupFacade.onMouseMoveFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseMove") + set(newValue) { + consumer.onTagEvent(this, "onmousemove", newValue) + } + +public var CommonAttributeGroupFacade.onMouseOutFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseOut") + set(newValue) { + consumer.onTagEvent(this, "onmouseout", newValue) + } + +public var CommonAttributeGroupFacade.onMouseOverFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseOver") + set(newValue) { + consumer.onTagEvent(this, "onmouseover", newValue) + } + +public var CommonAttributeGroupFacade.onMouseUpFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseUp") + set(newValue) { + consumer.onTagEvent(this, "onmouseup", newValue) + } + +public var CommonAttributeGroupFacade.onMouseWheelFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onMouseWheel") + set(newValue) { + consumer.onTagEvent(this, "onmousewheel", newValue) + } + +public var CommonAttributeGroupFacade.onPauseFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onPause") + set(newValue) { + consumer.onTagEvent(this, "onpause", newValue) + } + +public var CommonAttributeGroupFacade.onPlayFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onPlay") + set(newValue) { + consumer.onTagEvent(this, "onplay", newValue) + } + +public var CommonAttributeGroupFacade.onPlayingFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onPlaying") + set(newValue) { + consumer.onTagEvent(this, "onplaying", newValue) + } + +public var CommonAttributeGroupFacade.onProgressFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onProgress") + set(newValue) { + consumer.onTagEvent(this, "onprogress", newValue) + } + +public var CommonAttributeGroupFacade.onRateChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onRateChange") + set(newValue) { + consumer.onTagEvent(this, "onratechange", newValue) + } + +public var CommonAttributeGroupFacade.onReadyStateChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onReadyStateChange") + set(newValue) { + consumer.onTagEvent(this, "onreadystatechange", newValue) + } + +public var CommonAttributeGroupFacade.onScrollFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onScroll") + set(newValue) { + consumer.onTagEvent(this, "onscroll", newValue) + } + +public var CommonAttributeGroupFacade.onSearchFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSearch") + set(newValue) { + consumer.onTagEvent(this, "onsearch", newValue) + } + +public var CommonAttributeGroupFacade.onSeekedFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSeeked") + set(newValue) { + consumer.onTagEvent(this, "onseeked", newValue) + } + +public var CommonAttributeGroupFacade.onSeekingFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSeeking") + set(newValue) { + consumer.onTagEvent(this, "onseeking", newValue) + } + +public var CommonAttributeGroupFacade.onSelectFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSelect") + set(newValue) { + consumer.onTagEvent(this, "onselect", newValue) + } + +public var CommonAttributeGroupFacade.onShowFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onShow") + set(newValue) { + consumer.onTagEvent(this, "onshow", newValue) + } + +public var CommonAttributeGroupFacade.onStalledFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onStalled") + set(newValue) { + consumer.onTagEvent(this, "onstalled", newValue) + } + +public var CommonAttributeGroupFacade.onSubmitFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSubmit") + set(newValue) { + consumer.onTagEvent(this, "onsubmit", newValue) + } + +public var CommonAttributeGroupFacade.onSuspendFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onSuspend") + set(newValue) { + consumer.onTagEvent(this, "onsuspend", newValue) + } + +public var CommonAttributeGroupFacade.onTimeUpdateFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTimeUpdate") + set(newValue) { + consumer.onTagEvent(this, "ontimeupdate", newValue) + } + +public var CommonAttributeGroupFacade.onTouchCancelFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTouchCancel") + set(newValue) { + consumer.onTagEvent(this, "ontouchcancel", newValue) + } + +public var CommonAttributeGroupFacade.onTouchEndFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTouchEnd") + set(newValue) { + consumer.onTagEvent(this, "ontouchend", newValue) + } + +public var CommonAttributeGroupFacade.onTouchMoveFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTouchMove") + set(newValue) { + consumer.onTagEvent(this, "ontouchmove", newValue) + } + +public var CommonAttributeGroupFacade.onTouchStartFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onTouchStart") + set(newValue) { + consumer.onTagEvent(this, "ontouchstart", newValue) + } + +public var CommonAttributeGroupFacade.onVolumeChangeFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onVolumeChange") + set(newValue) { + consumer.onTagEvent(this, "onvolumechange", newValue) + } + +public var CommonAttributeGroupFacade.onWaitingFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onWaiting") + set(newValue) { + consumer.onTagEvent(this, "onwaiting", newValue) + } + +public var CommonAttributeGroupFacade.onWheelFunction: (Event) -> Unit + get() = throw UnsupportedOperationException("You can't read variable onWheel") + set(newValue) { + consumer.onTagEvent(this, "onwheel", newValue) + } diff --git a/src/wasmJsMain/kotlin/injector.kt b/src/wasmJsMain/kotlin/injector.kt new file mode 100644 index 00000000..0bc3fcf5 --- /dev/null +++ b/src/wasmJsMain/kotlin/injector.kt @@ -0,0 +1,93 @@ +package kotlinx.html.injector + +import kotlinx.html.Tag +import kotlinx.html.TagConsumer +import kotlinx.html.dom.append +import org.w3c.dom.Element +import org.w3c.dom.asList +import kotlin.reflect.KMutableProperty1 + +fun F.injectTo(bean: T, field: KMutableProperty1) { + field.set(bean, this) +} + +@Suppress("UnsafeCastFromDynamic") +private fun F.injectToUnsafe(bean: T, field: KMutableProperty1) { + injectTo(bean, field as KMutableProperty1) +} + +interface InjectCapture +class InjectByClassName(val className: String) : InjectCapture +class InjectByTagName(val tagName: String) : InjectCapture +object InjectRoot : InjectCapture +interface CustomCapture : InjectCapture { + fun apply(element: Element): Boolean +} + +class InjectorConsumer( + val downstream: TagConsumer, + val bean: T, + rules: List>>, +) : TagConsumer by downstream { + + private val classesMap: Map>> = rules + .filter { it.first is InjectByClassName } + .map { it.first as InjectByClassName to it.second } + .groupBy({ it.first.className }, { it.second }) + + private val tagNamesMap = rules + .filter { it.first is InjectByTagName } + .map { it.first as InjectByTagName to it.second } + .groupBy({ it.first.tagName.lowercase() }, { it.second }) + + private val rootCaptures = rules.filter { it.first == InjectRoot }.map { it.second } + private val customCaptures = + rules.filter { it.first is CustomCapture }.map { it.first as CustomCapture to it.second } + + override fun onTagEnd(tag: Tag) { + downstream.onTagEnd(tag) + + val node = downstream.finalize() + + if (classesMap.isNotEmpty()) { + node.classList.asList().flatMap { clazz: JsString -> + classesMap[clazz.toString()] ?: emptyList() + }.forEach { field -> + node.injectToUnsafe(bean, field) + } + } + + if (tagNamesMap.isNotEmpty()) { + tagNamesMap[node.tagName.lowercase()]?.forEach { field -> + node.injectToUnsafe(bean, field) + } + } + + customCaptures.filter { it.first.apply(node) }.map { it.second }.forEach { field -> + node.injectToUnsafe(bean, field) + } + } + + override fun finalize(): Element { + val node = downstream.finalize() + rootCaptures.forEach { field -> + node.injectToUnsafe(bean, field) + } + + return node + } +} + +fun TagConsumer.inject( + bean: T, + rules: List>>, +): TagConsumer = InjectorConsumer(this, bean, rules) + +fun Element.appendAndInject( + bean: T, + rules: List>>, + block: TagConsumer.() -> Unit, +): List = append { + InjectorConsumer(this@append, bean, rules).block() + Unit +} diff --git a/src/wasmJsMain/kotlin/trace-js.kt b/src/wasmJsMain/kotlin/trace-js.kt new file mode 100644 index 00000000..9fbcbfd5 --- /dev/null +++ b/src/wasmJsMain/kotlin/trace-js.kt @@ -0,0 +1,9 @@ +package kotlinx.html.consumers + +import kotlinx.html.* + +fun TagConsumer.trace() : TagConsumer = trace(println = { consoleInfo(it) }) + +private fun consoleInfo(message: String) { + js("console.info(message)") +} \ No newline at end of file diff --git a/src/wasmJsMain/kotlin/utilsImpl-js.kt b/src/wasmJsMain/kotlin/utilsImpl-js.kt new file mode 100644 index 00000000..9c782550 --- /dev/null +++ b/src/wasmJsMain/kotlin/utilsImpl-js.kt @@ -0,0 +1,8 @@ +package kotlinx.html + +import kotlin.js.* + +actual fun currentTimeMillis(): Long = currentTimeMillisJs().toLong() + +private fun currentTimeMillisJs(): Double = + js("new Date().getTime()") \ No newline at end of file diff --git a/src/wasmJsTest/kotlin/generated/gen-tag-tests.kt b/src/wasmJsTest/kotlin/generated/gen-tag-tests.kt new file mode 100644 index 00000000..2554ae20 --- /dev/null +++ b/src/wasmJsTest/kotlin/generated/gen-tag-tests.kt @@ -0,0 +1,570 @@ +import kotlinx.html.js.* + +/******************************************************************************* + DO NOT EDIT + This file was generated by module generate +*******************************************************************************/ +import kotlinx.browser.document +import kotlinx.html.TagConsumer +import kotlinx.html.dom.append +import org.w3c.dom.Element +import kotlin.test.Test as test + +public class JsTagCastTests { + public fun wrapper(): TagConsumer = document.body!!.append + + @test + public fun testA() { + wrapper().a {} + } + + @test + public fun testAbbr() { + wrapper().abbr {} + } + + @test + public fun testAddress() { + wrapper().address {} + } + + @test + public fun testArea() { + wrapper().area {} + } + + @test + public fun testArticle() { + wrapper().article {} + } + + @test + public fun testAside() { + wrapper().aside {} + } + + @test + public fun testAudio() { + wrapper().audio {} + } + + @test + public fun testB() { + wrapper().b {} + } + + @test + public fun testBase() { + wrapper().base {} + } + + @test + public fun testBdi() { + wrapper().bdi {} + } + + @test + public fun testBdo() { + wrapper().bdo {} + } + + @test + public fun testBlockQuote() { + wrapper().blockQuote {} + } + + @test + public fun testBody() { + wrapper().body {} + } + + @test + public fun testBr() { + wrapper().br {} + } + + @test + public fun testButton() { + wrapper().button {} + } + + @test + public fun testCanvas() { + wrapper().canvas {} + } + + @test + public fun testCaption() { + wrapper().caption {} + } + + @test + public fun testCite() { + wrapper().cite {} + } + + @test + public fun testCode() { + wrapper().code {} + } + + @test + public fun testCol() { + wrapper().col {} + } + + @test + public fun testColGroup() { + wrapper().colGroup {} + } + + @test + public fun testCommand() { + wrapper().command {} + } + + @test + public fun testDataList() { + wrapper().dataList {} + } + + @test + public fun testDd() { + wrapper().dd {} + } + + @test + public fun testDel() { + wrapper().del {} + } + + @test + public fun testDetails() { + wrapper().details {} + } + + @test + public fun testDfn() { + wrapper().dfn {} + } + + @test + public fun testDialog() { + wrapper().dialog {} + } + + @test + public fun testDiv() { + wrapper().div {} + } + + @test + public fun testDl() { + wrapper().dl {} + } + + @test + public fun testDt() { + wrapper().dt {} + } + + @test + public fun testEm() { + wrapper().em {} + } + + @test + public fun testEmbed() { + wrapper().embed {} + } + + @test + public fun testFieldSet() { + wrapper().fieldSet {} + } + + @test + public fun testFigcaption() { + wrapper().figcaption {} + } + + @test + public fun testFigure() { + wrapper().figure {} + } + + @test + public fun testFooter() { + wrapper().footer {} + } + + @test + public fun testForm() { + wrapper().form {} + } + + @test + public fun testH1() { + wrapper().h1 {} + } + + @test + public fun testH2() { + wrapper().h2 {} + } + + @test + public fun testH3() { + wrapper().h3 {} + } + + @test + public fun testH4() { + wrapper().h4 {} + } + + @test + public fun testH5() { + wrapper().h5 {} + } + + @test + public fun testH6() { + wrapper().h6 {} + } + + @test + public fun testHead() { + wrapper().head {} + } + + @test + public fun testHeader() { + wrapper().header {} + } + + @test + public fun testHGroup() { + wrapper().hGroup {} + } + + @test + public fun testHr() { + wrapper().hr {} + } + + @test + public fun testHtml() { + wrapper().html {} + } + + @test + public fun testI() { + wrapper().i {} + } + + @test + public fun testIframe() { + wrapper().iframe {} + } + + @test + public fun testImg() { + wrapper().img {} + } + + @test + public fun testInput() { + wrapper().input {} + } + + @test + public fun testIns() { + wrapper().ins {} + } + + @test + public fun testKbd() { + wrapper().kbd {} + } + + @test + public fun testKeyGen() { + wrapper().keyGen {} + } + + @test + public fun testLabel() { + wrapper().label {} + } + + @test + public fun testLegend() { + wrapper().legend {} + } + + @test + public fun testLi() { + wrapper().li {} + } + + @test + public fun testLink() { + wrapper().link {} + } + + @test + public fun testMain() { + wrapper().main {} + } + + @test + public fun testMap() { + wrapper().map {} + } + + @test + public fun testMark() { + wrapper().mark {} + } + + @test + public fun testMath() { + wrapper().math {} + } + + @test + public fun testMathml() { + wrapper().mathml {} + } + + @test + public fun testMeta() { + wrapper().meta {} + } + + @test + public fun testMeter() { + wrapper().meter {} + } + + @test + public fun testNav() { + wrapper().nav {} + } + + @test + public fun testNoScript() { + wrapper().noScript {} + } + + @test + public fun testHtmlObject() { + wrapper().htmlObject {} + } + + @test + public fun testOl() { + wrapper().ol {} + } + + @test + public fun testOptGroup() { + wrapper().optGroup {} + } + + @test + public fun testOption() { + wrapper().option {} + } + + @test + public fun testOutput() { + wrapper().output {} + } + + @test + public fun testP() { + wrapper().p {} + } + + @test + public fun testParam() { + wrapper().param {} + } + + @test + public fun testPicture() { + wrapper().picture {} + } + + @test + public fun testPre() { + wrapper().pre {} + } + + @test + public fun testProgress() { + wrapper().progress {} + } + + @test + public fun testQ() { + wrapper().q {} + } + + @test + public fun testRp() { + wrapper().rp {} + } + + @test + public fun testRt() { + wrapper().rt {} + } + + @test + public fun testRuby() { + wrapper().ruby {} + } + + @test + public fun testS() { + wrapper().s {} + } + + @test + public fun testSamp() { + wrapper().samp {} + } + + @test + public fun testScript() { + wrapper().script {} + } + + @test + public fun testSection() { + wrapper().section {} + } + + @test + public fun testSelect() { + wrapper().select {} + } + + @test + public fun testSmall() { + wrapper().small {} + } + + @test + public fun testSource() { + wrapper().source {} + } + + @test + public fun testSpan() { + wrapper().span {} + } + + @test + public fun testStrong() { + wrapper().strong {} + } + + @test + public fun testStyle() { + wrapper().style {} + } + + @test + public fun testSub() { + wrapper().sub {} + } + + @test + public fun testSummary() { + wrapper().summary {} + } + + @test + public fun testSup() { + wrapper().sup {} + } + + @test + public fun testSvg() { + wrapper().svg {} + } + + @test + public fun testTable() { + wrapper().table {} + } + + @test + public fun testTbody() { + wrapper().tbody {} + } + + @test + public fun testTd() { + wrapper().td {} + } + + @test + public fun testTextArea() { + wrapper().textArea {} + } + + @test + public fun testTfoot() { + wrapper().tfoot {} + } + + @test + public fun testTh() { + wrapper().th {} + } + + @test + public fun testThead() { + wrapper().thead {} + } + + @test + public fun testTime() { + wrapper().time {} + } + + @test + public fun testTitle() { + wrapper().title {} + } + + @test + public fun testTr() { + wrapper().tr {} + } + + @test + public fun testU() { + wrapper().u {} + } + + @test + public fun testUl() { + wrapper().ul {} + } + + @test + public fun testHtmlVar() { + wrapper().htmlVar {} + } + + @test + public fun testVideo() { + wrapper().video {} + } +} diff --git a/src/wasmJsTest/kotlin/injector.kt b/src/wasmJsTest/kotlin/injector.kt new file mode 100644 index 00000000..b5510c6c --- /dev/null +++ b/src/wasmJsTest/kotlin/injector.kt @@ -0,0 +1,100 @@ +import kotlinx.html.* +import kotlinx.html.dom.* +import kotlinx.html.injector.* +import kotlinx.html.js.* +import org.w3c.dom.* +import kotlinx.browser.* +import kotlin.properties.* +import kotlin.test.* +import kotlin.test.Test as test + +class MyBeanWithDiv { + var node: HTMLDivElement by Delegates.notNull() +} + +class MyBeanWithP { + var p: HTMLParagraphElement by Delegates.notNull() +} + +class ExampleBean { + var myDiv: HTMLDivElement by Delegates.notNull() + var myP: HTMLParagraphElement by Delegates.notNull() +} + +class InjectToLateInitVarBean { + lateinit var myP: HTMLParagraphElement +} + +class InjectorTests { + @test fun injectByClass() { + val bean = MyBeanWithDiv() + val node = document.create.inject(bean, listOf( + InjectByClassName("my-class") to MyBeanWithDiv::node + )).div { + classes = setOf("my-class") + } + + val found: HTMLDivElement = node + + assertEquals("DIV", bean.node.tagName) + assertEquals(found, bean.node) + } + + @test fun injectByClassFailed() { + val bean = MyBeanWithDiv() + document.create.inject(bean, listOf( + InjectByClassName("my-class") to MyBeanWithDiv::node + )).div { + classes = setOf("other-class") + } + + try { + bean.node.tagName + fail("node shouldn't be initialized") + } catch (e: Throwable) { + assertTrue(true) + } + } + + @test fun injectByTagName() { + val bean = MyBeanWithP() + document.create.inject(bean, listOf( + InjectByTagName("p") to MyBeanWithP::p + )).div { + p { + } + } + + assertEquals("P", bean.p.tagName) + } + + @test fun injectToLateInitVar() { + val bean = InjectToLateInitVarBean() + document.create.inject(bean, listOf( + InjectByTagName("p") to InjectToLateInitVarBean::myP + )).div { + p { + } + } + + assertEquals("P", bean.myP.tagName) + } + + @test fun exampleFromWiki() { + val bean = ExampleBean() + + document.create.inject(bean, listOf( + InjectByClassName("my-class") to ExampleBean::myDiv, + InjectByTagName("p") to ExampleBean::myP + )).div { + div("my-class") { + p { + +"test" + } + } + } + + assertNotNull(bean.myDiv) + assertNotNull(bean.myP) + } +} diff --git a/src/wasmJsTest/kotlin/trees.kt b/src/wasmJsTest/kotlin/trees.kt new file mode 100644 index 00000000..deffb1bb --- /dev/null +++ b/src/wasmJsTest/kotlin/trees.kt @@ -0,0 +1,285 @@ + +import kotlinx.browser.document +import kotlinx.html.Entities +import kotlinx.html.a +import kotlinx.html.classes +import kotlinx.html.consumers.trace +import kotlinx.html.div +import kotlinx.html.dom.append +import kotlinx.html.dom.create +import kotlinx.html.dom.prepend +import kotlinx.html.id +import kotlinx.html.js.col +import kotlinx.html.js.colGroup +import kotlinx.html.js.div +import kotlinx.html.js.form +import kotlinx.html.js.h1 +import kotlinx.html.js.onClickFunction +import kotlinx.html.js.onSubmitFunction +import kotlinx.html.js.p +import kotlinx.html.js.span +import kotlinx.html.js.svg +import kotlinx.html.js.td +import kotlinx.html.js.th +import kotlinx.html.li +import kotlinx.html.p +import kotlinx.html.span +import kotlinx.html.ul +import org.w3c.dom.HTMLDivElement +import org.w3c.dom.HTMLElement +import org.w3c.dom.HTMLFormElement +import org.w3c.dom.asList +import org.w3c.dom.get +import org.w3c.dom.svg.SVGElement +import kotlin.test.assertEquals +import kotlin.test.assertTrue +import kotlin.test.fail +import kotlin.test.Test as test + +class DomTreeImplTest { + @test fun simpleTree() { + val node = document.body!!.append.div { + p { + +"test" + } + } + + assertEquals("DIV", node.tagName) + assertEquals(1, node.childNodes.length) + assertEquals("P", node.children[0]?.tagName) + + assertTrue(document.body!!.children.length > 0) + assertEquals(node, document.body!!.children.asList().last()) + } + + @test fun appendSingleNode() { + val myDiv: HTMLDivElement = document.body!!.append.div { + p { + +"test" + } + } + + assertEquals("DIV", myDiv.tagName) + assertEquals(document.body, myDiv.parentNode) + assertEquals("

test

", myDiv.outerHTML.replace("\\s+".toRegex(), "")) + } + + @test fun appendNodeWithEventHandler() { + var clicked = false + + document.body!!.append.div { + id = "clickable" + onClickFunction = { + clicked = true + } + } + document.create.div("a b c ") { + a("http://kotlinlang.org") { +"official Kotlin site" } + } + document.getElementsByTagName("div").asList().forEach { + if (it is HTMLElement) { + it.click() + } + } + + assertTrue(clicked) + } + + @test fun testAtMainPage() { + document.body!!.append.div { + id = "container" + } + + val myDiv = document.create.div("panel") { + p { + +"Here is " + a("http://kotlinlang.org") { +"official Kotlin site" } + } + } + + val container = document.getElementById("container") + if (container == null) { + fail("container not found") + } + + container.appendChild(myDiv) + + assertEquals("", container.innerHTML) + } + + @test fun appendMultipleNodes() { + val wrapper = wrapper() + + val nodes = wrapper.append { + div { + +"div1" + } + div { + +"div2" + } + } + + assertEquals(2, nodes.size) + nodes.forEach { + assertTrue(it in wrapper.children.asList()) + } + + assertEquals("
div1
div2
", wrapper.innerHTML) + } + + @test fun appendEntity() { + val wrapper = wrapper() + wrapper.append.span { + +Entities.nbsp + } + + assertEquals(" ", wrapper.innerHTML) + } + + @test fun pastTagAttributeChangedShouldBeProhibited() { + try { + document.body!!.append.trace().div { + p { + span { + this@div.id = "d1" + } + } + } + + fail("We shouldn't be able to modify attribute for outer tag") + } catch (expected: Throwable) { + assertTrue(true) + } + } + + @test fun buildBiggerPage() { + val wrapper = wrapper() + + wrapper.append { + h1 { + +"kotlin" + } + p { + +"Here we are" + } + div { + classes = setOf("root") + + div { + classes = setOf("menu") + + ul { + li { +"item1" } + li { +"item2" } + li { +"item3" } + } + } + div { + classes = setOf("content") + } + } + } + + assertEquals(""" +

kotlin

+

Here we are

+
+ +
+
""".trimLines(), wrapper.innerHTML) + } + + @test fun testAppendAndRemoveClass() { + val wrapper = wrapper() + + wrapper.append { + span("class1") { + classes += "class2" + classes -= "class1" + } + } + + assertEquals("", wrapper.innerHTML) + } + + @test fun testSvg() { + val wrapper = wrapper() + + wrapper.append.svg { + } + + val nodes = wrapper.childNodes.asList() + + val svg = nodes.map { it as SVGElement }.first() + + assertEquals("http://www.w3.org/2000/svg", svg.namespaceURI) + } + + @test fun assignEvent() { + val wrapper = wrapper() + var invoked = false + + wrapper.append { + form { + id = "my-form" + onSubmitFunction = { _ -> + invoked = true + } + } + } + + val event = document.createEvent("Event") + event.initEvent("submit", true, true) + + println("Got event $event") + + (wrapper.getElementsByTagName("form").asList().first { it.id == "my-form" } as HTMLFormElement).dispatchEvent(event) + + assertTrue { invoked } + } + + @test fun testTdThColColGroupCreation() { + val td = document.create.td() + val th = document.create.th() + val col = document.create.col() + val colGroup = document.create.colGroup() + + assertEquals("TH", th.tagName.uppercase()) + assertEquals("TD", td.tagName.uppercase()) + assertEquals("COL", col.tagName.uppercase()) + assertEquals("COLGROUP", colGroup.tagName.uppercase()) + } + + @test fun testPrepend() { + val wrapper = wrapper() + wrapper.appendChild(document.createElement("A").apply { textContent = "aaa" }) + + wrapper.prepend { + p { + text("OK") + } + } + + assertEquals("

OK

aaa", wrapper.innerHTML) + } + + @test fun testComment() { + val wrapper = wrapper() + wrapper.append.div { + comment("commented") + } + + assertEquals("
", wrapper.innerHTML) + } + + private fun wrapper() = document.body!!.append.div {} + @Suppress("UNCHECKED_CAST") + private fun uninitialized(): T = null as T + private fun String.trimLines() = trimIndent().lines().filter { it.isNotBlank() }.joinToString("") +} diff --git a/src/wasmJsTest/kotlin/unsafe.kt b/src/wasmJsTest/kotlin/unsafe.kt new file mode 100644 index 00000000..10c875a1 --- /dev/null +++ b/src/wasmJsTest/kotlin/unsafe.kt @@ -0,0 +1,47 @@ +import kotlinx.html.* +import kotlinx.html.dom.* +import kotlinx.html.stream.* +import kotlinx.browser.* +import kotlin.test.* + +class UnsafeContentTest { + @Test + fun testStream() { + val text = StringBuilder().apply { + appendHTML(false).html { + unsafe { + +"

para

" + } + } + }.toString() + + assertEquals("

para

", text) + } + + @Test + fun testDOM() { + val tree = document.createTree().div { + unsafe { + +"

para

" + } + } + + assertEquals("

para

", tree.innerHTML) + assertEquals("

para

", tree.outerHTML) + } + + @Test + fun testDOMMultiple() { + val tree = document.createTree().div { + unsafe { + +"

para1

" + +"

para2

" + } + unsafe { + +"

para3

" + } + } + + assertEquals("

para1

para2

para3

", tree.innerHTML) + } +}