diff --git a/demo/src/commonMain/kotlin/App.kt b/demo/src/commonMain/kotlin/App.kt index b909778..dd6442b 100644 --- a/demo/src/commonMain/kotlin/App.kt +++ b/demo/src/commonMain/kotlin/App.kt @@ -20,6 +20,10 @@ import androidx.compose.ui.graphics.vector.path import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp +import com.composables.ui.Menu +import com.composables.ui.MenuButton +import com.composables.ui.MenuContent +import com.composables.ui.MenuItem @Composable fun App() { diff --git a/demo/src/wasmJsMain/resources/index.html b/demo/src/wasmJsMain/resources/index.html index 1694335..00f7501 100644 --- a/demo/src/wasmJsMain/resources/index.html +++ b/demo/src/wasmJsMain/resources/index.html @@ -2,23 +2,11 @@ - Compose Menu - + KotlinProject + + - + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ba26677..732c5ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ #Gradle -org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" +org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=2048m -XX:+HeapDumpOnOutOfMemoryError kotlin.code.style=official diff --git a/menu/build.gradle.kts b/menu/build.gradle.kts index 6962d6d..1b9b80e 100644 --- a/menu/build.gradle.kts +++ b/menu/build.gradle.kts @@ -16,6 +16,8 @@ val publishVersion = "1.2.0" val githubUrl = "github.com/composablehorizons/compose-menu" kotlin { + explicitApi() + androidTarget { publishLibraryVariants("release", "debug") compilations.all { diff --git a/menu/src/androidMain/kotlin/Utils.kt b/menu/src/androidMain/kotlin/Utils.kt index e6656ff..2c98833 100644 --- a/menu/src/androidMain/kotlin/Utils.kt +++ b/menu/src/androidMain/kotlin/Utils.kt @@ -1,3 +1,5 @@ +package com.composables.ui + import android.view.KeyEvent import android.view.View.OnKeyListener import androidx.compose.runtime.Composable diff --git a/menu/src/appleMain/kotlin/Utils.kt b/menu/src/appleMain/kotlin/Utils.kt index 2c94ab7..d673d24 100644 --- a/menu/src/appleMain/kotlin/Utils.kt +++ b/menu/src/appleMain/kotlin/Utils.kt @@ -1,5 +1,8 @@ +package com.composables.ui + import androidx.compose.runtime.Composable @Composable internal actual fun KeyDownHandler(onEvent: (KeyDownEvent) -> Boolean) { + // not handled } \ No newline at end of file diff --git a/menu/src/commonMain/kotlin/Menu.kt b/menu/src/commonMain/kotlin/Menu.kt index c278ed2..8b84228 100644 --- a/menu/src/commonMain/kotlin/Menu.kt +++ b/menu/src/commonMain/kotlin/Menu.kt @@ -1,3 +1,5 @@ +package com.composables.ui + import androidx.compose.animation.* import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.tween @@ -23,7 +25,7 @@ import kotlinx.coroutines.launch @OptIn(ExperimentalComposeUiApi::class) @Composable -fun Menu(modifier: Modifier = Modifier, contents: @Composable MenuScope.() -> Unit) { +public fun Menu(modifier: Modifier = Modifier, contents: @Composable MenuScope.() -> Unit) { val scope = remember { MenuScope() } val coroutineScope = rememberCoroutineScope() var hasFocus by remember { mutableStateOf(false) } @@ -77,18 +79,18 @@ fun Menu(modifier: Modifier = Modifier, contents: @Composable MenuScope.() -> Un @Composable -fun MenuScope.MenuButton(modifier: Modifier = Modifier, contents: @Composable () -> Unit) { +public fun MenuScope.MenuButton(modifier: Modifier = Modifier, contents: @Composable () -> Unit) { Box(modifier = modifier.clickable(role = Role.DropdownList) { this.expanded = expanded.not() }) { contents() } } @Stable -class MenuScope { +public class MenuScope { internal var expanded by mutableStateOf(false) internal val menuFocusRequester = FocusRequester() internal var currentFocusManager by mutableStateOf(null) - internal var hasMenuFocus by mutableStateOf(false) + internal var hasMenuFocus by mutableStateOf(false) override fun equals(other: Any?): Boolean { if (this === other) return true if (other == null || this::class != other::class) return false @@ -172,7 +174,7 @@ internal data class DropdownMenuPositionProvider( } @Composable -fun MenuScope.MenuContent( +public fun MenuScope.MenuContent( modifier: Modifier = Modifier, showTransition: EnterTransition = fadeIn(animationSpec = tween(durationMillis = 0)), hideTransition: ExitTransition = fadeOut(animationSpec = tween(durationMillis = 0)), @@ -213,7 +215,7 @@ fun MenuScope.MenuContent( } @Composable -fun MenuScope.MenuItem( +public fun MenuScope.MenuItem( modifier: Modifier = Modifier, onClick: () -> Unit, enabled: Boolean = true, diff --git a/menu/src/commonMain/kotlin/Utils.kt b/menu/src/commonMain/kotlin/Utils.kt index de17b29..bc233a6 100644 --- a/menu/src/commonMain/kotlin/Utils.kt +++ b/menu/src/commonMain/kotlin/Utils.kt @@ -1,3 +1,5 @@ +package com.composables.ui + import androidx.compose.runtime.Composable import androidx.compose.ui.input.key.Key diff --git a/menu/src/jvmMain/kotlin/Utils.kt b/menu/src/jvmMain/kotlin/Utils.kt index 5d6b0e1..0f72cd6 100644 --- a/menu/src/jvmMain/kotlin/Utils.kt +++ b/menu/src/jvmMain/kotlin/Utils.kt @@ -1,3 +1,5 @@ +package com.composables.ui + import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.ui.input.key.Key diff --git a/menu/src/wasmJsMain/kotlin/Utils.kt b/menu/src/wasmJsMain/kotlin/Utils.kt index 3ea4c13..8e244f5 100644 --- a/menu/src/wasmJsMain/kotlin/Utils.kt +++ b/menu/src/wasmJsMain/kotlin/Utils.kt @@ -1,3 +1,5 @@ +package com.composables.ui + import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.ui.input.key.Key