diff --git a/compose-dnd/build.gradle.kts b/compose-dnd/build.gradle.kts index 0f363ca..a3d33b1 100644 --- a/compose-dnd/build.gradle.kts +++ b/compose-dnd/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl + /* * Copyright 2023, Mohamed Ben Rejeb and the Compose Dnd project contributors * @@ -41,6 +43,11 @@ kotlin { browser() } + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser() + } + iosX64() iosArm64() iosSimulatorArm64() diff --git a/gradle.properties b/gradle.properties index f644c46..04596b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,8 @@ org.jetbrains.compose.experimental.uikit.enabled=true # Compose for Web org.jetbrains.compose.experimental.jscanvas.enabled=true +org.jetbrains.compose.experimental.wasm.enabled=true #Android android.useAndroidX=true -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true diff --git a/sample/common/build.gradle.kts b/sample/common/build.gradle.kts index 235f10c..95ef5df 100644 --- a/sample/common/build.gradle.kts +++ b/sample/common/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl + /* * Copyright 2023, Mohamed Ben Rejeb and the Compose Dnd project contributors * @@ -39,6 +41,11 @@ kotlin { browser() } + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser() + } + listOf( iosX64(), iosArm64(), diff --git a/sample/web/build.gradle.kts b/sample/web/build.gradle.kts index 7f9b420..aa4c51d 100644 --- a/sample/web/build.gradle.kts +++ b/sample/web/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl + plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.jetbrainsCompose) @@ -9,7 +11,13 @@ kotlin { binaries.executable() } - sourceSets.jsMain.dependencies { + @OptIn(ExperimentalWasmDsl::class) + wasmJs { + browser() + binaries.executable() + } + + sourceSets.commonMain.dependencies { implementation(projects.sample.common) implementation(compose.foundation) @@ -18,4 +26,4 @@ kotlin { compose.experimental { web.application {} -} \ No newline at end of file +} diff --git a/sample/web/src/wasmJsMain/kotlin/main.kt b/sample/web/src/wasmJsMain/kotlin/main.kt new file mode 100644 index 0000000..a0cf469 --- /dev/null +++ b/sample/web/src/wasmJsMain/kotlin/main.kt @@ -0,0 +1,11 @@ +import androidx.compose.ui.ExperimentalComposeUiApi +import androidx.compose.ui.window.CanvasBasedWindow + +@OptIn(ExperimentalComposeUiApi::class) +fun main() { + CanvasBasedWindow( + title = "Compose DND", + ) { + App() + } +} diff --git a/sample/web/src/wasmJsMain/resources/index.html b/sample/web/src/wasmJsMain/resources/index.html new file mode 100644 index 0000000..d200332 --- /dev/null +++ b/sample/web/src/wasmJsMain/resources/index.html @@ -0,0 +1,19 @@ + + + + + Multiplatform App + + + + + +
+
+
+ +
+ +