From a39765a94242331f275b0ab42847f5c0b7ea5ed1 Mon Sep 17 00:00:00 2001 From: "Artem.Kobzar" Date: Tue, 11 Mar 2025 10:36:42 +0100 Subject: [PATCH] Setup a common sourceSet in between wasmJs and JS targets to publish both variants from the single source --- .gitignore | 3 +- build.gradle.kts | 34 ++++- generator/build.gradle.kts | 8 +- .../dukat/{launchWasm.kt => launchBrowser.kt} | 2 +- .../main/kotlin/dukat/wasm/convertToModel.kt | 8 +- generator/src/main/kotlin/helpers/generate.kt | 108 +++++++++++++-- settings.gradle.kts | 2 +- src/browserMain/kotlin/arrayCopy.kt | 64 +++++++++ .../kotlin/kotlinx/browser/declarations.kt | 0 .../kotlin/kotlinx/dom/Builders.kt | 0 .../kotlin/kotlinx/dom/Classes.kt | 0 .../kotlin/kotlinx/dom/Dom.kt | 0 .../kotlin/kotlinx/dom/ItemArrayLike.kt | 0 .../kotlin/kotlinx/dom/Mutations.kt | 0 .../kotlin/org.w3c/org.khronos.webgl.kt | 24 ++-- .../kotlin/org.w3c/org.w3c.css.masking.kt | 2 +- .../kotlin/org.w3c/org.w3c.dom.clipboard.kt | 6 +- .../kotlin/org.w3c/org.w3c.dom.css.kt | 10 +- .../org.w3c/org.w3c.dom.encryptedmedia.kt | 10 +- .../kotlin/org.w3c/org.w3c.dom.events.kt | 18 +-- .../kotlin/org.w3c/org.w3c.dom.kt | 128 +++++++++--------- .../org.w3c/org.w3c.dom.mediacapture.kt | 38 +++--- .../kotlin/org.w3c/org.w3c.dom.mediasource.kt | 4 +- .../kotlin/org.w3c/org.w3c.dom.parsing.kt | 2 +- .../org.w3c/org.w3c.dom.pointerevents.kt | 4 +- .../kotlin/org.w3c/org.w3c.dom.svg.kt | 16 +-- .../kotlin/org.w3c/org.w3c.dom.url.kt | 2 +- .../kotlin/org.w3c/org.w3c.fetch.kt | 6 +- .../kotlin/org.w3c/org.w3c.files.kt | 8 +- .../kotlin/org.w3c/org.w3c.notifications.kt | 10 +- .../kotlin/org.w3c/org.w3c.performance.kt | 2 +- .../kotlin/org.w3c/org.w3c.workers.kt | 24 ++-- .../kotlin/org.w3c/org.w3c.xhr.kt | 4 +- .../kotlin/w3cSupport.kt | 0 .../kotlin/SmokeTest.kt | 0 .../kotlin/arrayCopyTest.kt | 2 +- src/jsMain/kotlin/arrayCopy.js.kt | 80 +++++++++++ .../{arrayCopy.kt => arrayCopy.wasm.kt} | 34 ++--- 38 files changed, 457 insertions(+), 206 deletions(-) rename generator/src/main/kotlin/dukat/{launchWasm.kt => launchBrowser.kt} (92%) create mode 100644 src/browserMain/kotlin/arrayCopy.kt rename src/{wasmJsMain => browserMain}/kotlin/kotlinx/browser/declarations.kt (100%) rename src/{wasmJsMain => browserMain}/kotlin/kotlinx/dom/Builders.kt (100%) rename src/{wasmJsMain => browserMain}/kotlin/kotlinx/dom/Classes.kt (100%) rename src/{wasmJsMain => browserMain}/kotlin/kotlinx/dom/Dom.kt (100%) rename src/{wasmJsMain => browserMain}/kotlin/kotlinx/dom/ItemArrayLike.kt (100%) rename src/{wasmJsMain => browserMain}/kotlin/kotlinx/dom/Mutations.kt (100%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.khronos.webgl.kt (98%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.css.masking.kt (97%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.clipboard.kt (85%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.css.kt (98%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.encryptedmedia.kt (92%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.events.kt (82%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.kt (97%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.mediacapture.kt (87%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.mediasource.kt (96%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.parsing.kt (92%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.pointerevents.kt (77%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.svg.kt (99%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.dom.url.kt (96%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.fetch.kt (96%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.files.kt (94%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.notifications.kt (91%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.performance.kt (97%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.workers.kt (92%) rename src/{wasmJsMain => browserMain}/kotlin/org.w3c/org.w3c.xhr.kt (95%) rename src/{wasmJsMain => browserMain}/kotlin/w3cSupport.kt (100%) rename src/{wasmJsTest => browserTest}/kotlin/SmokeTest.kt (100%) rename src/{wasmJsTest => browserTest}/kotlin/arrayCopyTest.kt (98%) create mode 100644 src/jsMain/kotlin/arrayCopy.js.kt rename src/wasmJsMain/kotlin/{arrayCopy.kt => arrayCopy.wasm.kt} (76%) diff --git a/.gitignore b/.gitignore index 3d664eb..5d95d8f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ gradle-app.setting # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 # gradle/wrapper/gradle-wrapper.properties /.idea/ -/kotlin-js-store/ \ No newline at end of file +/kotlin-js-store/ +/.kotlin/ diff --git a/build.gradle.kts b/build.gradle.kts index ea75d48..1e754a3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,9 @@ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon plugins { - kotlin("multiplatform") version "1.9.24" + kotlin("multiplatform") version "2.1.10" `maven-publish` signing } @@ -26,6 +28,7 @@ afterEvaluate { repositories { mavenCentral() + mavenLocal() } val artifactId = "kotlinx-browser" @@ -39,16 +42,43 @@ if (!versionSuffix.isNullOrBlank()) { } kotlin { + js() + @OptIn(ExperimentalWasmDsl::class) wasmJs { nodejs() } sourceSets { - val wasmJsTest by getting { + val commonMain by getting + val commonTest by getting + val browserMain by creating { + dependsOn(commonMain) + } + val browserTest by creating { + dependsOn(commonTest) dependencies { implementation(kotlin("test")) } } + val jsMain by getting { + dependsOn(browserMain) + dependencies { + implementation(kotlin("wasm-js-interop", "0.0.1-SNAPSHOT")) + } + } + val jsTest by getting { + dependsOn(browserTest) + } + val wasmJsMain by getting { + dependsOn(browserMain) + } + val wasmJsTest by getting { + dependsOn(browserTest) + } } +} + +tasks.withType().configureEach { + enabled = false } \ No newline at end of file diff --git a/generator/build.gradle.kts b/generator/build.gradle.kts index 9d5bf28..821842c 100644 --- a/generator/build.gradle.kts +++ b/generator/build.gradle.kts @@ -18,15 +18,15 @@ task("downloadIDL", JavaExec::class) { dependsOn("build") } -task("generateWasmStdlibFromIDL", JavaExec::class) { - mainClass = "org.jetbrains.kotlin.tools.dukat.LaunchWasmKt" +task("generateStdlibFromIDL", JavaExec::class) { + mainClass = "org.jetbrains.kotlin.tools.dukat.LaunchBrowserKt" classpath = sourceSets["main"].runtimeClasspath dependsOn("build") systemProperty("line.separator", "\n") } -task("generateWasmJsUtils", JavaExec::class) { - mainClass.set("org.jetbrains.kotlin.generators.wasm.js.GenerateKt") +task("generateUtils", JavaExec::class) { + mainClass.set("org.jetbrains.kotlin.generators.helpers.GenerateKt") classpath = sourceSets["main"].runtimeClasspath dependsOn("build") } diff --git a/generator/src/main/kotlin/dukat/launchWasm.kt b/generator/src/main/kotlin/dukat/launchBrowser.kt similarity index 92% rename from generator/src/main/kotlin/dukat/launchWasm.kt rename to generator/src/main/kotlin/dukat/launchBrowser.kt index af79fd6..fe9ca14 100644 --- a/generator/src/main/kotlin/dukat/launchWasm.kt +++ b/generator/src/main/kotlin/dukat/launchBrowser.kt @@ -11,7 +11,7 @@ import org.jetbrains.kotlin.tools.dukat.wasm.translateIdlToSourceSet import java.io.File fun main() { - val outputDirectory = "../src/wasmJsMain/kotlin/org.w3c/" + val outputDirectory = "../src/browserMain/kotlin/org.w3c/" val input = "../idl/org.w3c.dom.idl" val sourceSet = translateIdlToSourceSet(input) diff --git a/generator/src/main/kotlin/dukat/wasm/convertToModel.kt b/generator/src/main/kotlin/dukat/wasm/convertToModel.kt index d8a1871..d5c9092 100644 --- a/generator/src/main/kotlin/dukat/wasm/convertToModel.kt +++ b/generator/src/main/kotlin/dukat/wasm/convertToModel.kt @@ -380,9 +380,7 @@ private class IdlFileConverter( SUPPRESS_UNUSED_PARAMETER_ANNOTATION ), body = BlockStatementModel( - listOf( - ExpressionStatementModel(callJsFunction("return obj[${key.name}];")) - ) + listOf(ReturnStatementModel(callJsFunction("obj[${key.name}]"))) ), visibilityModifier = VisibilityModifierModel.INTERNAL, comment = null, @@ -555,8 +553,8 @@ private class IdlFileConverter( fun IDLDictionaryDeclaration.generateFunctionBody(): List = listOf( - ExpressionStatementModel( - callJsFunction("return { ${members.joinToString { it.name }} };") + ReturnStatementModel( + callJsFunction("({ ${members.joinToString(", ") { "${it.name}: ${it.name}" }} })") ) ) diff --git a/generator/src/main/kotlin/helpers/generate.kt b/generator/src/main/kotlin/helpers/generate.kt index 9113b55..0062d1f 100644 --- a/generator/src/main/kotlin/helpers/generate.kt +++ b/generator/src/main/kotlin/helpers/generate.kt @@ -3,7 +3,7 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ -package org.jetbrains.kotlin.generators.wasm.js +package org.jetbrains.kotlin.generators.helpers import org.jetbrains.kotlin.tools.dukat.getHeader import java.io.File @@ -15,25 +15,100 @@ fun main() { } fun generatePublicStdlibFunctions() { - FileWriter(File("../src/wasmJsMain/kotlin/arrayCopy.kt")).use { writer: FileWriter -> + val conversions = listOf( + Conversion("Byte", "Int8"), + Conversion("UByte", "Uint8", isUnsigned = true), + Conversion("Short", "Int16"), + Conversion("UShort", "Uint16", isUnsigned = true), + Conversion("Int", "Int32"), + Conversion("UInt", "Uint32", isUnsigned = true), + Conversion("Float", "Float32"), + Conversion("Double", "Float64") + ) + + FileWriter(File("../src/browserMain/kotlin/arrayCopy.kt")).use { writer: FileWriter -> with(writer) { appendLine(getHeader(seeDetailsAt = "generator/src/main/kotlin/helpers/generate.kt")) + appendLine("package org.khronos.webgl") + conversions.forEach { (ktType, jsType, isUnsigned) -> + appendExpectConversionsForType(ktType, jsType, isUnsigned) + } + } + } + FileWriter(File("../src/jsMain/kotlin/arrayCopy.js.kt")).use { writer: FileWriter -> + with(writer) { + appendLine(getHeader(seeDetailsAt = "generator/src/main/kotlin/helpers/generate.kt")) + + appendLine("package org.khronos.webgl") + + conversions.forEach { (ktType, jsType, isUnsigned) -> + appendJsConversionsForType(ktType, jsType, isUnsigned) + } + } + } + FileWriter(File("../src/wasmJsMain/kotlin/arrayCopy.wasm.kt")).use { writer: FileWriter -> + with(writer) { + appendLine(getHeader(seeDetailsAt = "generator/src/main/kotlin/helpers/generate.kt")) appendLine("package org.khronos.webgl") - appendConversionsForType("Byte", "Int8") - appendConversionsForType("UByte", "Uint8", isUnsigned = true) - appendConversionsForType("Short", "Int16") - appendConversionsForType("UShort", "Uint16", isUnsigned = true) - appendConversionsForType("Int", "Int32") - appendConversionsForType("UInt", "Uint32", isUnsigned = true) - appendConversionsForType("Float", "Float32") - appendConversionsForType("Double", "Float64") + conversions.forEach { (ktType, jsType, isUnsigned) -> + appendWasmConversionsForType(ktType, jsType, isUnsigned) + } } } } -private fun FileWriter.appendConversionsForType( + +private fun FileWriter.appendExpectConversionsForType( + ktType: String, + jsType: String, + isUnsigned: Boolean = false, +) { + val kotlinArrayType = "${ktType}Array" + val jsArrayType = "${jsType}Array" + + appendLine() + appendLine("/** Returns a new [$kotlinArrayType] containing all the elements of this [$jsArrayType]. */") + if (isUnsigned) { + appendLine("@ExperimentalUnsignedTypes") + } + appendLine("public expect fun $jsArrayType.to$kotlinArrayType(): $kotlinArrayType") + appendLine() + appendLine("/** Returns a new [$jsArrayType] containing all the elements of this [$kotlinArrayType]. */") + if (isUnsigned) { + appendLine("@ExperimentalUnsignedTypes") + } + appendLine("public expect fun $kotlinArrayType.to$jsArrayType(): $jsArrayType") +} + + +private fun FileWriter.appendJsConversionsForType( + ktType: String, + jsType: String, + isUnsigned: Boolean = false, +) { + val kotlinArrayType = "${ktType}Array" + val jsArrayType = "${jsType}Array" + + appendLine() + appendLine("/** Returns a new [$kotlinArrayType] containing all the elements of this [$jsArrayType]. */") + if (isUnsigned) { + appendLine("@ExperimentalUnsignedTypes") + } + appendLine("public actual inline fun $jsArrayType.to$kotlinArrayType(): $kotlinArrayType =") + appendLine(" unsafeCast<$kotlinArrayType>()") + + appendLine() + appendLine("/** Returns a new [$jsArrayType] containing all the elements of this [$kotlinArrayType]. */") + if (isUnsigned) { + appendLine("@ExperimentalUnsignedTypes") + } + appendLine("public actual inline fun $kotlinArrayType.to$jsArrayType(): $jsArrayType =") + appendLine(" unsafeCast<$jsArrayType>()") +} + +private fun FileWriter.appendWasmConversionsForType( ktType: String, jsType: String, isUnsigned: Boolean = false, @@ -46,7 +121,7 @@ private fun FileWriter.appendConversionsForType( if (isUnsigned) { appendLine("@ExperimentalUnsignedTypes") } - appendLine("public fun $jsArrayType.to$kotlinArrayType(): $kotlinArrayType =") + appendLine("public actual fun $jsArrayType.to$kotlinArrayType(): $kotlinArrayType =") if (isUnsigned) { appendLine(" $kotlinArrayType(this.length) { this[it].to$ktType() }") } else { @@ -58,7 +133,7 @@ private fun FileWriter.appendConversionsForType( if (isUnsigned) { appendLine("@ExperimentalUnsignedTypes") } - appendLine("public fun $kotlinArrayType.to$jsArrayType(): $jsArrayType {") + appendLine("public actual fun $kotlinArrayType.to$jsArrayType(): $jsArrayType {") appendLine(" val result = $jsArrayType(this.size)") appendLine(" for (index in this.indices) {") if (isUnsigned) { @@ -73,7 +148,7 @@ private fun FileWriter.appendConversionsForType( } fun generateTests() { - FileWriter(File("../src/wasmJsTest/kotlin/arrayCopyTest.kt")).use { writer: FileWriter -> + FileWriter(File("../src/browserTest/kotlin/arrayCopyTest.kt")).use { writer: FileWriter -> with(writer) { appendLine(getHeader(seeDetailsAt = "generator/src/main/kotlin/helpers/generate.kt")) @@ -146,4 +221,7 @@ private fun FileWriter.appendTestFunction( appendLine(" testJsRoundTrip($ktArrayOf(0.to$ktType(), (-42).to$ktType(), $ktType.MIN_VALUE, $ktType.MAX_VALUE))") appendLine(" testJsRoundTrip($kotlinArrayType(1000) { it.to$ktType() })") appendLine(" }") -} \ No newline at end of file +} + +data class Conversion(val jsType: String, val ktType: String, val isUnsigned: Boolean = false) +data class InteropCorrespondence(val interopType: String, val wasmType: String, val jsType: String) diff --git a/settings.gradle.kts b/settings.gradle.kts index 5cdf049..bef08c1 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,7 +3,7 @@ pluginManagement { gradlePluginPortal() } plugins { - kotlin("multiplatform").version("1.9.23") + kotlin("multiplatform").version("2.1.10") } } diff --git a/src/browserMain/kotlin/arrayCopy.kt b/src/browserMain/kotlin/arrayCopy.kt new file mode 100644 index 0000000..bd09632 --- /dev/null +++ b/src/browserMain/kotlin/arrayCopy.kt @@ -0,0 +1,64 @@ +/* + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + */ + +// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT! +// See generator/src/main/kotlin/helpers/generate.kt for details + + +package org.khronos.webgl + +/** Returns a new [ByteArray] containing all the elements of this [Int8Array]. */ +public expect fun Int8Array.toByteArray(): ByteArray + +/** Returns a new [Int8Array] containing all the elements of this [ByteArray]. */ +public expect fun ByteArray.toInt8Array(): Int8Array + +/** Returns a new [UByteArray] containing all the elements of this [Uint8Array]. */ +@ExperimentalUnsignedTypes +public expect fun Uint8Array.toUByteArray(): UByteArray + +/** Returns a new [Uint8Array] containing all the elements of this [UByteArray]. */ +@ExperimentalUnsignedTypes +public expect fun UByteArray.toUint8Array(): Uint8Array + +/** Returns a new [ShortArray] containing all the elements of this [Int16Array]. */ +public expect fun Int16Array.toShortArray(): ShortArray + +/** Returns a new [Int16Array] containing all the elements of this [ShortArray]. */ +public expect fun ShortArray.toInt16Array(): Int16Array + +/** Returns a new [UShortArray] containing all the elements of this [Uint16Array]. */ +@ExperimentalUnsignedTypes +public expect fun Uint16Array.toUShortArray(): UShortArray + +/** Returns a new [Uint16Array] containing all the elements of this [UShortArray]. */ +@ExperimentalUnsignedTypes +public expect fun UShortArray.toUint16Array(): Uint16Array + +/** Returns a new [IntArray] containing all the elements of this [Int32Array]. */ +public expect fun Int32Array.toIntArray(): IntArray + +/** Returns a new [Int32Array] containing all the elements of this [IntArray]. */ +public expect fun IntArray.toInt32Array(): Int32Array + +/** Returns a new [UIntArray] containing all the elements of this [Uint32Array]. */ +@ExperimentalUnsignedTypes +public expect fun Uint32Array.toUIntArray(): UIntArray + +/** Returns a new [Uint32Array] containing all the elements of this [UIntArray]. */ +@ExperimentalUnsignedTypes +public expect fun UIntArray.toUint32Array(): Uint32Array + +/** Returns a new [FloatArray] containing all the elements of this [Float32Array]. */ +public expect fun Float32Array.toFloatArray(): FloatArray + +/** Returns a new [Float32Array] containing all the elements of this [FloatArray]. */ +public expect fun FloatArray.toFloat32Array(): Float32Array + +/** Returns a new [DoubleArray] containing all the elements of this [Float64Array]. */ +public expect fun Float64Array.toDoubleArray(): DoubleArray + +/** Returns a new [Float64Array] containing all the elements of this [DoubleArray]. */ +public expect fun DoubleArray.toFloat64Array(): Float64Array diff --git a/src/wasmJsMain/kotlin/kotlinx/browser/declarations.kt b/src/browserMain/kotlin/kotlinx/browser/declarations.kt similarity index 100% rename from src/wasmJsMain/kotlin/kotlinx/browser/declarations.kt rename to src/browserMain/kotlin/kotlinx/browser/declarations.kt diff --git a/src/wasmJsMain/kotlin/kotlinx/dom/Builders.kt b/src/browserMain/kotlin/kotlinx/dom/Builders.kt similarity index 100% rename from src/wasmJsMain/kotlin/kotlinx/dom/Builders.kt rename to src/browserMain/kotlin/kotlinx/dom/Builders.kt diff --git a/src/wasmJsMain/kotlin/kotlinx/dom/Classes.kt b/src/browserMain/kotlin/kotlinx/dom/Classes.kt similarity index 100% rename from src/wasmJsMain/kotlin/kotlinx/dom/Classes.kt rename to src/browserMain/kotlin/kotlinx/dom/Classes.kt diff --git a/src/wasmJsMain/kotlin/kotlinx/dom/Dom.kt b/src/browserMain/kotlin/kotlinx/dom/Dom.kt similarity index 100% rename from src/wasmJsMain/kotlin/kotlinx/dom/Dom.kt rename to src/browserMain/kotlin/kotlinx/dom/Dom.kt diff --git a/src/wasmJsMain/kotlin/kotlinx/dom/ItemArrayLike.kt b/src/browserMain/kotlin/kotlinx/dom/ItemArrayLike.kt similarity index 100% rename from src/wasmJsMain/kotlin/kotlinx/dom/ItemArrayLike.kt rename to src/browserMain/kotlin/kotlinx/dom/ItemArrayLike.kt diff --git a/src/wasmJsMain/kotlin/kotlinx/dom/Mutations.kt b/src/browserMain/kotlin/kotlinx/dom/Mutations.kt similarity index 100% rename from src/wasmJsMain/kotlin/kotlinx/dom/Mutations.kt rename to src/browserMain/kotlin/kotlinx/dom/Mutations.kt diff --git a/src/wasmJsMain/kotlin/org.w3c/org.khronos.webgl.kt b/src/browserMain/kotlin/org.w3c/org.khronos.webgl.kt similarity index 98% rename from src/wasmJsMain/kotlin/org.w3c/org.khronos.webgl.kt rename to src/browserMain/kotlin/org.w3c/org.khronos.webgl.kt index 1b3647e..c3b0282 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.khronos.webgl.kt +++ b/src/browserMain/kotlin/org.w3c/org.khronos.webgl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -41,7 +41,7 @@ public external interface WebGLContextAttributes : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun WebGLContextAttributes(alpha: Boolean? = true, depth: Boolean? = true, stencil: Boolean? = false, antialias: Boolean? = true, premultipliedAlpha: Boolean? = true, preserveDrawingBuffer: Boolean? = false, preferLowPowerToHighPerformance: Boolean? = false, failIfMajorPerformanceCaveat: Boolean? = false): WebGLContextAttributes { js("return { alpha, depth, stencil, antialias, premultipliedAlpha, preserveDrawingBuffer, preferLowPowerToHighPerformance, failIfMajorPerformanceCaveat };") } +public fun WebGLContextAttributes(alpha: Boolean? = true, depth: Boolean? = true, stencil: Boolean? = false, antialias: Boolean? = true, premultipliedAlpha: Boolean? = true, preserveDrawingBuffer: Boolean? = false, preferLowPowerToHighPerformance: Boolean? = false, failIfMajorPerformanceCaveat: Boolean? = false): WebGLContextAttributes = js("({ alpha: alpha, depth: depth, stencil: stencil, antialias: antialias, premultipliedAlpha: premultipliedAlpha, preserveDrawingBuffer: preserveDrawingBuffer, preferLowPowerToHighPerformance: preferLowPowerToHighPerformance, failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat })") public external abstract class WebGLObject : JsAny @@ -885,7 +885,7 @@ public external interface WebGLContextEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun WebGLContextEventInit(statusMessage: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WebGLContextEventInit { js("return { statusMessage, bubbles, cancelable, composed };") } +public fun WebGLContextEventInit(statusMessage: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WebGLContextEventInit = js("({ statusMessage: statusMessage, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [ArrayBuffer](https://developer.mozilla.org/en/docs/Web/API/ArrayBuffer) to Kotlin @@ -930,7 +930,7 @@ public external open class Int8Array : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForInt8Array(obj: Int8Array, index: Int): Byte { js("return obj[index];") } +internal fun getMethodImplForInt8Array(obj: Int8Array, index: Int): Byte = js("obj[index]") public operator fun Int8Array.get(index: Int): Byte = getMethodImplForInt8Array(this, index) @@ -961,7 +961,7 @@ public external open class Uint8Array : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForUint8Array(obj: Uint8Array, index: Int): Byte { js("return obj[index];") } +internal fun getMethodImplForUint8Array(obj: Uint8Array, index: Int): Byte = js("obj[index]") public operator fun Uint8Array.get(index: Int): Byte = getMethodImplForUint8Array(this, index) @@ -992,7 +992,7 @@ public external open class Uint8ClampedArray : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForUint8ClampedArray(obj: Uint8ClampedArray, index: Int): Byte { js("return obj[index];") } +internal fun getMethodImplForUint8ClampedArray(obj: Uint8ClampedArray, index: Int): Byte = js("obj[index]") public operator fun Uint8ClampedArray.get(index: Int): Byte = getMethodImplForUint8ClampedArray(this, index) @@ -1023,7 +1023,7 @@ public external open class Int16Array : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForInt16Array(obj: Int16Array, index: Int): Short { js("return obj[index];") } +internal fun getMethodImplForInt16Array(obj: Int16Array, index: Int): Short = js("obj[index]") public operator fun Int16Array.get(index: Int): Short = getMethodImplForInt16Array(this, index) @@ -1054,7 +1054,7 @@ public external open class Uint16Array : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForUint16Array(obj: Uint16Array, index: Int): Short { js("return obj[index];") } +internal fun getMethodImplForUint16Array(obj: Uint16Array, index: Int): Short = js("obj[index]") public operator fun Uint16Array.get(index: Int): Short = getMethodImplForUint16Array(this, index) @@ -1085,7 +1085,7 @@ public external open class Int32Array : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForInt32Array(obj: Int32Array, index: Int): Int { js("return obj[index];") } +internal fun getMethodImplForInt32Array(obj: Int32Array, index: Int): Int = js("obj[index]") public operator fun Int32Array.get(index: Int): Int = getMethodImplForInt32Array(this, index) @@ -1116,7 +1116,7 @@ public external open class Uint32Array : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForUint32Array(obj: Uint32Array, index: Int): Int { js("return obj[index];") } +internal fun getMethodImplForUint32Array(obj: Uint32Array, index: Int): Int = js("obj[index]") public operator fun Uint32Array.get(index: Int): Int = getMethodImplForUint32Array(this, index) @@ -1147,7 +1147,7 @@ public external open class Float32Array : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForFloat32Array(obj: Float32Array, index: Int): Float { js("return obj[index];") } +internal fun getMethodImplForFloat32Array(obj: Float32Array, index: Int): Float = js("obj[index]") public operator fun Float32Array.get(index: Int): Float = getMethodImplForFloat32Array(this, index) @@ -1178,7 +1178,7 @@ public external open class Float64Array : ArrayBufferView, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForFloat64Array(obj: Float64Array, index: Int): Double { js("return obj[index];") } +internal fun getMethodImplForFloat64Array(obj: Float64Array, index: Int): Double = js("obj[index]") public operator fun Float64Array.get(index: Int): Double = getMethodImplForFloat64Array(this, index) diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.css.masking.kt b/src/browserMain/kotlin/org.w3c/org.w3c.css.masking.kt similarity index 97% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.css.masking.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.css.masking.kt index 8a170aa..62e9e47 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.css.masking.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.css.masking.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.clipboard.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.clipboard.kt similarity index 85% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.clipboard.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.clipboard.kt index 566c2d2..af65b96 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.clipboard.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.clipboard.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -21,7 +21,7 @@ public external interface ClipboardEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ClipboardEventInit(clipboardData: DataTransfer? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ClipboardEventInit { js("return { clipboardData, bubbles, cancelable, composed };") } +public fun ClipboardEventInit(clipboardData: DataTransfer? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ClipboardEventInit = js("({ clipboardData: clipboardData, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [ClipboardEvent](https://developer.mozilla.org/en/docs/Web/API/ClipboardEvent) to Kotlin @@ -54,4 +54,4 @@ public external interface ClipboardPermissionDescriptor : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ClipboardPermissionDescriptor(allowWithoutGesture: Boolean? = false): ClipboardPermissionDescriptor { js("return { allowWithoutGesture };") } \ No newline at end of file +public fun ClipboardPermissionDescriptor(allowWithoutGesture: Boolean? = false): ClipboardPermissionDescriptor = js("({ allowWithoutGesture: allowWithoutGesture })") \ No newline at end of file diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.css.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.css.kt similarity index 98% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.css.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.css.kt index a368511..8cd8a42 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.css.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.css.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -21,7 +21,7 @@ public external abstract class MediaList : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForMediaList(obj: MediaList, index: Int): String? { js("return obj[index];") } +internal fun getMethodImplForMediaList(obj: MediaList, index: Int): String? = js("obj[index]") public operator fun MediaList.get(index: Int): String? = getMethodImplForMediaList(this, index) @@ -56,7 +56,7 @@ public external abstract class StyleSheetList : ItemArrayLike, JsAny } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForStyleSheetList(obj: StyleSheetList, index: Int): StyleSheet? { js("return obj[index];") } +internal fun getMethodImplForStyleSheetList(obj: StyleSheetList, index: Int): StyleSheet? = js("obj[index]") public operator fun StyleSheetList.get(index: Int): StyleSheet? = getMethodImplForStyleSheetList(this, index) @@ -76,7 +76,7 @@ public external abstract class CSSRuleList : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForCSSRuleList(obj: CSSRuleList, index: Int): CSSRule? { js("return obj[index];") } +internal fun getMethodImplForCSSRuleList(obj: CSSRuleList, index: Int): CSSRule? = js("obj[index]") public operator fun CSSRuleList.get(index: Int): CSSRule? = getMethodImplForCSSRuleList(this, index) @@ -472,7 +472,7 @@ public external abstract class CSSStyleDeclaration : ItemArrayLike, Js } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForCSSStyleDeclaration(obj: CSSStyleDeclaration, index: Int): String? { js("return obj[index];") } +internal fun getMethodImplForCSSStyleDeclaration(obj: CSSStyleDeclaration, index: Int): String? = js("obj[index]") public operator fun CSSStyleDeclaration.get(index: Int): String? = getMethodImplForCSSStyleDeclaration(this, index) diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.encryptedmedia.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.encryptedmedia.kt similarity index 92% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.encryptedmedia.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.encryptedmedia.kt index 30fd3f2..23e5501 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.encryptedmedia.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.encryptedmedia.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -42,7 +42,7 @@ public external interface MediaKeySystemConfiguration : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaKeySystemConfiguration(label: String? = "", initDataTypes: JsArray? = JsArray(), audioCapabilities: JsArray? = JsArray(), videoCapabilities: JsArray? = JsArray(), distinctiveIdentifier: MediaKeysRequirement? = MediaKeysRequirement.OPTIONAL, persistentState: MediaKeysRequirement? = MediaKeysRequirement.OPTIONAL, sessionTypes: JsArray? = undefined): MediaKeySystemConfiguration { js("return { label, initDataTypes, audioCapabilities, videoCapabilities, distinctiveIdentifier, persistentState, sessionTypes };") } +public fun MediaKeySystemConfiguration(label: String? = "", initDataTypes: JsArray? = JsArray(), audioCapabilities: JsArray? = JsArray(), videoCapabilities: JsArray? = JsArray(), distinctiveIdentifier: MediaKeysRequirement? = MediaKeysRequirement.OPTIONAL, persistentState: MediaKeysRequirement? = MediaKeysRequirement.OPTIONAL, sessionTypes: JsArray? = undefined): MediaKeySystemConfiguration = js("({ label: label, initDataTypes: initDataTypes, audioCapabilities: audioCapabilities, videoCapabilities: videoCapabilities, distinctiveIdentifier: distinctiveIdentifier, persistentState: persistentState, sessionTypes: sessionTypes })") public external interface MediaKeySystemMediaCapability : JsAny { var contentType: String? /* = "" */ @@ -54,7 +54,7 @@ public external interface MediaKeySystemMediaCapability : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaKeySystemMediaCapability(contentType: String? = "", robustness: String? = ""): MediaKeySystemMediaCapability { js("return { contentType, robustness };") } +public fun MediaKeySystemMediaCapability(contentType: String? = "", robustness: String? = ""): MediaKeySystemMediaCapability = js("({ contentType: contentType, robustness: robustness })") /** * Exposes the JavaScript [MediaKeySystemAccess](https://developer.mozilla.org/en/docs/Web/API/MediaKeySystemAccess) to Kotlin @@ -120,7 +120,7 @@ public external interface MediaKeyMessageEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaKeyMessageEventInit(messageType: MediaKeyMessageType?, message: ArrayBuffer?, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaKeyMessageEventInit { js("return { messageType, message, bubbles, cancelable, composed };") } +public fun MediaKeyMessageEventInit(messageType: MediaKeyMessageType?, message: ArrayBuffer?, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaKeyMessageEventInit = js("({ messageType: messageType, message: message, bubbles: bubbles, cancelable: cancelable, composed: composed })") public external open class MediaEncryptedEvent(type: String, eventInitDict: MediaEncryptedEventInit = definedExternally) : Event, JsAny { open val initDataType: String @@ -144,7 +144,7 @@ public external interface MediaEncryptedEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaEncryptedEventInit(initDataType: String? = "", initData: ArrayBuffer? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaEncryptedEventInit { js("return { initDataType, initData, bubbles, cancelable, composed };") } +public fun MediaEncryptedEventInit(initDataType: String? = "", initData: ArrayBuffer? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaEncryptedEventInit = js("({ initDataType: initDataType, initData: initData, bubbles: bubbles, cancelable: cancelable, composed: composed })") /* please, don't implement this interface! */ @JsName("null") diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.events.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.events.kt similarity index 82% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.events.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.events.kt index a406b79..2d384c2 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.events.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.events.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -38,7 +38,7 @@ public external interface UIEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun UIEventInit(view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): UIEventInit { js("return { view, detail, bubbles, cancelable, composed };") } +public fun UIEventInit(view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): UIEventInit = js("({ view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [FocusEvent](https://developer.mozilla.org/en/docs/Web/API/FocusEvent) to Kotlin @@ -61,7 +61,7 @@ public external interface FocusEventInit : UIEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun FocusEventInit(relatedTarget: EventTarget? = null, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FocusEventInit { js("return { relatedTarget, view, detail, bubbles, cancelable, composed };") } +public fun FocusEventInit(relatedTarget: EventTarget? = null, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FocusEventInit = js("({ relatedTarget: relatedTarget, view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [MouseEvent](https://developer.mozilla.org/en/docs/Web/API/MouseEvent) to Kotlin @@ -123,7 +123,7 @@ public external interface MouseEventInit : EventModifierInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MouseEventInit(screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MouseEventInit { js("return { screenX, screenY, clientX, clientY, button, buttons, relatedTarget, region, ctrlKey, shiftKey, altKey, metaKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierHyper, modifierNumLock, modifierScrollLock, modifierSuper, modifierSymbol, modifierSymbolLock, view, detail, bubbles, cancelable, composed };") } +public fun MouseEventInit(screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MouseEventInit = js("({ screenX: screenX, screenY: screenY, clientX: clientX, clientY: clientY, button: button, buttons: buttons, relatedTarget: relatedTarget, region: region, ctrlKey: ctrlKey, shiftKey: shiftKey, altKey: altKey, metaKey: metaKey, modifierAltGraph: modifierAltGraph, modifierCapsLock: modifierCapsLock, modifierFn: modifierFn, modifierFnLock: modifierFnLock, modifierHyper: modifierHyper, modifierNumLock: modifierNumLock, modifierScrollLock: modifierScrollLock, modifierSuper: modifierSuper, modifierSymbol: modifierSymbol, modifierSymbolLock: modifierSymbolLock, view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") public external interface EventModifierInit : UIEventInit, JsAny { var ctrlKey: Boolean? /* = false */ @@ -171,7 +171,7 @@ public external interface EventModifierInit : UIEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun EventModifierInit(ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): EventModifierInit { js("return { ctrlKey, shiftKey, altKey, metaKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierHyper, modifierNumLock, modifierScrollLock, modifierSuper, modifierSymbol, modifierSymbolLock, view, detail, bubbles, cancelable, composed };") } +public fun EventModifierInit(ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): EventModifierInit = js("({ ctrlKey: ctrlKey, shiftKey: shiftKey, altKey: altKey, metaKey: metaKey, modifierAltGraph: modifierAltGraph, modifierCapsLock: modifierCapsLock, modifierFn: modifierFn, modifierFnLock: modifierFnLock, modifierHyper: modifierHyper, modifierNumLock: modifierNumLock, modifierScrollLock: modifierScrollLock, modifierSuper: modifierSuper, modifierSymbol: modifierSymbol, modifierSymbolLock: modifierSymbolLock, view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [WheelEvent](https://developer.mozilla.org/en/docs/Web/API/WheelEvent) to Kotlin @@ -209,7 +209,7 @@ public external interface WheelEventInit : MouseEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun WheelEventInit(deltaX: Double? = 0.0, deltaY: Double? = 0.0, deltaZ: Double? = 0.0, deltaMode: Int? = 0, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WheelEventInit { js("return { deltaX, deltaY, deltaZ, deltaMode, screenX, screenY, clientX, clientY, button, buttons, relatedTarget, region, ctrlKey, shiftKey, altKey, metaKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierHyper, modifierNumLock, modifierScrollLock, modifierSuper, modifierSymbol, modifierSymbolLock, view, detail, bubbles, cancelable, composed };") } +public fun WheelEventInit(deltaX: Double? = 0.0, deltaY: Double? = 0.0, deltaZ: Double? = 0.0, deltaMode: Int? = 0, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WheelEventInit = js("({ deltaX: deltaX, deltaY: deltaY, deltaZ: deltaZ, deltaMode: deltaMode, screenX: screenX, screenY: screenY, clientX: clientX, clientY: clientY, button: button, buttons: buttons, relatedTarget: relatedTarget, region: region, ctrlKey: ctrlKey, shiftKey: shiftKey, altKey: altKey, metaKey: metaKey, modifierAltGraph: modifierAltGraph, modifierCapsLock: modifierCapsLock, modifierFn: modifierFn, modifierFnLock: modifierFnLock, modifierHyper: modifierHyper, modifierNumLock: modifierNumLock, modifierScrollLock: modifierScrollLock, modifierSuper: modifierSuper, modifierSymbol: modifierSymbol, modifierSymbolLock: modifierSymbolLock, view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [InputEvent](https://developer.mozilla.org/en/docs/Web/API/InputEvent) to Kotlin @@ -236,7 +236,7 @@ public external interface InputEventInit : UIEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun InputEventInit(data: String? = "", isComposing: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): InputEventInit { js("return { data, isComposing, view, detail, bubbles, cancelable, composed };") } +public fun InputEventInit(data: String? = "", isComposing: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): InputEventInit = js("({ data: data, isComposing: isComposing, view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [KeyboardEvent](https://developer.mozilla.org/en/docs/Web/API/KeyboardEvent) to Kotlin @@ -287,7 +287,7 @@ public external interface KeyboardEventInit : EventModifierInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun KeyboardEventInit(key: String? = "", code: String? = "", location: Int? = 0, repeat: Boolean? = false, isComposing: Boolean? = false, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): KeyboardEventInit { js("return { key, code, location, repeat, isComposing, ctrlKey, shiftKey, altKey, metaKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierHyper, modifierNumLock, modifierScrollLock, modifierSuper, modifierSymbol, modifierSymbolLock, view, detail, bubbles, cancelable, composed };") } +public fun KeyboardEventInit(key: String? = "", code: String? = "", location: Int? = 0, repeat: Boolean? = false, isComposing: Boolean? = false, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): KeyboardEventInit = js("({ key: key, code: code, location: location, repeat: repeat, isComposing: isComposing, ctrlKey: ctrlKey, shiftKey: shiftKey, altKey: altKey, metaKey: metaKey, modifierAltGraph: modifierAltGraph, modifierCapsLock: modifierCapsLock, modifierFn: modifierFn, modifierFnLock: modifierFnLock, modifierHyper: modifierHyper, modifierNumLock: modifierNumLock, modifierScrollLock: modifierScrollLock, modifierSuper: modifierSuper, modifierSymbol: modifierSymbol, modifierSymbolLock: modifierSymbolLock, view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [CompositionEvent](https://developer.mozilla.org/en/docs/Web/API/CompositionEvent) to Kotlin @@ -310,7 +310,7 @@ public external interface CompositionEventInit : UIEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun CompositionEventInit(data: String? = "", view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CompositionEventInit { js("return { data, view, detail, bubbles, cancelable, composed };") } +public fun CompositionEventInit(data: String? = "", view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CompositionEventInit = js("({ data: data, view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [Event](https://developer.mozilla.org/en/docs/Web/API/Event) to Kotlin diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.kt similarity index 97% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.kt index 15e9b9b..fb501a6 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -32,12 +32,12 @@ public external abstract class HTMLAllCollection : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForHTMLAllCollection(obj: HTMLAllCollection, index: Int): Element? { js("return obj[index];") } +internal fun getMethodImplForHTMLAllCollection(obj: HTMLAllCollection, index: Int): Element? = js("obj[index]") public operator fun HTMLAllCollection.get(index: Int): Element? = getMethodImplForHTMLAllCollection(this, index) @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForHTMLAllCollection(obj: HTMLAllCollection, name: String): UnionElementOrHTMLCollection? { js("return obj[name];") } +internal fun getMethodImplForHTMLAllCollection(obj: HTMLAllCollection, name: String): UnionElementOrHTMLCollection? = js("obj[name]") public operator fun HTMLAllCollection.get(name: String): UnionElementOrHTMLCollection? = getMethodImplForHTMLAllCollection(this, name) @@ -152,7 +152,7 @@ public external abstract class HTMLUnknownElement : HTMLElement, JsAny { public external abstract class DOMStringMap : JsAny @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForDOMStringMap(obj: DOMStringMap, name: String): String? { js("return obj[name];") } +internal fun getMethodImplForDOMStringMap(obj: DOMStringMap, name: String): String? = js("obj[name]") public operator fun DOMStringMap.get(name: String): String? = getMethodImplForDOMStringMap(this, name) @@ -1382,7 +1382,7 @@ public external abstract class AudioTrackList : EventTarget, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForAudioTrackList(obj: AudioTrackList, index: Int): AudioTrack? { js("return obj[index];") } +internal fun getMethodImplForAudioTrackList(obj: AudioTrackList, index: Int): AudioTrack? = js("obj[index]") public operator fun AudioTrackList.get(index: Int): AudioTrack? = getMethodImplForAudioTrackList(this, index) @@ -1411,7 +1411,7 @@ public external abstract class VideoTrackList : EventTarget, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForVideoTrackList(obj: VideoTrackList, index: Int): VideoTrack? { js("return obj[index];") } +internal fun getMethodImplForVideoTrackList(obj: VideoTrackList, index: Int): VideoTrack? = js("obj[index]") public operator fun VideoTrackList.get(index: Int): VideoTrack? = getMethodImplForVideoTrackList(this, index) @@ -1436,7 +1436,7 @@ public external abstract class TextTrackList : EventTarget, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForTextTrackList(obj: TextTrackList, index: Int): TextTrack? { js("return obj[index];") } +internal fun getMethodImplForTextTrackList(obj: TextTrackList, index: Int): TextTrack? = js("obj[index]") public operator fun TextTrackList.get(index: Int): TextTrack? = getMethodImplForTextTrackList(this, index) @@ -1464,7 +1464,7 @@ public external abstract class TextTrackCueList : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForTextTrackCueList(obj: TextTrackCueList, index: Int): TextTrackCue? { js("return obj[index];") } +internal fun getMethodImplForTextTrackCueList(obj: TextTrackCueList, index: Int): TextTrackCue? = js("obj[index]") public operator fun TextTrackCueList.get(index: Int): TextTrackCue? = getMethodImplForTextTrackCueList(this, index) @@ -1511,7 +1511,7 @@ public external interface TrackEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun TrackEventInit(track: UnionAudioTrackOrTextTrackOrVideoTrack? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): TrackEventInit { js("return { track, bubbles, cancelable, composed };") } +public fun TrackEventInit(track: UnionAudioTrackOrTextTrackOrVideoTrack? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): TrackEventInit = js("({ track: track, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [HTMLMapElement](https://developer.mozilla.org/en/docs/Web/API/HTMLMapElement) to Kotlin @@ -1846,12 +1846,12 @@ public external abstract class HTMLFormElement : HTMLElement, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForHTMLFormElement(obj: HTMLFormElement, index: Int): Element? { js("return obj[index];") } +internal fun getMethodImplForHTMLFormElement(obj: HTMLFormElement, index: Int): Element? = js("obj[index]") public operator fun HTMLFormElement.get(index: Int): Element? = getMethodImplForHTMLFormElement(this, index) @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForHTMLFormElement(obj: HTMLFormElement, name: String): UnionElementOrRadioNodeList? { js("return obj[name];") } +internal fun getMethodImplForHTMLFormElement(obj: HTMLFormElement, name: String): UnionElementOrRadioNodeList? = js("obj[name]") public operator fun HTMLFormElement.get(name: String): UnionElementOrRadioNodeList? = getMethodImplForHTMLFormElement(this, name) @@ -2069,7 +2069,7 @@ public external abstract class HTMLSelectElement : HTMLElement, ItemArrayLike?, reason: JsAny? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PromiseRejectionEventInit { js("return { promise, reason, bubbles, cancelable, composed };") } +public fun PromiseRejectionEventInit(promise: Promise?, reason: JsAny? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PromiseRejectionEventInit = js("({ promise: promise, reason: reason, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [GlobalEventHandlers](https://developer.mozilla.org/en/docs/Web/API/GlobalEventHandlers) to Kotlin @@ -3741,12 +3741,12 @@ public external abstract class PluginArray : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForPluginArray(obj: PluginArray, index: Int): Plugin? { js("return obj[index];") } +internal fun getMethodImplForPluginArray(obj: PluginArray, index: Int): Plugin? = js("obj[index]") public operator fun PluginArray.get(index: Int): Plugin? = getMethodImplForPluginArray(this, index) @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForPluginArray(obj: PluginArray, name: String): Plugin? { js("return obj[name];") } +internal fun getMethodImplForPluginArray(obj: PluginArray, name: String): Plugin? = js("obj[name]") public operator fun PluginArray.get(name: String): Plugin? = getMethodImplForPluginArray(this, name) @@ -3759,12 +3759,12 @@ public external abstract class MimeTypeArray : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForMimeTypeArray(obj: MimeTypeArray, index: Int): MimeType? { js("return obj[index];") } +internal fun getMethodImplForMimeTypeArray(obj: MimeTypeArray, index: Int): MimeType? = js("obj[index]") public operator fun MimeTypeArray.get(index: Int): MimeType? = getMethodImplForMimeTypeArray(this, index) @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForMimeTypeArray(obj: MimeTypeArray, name: String): MimeType? { js("return obj[name];") } +internal fun getMethodImplForMimeTypeArray(obj: MimeTypeArray, name: String): MimeType? = js("obj[name]") public operator fun MimeTypeArray.get(name: String): MimeType? = getMethodImplForMimeTypeArray(this, name) @@ -3780,12 +3780,12 @@ public external abstract class Plugin : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForPlugin(obj: Plugin, index: Int): MimeType? { js("return obj[index];") } +internal fun getMethodImplForPlugin(obj: Plugin, index: Int): MimeType? = js("obj[index]") public operator fun Plugin.get(index: Int): MimeType? = getMethodImplForPlugin(this, index) @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForPlugin(obj: Plugin, name: String): MimeType? { js("return obj[name];") } +internal fun getMethodImplForPlugin(obj: Plugin, name: String): MimeType? = js("obj[name]") public operator fun Plugin.get(name: String): MimeType? = getMethodImplForPlugin(this, name) @@ -3830,7 +3830,7 @@ public external interface ImageBitmapOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ImageBitmapOptions(imageOrientation: ImageOrientation? = ImageOrientation.NONE, premultiplyAlpha: PremultiplyAlpha? = PremultiplyAlpha.DEFAULT, colorSpaceConversion: ColorSpaceConversion? = ColorSpaceConversion.DEFAULT, resizeWidth: Int? = undefined, resizeHeight: Int? = undefined, resizeQuality: ResizeQuality? = ResizeQuality.LOW): ImageBitmapOptions { js("return { imageOrientation, premultiplyAlpha, colorSpaceConversion, resizeWidth, resizeHeight, resizeQuality };") } +public fun ImageBitmapOptions(imageOrientation: ImageOrientation? = ImageOrientation.NONE, premultiplyAlpha: PremultiplyAlpha? = PremultiplyAlpha.DEFAULT, colorSpaceConversion: ColorSpaceConversion? = ColorSpaceConversion.DEFAULT, resizeWidth: Int? = undefined, resizeHeight: Int? = undefined, resizeQuality: ResizeQuality? = ResizeQuality.LOW): ImageBitmapOptions = js("({ imageOrientation: imageOrientation, premultiplyAlpha: premultiplyAlpha, colorSpaceConversion: colorSpaceConversion, resizeWidth: resizeWidth, resizeHeight: resizeHeight, resizeQuality: resizeQuality })") /** * Exposes the JavaScript [MessageEvent](https://developer.mozilla.org/en/docs/Web/API/MessageEvent) to Kotlin @@ -3870,7 +3870,7 @@ public external interface MessageEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MessageEventInit(data: JsAny? = null, origin: String? = "", lastEventId: String? = "", source: UnionMessagePortOrWindowProxy? = null, ports: JsArray? = JsArray(), bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MessageEventInit { js("return { data, origin, lastEventId, source, ports, bubbles, cancelable, composed };") } +public fun MessageEventInit(data: JsAny? = null, origin: String? = "", lastEventId: String? = "", source: UnionMessagePortOrWindowProxy? = null, ports: JsArray? = JsArray(), bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MessageEventInit = js("({ data: data, origin: origin, lastEventId: lastEventId, source: source, ports: ports, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [EventSource](https://developer.mozilla.org/en/docs/Web/API/EventSource) to Kotlin @@ -3898,7 +3898,7 @@ public external interface EventSourceInit : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun EventSourceInit(withCredentials: Boolean? = false): EventSourceInit { js("return { withCredentials };") } +public fun EventSourceInit(withCredentials: Boolean? = false): EventSourceInit = js("({ withCredentials: withCredentials })") /** * Exposes the JavaScript [WebSocket](https://developer.mozilla.org/en/docs/Web/API/WebSocket) to Kotlin @@ -3957,7 +3957,7 @@ public external interface CloseEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun CloseEventInit(wasClean: Boolean? = false, code: Short? = 0, reason: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CloseEventInit { js("return { wasClean, code, reason, bubbles, cancelable, composed };") } +public fun CloseEventInit(wasClean: Boolean? = false, code: Short? = 0, reason: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CloseEventInit = js("({ wasClean: wasClean, code: code, reason: reason, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [MessageChannel](https://developer.mozilla.org/en/docs/Web/API/MessageChannel) to Kotlin @@ -4051,7 +4051,7 @@ public external interface WorkerOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun WorkerOptions(type: WorkerType? = WorkerType.CLASSIC, credentials: RequestCredentials? = RequestCredentials.OMIT): WorkerOptions { js("return { type, credentials };") } +public fun WorkerOptions(type: WorkerType? = WorkerType.CLASSIC, credentials: RequestCredentials? = RequestCredentials.OMIT): WorkerOptions = js("({ type: type, credentials: credentials })") /** * Exposes the JavaScript [SharedWorker](https://developer.mozilla.org/en/docs/Web/API/SharedWorker) to Kotlin @@ -4103,7 +4103,7 @@ public external abstract class Storage : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForStorage(obj: Storage, key: String): String? { js("return obj[key];") } +internal fun getMethodImplForStorage(obj: Storage, key: String): String? = js("obj[key]") public operator fun Storage.get(key: String): String? = getMethodImplForStorage(this, key) @@ -4163,7 +4163,7 @@ public external interface StorageEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun StorageEventInit(key: String? = null, oldValue: String? = null, newValue: String? = null, url: String? = "", storageArea: Storage? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): StorageEventInit { js("return { key, oldValue, newValue, url, storageArea, bubbles, cancelable, composed };") } +public fun StorageEventInit(key: String? = null, oldValue: String? = null, newValue: String? = null, url: String? = "", storageArea: Storage? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): StorageEventInit = js("({ key: key, oldValue: oldValue, newValue: newValue, url: url, storageArea: storageArea, bubbles: bubbles, cancelable: cancelable, composed: composed })") public external abstract class HTMLAppletElement : HTMLElement, JsAny { open var align: String @@ -4379,7 +4379,7 @@ public external interface EventInit : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun EventInit(bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): EventInit { js("return { bubbles, cancelable, composed };") } +public fun EventInit(bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): EventInit = js("({ bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [CustomEvent](https://developer.mozilla.org/en/docs/Web/API/CustomEvent) to Kotlin @@ -4403,7 +4403,7 @@ public external interface CustomEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun CustomEventInit(detail: JsAny? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CustomEventInit { js("return { detail, bubbles, cancelable, composed };") } +public fun CustomEventInit(detail: JsAny? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): CustomEventInit = js("({ detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") public external interface EventListenerOptions : JsAny { var capture: Boolean? /* = false */ @@ -4412,7 +4412,7 @@ public external interface EventListenerOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun EventListenerOptions(capture: Boolean? = false): EventListenerOptions { js("return { capture };") } +public fun EventListenerOptions(capture: Boolean? = false): EventListenerOptions = js("({ capture: capture })") public external interface AddEventListenerOptions : EventListenerOptions, JsAny { var passive: Boolean? /* = false */ @@ -4424,7 +4424,7 @@ public external interface AddEventListenerOptions : EventListenerOptions, JsAny } @Suppress("UNUSED_PARAMETER") -public fun AddEventListenerOptions(passive: Boolean? = false, once: Boolean? = false, capture: Boolean? = false): AddEventListenerOptions { js("return { passive, once, capture };") } +public fun AddEventListenerOptions(passive: Boolean? = false, once: Boolean? = false, capture: Boolean? = false): AddEventListenerOptions = js("({ passive: passive, once: once, capture: capture })") public external interface NonElementParentNode : JsAny { fun getElementById(elementId: String): Element? @@ -4495,7 +4495,7 @@ public external abstract class NodeList : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForNodeList(obj: NodeList, index: Int): Node? { js("return obj[index];") } +internal fun getMethodImplForNodeList(obj: NodeList, index: Int): Node? = js("obj[index]") public operator fun NodeList.get(index: Int): Node? = getMethodImplForNodeList(this, index) @@ -4508,12 +4508,12 @@ public external abstract class HTMLCollection : ItemArrayLike, UnionEle } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForHTMLCollection(obj: HTMLCollection, index: Int): Element? { js("return obj[index];") } +internal fun getMethodImplForHTMLCollection(obj: HTMLCollection, index: Int): Element? = js("obj[index]") public operator fun HTMLCollection.get(index: Int): Element? = getMethodImplForHTMLCollection(this, index) @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForHTMLCollection(obj: HTMLCollection, name: String): Element? { js("return obj[name];") } +internal fun getMethodImplForHTMLCollection(obj: HTMLCollection, name: String): Element? = js("obj[name]") public operator fun HTMLCollection.get(name: String): Element? = getMethodImplForHTMLCollection(this, name) @@ -4554,7 +4554,7 @@ public external interface MutationObserverInit : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MutationObserverInit(childList: Boolean? = false, attributes: Boolean? = undefined, characterData: Boolean? = undefined, subtree: Boolean? = false, attributeOldValue: Boolean? = undefined, characterDataOldValue: Boolean? = undefined, attributeFilter: JsArray? = undefined): MutationObserverInit { js("return { childList, attributes, characterData, subtree, attributeOldValue, characterDataOldValue, attributeFilter };") } +public fun MutationObserverInit(childList: Boolean? = false, attributes: Boolean? = undefined, characterData: Boolean? = undefined, subtree: Boolean? = false, attributeOldValue: Boolean? = undefined, characterDataOldValue: Boolean? = undefined, attributeFilter: JsArray? = undefined): MutationObserverInit = js("({ childList: childList, attributes: attributes, characterData: characterData, subtree: subtree, attributeOldValue: attributeOldValue, characterDataOldValue: characterDataOldValue, attributeFilter: attributeFilter })") /** * Exposes the JavaScript [MutationRecord](https://developer.mozilla.org/en/docs/Web/API/MutationRecord) to Kotlin @@ -4634,7 +4634,7 @@ public external interface GetRootNodeOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun GetRootNodeOptions(composed: Boolean? = false): GetRootNodeOptions { js("return { composed };") } +public fun GetRootNodeOptions(composed: Boolean? = false): GetRootNodeOptions = js("({ composed: composed })") /** * Exposes the JavaScript [Document](https://developer.mozilla.org/en/docs/Web/API/Document) to Kotlin @@ -4849,7 +4849,7 @@ public external open class Document : Node, GlobalEventHandlers, DocumentAndElem } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForDocument(obj: Document, name: String): JsAny? { js("return obj[name];") } +internal fun getMethodImplForDocument(obj: Document, name: String): JsAny? = js("obj[name]") public operator fun Document.get(name: String): JsAny? = getMethodImplForDocument(this, name) @@ -4886,7 +4886,7 @@ public external interface ElementCreationOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ElementCreationOptions(param_is: String? = undefined): ElementCreationOptions { js("return { is };") } +public fun ElementCreationOptions(param_is: String? = undefined): ElementCreationOptions = js("({ is: is })") /** * Exposes the JavaScript [DOMImplementation](https://developer.mozilla.org/en/docs/Web/API/DOMImplementation) to Kotlin @@ -5088,7 +5088,7 @@ public external interface ShadowRootInit : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ShadowRootInit(mode: ShadowRootMode?): ShadowRootInit { js("return { mode };") } +public fun ShadowRootInit(mode: ShadowRootMode?): ShadowRootInit = js("({ mode: mode })") /** * Exposes the JavaScript [NamedNodeMap](https://developer.mozilla.org/en/docs/Web/API/NamedNodeMap) to Kotlin @@ -5104,12 +5104,12 @@ public external abstract class NamedNodeMap : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForNamedNodeMap(obj: NamedNodeMap, index: Int): Attr? { js("return obj[index];") } +internal fun getMethodImplForNamedNodeMap(obj: NamedNodeMap, index: Int): Attr? = js("obj[index]") public operator fun NamedNodeMap.get(index: Int): Attr? = getMethodImplForNamedNodeMap(this, index) @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForNamedNodeMap(obj: NamedNodeMap, qualifiedName: String): Attr? { js("return obj[qualifiedName];") } +internal fun getMethodImplForNamedNodeMap(obj: NamedNodeMap, qualifiedName: String): Attr? = js("obj[qualifiedName]") public operator fun NamedNodeMap.get(qualifiedName: String): Attr? = getMethodImplForNamedNodeMap(this, qualifiedName) @@ -5435,7 +5435,7 @@ public external abstract class DOMTokenList : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForDOMTokenList(obj: DOMTokenList, index: Int): String? { js("return obj[index];") } +internal fun getMethodImplForDOMTokenList(obj: DOMTokenList, index: Int): String? = js("obj[index]") public operator fun DOMTokenList.get(index: Int): String? = getMethodImplForDOMTokenList(this, index) @@ -5481,7 +5481,7 @@ public external interface DOMPointInit : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun DOMPointInit(x: Double? = 0.0, y: Double? = 0.0, z: Double? = 0.0, w: Double? = 1.0): DOMPointInit { js("return { x, y, z, w };") } +public fun DOMPointInit(x: Double? = 0.0, y: Double? = 0.0, z: Double? = 0.0, w: Double? = 1.0): DOMPointInit = js("({ x: x, y: y, z: z, w: w })") /** * Exposes the JavaScript [DOMRect](https://developer.mozilla.org/en/docs/Web/API/DOMRect) to Kotlin @@ -5523,14 +5523,14 @@ public external interface DOMRectInit : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun DOMRectInit(x: Double? = 0.0, y: Double? = 0.0, width: Double? = 0.0, height: Double? = 0.0): DOMRectInit { js("return { x, y, width, height };") } +public fun DOMRectInit(x: Double? = 0.0, y: Double? = 0.0, width: Double? = 0.0, height: Double? = 0.0): DOMRectInit = js("({ x: x, y: y, width: width, height: height })") public external interface DOMRectList : ItemArrayLike, JsAny { override fun item(index: Int): DOMRect? } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForDOMRectList(obj: DOMRectList, index: Int): DOMRect? { js("return obj[index];") } +internal fun getMethodImplForDOMRectList(obj: DOMRectList, index: Int): DOMRect? = js("obj[index]") public operator fun DOMRectList.get(index: Int): DOMRect? = getMethodImplForDOMRectList(this, index) @@ -5646,7 +5646,7 @@ public external interface ScrollOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ScrollOptions(behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollOptions { js("return { behavior };") } +public fun ScrollOptions(behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollOptions = js("({ behavior: behavior })") /** * Exposes the JavaScript [ScrollToOptions](https://developer.mozilla.org/en/docs/Web/API/ScrollToOptions) to Kotlin @@ -5661,7 +5661,7 @@ public external interface ScrollToOptions : ScrollOptions, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ScrollToOptions(left: Double? = undefined, top: Double? = undefined, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollToOptions { js("return { left, top, behavior };") } +public fun ScrollToOptions(left: Double? = undefined, top: Double? = undefined, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollToOptions = js("({ left: left, top: top, behavior: behavior })") /** * Exposes the JavaScript [MediaQueryList](https://developer.mozilla.org/en/docs/Web/API/MediaQueryList) to Kotlin @@ -5701,7 +5701,7 @@ public external interface MediaQueryListEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaQueryListEventInit(media: String? = "", matches: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaQueryListEventInit { js("return { media, matches, bubbles, cancelable, composed };") } +public fun MediaQueryListEventInit(media: String? = "", matches: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaQueryListEventInit = js("({ media: media, matches: matches, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [Screen](https://developer.mozilla.org/en/docs/Web/API/Screen) to Kotlin @@ -5734,7 +5734,7 @@ public external interface ScrollIntoViewOptions : ScrollOptions, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ScrollIntoViewOptions(block: ScrollLogicalPosition? = ScrollLogicalPosition.CENTER, inline: ScrollLogicalPosition? = ScrollLogicalPosition.CENTER, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollIntoViewOptions { js("return { block, inline, behavior };") } +public fun ScrollIntoViewOptions(block: ScrollLogicalPosition? = ScrollLogicalPosition.CENTER, inline: ScrollLogicalPosition? = ScrollLogicalPosition.CENTER, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollIntoViewOptions = js("({ block: block, inline: inline, behavior: behavior })") public external interface BoxQuadOptions : JsAny { var box: CSSBoxType? /* = CSSBoxType.BORDER */ @@ -5746,7 +5746,7 @@ public external interface BoxQuadOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun BoxQuadOptions(box: CSSBoxType? = CSSBoxType.BORDER, relativeTo: JsAny? /* Text|Element|CSSPseudoElement|Document */ = undefined): BoxQuadOptions { js("return { box, relativeTo };") } +public fun BoxQuadOptions(box: CSSBoxType? = CSSBoxType.BORDER, relativeTo: JsAny? /* Text|Element|CSSPseudoElement|Document */ = undefined): BoxQuadOptions = js("({ box: box, relativeTo: relativeTo })") public external interface ConvertCoordinateOptions : JsAny { var fromBox: CSSBoxType? /* = CSSBoxType.BORDER */ @@ -5758,7 +5758,7 @@ public external interface ConvertCoordinateOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ConvertCoordinateOptions(fromBox: CSSBoxType? = CSSBoxType.BORDER, toBox: CSSBoxType? = CSSBoxType.BORDER): ConvertCoordinateOptions { js("return { fromBox, toBox };") } +public fun ConvertCoordinateOptions(fromBox: CSSBoxType? = CSSBoxType.BORDER, toBox: CSSBoxType? = CSSBoxType.BORDER): ConvertCoordinateOptions = js("({ fromBox: fromBox, toBox: toBox })") /** * Exposes the JavaScript [GeometryUtils](https://developer.mozilla.org/en/docs/Web/API/GeometryUtils) to Kotlin @@ -5796,7 +5796,7 @@ public external abstract class TouchList : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForTouchList(obj: TouchList, index: Int): Touch? { js("return obj[index];") } +internal fun getMethodImplForTouchList(obj: TouchList, index: Int): Touch? = js("obj[index]") public operator fun TouchList.get(index: Int): Touch? = getMethodImplForTouchList(this, index) diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.mediacapture.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.mediacapture.kt similarity index 87% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.mediacapture.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.mediacapture.kt index d1e448d..02c5c47 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.mediacapture.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.mediacapture.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -110,7 +110,7 @@ public external interface MediaTrackSupportedConstraints : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaTrackSupportedConstraints(width: Boolean? = true, height: Boolean? = true, aspectRatio: Boolean? = true, frameRate: Boolean? = true, facingMode: Boolean? = true, resizeMode: Boolean? = true, volume: Boolean? = true, sampleRate: Boolean? = true, sampleSize: Boolean? = true, echoCancellation: Boolean? = true, autoGainControl: Boolean? = true, noiseSuppression: Boolean? = true, latency: Boolean? = true, channelCount: Boolean? = true, deviceId: Boolean? = true, groupId: Boolean? = true): MediaTrackSupportedConstraints { js("return { width, height, aspectRatio, frameRate, facingMode, resizeMode, volume, sampleRate, sampleSize, echoCancellation, autoGainControl, noiseSuppression, latency, channelCount, deviceId, groupId };") } +public fun MediaTrackSupportedConstraints(width: Boolean? = true, height: Boolean? = true, aspectRatio: Boolean? = true, frameRate: Boolean? = true, facingMode: Boolean? = true, resizeMode: Boolean? = true, volume: Boolean? = true, sampleRate: Boolean? = true, sampleSize: Boolean? = true, echoCancellation: Boolean? = true, autoGainControl: Boolean? = true, noiseSuppression: Boolean? = true, latency: Boolean? = true, channelCount: Boolean? = true, deviceId: Boolean? = true, groupId: Boolean? = true): MediaTrackSupportedConstraints = js("({ width: width, height: height, aspectRatio: aspectRatio, frameRate: frameRate, facingMode: facingMode, resizeMode: resizeMode, volume: volume, sampleRate: sampleRate, sampleSize: sampleSize, echoCancellation: echoCancellation, autoGainControl: autoGainControl, noiseSuppression: noiseSuppression, latency: latency, channelCount: channelCount, deviceId: deviceId, groupId: groupId })") public external interface MediaTrackCapabilities : JsAny { var width: ULongRange? @@ -164,7 +164,7 @@ public external interface MediaTrackCapabilities : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaTrackCapabilities(width: ULongRange? = undefined, height: ULongRange? = undefined, aspectRatio: DoubleRange? = undefined, frameRate: DoubleRange? = undefined, facingMode: JsArray? = undefined, resizeMode: JsArray? = undefined, volume: DoubleRange? = undefined, sampleRate: ULongRange? = undefined, sampleSize: ULongRange? = undefined, echoCancellation: JsArray? = undefined, autoGainControl: JsArray? = undefined, noiseSuppression: JsArray? = undefined, latency: DoubleRange? = undefined, channelCount: ULongRange? = undefined, deviceId: String? = undefined, groupId: String? = undefined): MediaTrackCapabilities { js("return { width, height, aspectRatio, frameRate, facingMode, resizeMode, volume, sampleRate, sampleSize, echoCancellation, autoGainControl, noiseSuppression, latency, channelCount, deviceId, groupId };") } +public fun MediaTrackCapabilities(width: ULongRange? = undefined, height: ULongRange? = undefined, aspectRatio: DoubleRange? = undefined, frameRate: DoubleRange? = undefined, facingMode: JsArray? = undefined, resizeMode: JsArray? = undefined, volume: DoubleRange? = undefined, sampleRate: ULongRange? = undefined, sampleSize: ULongRange? = undefined, echoCancellation: JsArray? = undefined, autoGainControl: JsArray? = undefined, noiseSuppression: JsArray? = undefined, latency: DoubleRange? = undefined, channelCount: ULongRange? = undefined, deviceId: String? = undefined, groupId: String? = undefined): MediaTrackCapabilities = js("({ width: width, height: height, aspectRatio: aspectRatio, frameRate: frameRate, facingMode: facingMode, resizeMode: resizeMode, volume: volume, sampleRate: sampleRate, sampleSize: sampleSize, echoCancellation: echoCancellation, autoGainControl: autoGainControl, noiseSuppression: noiseSuppression, latency: latency, channelCount: channelCount, deviceId: deviceId, groupId: groupId })") /** * Exposes the JavaScript [MediaTrackConstraints](https://developer.mozilla.org/en/docs/Web/API/MediaTrackConstraints) to Kotlin @@ -176,7 +176,7 @@ public external interface MediaTrackConstraints : MediaTrackConstraintSet, JsAny } @Suppress("UNUSED_PARAMETER") -public fun MediaTrackConstraints(advanced: JsArray? = undefined, width: JsAny? /* Int|ConstrainULongRange */ = undefined, height: JsAny? /* Int|ConstrainULongRange */ = undefined, aspectRatio: JsAny? /* Double|ConstrainDoubleRange */ = undefined, frameRate: JsAny? /* Double|ConstrainDoubleRange */ = undefined, facingMode: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, resizeMode: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, volume: JsAny? /* Double|ConstrainDoubleRange */ = undefined, sampleRate: JsAny? /* Int|ConstrainULongRange */ = undefined, sampleSize: JsAny? /* Int|ConstrainULongRange */ = undefined, echoCancellation: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, autoGainControl: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, noiseSuppression: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, latency: JsAny? /* Double|ConstrainDoubleRange */ = undefined, channelCount: JsAny? /* Int|ConstrainULongRange */ = undefined, deviceId: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, groupId: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined): MediaTrackConstraints { js("return { advanced, width, height, aspectRatio, frameRate, facingMode, resizeMode, volume, sampleRate, sampleSize, echoCancellation, autoGainControl, noiseSuppression, latency, channelCount, deviceId, groupId };") } +public fun MediaTrackConstraints(advanced: JsArray? = undefined, width: JsAny? /* Int|ConstrainULongRange */ = undefined, height: JsAny? /* Int|ConstrainULongRange */ = undefined, aspectRatio: JsAny? /* Double|ConstrainDoubleRange */ = undefined, frameRate: JsAny? /* Double|ConstrainDoubleRange */ = undefined, facingMode: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, resizeMode: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, volume: JsAny? /* Double|ConstrainDoubleRange */ = undefined, sampleRate: JsAny? /* Int|ConstrainULongRange */ = undefined, sampleSize: JsAny? /* Int|ConstrainULongRange */ = undefined, echoCancellation: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, autoGainControl: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, noiseSuppression: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, latency: JsAny? /* Double|ConstrainDoubleRange */ = undefined, channelCount: JsAny? /* Int|ConstrainULongRange */ = undefined, deviceId: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, groupId: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined): MediaTrackConstraints = js("({ advanced: advanced, width: width, height: height, aspectRatio: aspectRatio, frameRate: frameRate, facingMode: facingMode, resizeMode: resizeMode, volume: volume, sampleRate: sampleRate, sampleSize: sampleSize, echoCancellation: echoCancellation, autoGainControl: autoGainControl, noiseSuppression: noiseSuppression, latency: latency, channelCount: channelCount, deviceId: deviceId, groupId: groupId })") public external interface MediaTrackConstraintSet : JsAny { var width: JsAny? /* Int|ConstrainULongRange */ @@ -230,7 +230,7 @@ public external interface MediaTrackConstraintSet : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaTrackConstraintSet(width: JsAny? /* Int|ConstrainULongRange */ = undefined, height: JsAny? /* Int|ConstrainULongRange */ = undefined, aspectRatio: JsAny? /* Double|ConstrainDoubleRange */ = undefined, frameRate: JsAny? /* Double|ConstrainDoubleRange */ = undefined, facingMode: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, resizeMode: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, volume: JsAny? /* Double|ConstrainDoubleRange */ = undefined, sampleRate: JsAny? /* Int|ConstrainULongRange */ = undefined, sampleSize: JsAny? /* Int|ConstrainULongRange */ = undefined, echoCancellation: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, autoGainControl: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, noiseSuppression: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, latency: JsAny? /* Double|ConstrainDoubleRange */ = undefined, channelCount: JsAny? /* Int|ConstrainULongRange */ = undefined, deviceId: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, groupId: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined): MediaTrackConstraintSet { js("return { width, height, aspectRatio, frameRate, facingMode, resizeMode, volume, sampleRate, sampleSize, echoCancellation, autoGainControl, noiseSuppression, latency, channelCount, deviceId, groupId };") } +public fun MediaTrackConstraintSet(width: JsAny? /* Int|ConstrainULongRange */ = undefined, height: JsAny? /* Int|ConstrainULongRange */ = undefined, aspectRatio: JsAny? /* Double|ConstrainDoubleRange */ = undefined, frameRate: JsAny? /* Double|ConstrainDoubleRange */ = undefined, facingMode: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, resizeMode: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, volume: JsAny? /* Double|ConstrainDoubleRange */ = undefined, sampleRate: JsAny? /* Int|ConstrainULongRange */ = undefined, sampleSize: JsAny? /* Int|ConstrainULongRange */ = undefined, echoCancellation: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, autoGainControl: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, noiseSuppression: JsAny? /* Boolean|ConstrainBooleanParameters */ = undefined, latency: JsAny? /* Double|ConstrainDoubleRange */ = undefined, channelCount: JsAny? /* Int|ConstrainULongRange */ = undefined, deviceId: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined, groupId: JsAny? /* String|JsArray|ConstrainDOMStringParameters */ = undefined): MediaTrackConstraintSet = js("({ width: width, height: height, aspectRatio: aspectRatio, frameRate: frameRate, facingMode: facingMode, resizeMode: resizeMode, volume: volume, sampleRate: sampleRate, sampleSize: sampleSize, echoCancellation: echoCancellation, autoGainControl: autoGainControl, noiseSuppression: noiseSuppression, latency: latency, channelCount: channelCount, deviceId: deviceId, groupId: groupId })") /** * Exposes the JavaScript [MediaTrackSettings](https://developer.mozilla.org/en/docs/Web/API/MediaTrackSettings) to Kotlin @@ -287,7 +287,7 @@ public external interface MediaTrackSettings : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaTrackSettings(width: Int? = undefined, height: Int? = undefined, aspectRatio: Double? = undefined, frameRate: Double? = undefined, facingMode: String? = undefined, resizeMode: String? = undefined, volume: Double? = undefined, sampleRate: Int? = undefined, sampleSize: Int? = undefined, echoCancellation: Boolean? = undefined, autoGainControl: Boolean? = undefined, noiseSuppression: Boolean? = undefined, latency: Double? = undefined, channelCount: Int? = undefined, deviceId: String? = undefined, groupId: String? = undefined): MediaTrackSettings { js("return { width, height, aspectRatio, frameRate, facingMode, resizeMode, volume, sampleRate, sampleSize, echoCancellation, autoGainControl, noiseSuppression, latency, channelCount, deviceId, groupId };") } +public fun MediaTrackSettings(width: Int? = undefined, height: Int? = undefined, aspectRatio: Double? = undefined, frameRate: Double? = undefined, facingMode: String? = undefined, resizeMode: String? = undefined, volume: Double? = undefined, sampleRate: Int? = undefined, sampleSize: Int? = undefined, echoCancellation: Boolean? = undefined, autoGainControl: Boolean? = undefined, noiseSuppression: Boolean? = undefined, latency: Double? = undefined, channelCount: Int? = undefined, deviceId: String? = undefined, groupId: String? = undefined): MediaTrackSettings = js("({ width: width, height: height, aspectRatio: aspectRatio, frameRate: frameRate, facingMode: facingMode, resizeMode: resizeMode, volume: volume, sampleRate: sampleRate, sampleSize: sampleSize, echoCancellation: echoCancellation, autoGainControl: autoGainControl, noiseSuppression: noiseSuppression, latency: latency, channelCount: channelCount, deviceId: deviceId, groupId: groupId })") /** * Exposes the JavaScript [MediaStreamTrackEvent](https://developer.mozilla.org/en/docs/Web/API/MediaStreamTrackEvent) to Kotlin @@ -308,7 +308,7 @@ public external interface MediaStreamTrackEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaStreamTrackEventInit(track: MediaStreamTrack?, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaStreamTrackEventInit { js("return { track, bubbles, cancelable, composed };") } +public fun MediaStreamTrackEventInit(track: MediaStreamTrack?, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): MediaStreamTrackEventInit = js("({ track: track, bubbles: bubbles, cancelable: cancelable, composed: composed })") public external open class OverconstrainedErrorEvent(type: String, eventInitDict: OverconstrainedErrorEventInit) : Event, JsAny { open val error: JsAny? @@ -328,7 +328,7 @@ public external interface OverconstrainedErrorEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun OverconstrainedErrorEventInit(error: JsAny? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): OverconstrainedErrorEventInit { js("return { error, bubbles, cancelable, composed };") } +public fun OverconstrainedErrorEventInit(error: JsAny? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): OverconstrainedErrorEventInit = js("({ error: error, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [MediaDevices](https://developer.mozilla.org/en/docs/Web/API/MediaDevices) to Kotlin @@ -368,7 +368,7 @@ public external interface MediaStreamConstraints : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun MediaStreamConstraints(video: JsAny? /* Boolean|MediaTrackConstraints */ = false.toJsBoolean(), audio: JsAny? /* Boolean|MediaTrackConstraints */ = false.toJsBoolean()): MediaStreamConstraints { js("return { video, audio };") } +public fun MediaStreamConstraints(video: JsAny? /* Boolean|MediaTrackConstraints */ = false.toJsBoolean(), audio: JsAny? /* Boolean|MediaTrackConstraints */ = false.toJsBoolean()): MediaStreamConstraints = js("({ video: video, audio: audio })") public external interface ConstrainablePattern : JsAny { var onoverconstrained: ((Event) -> Unit)? @@ -393,7 +393,7 @@ public external interface DoubleRange : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun DoubleRange(max: Double? = undefined, min: Double? = undefined): DoubleRange { js("return { max, min };") } +public fun DoubleRange(max: Double? = undefined, min: Double? = undefined): DoubleRange = js("({ max: max, min: min })") public external interface ConstrainDoubleRange : DoubleRange, JsAny { var exact: Double? @@ -405,7 +405,7 @@ public external interface ConstrainDoubleRange : DoubleRange, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ConstrainDoubleRange(exact: Double? = undefined, ideal: Double? = undefined, max: Double? = undefined, min: Double? = undefined): ConstrainDoubleRange { js("return { exact, ideal, max, min };") } +public fun ConstrainDoubleRange(exact: Double? = undefined, ideal: Double? = undefined, max: Double? = undefined, min: Double? = undefined): ConstrainDoubleRange = js("({ exact: exact, ideal: ideal, max: max, min: min })") public external interface ULongRange : JsAny { var max: Int? @@ -417,7 +417,7 @@ public external interface ULongRange : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ULongRange(max: Int? = undefined, min: Int? = undefined): ULongRange { js("return { max, min };") } +public fun ULongRange(max: Int? = undefined, min: Int? = undefined): ULongRange = js("({ max: max, min: min })") public external interface ConstrainULongRange : ULongRange, JsAny { var exact: Int? @@ -429,7 +429,7 @@ public external interface ConstrainULongRange : ULongRange, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ConstrainULongRange(exact: Int? = undefined, ideal: Int? = undefined, max: Int? = undefined, min: Int? = undefined): ConstrainULongRange { js("return { exact, ideal, max, min };") } +public fun ConstrainULongRange(exact: Int? = undefined, ideal: Int? = undefined, max: Int? = undefined, min: Int? = undefined): ConstrainULongRange = js("({ exact: exact, ideal: ideal, max: max, min: min })") /** * Exposes the JavaScript [ConstrainBooleanParameters](https://developer.mozilla.org/en/docs/Web/API/ConstrainBooleanParameters) to Kotlin @@ -444,7 +444,7 @@ public external interface ConstrainBooleanParameters : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ConstrainBooleanParameters(exact: Boolean? = undefined, ideal: Boolean? = undefined): ConstrainBooleanParameters { js("return { exact, ideal };") } +public fun ConstrainBooleanParameters(exact: Boolean? = undefined, ideal: Boolean? = undefined): ConstrainBooleanParameters = js("({ exact: exact, ideal: ideal })") /** * Exposes the JavaScript [ConstrainDOMStringParameters](https://developer.mozilla.org/en/docs/Web/API/ConstrainDOMStringParameters) to Kotlin @@ -459,22 +459,22 @@ public external interface ConstrainDOMStringParameters : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ConstrainDOMStringParameters(exact: JsAny? /* String|JsArray */ = undefined, ideal: JsAny? /* String|JsArray */ = undefined): ConstrainDOMStringParameters { js("return { exact, ideal };") } +public fun ConstrainDOMStringParameters(exact: JsAny? /* String|JsArray */ = undefined, ideal: JsAny? /* String|JsArray */ = undefined): ConstrainDOMStringParameters = js("({ exact: exact, ideal: ideal })") public external interface Capabilities : JsAny @Suppress("UNUSED_PARAMETER") -public fun Capabilities(): Capabilities { js("return { };") } +public fun Capabilities(): Capabilities = js("({ })") public external interface Settings : JsAny @Suppress("UNUSED_PARAMETER") -public fun Settings(): Settings { js("return { };") } +public fun Settings(): Settings = js("({ })") public external interface ConstraintSet : JsAny @Suppress("UNUSED_PARAMETER") -public fun ConstraintSet(): ConstraintSet { js("return { };") } +public fun ConstraintSet(): ConstraintSet = js("({ })") public external interface Constraints : ConstraintSet, JsAny { var advanced: JsArray? @@ -483,7 +483,7 @@ public external interface Constraints : ConstraintSet, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun Constraints(advanced: JsArray? = undefined): Constraints { js("return { advanced };") } +public fun Constraints(advanced: JsArray? = undefined): Constraints = js("({ advanced: advanced })") /* please, don't implement this interface! */ @JsName("null") diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.mediasource.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.mediasource.kt similarity index 96% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.mediasource.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.mediasource.kt index 33e89fb..4489c9e 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.mediasource.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.mediasource.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -69,7 +69,7 @@ public external abstract class SourceBufferList : EventTarget, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForSourceBufferList(obj: SourceBufferList, index: Int): SourceBuffer? { js("return obj[index];") } +internal fun getMethodImplForSourceBufferList(obj: SourceBufferList, index: Int): SourceBuffer? = js("obj[index]") public operator fun SourceBufferList.get(index: Int): SourceBuffer? = getMethodImplForSourceBufferList(this, index) diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.parsing.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.parsing.kt similarity index 92% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.parsing.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.parsing.kt index ca326b0..930889c 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.parsing.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.parsing.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.pointerevents.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.pointerevents.kt similarity index 77% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.pointerevents.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.pointerevents.kt index 9466910..22afcaf 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.pointerevents.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.pointerevents.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -48,7 +48,7 @@ public external interface PointerEventInit : MouseEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun PointerEventInit(pointerId: Int? = 0, width: Double? = 1.0, height: Double? = 1.0, pressure: Float? = 0f, tangentialPressure: Float? = 0f, tiltX: Int? = 0, tiltY: Int? = 0, twist: Int? = 0, pointerType: String? = "", isPrimary: Boolean? = false, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PointerEventInit { js("return { pointerId, width, height, pressure, tangentialPressure, tiltX, tiltY, twist, pointerType, isPrimary, screenX, screenY, clientX, clientY, button, buttons, relatedTarget, region, ctrlKey, shiftKey, altKey, metaKey, modifierAltGraph, modifierCapsLock, modifierFn, modifierFnLock, modifierHyper, modifierNumLock, modifierScrollLock, modifierSuper, modifierSymbol, modifierSymbolLock, view, detail, bubbles, cancelable, composed };") } +public fun PointerEventInit(pointerId: Int? = 0, width: Double? = 1.0, height: Double? = 1.0, pressure: Float? = 0f, tangentialPressure: Float? = 0f, tiltX: Int? = 0, tiltY: Int? = 0, twist: Int? = 0, pointerType: String? = "", isPrimary: Boolean? = false, screenX: Int? = 0, screenY: Int? = 0, clientX: Int? = 0, clientY: Int? = 0, button: Short? = 0, buttons: Short? = 0, relatedTarget: EventTarget? = null, region: String? = null, ctrlKey: Boolean? = false, shiftKey: Boolean? = false, altKey: Boolean? = false, metaKey: Boolean? = false, modifierAltGraph: Boolean? = false, modifierCapsLock: Boolean? = false, modifierFn: Boolean? = false, modifierFnLock: Boolean? = false, modifierHyper: Boolean? = false, modifierNumLock: Boolean? = false, modifierScrollLock: Boolean? = false, modifierSuper: Boolean? = false, modifierSymbol: Boolean? = false, modifierSymbolLock: Boolean? = false, view: Window? = null, detail: Int? = 0, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PointerEventInit = js("({ pointerId: pointerId, width: width, height: height, pressure: pressure, tangentialPressure: tangentialPressure, tiltX: tiltX, tiltY: tiltY, twist: twist, pointerType: pointerType, isPrimary: isPrimary, screenX: screenX, screenY: screenY, clientX: clientX, clientY: clientY, button: button, buttons: buttons, relatedTarget: relatedTarget, region: region, ctrlKey: ctrlKey, shiftKey: shiftKey, altKey: altKey, metaKey: metaKey, modifierAltGraph: modifierAltGraph, modifierCapsLock: modifierCapsLock, modifierFn: modifierFn, modifierFnLock: modifierFnLock, modifierHyper: modifierHyper, modifierNumLock: modifierNumLock, modifierScrollLock: modifierScrollLock, modifierSuper: modifierSuper, modifierSymbol: modifierSymbol, modifierSymbolLock: modifierSymbolLock, view: view, detail: detail, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [PointerEvent](https://developer.mozilla.org/en/docs/Web/API/PointerEvent) to Kotlin diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.svg.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.svg.kt similarity index 99% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.svg.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.svg.kt index 4691349..f86cfec 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.svg.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.svg.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -63,7 +63,7 @@ public external interface SVGBoundingBoxOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun SVGBoundingBoxOptions(fill: Boolean? = true, stroke: Boolean? = false, markers: Boolean? = false, clipped: Boolean? = false): SVGBoundingBoxOptions { js("return { fill, stroke, markers, clipped };") } +public fun SVGBoundingBoxOptions(fill: Boolean? = true, stroke: Boolean? = false, markers: Boolean? = false, clipped: Boolean? = false): SVGBoundingBoxOptions = js("({ fill: fill, stroke: stroke, markers: markers, clipped: clipped })") /** * Exposes the JavaScript [SVGGraphicsElement](https://developer.mozilla.org/en/docs/Web/API/SVGGraphicsElement) to Kotlin @@ -194,7 +194,7 @@ public external abstract class SVGNameList : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForSVGNameList(obj: SVGNameList, index: Int): JsAny? { js("return obj[index];") } +internal fun getMethodImplForSVGNameList(obj: SVGNameList, index: Int): JsAny? = js("obj[index]") public operator fun SVGNameList.get(index: Int): JsAny? = getMethodImplForSVGNameList(this, index) @@ -219,7 +219,7 @@ public external abstract class SVGNumberList : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForSVGNumberList(obj: SVGNumberList, index: Int): SVGNumber? { js("return obj[index];") } +internal fun getMethodImplForSVGNumberList(obj: SVGNumberList, index: Int): SVGNumber? = js("obj[index]") public operator fun SVGNumberList.get(index: Int): SVGNumber? = getMethodImplForSVGNumberList(this, index) @@ -244,7 +244,7 @@ public external abstract class SVGLengthList : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForSVGLengthList(obj: SVGLengthList, index: Int): SVGLength? { js("return obj[index];") } +internal fun getMethodImplForSVGLengthList(obj: SVGLengthList, index: Int): SVGLength? = js("obj[index]") public operator fun SVGLengthList.get(index: Int): SVGLength? = getMethodImplForSVGLengthList(this, index) @@ -349,7 +349,7 @@ public external abstract class SVGStringList : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForSVGStringList(obj: SVGStringList, index: Int): String? { js("return obj[index];") } +internal fun getMethodImplForSVGStringList(obj: SVGStringList, index: Int): String? = js("obj[index]") public operator fun SVGStringList.get(index: Int): String? = getMethodImplForSVGStringList(this, index) @@ -807,7 +807,7 @@ public external abstract class SVGTransformList : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForSVGTransformList(obj: SVGTransformList, index: Int): SVGTransform? { js("return obj[index];") } +internal fun getMethodImplForSVGTransformList(obj: SVGTransformList, index: Int): SVGTransform? = js("obj[index]") public operator fun SVGTransformList.get(index: Int): SVGTransform? = getMethodImplForSVGTransformList(this, index) @@ -1055,7 +1055,7 @@ public external abstract class SVGPointList : JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForSVGPointList(obj: SVGPointList, index: Int): DOMPoint? { js("return obj[index];") } +internal fun getMethodImplForSVGPointList(obj: SVGPointList, index: Int): DOMPoint? = js("obj[index]") public operator fun SVGPointList.get(index: Int): DOMPoint? = getMethodImplForSVGPointList(this, index) diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.url.kt b/src/browserMain/kotlin/org.w3c/org.w3c.dom.url.kt similarity index 96% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.url.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.dom.url.kt index fe08e0c..db2e5cf 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.dom.url.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.dom.url.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.fetch.kt b/src/browserMain/kotlin/org.w3c/org.w3c.fetch.kt similarity index 96% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.fetch.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.fetch.kt index 94822cc..bd5c4cd 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.fetch.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.fetch.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -103,7 +103,7 @@ public external interface RequestInit : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun RequestInit(method: String? = undefined, headers: JsAny? /* Headers|JsArray>|OpenEndedDictionary */ = undefined, body: JsAny? /* Blob|BufferSource|FormData|URLSearchParams|String */ = undefined, referrer: String? = undefined, referrerPolicy: JsAny? = undefined, mode: RequestMode? = undefined, credentials: RequestCredentials? = undefined, cache: RequestCache? = undefined, redirect: RequestRedirect? = undefined, integrity: String? = undefined, keepalive: Boolean? = undefined, window: JsAny? = undefined): RequestInit { js("return { method, headers, body, referrer, referrerPolicy, mode, credentials, cache, redirect, integrity, keepalive, window };") } +public fun RequestInit(method: String? = undefined, headers: JsAny? /* Headers|JsArray>|OpenEndedDictionary */ = undefined, body: JsAny? /* Blob|BufferSource|FormData|URLSearchParams|String */ = undefined, referrer: String? = undefined, referrerPolicy: JsAny? = undefined, mode: RequestMode? = undefined, credentials: RequestCredentials? = undefined, cache: RequestCache? = undefined, redirect: RequestRedirect? = undefined, integrity: String? = undefined, keepalive: Boolean? = undefined, window: JsAny? = undefined): RequestInit = js("({ method: method, headers: headers, body: body, referrer: referrer, referrerPolicy: referrerPolicy, mode: mode, credentials: credentials, cache: cache, redirect: redirect, integrity: integrity, keepalive: keepalive, window: window })") /** * Exposes the JavaScript [Response](https://developer.mozilla.org/en/docs/Web/API/Response) to Kotlin @@ -145,7 +145,7 @@ public external interface ResponseInit : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ResponseInit(status: Short? = 200, statusText: String? = "OK", headers: JsAny? /* Headers|JsArray>|OpenEndedDictionary */ = undefined): ResponseInit { js("return { status, statusText, headers };") } +public fun ResponseInit(status: Short? = 200, statusText: String? = "OK", headers: JsAny? /* Headers|JsArray>|OpenEndedDictionary */ = undefined): ResponseInit = js("({ status: status, statusText: statusText, headers: headers })") /* please, don't implement this interface! */ @JsName("null") diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.files.kt b/src/browserMain/kotlin/org.w3c/org.w3c.files.kt similarity index 94% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.files.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.files.kt index 901247f..98adf8e 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.files.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.files.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -33,7 +33,7 @@ public external interface BlobPropertyBag : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun BlobPropertyBag(type: String? = ""): BlobPropertyBag { js("return { type };") } +public fun BlobPropertyBag(type: String? = ""): BlobPropertyBag = js("({ type: type })") /** * Exposes the JavaScript [File](https://developer.mozilla.org/en/docs/Web/API/File) to Kotlin @@ -50,7 +50,7 @@ public external interface FilePropertyBag : BlobPropertyBag, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun FilePropertyBag(lastModified: Int? = undefined, type: String? = ""): FilePropertyBag { js("return { lastModified, type };") } +public fun FilePropertyBag(lastModified: Int? = undefined, type: String? = ""): FilePropertyBag = js("({ lastModified: lastModified, type: type })") /** * Exposes the JavaScript [FileList](https://developer.mozilla.org/en/docs/Web/API/FileList) to Kotlin @@ -60,7 +60,7 @@ public external abstract class FileList : ItemArrayLike, JsAny { } @Suppress("UNUSED_PARAMETER") -internal fun getMethodImplForFileList(obj: FileList, index: Int): File? { js("return obj[index];") } +internal fun getMethodImplForFileList(obj: FileList, index: Int): File? = js("obj[index]") public operator fun FileList.get(index: Int): File? = getMethodImplForFileList(this, index) diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.notifications.kt b/src/browserMain/kotlin/org.w3c/org.w3c.notifications.kt similarity index 91% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.notifications.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.notifications.kt index cfa29d3..32b70e2 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.notifications.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.notifications.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -102,7 +102,7 @@ public external interface NotificationOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun NotificationOptions(dir: NotificationDirection? = NotificationDirection.AUTO, lang: String? = "", body: String? = "", tag: String? = "", image: String? = undefined, icon: String? = undefined, badge: String? = undefined, sound: String? = undefined, vibrate: JsAny? /* Int|JsArray */ = undefined, timestamp: JsNumber? = undefined, renotify: Boolean? = false, silent: Boolean? = false, noscreen: Boolean? = false, requireInteraction: Boolean? = false, sticky: Boolean? = false, data: JsAny? = null, actions: JsArray? = JsArray()): NotificationOptions { js("return { dir, lang, body, tag, image, icon, badge, sound, vibrate, timestamp, renotify, silent, noscreen, requireInteraction, sticky, data, actions };") } +public fun NotificationOptions(dir: NotificationDirection? = NotificationDirection.AUTO, lang: String? = "", body: String? = "", tag: String? = "", image: String? = undefined, icon: String? = undefined, badge: String? = undefined, sound: String? = undefined, vibrate: JsAny? /* Int|JsArray */ = undefined, timestamp: JsNumber? = undefined, renotify: Boolean? = false, silent: Boolean? = false, noscreen: Boolean? = false, requireInteraction: Boolean? = false, sticky: Boolean? = false, data: JsAny? = null, actions: JsArray? = JsArray()): NotificationOptions = js("({ dir: dir, lang: lang, body: body, tag: tag, image: image, icon: icon, badge: badge, sound: sound, vibrate: vibrate, timestamp: timestamp, renotify: renotify, silent: silent, noscreen: noscreen, requireInteraction: requireInteraction, sticky: sticky, data: data, actions: actions })") public external interface NotificationAction : JsAny { var action: String? @@ -113,7 +113,7 @@ public external interface NotificationAction : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun NotificationAction(action: String?, title: String?, icon: String? = undefined): NotificationAction { js("return { action, title, icon };") } +public fun NotificationAction(action: String?, title: String?, icon: String? = undefined): NotificationAction = js("({ action: action, title: title, icon: icon })") public external interface GetNotificationOptions : JsAny { var tag: String? /* = "" */ @@ -122,7 +122,7 @@ public external interface GetNotificationOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun GetNotificationOptions(tag: String? = ""): GetNotificationOptions { js("return { tag };") } +public fun GetNotificationOptions(tag: String? = ""): GetNotificationOptions = js("({ tag: tag })") /** * Exposes the JavaScript [NotificationEvent](https://developer.mozilla.org/en/docs/Web/API/NotificationEvent) to Kotlin @@ -147,7 +147,7 @@ public external interface NotificationEventInit : ExtendableEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun NotificationEventInit(notification: Notification?, action: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): NotificationEventInit { js("return { notification, action, bubbles, cancelable, composed };") } +public fun NotificationEventInit(notification: Notification?, action: String? = "", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): NotificationEventInit = js("({ notification: notification, action: action, bubbles: bubbles, cancelable: cancelable, composed: composed })") /* please, don't implement this interface! */ @JsName("null") diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.performance.kt b/src/browserMain/kotlin/org.w3c/org.w3c.performance.kt similarity index 97% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.performance.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.performance.kt index 939667e..b36ea1e 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.performance.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.performance.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.workers.kt b/src/browserMain/kotlin/org.w3c/org.w3c.workers.kt similarity index 92% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.workers.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.workers.kt index e5e98b8..6dce603 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.workers.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.workers.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -67,7 +67,7 @@ public external interface RegistrationOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun RegistrationOptions(scope: String? = undefined, type: WorkerType? = WorkerType.CLASSIC): RegistrationOptions { js("return { scope, type };") } +public fun RegistrationOptions(scope: String? = undefined, type: WorkerType? = WorkerType.CLASSIC): RegistrationOptions = js("({ scope: scope, type: type })") /** * Exposes the JavaScript [ServiceWorkerMessageEvent](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerMessageEvent) to Kotlin @@ -106,7 +106,7 @@ public external interface ServiceWorkerMessageEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ServiceWorkerMessageEventInit(data: JsAny? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionMessagePortOrServiceWorker? = undefined, ports: JsArray? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ServiceWorkerMessageEventInit { js("return { data, origin, lastEventId, source, ports, bubbles, cancelable, composed };") } +public fun ServiceWorkerMessageEventInit(data: JsAny? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionMessagePortOrServiceWorker? = undefined, ports: JsArray? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ServiceWorkerMessageEventInit = js("({ data: data, origin: origin, lastEventId: lastEventId, source: source, ports: ports, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [ServiceWorkerGlobalScope](https://developer.mozilla.org/en/docs/Web/API/ServiceWorkerGlobalScope) to Kotlin @@ -165,7 +165,7 @@ public external interface ClientQueryOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ClientQueryOptions(includeUncontrolled: Boolean? = false, type: ClientType? = ClientType.WINDOW): ClientQueryOptions { js("return { includeUncontrolled, type };") } +public fun ClientQueryOptions(includeUncontrolled: Boolean? = false, type: ClientType? = ClientType.WINDOW): ClientQueryOptions = js("({ includeUncontrolled: includeUncontrolled, type: type })") /** * Exposes the JavaScript [ExtendableEvent](https://developer.mozilla.org/en/docs/Web/API/ExtendableEvent) to Kotlin @@ -184,7 +184,7 @@ public external open class ExtendableEvent(type: String, eventInitDict: Extendab public external interface ExtendableEventInit : EventInit, JsAny @Suppress("UNUSED_PARAMETER") -public fun ExtendableEventInit(bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableEventInit { js("return { bubbles, cancelable, composed };") } +public fun ExtendableEventInit(bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableEventInit = js("({ bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [InstallEvent](https://developer.mozilla.org/en/docs/Web/API/InstallEvent) to Kotlin @@ -206,7 +206,7 @@ public external interface ForeignFetchOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ForeignFetchOptions(scopes: JsArray?, origins: JsArray?): ForeignFetchOptions { js("return { scopes, origins };") } +public fun ForeignFetchOptions(scopes: JsArray?, origins: JsArray?): ForeignFetchOptions = js("({ scopes: scopes, origins: origins })") /** * Exposes the JavaScript [FetchEvent](https://developer.mozilla.org/en/docs/Web/API/FetchEvent) to Kotlin @@ -236,7 +236,7 @@ public external interface FetchEventInit : ExtendableEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun FetchEventInit(request: Request?, clientId: String? = null, isReload: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FetchEventInit { js("return { request, clientId, isReload, bubbles, cancelable, composed };") } +public fun FetchEventInit(request: Request?, clientId: String? = null, isReload: Boolean? = false, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): FetchEventInit = js("({ request: request, clientId: clientId, isReload: isReload, bubbles: bubbles, cancelable: cancelable, composed: composed })") public external open class ForeignFetchEvent(type: String, eventInitDict: ForeignFetchEventInit) : ExtendableEvent, JsAny { open val request: Request @@ -259,7 +259,7 @@ public external interface ForeignFetchEventInit : ExtendableEventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ForeignFetchEventInit(request: Request?, origin: String? = "null", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ForeignFetchEventInit { js("return { request, origin, bubbles, cancelable, composed };") } +public fun ForeignFetchEventInit(request: Request?, origin: String? = "null", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ForeignFetchEventInit = js("({ request: request, origin: origin, bubbles: bubbles, cancelable: cancelable, composed: composed })") public external interface ForeignFetchResponse : JsAny { var response: Response? @@ -272,7 +272,7 @@ public external interface ForeignFetchResponse : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ForeignFetchResponse(response: Response?, origin: String? = undefined, headers: JsArray? = undefined): ForeignFetchResponse { js("return { response, origin, headers };") } +public fun ForeignFetchResponse(response: Response?, origin: String? = undefined, headers: JsArray? = undefined): ForeignFetchResponse = js("({ response: response, origin: origin, headers: headers })") /** * Exposes the JavaScript [ExtendableMessageEvent](https://developer.mozilla.org/en/docs/Web/API/ExtendableMessageEvent) to Kotlin @@ -311,7 +311,7 @@ public external interface ExtendableMessageEventInit : ExtendableEventInit, JsAn } @Suppress("UNUSED_PARAMETER") -public fun ExtendableMessageEventInit(data: JsAny? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionClientOrMessagePortOrServiceWorker? = undefined, ports: JsArray? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableMessageEventInit { js("return { data, origin, lastEventId, source, ports, bubbles, cancelable, composed };") } +public fun ExtendableMessageEventInit(data: JsAny? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionClientOrMessagePortOrServiceWorker? = undefined, ports: JsArray? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableMessageEventInit = js("({ data: data, origin: origin, lastEventId: lastEventId, source: source, ports: ports, bubbles: bubbles, cancelable: cancelable, composed: composed })") /** * Exposes the JavaScript [Cache](https://developer.mozilla.org/en/docs/Web/API/Cache) to Kotlin @@ -350,7 +350,7 @@ public external interface CacheQueryOptions : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun CacheQueryOptions(ignoreSearch: Boolean? = false, ignoreMethod: Boolean? = false, ignoreVary: Boolean? = false, cacheName: String? = undefined): CacheQueryOptions { js("return { ignoreSearch, ignoreMethod, ignoreVary, cacheName };") } +public fun CacheQueryOptions(ignoreSearch: Boolean? = false, ignoreMethod: Boolean? = false, ignoreVary: Boolean? = false, cacheName: String? = undefined): CacheQueryOptions = js("({ ignoreSearch: ignoreSearch, ignoreMethod: ignoreMethod, ignoreVary: ignoreVary, cacheName: cacheName })") public external interface CacheBatchOperation : JsAny { var type: String? @@ -368,7 +368,7 @@ public external interface CacheBatchOperation : JsAny { } @Suppress("UNUSED_PARAMETER") -public fun CacheBatchOperation(type: String? = undefined, request: Request? = undefined, response: Response? = undefined, options: CacheQueryOptions? = undefined): CacheBatchOperation { js("return { type, request, response, options };") } +public fun CacheBatchOperation(type: String? = undefined, request: Request? = undefined, response: Response? = undefined, options: CacheQueryOptions? = undefined): CacheBatchOperation = js("({ type: type, request: request, response: response, options: options })") /** * Exposes the JavaScript [CacheStorage](https://developer.mozilla.org/en/docs/Web/API/CacheStorage) to Kotlin diff --git a/src/wasmJsMain/kotlin/org.w3c/org.w3c.xhr.kt b/src/browserMain/kotlin/org.w3c/org.w3c.xhr.kt similarity index 95% rename from src/wasmJsMain/kotlin/org.w3c/org.w3c.xhr.kt rename to src/browserMain/kotlin/org.w3c/org.w3c.xhr.kt index f324cbc..c9dc9a3 100644 --- a/src/wasmJsMain/kotlin/org.w3c/org.w3c.xhr.kt +++ b/src/browserMain/kotlin/org.w3c/org.w3c.xhr.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -113,7 +113,7 @@ public external interface ProgressEventInit : EventInit, JsAny { } @Suppress("UNUSED_PARAMETER") -public fun ProgressEventInit(lengthComputable: Boolean? = false, loaded: JsNumber? = 0.toJsNumber(), total: JsNumber? = 0.toJsNumber(), bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ProgressEventInit { js("return { lengthComputable, loaded, total, bubbles, cancelable, composed };") } +public fun ProgressEventInit(lengthComputable: Boolean? = false, loaded: JsNumber? = 0.toJsNumber(), total: JsNumber? = 0.toJsNumber(), bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ProgressEventInit = js("({ lengthComputable: lengthComputable, loaded: loaded, total: total, bubbles: bubbles, cancelable: cancelable, composed: composed })") /* please, don't implement this interface! */ @JsName("null") diff --git a/src/wasmJsMain/kotlin/w3cSupport.kt b/src/browserMain/kotlin/w3cSupport.kt similarity index 100% rename from src/wasmJsMain/kotlin/w3cSupport.kt rename to src/browserMain/kotlin/w3cSupport.kt diff --git a/src/wasmJsTest/kotlin/SmokeTest.kt b/src/browserTest/kotlin/SmokeTest.kt similarity index 100% rename from src/wasmJsTest/kotlin/SmokeTest.kt rename to src/browserTest/kotlin/SmokeTest.kt diff --git a/src/wasmJsTest/kotlin/arrayCopyTest.kt b/src/browserTest/kotlin/arrayCopyTest.kt similarity index 98% rename from src/wasmJsTest/kotlin/arrayCopyTest.kt rename to src/browserTest/kotlin/arrayCopyTest.kt index 9d34c22..d6f8cf8 100644 --- a/src/wasmJsTest/kotlin/arrayCopyTest.kt +++ b/src/browserTest/kotlin/arrayCopyTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ diff --git a/src/jsMain/kotlin/arrayCopy.js.kt b/src/jsMain/kotlin/arrayCopy.js.kt new file mode 100644 index 0000000..0b66ce0 --- /dev/null +++ b/src/jsMain/kotlin/arrayCopy.js.kt @@ -0,0 +1,80 @@ +/* + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. + */ + +// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT! +// See generator/src/main/kotlin/helpers/generate.kt for details + + +package org.khronos.webgl + +/** Returns a new [ByteArray] containing all the elements of this [Int8Array]. */ +public actual inline fun Int8Array.toByteArray(): ByteArray = + unsafeCast() + +/** Returns a new [Int8Array] containing all the elements of this [ByteArray]. */ +public actual inline fun ByteArray.toInt8Array(): Int8Array = + unsafeCast() + +/** Returns a new [UByteArray] containing all the elements of this [Uint8Array]. */ +@ExperimentalUnsignedTypes +public actual inline fun Uint8Array.toUByteArray(): UByteArray = + unsafeCast() + +/** Returns a new [Uint8Array] containing all the elements of this [UByteArray]. */ +@ExperimentalUnsignedTypes +public actual inline fun UByteArray.toUint8Array(): Uint8Array = + unsafeCast() + +/** Returns a new [ShortArray] containing all the elements of this [Int16Array]. */ +public actual inline fun Int16Array.toShortArray(): ShortArray = + unsafeCast() + +/** Returns a new [Int16Array] containing all the elements of this [ShortArray]. */ +public actual inline fun ShortArray.toInt16Array(): Int16Array = + unsafeCast() + +/** Returns a new [UShortArray] containing all the elements of this [Uint16Array]. */ +@ExperimentalUnsignedTypes +public actual inline fun Uint16Array.toUShortArray(): UShortArray = + unsafeCast() + +/** Returns a new [Uint16Array] containing all the elements of this [UShortArray]. */ +@ExperimentalUnsignedTypes +public actual inline fun UShortArray.toUint16Array(): Uint16Array = + unsafeCast() + +/** Returns a new [IntArray] containing all the elements of this [Int32Array]. */ +public actual inline fun Int32Array.toIntArray(): IntArray = + unsafeCast() + +/** Returns a new [Int32Array] containing all the elements of this [IntArray]. */ +public actual inline fun IntArray.toInt32Array(): Int32Array = + unsafeCast() + +/** Returns a new [UIntArray] containing all the elements of this [Uint32Array]. */ +@ExperimentalUnsignedTypes +public actual inline fun Uint32Array.toUIntArray(): UIntArray = + unsafeCast() + +/** Returns a new [Uint32Array] containing all the elements of this [UIntArray]. */ +@ExperimentalUnsignedTypes +public actual inline fun UIntArray.toUint32Array(): Uint32Array = + unsafeCast() + +/** Returns a new [FloatArray] containing all the elements of this [Float32Array]. */ +public actual inline fun Float32Array.toFloatArray(): FloatArray = + unsafeCast() + +/** Returns a new [Float32Array] containing all the elements of this [FloatArray]. */ +public actual inline fun FloatArray.toFloat32Array(): Float32Array = + unsafeCast() + +/** Returns a new [DoubleArray] containing all the elements of this [Float64Array]. */ +public actual inline fun Float64Array.toDoubleArray(): DoubleArray = + unsafeCast() + +/** Returns a new [Float64Array] containing all the elements of this [DoubleArray]. */ +public actual inline fun DoubleArray.toFloat64Array(): Float64Array = + unsafeCast() diff --git a/src/wasmJsMain/kotlin/arrayCopy.kt b/src/wasmJsMain/kotlin/arrayCopy.wasm.kt similarity index 76% rename from src/wasmJsMain/kotlin/arrayCopy.kt rename to src/wasmJsMain/kotlin/arrayCopy.wasm.kt index 1f11bb5..ab6894d 100644 --- a/src/wasmJsMain/kotlin/arrayCopy.kt +++ b/src/wasmJsMain/kotlin/arrayCopy.wasm.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ @@ -10,11 +10,11 @@ package org.khronos.webgl /** Returns a new [ByteArray] containing all the elements of this [Int8Array]. */ -public fun Int8Array.toByteArray(): ByteArray = +public actual fun Int8Array.toByteArray(): ByteArray = ByteArray(this.length) { this[it] } /** Returns a new [Int8Array] containing all the elements of this [ByteArray]. */ -public fun ByteArray.toInt8Array(): Int8Array { +public actual fun ByteArray.toInt8Array(): Int8Array { val result = Int8Array(this.size) for (index in this.indices) { result[index] = this[index] @@ -24,12 +24,12 @@ public fun ByteArray.toInt8Array(): Int8Array { /** Returns a new [UByteArray] containing all the elements of this [Uint8Array]. */ @ExperimentalUnsignedTypes -public fun Uint8Array.toUByteArray(): UByteArray = +public actual fun Uint8Array.toUByteArray(): UByteArray = UByteArray(this.length) { this[it].toUByte() } /** Returns a new [Uint8Array] containing all the elements of this [UByteArray]. */ @ExperimentalUnsignedTypes -public fun UByteArray.toUint8Array(): Uint8Array { +public actual fun UByteArray.toUint8Array(): Uint8Array { val result = Uint8Array(this.size) for (index in this.indices) { result[index] = this[index].toByte() @@ -38,11 +38,11 @@ public fun UByteArray.toUint8Array(): Uint8Array { } /** Returns a new [ShortArray] containing all the elements of this [Int16Array]. */ -public fun Int16Array.toShortArray(): ShortArray = +public actual fun Int16Array.toShortArray(): ShortArray = ShortArray(this.length) { this[it] } /** Returns a new [Int16Array] containing all the elements of this [ShortArray]. */ -public fun ShortArray.toInt16Array(): Int16Array { +public actual fun ShortArray.toInt16Array(): Int16Array { val result = Int16Array(this.size) for (index in this.indices) { result[index] = this[index] @@ -52,12 +52,12 @@ public fun ShortArray.toInt16Array(): Int16Array { /** Returns a new [UShortArray] containing all the elements of this [Uint16Array]. */ @ExperimentalUnsignedTypes -public fun Uint16Array.toUShortArray(): UShortArray = +public actual fun Uint16Array.toUShortArray(): UShortArray = UShortArray(this.length) { this[it].toUShort() } /** Returns a new [Uint16Array] containing all the elements of this [UShortArray]. */ @ExperimentalUnsignedTypes -public fun UShortArray.toUint16Array(): Uint16Array { +public actual fun UShortArray.toUint16Array(): Uint16Array { val result = Uint16Array(this.size) for (index in this.indices) { result[index] = this[index].toShort() @@ -66,11 +66,11 @@ public fun UShortArray.toUint16Array(): Uint16Array { } /** Returns a new [IntArray] containing all the elements of this [Int32Array]. */ -public fun Int32Array.toIntArray(): IntArray = +public actual fun Int32Array.toIntArray(): IntArray = IntArray(this.length) { this[it] } /** Returns a new [Int32Array] containing all the elements of this [IntArray]. */ -public fun IntArray.toInt32Array(): Int32Array { +public actual fun IntArray.toInt32Array(): Int32Array { val result = Int32Array(this.size) for (index in this.indices) { result[index] = this[index] @@ -80,12 +80,12 @@ public fun IntArray.toInt32Array(): Int32Array { /** Returns a new [UIntArray] containing all the elements of this [Uint32Array]. */ @ExperimentalUnsignedTypes -public fun Uint32Array.toUIntArray(): UIntArray = +public actual fun Uint32Array.toUIntArray(): UIntArray = UIntArray(this.length) { this[it].toUInt() } /** Returns a new [Uint32Array] containing all the elements of this [UIntArray]. */ @ExperimentalUnsignedTypes -public fun UIntArray.toUint32Array(): Uint32Array { +public actual fun UIntArray.toUint32Array(): Uint32Array { val result = Uint32Array(this.size) for (index in this.indices) { result[index] = this[index].toInt() @@ -94,11 +94,11 @@ public fun UIntArray.toUint32Array(): Uint32Array { } /** Returns a new [FloatArray] containing all the elements of this [Float32Array]. */ -public fun Float32Array.toFloatArray(): FloatArray = +public actual fun Float32Array.toFloatArray(): FloatArray = FloatArray(this.length) { this[it] } /** Returns a new [Float32Array] containing all the elements of this [FloatArray]. */ -public fun FloatArray.toFloat32Array(): Float32Array { +public actual fun FloatArray.toFloat32Array(): Float32Array { val result = Float32Array(this.size) for (index in this.indices) { result[index] = this[index] @@ -107,11 +107,11 @@ public fun FloatArray.toFloat32Array(): Float32Array { } /** Returns a new [DoubleArray] containing all the elements of this [Float64Array]. */ -public fun Float64Array.toDoubleArray(): DoubleArray = +public actual fun Float64Array.toDoubleArray(): DoubleArray = DoubleArray(this.length) { this[it] } /** Returns a new [Float64Array] containing all the elements of this [DoubleArray]. */ -public fun DoubleArray.toFloat64Array(): Float64Array { +public actual fun DoubleArray.toFloat64Array(): Float64Array { val result = Float64Array(this.size) for (index in this.indices) { result[index] = this[index]