diff --git a/appyx-components/experimental/puzzle15/web/src/wasmJsMain/kotlin/com/bumble/appyx/experimental/puzzle15/web/main.js.kt b/appyx-components/experimental/puzzle15/web/src/wasmJsMain/kotlin/com/bumble/appyx/experimental/puzzle15/web/main.js.kt index be5c03358..4adc93d61 100644 --- a/appyx-components/experimental/puzzle15/web/src/wasmJsMain/kotlin/com/bumble/appyx/experimental/puzzle15/web/main.js.kt +++ b/appyx-components/experimental/puzzle15/web/src/wasmJsMain/kotlin/com/bumble/appyx/experimental/puzzle15/web/main.js.kt @@ -18,7 +18,8 @@ import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.unit.IntSize import androidx.compose.ui.window.CanvasBasedWindow import com.bumble.appyx.components.experimental.puzzle15.ui.Puzzle15Ui -import org.jetbrains.skiko.wasm.onWasmReady + +external fun onWasmReady(onReady: () -> Unit) @OptIn(ExperimentalComposeUiApi::class) fun main() { diff --git a/appyx-navigation/common/src/jsMain/kotlin/com/bumble/appyx/navigation/integration/BrowserViewportWindow.kt b/appyx-navigation/common/src/jsMain/kotlin/com/bumble/appyx/navigation/integration/BrowserViewportWindow.kt index 90f94b819..ce2954b6e 100644 --- a/appyx-navigation/common/src/jsMain/kotlin/com/bumble/appyx/navigation/integration/BrowserViewportWindow.kt +++ b/appyx-navigation/common/src/jsMain/kotlin/com/bumble/appyx/navigation/integration/BrowserViewportWindow.kt @@ -23,7 +23,6 @@ private const val CANVAS_ELEMENT_ID = "ComposeTarget" // Hardwired into ComposeW /** * A Skiko/Canvas-based top-level window using the browser's entire viewport. Supports resizing. */ -@Composable @Suppress("FunctionNaming") fun BrowserViewportWindow( title: String = "Untitled", diff --git a/appyx-navigation/common/src/wasmJsMain/kotlin/com/bumble/appyx/navigation/integration/BrowserViewportWindow.kt b/appyx-navigation/common/src/wasmJsMain/kotlin/com/bumble/appyx/navigation/integration/BrowserViewportWindow.kt index 90f94b819..786edf653 100644 --- a/appyx-navigation/common/src/wasmJsMain/kotlin/com/bumble/appyx/navigation/integration/BrowserViewportWindow.kt +++ b/appyx-navigation/common/src/wasmJsMain/kotlin/com/bumble/appyx/navigation/integration/BrowserViewportWindow.kt @@ -23,7 +23,6 @@ private const val CANVAS_ELEMENT_ID = "ComposeTarget" // Hardwired into ComposeW /** * A Skiko/Canvas-based top-level window using the browser's entire viewport. Supports resizing. */ -@Composable @Suppress("FunctionNaming") fun BrowserViewportWindow( title: String = "Untitled", @@ -61,7 +60,7 @@ fun BrowserViewportWindow( } ComposeWindow(canvasId = "Appyx", content = content).apply { - window.addEventListener("resize", { + window.addEventListener("resize") { canvas.fillViewportSize() layer.layer.attachTo(canvas) layer.layer.needRedraw() @@ -70,7 +69,7 @@ fun BrowserViewportWindow( (canvas.width / scale * density.density).toInt(), (canvas.height / scale * density.density).toInt() ) - }) + } // WORKAROUND: ComposeWindow does not implement `setTitle(title)` val htmlTitleElement = ( diff --git a/demos/appyx-interactions/web/src/wasmJsMain/kotlin/com/bumble/appyx/interactions/main.js.kt b/demos/appyx-interactions/web/src/wasmJsMain/kotlin/com/bumble/appyx/interactions/main.js.kt index 53b130781..34426f6f8 100644 --- a/demos/appyx-interactions/web/src/wasmJsMain/kotlin/com/bumble/appyx/interactions/main.js.kt +++ b/demos/appyx-interactions/web/src/wasmJsMain/kotlin/com/bumble/appyx/interactions/main.js.kt @@ -25,7 +25,8 @@ import com.bumble.appyx.components.internal.testdrive.ui.md_light_green_500 import com.bumble.appyx.components.internal.testdrive.ui.md_lime_500 import com.bumble.appyx.components.internal.testdrive.ui.md_pink_500 import com.bumble.appyx.components.internal.testdrive.ui.md_teal_500 -import org.jetbrains.skiko.wasm.onWasmReady + +external fun onWasmReady(onReady: () -> Unit) val manatee = Color(0xFF8D99AE) val silver_sand = Color(0xFFBDC6D1) diff --git a/demos/mkdocs/appyx-interactions/interactions/observemp/web/src/wasmJsMain/kotlin/com/bumble/appyx/demos/observemp/main.js.kt b/demos/mkdocs/appyx-interactions/interactions/observemp/web/src/wasmJsMain/kotlin/com/bumble/appyx/demos/observemp/main.js.kt index 2028b19b8..be0f3f002 100644 --- a/demos/mkdocs/appyx-interactions/interactions/observemp/web/src/wasmJsMain/kotlin/com/bumble/appyx/demos/observemp/main.js.kt +++ b/demos/mkdocs/appyx-interactions/interactions/observemp/web/src/wasmJsMain/kotlin/com/bumble/appyx/demos/observemp/main.js.kt @@ -15,8 +15,8 @@ import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.dp import androidx.compose.ui.window.CanvasBasedWindow import com.bumble.appyx.demos.common.color_dark -import org.jetbrains.skiko.wasm.onWasmReady +external fun onWasmReady(onReady: () -> Unit) @OptIn(ExperimentalComposeUiApi::class) fun main() { diff --git a/demos/sandbox-appyx-navigation/web/src/jsMain/kotlin/com/bumble/appyx/demos/sandbox/navigation/Main.kt b/demos/sandbox-appyx-navigation/web/src/jsMain/kotlin/com/bumble/appyx/demos/sandbox/navigation/Main.kt index b65cea23c..979c5844e 100644 --- a/demos/sandbox-appyx-navigation/web/src/jsMain/kotlin/com/bumble/appyx/demos/sandbox/navigation/Main.kt +++ b/demos/sandbox-appyx-navigation/web/src/jsMain/kotlin/com/bumble/appyx/demos/sandbox/navigation/Main.kt @@ -22,9 +22,9 @@ import androidx.compose.ui.input.key.onKeyEvent import androidx.compose.ui.input.key.type import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.unit.dp -import androidx.compose.ui.window.CanvasBasedWindow import com.bumble.appyx.demos.sandbox.navigation.node.container.MainNavNode import com.bumble.appyx.demos.sandbox.navigation.ui.AppyxSampleAppTheme +import com.bumble.appyx.navigation.integration.BrowserViewportWindow import com.bumble.appyx.navigation.integration.ScreenSize import com.bumble.appyx.navigation.integration.WebNodeHost import kotlinx.coroutines.CoroutineScope @@ -35,11 +35,10 @@ import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch import org.jetbrains.skiko.wasm.onWasmReady -@OptIn(ExperimentalComposeUiApi::class) fun main() { val events: Channel = Channel() onWasmReady { - CanvasBasedWindow("Navigation Demo") { + BrowserViewportWindow("Navigation Demo") { val requester = remember { FocusRequester() } var hasFocus by remember { mutableStateOf(false) } diff --git a/demos/sandbox-appyx-navigation/web/src/wasmJsMain/kotlin/com/bumble/appyx/demos/sandbox/navigation/Main.kt b/demos/sandbox-appyx-navigation/web/src/wasmJsMain/kotlin/com/bumble/appyx/demos/sandbox/navigation/Main.kt index a138c466a..479f92d98 100644 --- a/demos/sandbox-appyx-navigation/web/src/wasmJsMain/kotlin/com/bumble/appyx/demos/sandbox/navigation/Main.kt +++ b/demos/sandbox-appyx-navigation/web/src/wasmJsMain/kotlin/com/bumble/appyx/demos/sandbox/navigation/Main.kt @@ -33,7 +33,8 @@ import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch -import org.jetbrains.skiko.wasm.onWasmReady + +external fun onWasmReady(onReady: () -> Unit) fun main() { val events: Channel = Channel() diff --git a/documentation/navigation/multiplatform.md b/documentation/navigation/multiplatform.md index 2cf2e5d1d..6ca6e830b 100644 --- a/documentation/navigation/multiplatform.md +++ b/documentation/navigation/multiplatform.md @@ -138,7 +138,7 @@ fun main() = application { fun main() { val events: Channel = Channel() onWasmReady { - CanvasBasedWindow("Your app") { + BrowserViewportWindow("Your app") { val requester = remember { FocusRequester() } var hasFocus by remember { mutableStateOf(false) } var screenSize by remember { mutableStateOf(ScreenSize(0.dp, 0.dp)) }