From 56c2601efa92f2a90cac64c2a2285e1535c1529a Mon Sep 17 00:00:00 2001 From: Arkadii Ivanov Date: Fri, 22 Nov 2024 10:34:41 +0000 Subject: [PATCH] Use Nothing type for ChildPanels without extra panel --- .../com/arkivanov/decompose/router/panels/ChildPanels.kt | 6 ++++++ .../com/arkivanov/decompose/router/panels/Panels.kt | 3 +++ .../api/extensions-compose-experimental.klib.api | 4 ++-- .../extensions/compose/experimental/panels/ChildPanels.kt | 8 ++++---- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/panels/ChildPanels.kt b/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/panels/ChildPanels.kt index 0aafac76..e5de7ab2 100644 --- a/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/panels/ChildPanels.kt +++ b/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/panels/ChildPanels.kt @@ -11,6 +11,12 @@ import com.arkivanov.decompose.ExperimentalDecomposeApi * @param extra an optional Extra child component. * @param mode determines how lifecycles of the panels within the Child Panels navigation model are changing, * default value is [ChildPanelsMode.SINGLE], see [ChildPanelsMode]. + * @param MC a type of the `Main` panel configuration. + * @param MT a type of the `Main` panel component. + * @param DC a type of the `Details` panel configuration. + * @param DT a type of the `Details` panel component. + * @param EC a type of the `Extra` panel configuration. Use `Nothing` if the panel is not required. + * @param ET a type of the `Extra` panel component. Use `Nothing` if the panel is not required. */ @ExperimentalDecomposeApi data class ChildPanels( diff --git a/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/panels/Panels.kt b/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/panels/Panels.kt index 97e00e8f..9c23f54d 100644 --- a/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/panels/Panels.kt +++ b/decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/panels/Panels.kt @@ -11,6 +11,9 @@ import kotlinx.serialization.Serializable * @param extra an optional configuration of the Extra panel, default value is `null`. * @param mode determines how lifecycles of the panels within the Child Panels navigation model are changing, * default value is [ChildPanelsMode.SINGLE], see [ChildPanelsMode]. + * @param MC a type of the `Main` panel configuration. + * @param DC a type of the `Details` panel configuration. + * @param EC a type of the `Extra` panel configuration. Use `Nothing` if the panel is not required. */ @ExperimentalDecomposeApi @Serializable diff --git a/extensions-compose-experimental/api/extensions-compose-experimental.klib.api b/extensions-compose-experimental/api/extensions-compose-experimental.klib.api index b30a935e..a3f7ac05 100644 --- a/extensions-compose-experimental/api/extensions-compose-experimental.klib.api +++ b/extensions-compose-experimental/api/extensions-compose-experimental.klib.api @@ -64,8 +64,8 @@ final val com.arkivanov.decompose.extensions.compose.experimental/com_arkivanov_ final fun (com.arkivanov.decompose.extensions.compose.experimental.stack.animation/StackAnimator).com.arkivanov.decompose.extensions.compose.experimental.stack.animation/plus(com.arkivanov.decompose.extensions.compose.experimental.stack.animation/StackAnimator): com.arkivanov.decompose.extensions.compose.experimental.stack.animation/StackAnimator // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/plus|plus@com.arkivanov.decompose.extensions.compose.experimental.stack.animation.StackAnimator(com.arkivanov.decompose.extensions.compose.experimental.stack.animation.StackAnimator){}[0] final fun <#A: kotlin/Any, #B: kotlin/Any, #C: kotlin/Any, #D: kotlin/Any, #E: kotlin/Any, #F: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels(com.arkivanov.decompose.router.panels/ChildPanels<#A, #B, #C, #D, #E, #F>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, androidx.compose.ui/Modifier?, kotlin/Function2?, kotlin/Function2?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsLayout?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsAnimators?, kotlin/Function1, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams?>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels|ChildPanels(com.arkivanov.decompose.router.panels.ChildPanels<0:0,0:1,0:2,0:3,0:4,0:5>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.ui.Modifier?;kotlin.Function2?;kotlin.Function2?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsLayout?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsAnimators?;kotlin.Function1,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.PredictiveBackParams?>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§;1§;2§;3§;4§;5§}[0] final fun <#A: kotlin/Any, #B: kotlin/Any, #C: kotlin/Any, #D: kotlin/Any, #E: kotlin/Any, #F: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels(com.arkivanov.decompose.value/Value>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, androidx.compose.ui/Modifier?, kotlin/Function2?, kotlin/Function2?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsLayout?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsAnimators?, kotlin/Function1, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams?>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels|ChildPanels(com.arkivanov.decompose.value.Value>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.ui.Modifier?;kotlin.Function2?;kotlin.Function2?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsLayout?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsAnimators?;kotlin.Function1,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.PredictiveBackParams?>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§;1§;2§;3§;4§;5§}[0] -final fun <#A: kotlin/Any, #B: kotlin/Any, #C: kotlin/Any, #D: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels(com.arkivanov.decompose.router.panels/ChildPanels<#A, #B, #C, #D, *, *>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, androidx.compose.ui/Modifier?, kotlin/Function2?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsLayout?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsAnimators?, kotlin/Function1, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams?>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels|ChildPanels(com.arkivanov.decompose.router.panels.ChildPanels<0:0,0:1,0:2,0:3,*,*>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.ui.Modifier?;kotlin.Function2?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsLayout?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsAnimators?;kotlin.Function1,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.PredictiveBackParams?>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§;1§;2§;3§}[0] -final fun <#A: kotlin/Any, #B: kotlin/Any, #C: kotlin/Any, #D: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels(com.arkivanov.decompose.value/Value>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, androidx.compose.ui/Modifier?, kotlin/Function2?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsLayout?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsAnimators?, kotlin/Function1, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams?>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels|ChildPanels(com.arkivanov.decompose.value.Value>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.ui.Modifier?;kotlin.Function2?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsLayout?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsAnimators?;kotlin.Function1,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.PredictiveBackParams?>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§;1§;2§;3§}[0] +final fun <#A: kotlin/Any, #B: kotlin/Any, #C: kotlin/Any, #D: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels(com.arkivanov.decompose.router.panels/ChildPanels<#A, #B, #C, #D, kotlin/Nothing, kotlin/Nothing>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, androidx.compose.ui/Modifier?, kotlin/Function2?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsLayout?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsAnimators?, kotlin/Function1, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams?>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels|ChildPanels(com.arkivanov.decompose.router.panels.ChildPanels<0:0,0:1,0:2,0:3,kotlin.Nothing,kotlin.Nothing>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.ui.Modifier?;kotlin.Function2?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsLayout?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsAnimators?;kotlin.Function1,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.PredictiveBackParams?>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§;1§;2§;3§}[0] +final fun <#A: kotlin/Any, #B: kotlin/Any, #C: kotlin/Any, #D: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels(com.arkivanov.decompose.value/Value>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, kotlin/Function3, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, androidx.compose.ui/Modifier?, kotlin/Function2?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsLayout?, com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanelsAnimators?, kotlin/Function1, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams?>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.arkivanov.decompose.extensions.compose.experimental.panels/ChildPanels|ChildPanels(com.arkivanov.decompose.value.Value>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;kotlin.Function3,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.ui.Modifier?;kotlin.Function2?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsLayout?;com.arkivanov.decompose.extensions.compose.experimental.panels.ChildPanelsAnimators?;kotlin.Function1,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.PredictiveBackParams?>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§;1§;2§;3§}[0] final fun <#A: kotlin/Any, #B: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.stack.animation/stackAnimation(com.arkivanov.decompose.extensions.compose.experimental.stack.animation/StackAnimator? = ..., kotlin/Boolean = ..., kotlin/Function1, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams?> = ...): com.arkivanov.decompose.extensions.compose.experimental.stack.animation/StackAnimation<#A, #B> // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/stackAnimation|stackAnimation(com.arkivanov.decompose.extensions.compose.experimental.stack.animation.StackAnimator?;kotlin.Boolean;kotlin.Function1,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.PredictiveBackParams?>){0§;1§}[0] final fun <#A: kotlin/Any, #B: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.stack.animation/stackAnimation(kotlin/Boolean = ..., kotlin/Function1, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams?> = ..., kotlin/Function3, com.arkivanov.decompose/Child.Created<#A, #B>, com.arkivanov.decompose.extensions.compose.stack.animation/Direction, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/StackAnimator?>): com.arkivanov.decompose.extensions.compose.experimental.stack.animation/StackAnimation<#A, #B> // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/stackAnimation|stackAnimation(kotlin.Boolean;kotlin.Function1,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.PredictiveBackParams?>;kotlin.Function3,com.arkivanov.decompose.Child.Created<0:0,0:1>,com.arkivanov.decompose.extensions.compose.stack.animation.Direction,com.arkivanov.decompose.extensions.compose.experimental.stack.animation.StackAnimator?>){0§;1§}[0] final fun <#A: kotlin/Any, #B: kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.stack/ChildStack(com.arkivanov.decompose.router.stack/ChildStack<#A, #B>, androidx.compose.ui/Modifier?, com.arkivanov.decompose.extensions.compose.experimental.stack.animation/StackAnimation<#A, #B>?, kotlin/Function4, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.arkivanov.decompose.extensions.compose.experimental.stack/ChildStack|ChildStack(com.arkivanov.decompose.router.stack.ChildStack<0:0,0:1>;androidx.compose.ui.Modifier?;com.arkivanov.decompose.extensions.compose.experimental.stack.animation.StackAnimation<0:0,0:1>?;kotlin.Function4,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){0§;1§}[0] diff --git a/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/panels/ChildPanels.kt b/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/panels/ChildPanels.kt index 63ee9029..a96d018d 100644 --- a/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/panels/ChildPanels.kt +++ b/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/panels/ChildPanels.kt @@ -46,14 +46,14 @@ import com.arkivanov.decompose.value.Value @ExperimentalDecomposeApi @Composable fun ChildPanels( - panels: Value>, + panels: Value>, mainChild: @Composable (Child.Created) -> Unit, detailsChild: @Composable (Child.Created) -> Unit, modifier: Modifier = Modifier, secondPanelPlaceholder: @Composable () -> Unit = {}, layout: ChildPanelsLayout = remember { HorizontalChildPanelsLayout() }, animators: ChildPanelsAnimators = remember { ChildPanelsAnimators() }, - predictiveBackParams: (ChildPanels) -> PredictiveBackParams? = { null }, + predictiveBackParams: (ChildPanels) -> PredictiveBackParams? = { null }, ) { ChildPanels( panels = panels, @@ -92,14 +92,14 @@ fun ChildPanels( @ExperimentalDecomposeApi @Composable fun ChildPanels( - panels: ChildPanels, + panels: ChildPanels, mainChild: @Composable (Child.Created) -> Unit, detailsChild: @Composable (Child.Created) -> Unit, modifier: Modifier = Modifier, secondPanelPlaceholder: @Composable () -> Unit = {}, layout: ChildPanelsLayout = remember { HorizontalChildPanelsLayout() }, animators: ChildPanelsAnimators = remember { ChildPanelsAnimators() }, - predictiveBackParams: (ChildPanels) -> PredictiveBackParams? = { null }, + predictiveBackParams: (ChildPanels) -> PredictiveBackParams? = { null }, ) { ChildPanels( panels = panels,