diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9050d79 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +@chRyNaN \ No newline at end of file diff --git a/.github/funding.yml b/.github/funding.yml new file mode 100644 index 0000000..35d242e --- /dev/null +++ b/.github/funding.yml @@ -0,0 +1 @@ +custom: [ "https://www.buymeacoffee.com/chrynan", "https://chrynan.codes" ] \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..262c7e4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: Build + +on: + release: + types: [ published ] + +jobs: + build: + runs-on: macos-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v1 + + - name: Set up JDK 1.8 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 11 + + - name: Gradle Build + env: + KEY: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew build \ No newline at end of file diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 3716de0..64cece4 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -10,4 +10,4 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} issue-message: 'Welcome and thanks for contributing! Make sure to leave a detailed explanation of the issue.' - pr-message: 'Welcome and thanks for contributing! Make sure to follow the project''s coding conventions.' \ No newline at end of file + pr-message: 'Welcome and thanks for contributing! Make sure to follow the project''s coding conventions. For a faster response time, consider [boosting](https://www.buymeacoffee.com/chrynan/commissions) your issue.' \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..dc63ecc --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: Publish + +on: + release: + types: [ published ] + +jobs: + build: + runs-on: macos-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v1 + + - name: Set up JDK 1.8 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 11 + + - name: Gradle Publish + env: + KEY: ${{ secrets.GITHUB_TOKEN }} + BINTRAY_USER: ${{ secrets.repsyUsername }} + BINTRAY_KEY: ${{ secrets.repsyToken }} + run: ./gradlew publish \ No newline at end of file diff --git a/.github/workflows/refresh_versions.yml b/.github/workflows/refresh_versions.yml new file mode 100644 index 0000000..f54d089 --- /dev/null +++ b/.github/workflows/refresh_versions.yml @@ -0,0 +1,58 @@ +# Creates a PR on an interval if there are dependencies need to be updated. + +name: RefreshVersions + +on: + workflow_dispatch: + schedule: + - cron: '0 7 * * 1' + +jobs: + "Refresh-Versions": + runs-on: "ubuntu-latest" + steps: + - id: step-0 + name: Set current date as env variable + run: echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV + - id: step-1 + name: check-out + uses: actions/checkout@v3 + with: + ref: develop + - id: step-2 + name: setup-java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: adopt + - id: step-3 + name: create-branch + uses: peterjgrainger/action-create-branch@v2.2.0 + with: + branch: dependency-update-$NOW + env: + GITHUB_TOKEN: {{ secrets.GITHUB_TOKEN }} + - id: step-4 + name: gradle refreshVersions + uses: gradle/gradle-build-action@v2 + with: + arguments: refreshVersions + - id: step-5 + name: Commit + uses: EndBug/add-and-commit@v9 + with: + author_name: GitHub Actions + author_email: noreply@github.com + message: Refresh versions.properties + new_branch: dependency-update-$NOW + push: --force --set-upstream origin dependency-update-$NOW + - id: step-6 + name: Pull Request + uses: repo-sync/pull-request@v2 + with: + source_branch: dependency-update + destination_branch: main + pr_title: Upgrade dependencies + pr_body: '[refreshVersions](https://github.com/jmfayard/refreshVersions) has found these library updates!' + pr_draft: true + github_token: {{ secrets.GITHUB_TOKEN }} diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000..a9329a6 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,26 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: + - family-names: "Keenan" + given-names: "Christopher" + alias: "chRyNaN" + website: "https://chrynan.codes" +contact: + - family-names: "Keenan" + given-names: "Christopher" + alias: "chRyNaN" + website: "https://chrynan.codes" +title: "navigation" +type: "software" +abstract: "Kotlin multi-platform application navigation library." +license: "Apache-2.0" +keywords: + - "kotlin" + - "navigation" + - "presentation" + - "navigator" + - "navigation-architecture-component" + - "kotlin multiplatform" + - "jetpack compose" +repository-code: "https://github.com/chRyNaN/navigation" +url: "https://github.com/chRyNaN/navigation" \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..1ac9eae --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +support@mooncloak.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. \ No newline at end of file diff --git a/CODING_CONVENTIONS.md b/CODING_CONVENTIONS.md new file mode 100644 index 0000000..56871bf --- /dev/null +++ b/CODING_CONVENTIONS.md @@ -0,0 +1,76 @@ +# Coding Conventions + +Coding conventions are meant to enforce consistency throughout an application's code base. This consistency makes the +code base easier to read, navigate, and maintain. However, coding conventions should not become a hindrance to a +developers creativity and productivity. Striking the balance between having clean and consistent code and allowing +developer creativity, freedom over implementation details, and promoting a productive development environment is a +difficult task. This convention tries to find that balance, but may change over time to better reflect that goal. + +## Code Review Process + +To promote consistency throughout the codebase, it is considered appropriate to mention violations of the coding +conventions during a code review. This will bring awareness and help keep the code consistent. However, while it is +recommended to fix these violations, minor and inconsistent coding convention deviations shouldn't hold up the merging +of a PR. Remember to follow the [Code of Conduct](CODE_OF_CONDUCT.md) when contributing to this project, including code +review comments. + +## Project's Coding Conventions + +This project follows a slightly modified version of +the [Kotlin Coding Conventions](https://kotlinlang.org/docs/coding-conventions.html). This helps enforce code +consistency throughout the project. The modifications to the +standard [Kotlin Coding Conventions](https://kotlinlang.org/docs/coding-conventions.html) +are outlined below. These modifications override any conflicting convention from the Kotlin standard conventions. + +In the absence of a coding convention, it is the developer's choice. If this occurs constantly for the same style, +consider adding it to this documentation. + +## Modifications + +The following are the modifications to +the [Kotlin Coding Conventions](https://kotlinlang.org/docs/coding-conventions.html) that this repository utilizes for +it's coding conventions. + +### Blank line after type declaration + +There must be a blank line after the type declaration and before the first line of code in a file. This helps +readability by making the class declaration more clear at a glance. + +#### Example + +```kotlin +interface AudioFocusHandler { + + fun request() +} +``` + +### No blank lines before last closing brace + +There must not be a blank line before the last closing brace of a type or function. + +#### Example + +```kotlin +class MyViewModel(...) : BaseViewModel() { + + override fun bind() { + ... + } +} +``` + +### Properties are declared before functions + +All properties must be declared before functions. This includes private properties. This makes it easier to find +properties and functions without having to search around the file. + +### Public functions declared before private functions + +All public functions must be declared before the private functions. This allows for quicker understanding of the public +facing functions for the file or type. + +### Nested types are declared last for a type + +All nested types, such as interfaces, classes, and objects, are declared after all properties and functions of a type. +This allows for quicker understanding of the public facing functions for the file or type. diff --git a/README.md b/README.md index bf368e5..fac12ae 100644 --- a/README.md +++ b/README.md @@ -1,148 +1,265 @@ +![navigation](assets/navigation_logo.png) + # navigation -Kotlin multi-platform application navigation library. Supports Jetpack Compose.
+Kotlin multi-platform application navigation library that supports Jetpack Compose.

GitHub tag (latest by date) ```kotlin -val navigator = rememberNavigator("Greeting") +val navigator = rememberNavigator(initialDestination = "Greeting") -NavContainer(navigator) { _, destination -> +NavigationContainer(navigator) { (destination, _) -> when (destination) { - "Greeting" -> Text("Hello") + "Greeting" -> Column { + Text("Hello") + + Button(onClick = { navigator.push("Farewell") }) { + Text("Say Goodbye") + } + } "Farewell" -> Text("Good-bye") - else -> Text("Unexpected Key: $key") + else -> Text("Unexpected Destination: $destination") } } +``` -navigator.goTo("Farewell") +## Getting Started 🏁 + +The library is provided through [Repsy.io](https://repsy.io/). Checkout +the [releases page](https://github.com/chRyNaN/navigation/releases) to get the latest version.
+GitHub tag (latest by date) + +### Repository + +```groovy +repositories { + maven { + url = uri("https://repo.repsy.io/mvn/chrynan/public") + } +} ``` -### Usage +### Dependencies -* Create a `Navigator` for any `NavigationDestination` type that you will use as a destination key. This can be Strings, - enums, sealed classes, or any type. +#### core + +```groovy +implementation("com.chrynan.navigation:navigation-core:VERSION") +``` + +#### compose + +```groovy +implementation("com.chrynan.navigation:navigation-compose:VERSION") +``` + +## Usage 👨‍💻 + +### Destinations + +`NavigationDestinations` represent the locations within an application that a `Navigator` can coordinate. They can be of +any type and can contain any data that is useful to render the destination UI. A common approach is to use enums or +sealed classes to represent the different `NavigationDestinations` within an application. ```kotlin -enum class Destination { +enum class AppDestination { HOME, + SEARCH, SETTINGS, DETAILS } +``` -@Composable -fun App() { - val navigator = rememberNavigator(initialDestination = Destination.HOME) +### Contexts + +A `NavigationContext` is a way of representing complex or nested navigation destinations. A `NavigationContext` defines +its `initialDestination` and has its own stack of `NavigationDestinations` associated with it within the internal +implementation of a `Navigator`. This allows there to be a stack of stacks of `NavigationDestinations` for an +application. + +```kotlin +enum class MainContext( + override val initialDestination: AppDestination, + val title: String, + val icon: ImageVector +) : NavigationContext { + + HOME(title = "Home", icon = Icons.Default.Home, initialDestination = AppDestination.Home), + + SEARCH(title = "Search", icon = Icons.Default.Search, initialDestination = AppDestination.Search), + + SETTINGS(title = "Settings", icon = Icons.Default.Settings, initialDestination = AppDestination.Settings) } ``` -* Create a `NavContainer` to display the current content based off of the latest navigation context and destination - values. +### Navigator + +A `Navigator` is used to navigate between navigation contexts and destinations via the +convenient `push`, `popContext`, and `popDestination` functions. A `Navigator` can be obtained via one of the +constructor functions or the `remember`/`rememberSavable` functions when using Jetpack Compose/Multiplatform Compose. + +```kotlin +val navigator = rememberNavigator(initialDestination = AppDestination.HOME) + +BackHandler { navigator.popDestination() } + +ListItem(modifier = Modifier.clickable { navigator.push(AppDestination.DETAILS) }) +``` + +### NavigationContainer + +The `NavigationContainer` composable provides a convenient way to listening to destination and context state changes and +recomposing its content accordingly. Just provide a `Navigator` instance and a content composable. ```kotlin @Composable fun App() { - val navigator = rememberNavigator(initialDestination = Destination.HOME) + val navigator = rememberNavigator(initialDestination = AppDestination.HOME) - NavContainer(navigator = navigator) { _, destination -> + NavigationContainer(navigator = navigator) { (destination, context) -> when (destination) { - Destination.HOME -> HomeScreenComposable() - Destination.SETTINGS -> SettingsScreenComposable() - Destination.DETAILS -> DetailsScreenComposable() + AppDestination.HOME -> HomeScreenComposable() + AppDestination.SEARCH -> SearchScreenComposable() + AppDestination.SETTINGS -> SettingsScreenComposable() + AppDestination.DETAILS -> DetailsScreenComposable() } } } ``` -* Use the `Navigator` instance to navigate between navigation contexts and destinations. +### Transitions and animations + +You have complete control over the composable functions that render the UI of the application and can use the Jetpack +Compose library's transition and animation APIs to change between the navigation context and destination UIs. For more +fine-grained control, create a custom composable replacing the `NavigationContainer` that handles transitions properly +for your application. Then just listen and react to the `Navigator.state` changes. ```kotlin -BackHandler { navigator.goBack() } +@Composable +fun > MyNavContainer( + navigator: Navigator, +) { + val context = navigator.store.context.collectAsState() + val destination = navigator.store.destination.collectAsState() + + // Render UI from context and destination values and apply any transition or animation desired. +} ``` -#### Navigation Contexts +### Best Practices -Complex navigation flows require multiple stacks of navigation destinations that may be retained when changing stacks. -These stacks are referred to as `NavigationContext` in this library. A `NavigationContext` is an interface that defines -the default navigation destination. For example: +* Avoid passing a `Navigator` to `@Composable` functions and + instead [hoist the state](https://developer.android.com/jetpack/compose/state-hoisting). ```kotlin -enum class MainNavigationContext( - val title: String, - val icon: ImageVector, - override val initialDestination: Destination -) : NavigationContext { +@Composable +fun App() { + val navigator = rememberNavigator(...) - HOME(title = "Home", icon = Icons.Default.Home, initialDestination = Destination.HOME), + ... - SETTINGS(title = "Settings", icon = Icons.Default.Settings, initialDestination = Destination.SETTINGS) + MyScreen( + onBackPressed = { navigator.popDestination() }, + onGoToDetails = { navigator.push(AppDestination.Details(it)) } + ) } ``` -Then to change the current context, use the `Navigator.changeContext` function: +* Use different `Navigators` for deep nested navigation. This way each component can retain its own navigation hierarchy + and delegate to its encapsulating component via state hoisting if it cannot handle the navigation. ```kotlin -navigator.changeContext(MainNavigationContext.SETTINGS) -``` +@Composable +fun ParentComponent() { + val parentNavigator = rememberNavigator(...) -#### Transitions and animations + ... -You have complete control over the composables that render the UI of the application and can use the Jetpack Compose -library's transition and animation APIs to change between the navigation context and destination UIs. For more -fine-grained control, create a custom composable replacing the `NavContainer` that handles transitions properly for your -application. Then just listen and react to the `Navigator.state` changes. + ChildComponent(onBack = { parentNavigator.popDestination() }) +} -```kotlin @Composable -fun > MyNavContainer( - navigator: Navigator, +fun ChildComponent( + onBack: () -> Unit ) { - val context = navigator.state.currentContextAsState() - val destination = navigator.state.currentDestinationAsState() + val childNavigator = rememberNavigator(...) - // Render UI from context and destination values and apply any transition or animtation desired. + BackHandler { + if (!childNavigator.canPopDestination()) { + onBack.invoke() + } + } } ``` -## Building the library +* Use the `rememberSavableNavigator` function along with serializable navigation destinations and contexts to retain the + navigation state between configuration changes. -The library is provided through [Repsy.io](https://repsy.io/). Checkout -the [releases page](https://github.com/chRyNaN/navigation/releases) to get the latest version.
-GitHub tag (latest by date) +```kotlin +val navigator = rememberSavableNavigator( + initialContext = MainContext.HOME, + destinationSerializer = AppDestination.serializer(), + contextSerializer = MainContext.serializer() +) +``` -### Repository +* Create the `Navigator` instance outside of `@Composable` functions to handle navigation outside the user interface + flow, such as in Activity lifecycle callbacks. -```groovy -repositories { - maven { - url = uri("https://repo.repsy.io/mvn/chrynan/public") - } -} +```kotlin +val navigator = Navigator(initialContext = MainContext.HOME) ``` -### Dependencies - -#### core +* Utilize [side-effects](https://developer.android.com/jetpack/compose/side-effects) in Jetpack Compose for handling + navigation to non-composable UI components, such as starting new Activities or changing Fragments. -```groovy -implementation("com.chrynan.navigation:navigation-core:VERSION") +```kotlin +NavigationContainer(navigator) { (destination, _) -> + when (destination) { + is AppDestination.Details -> LaunchedEffect(destination) { + context.startActivity(DetailsActivity.newIntent(context, destinatin.id)) + } + } +} ``` -#### compose +* Utilize [kotlinx serialization](https://github.com/Kotlin/kotlinx.serialization) and + the [serialization-parcelable](https://github.com/chRyNaN/serialization-parcelable) library to transfer a `Navigator` + between components. -```groovy -implementation("com.chrynan.navigation:navigation-compose:VERSION") +```kotlin +val navigatorSerializer = Navigator.serializer(destinationSerializer, contextSerializer) + +parcelable.encodeToParcel(serializer = navigatorSerializer, value = navigator) +json.encodeToString(serializer = navigatorSerializer, value = navigator) ``` -## Documentation +## Documentation 📃 More detailed documentation is available in the [docs](docs/) folder. The entry point to the documentation can be found [here](docs/index.md). -## License +## Security 🛡️ + +For security vulnerabilities, concerns, or issues, please responsibly disclose the information either by opening a +public GitHub Issue or reaching out to the project owner. + +## Contributing ✍️ + +Outside contributions are welcome for this project. Please follow the [code of conduct](CODE_OF_CONDUCT.md) +and [coding conventions](CODING_CONVENTIONS.md) when contributing. If contributing code, please add thorough documents. +and tests. Thank you! + +## Sponsorship ❤️ + +Support this project by [becoming a sponsor](https://www.buymeacoffee.com/chrynan) of my work! And make sure to give the +repository a ⭐ + +## License ⚖️ ``` -Copyright 2021 chRyNaN +Copyright 2023 chRyNaN Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/assets/navigation_logo.png b/assets/navigation_logo.png new file mode 100644 index 0000000..1af8e61 Binary files /dev/null and b/assets/navigation_logo.png differ diff --git a/build.gradle.kts b/build.gradle.kts index 3deaa37..205dd7d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,24 +3,17 @@ import com.chrynan.navigation.buildSrc.LibraryConstants group = LibraryConstants.group version = LibraryConstants.versionName -buildscript { - repositories { - google() - mavenCentral() - maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } - maven { url = uri("https://repo.repsy.io/mvn/chrynan/public") } - } - dependencies { - classpath("com.android.tools.build:gradle:4.2.2") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10") - classpath("org.jetbrains.kotlin:kotlin-serialization:1.7.10") - classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.10") - classpath("org.jetbrains.compose:compose-gradle-plugin:1.2.0-beta02") - } +plugins { + kotlin("jvm") version "1.8.20" apply false + kotlin("multiplatform") version "1.8.20" apply false + kotlin("android") version "1.8.20" apply false + id("com.android.library") version "7.3.1" apply false + id("com.android.application") version "7.3.1" apply false + id("org.jetbrains.dokka") version "1.8.10" + id("org.jetbrains.compose") version "1.5.0-beta01" apply false + id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" } -apply(plugin = "org.jetbrains.dokka") - allprojects { repositories { google() diff --git a/buildSrc/src/main/java/com.chrynan.navigation.buildSrc/LibraryConstants.kt b/buildSrc/src/main/java/com.chrynan.navigation.buildSrc/LibraryConstants.kt index dcfad6f..1fc0ac2 100644 --- a/buildSrc/src/main/java/com.chrynan.navigation.buildSrc/LibraryConstants.kt +++ b/buildSrc/src/main/java/com.chrynan.navigation.buildSrc/LibraryConstants.kt @@ -7,8 +7,8 @@ object LibraryConstants { const val group = "com.chrynan.navigation" const val owner = "chrynan" const val repoName = "navigation" - const val versionName = "0.6.0" - const val versionCode = 8 + const val versionName = "0.10.0" + const val versionCode = 12 const val versionDescription = "Release $versionName ($versionCode)" const val license = "Apache-2.0" const val vcsUrl = "https://github.com/chRyNaN/navigation.git" @@ -16,7 +16,7 @@ object LibraryConstants { object Android { const val compileSdkVersion = 33 - const val minSdkVersion = 25 + const val minSdkVersion = 21 const val targetSdkVersion = 33 } } diff --git a/buildSrc/src/main/java/com.chrynan.navigation.buildSrc/OSUtils.kt b/buildSrc/src/main/java/com.chrynan.navigation.buildSrc/OSUtils.kt new file mode 100644 index 0000000..9fc7e5d --- /dev/null +++ b/buildSrc/src/main/java/com.chrynan.navigation.buildSrc/OSUtils.kt @@ -0,0 +1,30 @@ +package com.chrynan.navigation.buildSrc + +import java.lang.System + +/** + * Determines if this Gradle build is running on a Mac OSX Operating System. + */ +fun isBuildingOnOSX(): Boolean { + val osName = System.getProperty("os.name").toLowerCase() + + return osName.contains("mac os x") || osName.contains("darwin") || osName.contains("osx") +} + +/** + * Determines if this Gradle build is running on a Linux Operating System. + */ +fun isBuildingOnLinux(): Boolean { + val osName = System.getProperty("os.name").toLowerCase() + + return osName.contains("linux") +} + +/** + * Determines if this Gradle build is running on a Windows Operating System. + */ +fun isBuildingOnWindows(): Boolean { + val osName = System.getProperty("os.name").toLowerCase() + + return osName.contains("windows") || osName.contains("mingw") +} diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/-companion/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/-companion/index.md new file mode 100644 index 0000000..bd6ddc0 --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-compose](../../../../index.md)/[com.chrynan.navigation.compose](../../index.md)/[ComposeNavigationContextState](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/index.md new file mode 100644 index 0000000..ac2d12d --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/index.md @@ -0,0 +1,34 @@ +//[navigation-compose](../../../index.md)/[com.chrynan.navigation.compose](../index.md)/[ComposeNavigationContextState](index.md) + +# ComposeNavigationContextState + +[common]\ +@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +interface [ComposeNavigationContextState](index.md)<[Destination](index.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](index.md) : [NavigationContext](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](index.md)>> : [NavigationContextState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md)<[Destination](index.md), [Context](index.md)> + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Properties + +| Name | Summary | +|---|---| +| [contextChanges](../-compose-navigator-state/index.md#-1880294209%2FProperties%2F-1093353005) | [common]
abstract val [contextChanges](../-compose-navigator-state/index.md#-1880294209%2FProperties%2F-1093353005): Flow<[Context](index.md)> | +| [currentContext](../-compose-navigator-state/index.md#-822285539%2FProperties%2F-1093353005) | [common]
abstract val [currentContext](../-compose-navigator-state/index.md#-822285539%2FProperties%2F-1093353005): [Context](index.md) | +| [initialContext](../-compose-navigator-state/index.md#-1520396056%2FProperties%2F-1093353005) | [common]
abstract val [initialContext](../-compose-navigator-state/index.md#-1520396056%2FProperties%2F-1093353005): [Context](index.md) | + +## Inheritors + +| Name | +|---| +| [ComposeNavigatorState](../-compose-navigator-state/index.md) | + +## Extensions + +| Name | Summary | +|---|---| +| [currentContextAsState](../current-context-as-state.md) | [common]
@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](../current-context-as-state.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](../current-context-as-state.md) : [NavigationContext](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](../current-context-as-state.md)>> [NavigationContextState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md)<[Destination](../current-context-as-state.md), [Context](../current-context-as-state.md)>.[currentContextAsState](../current-context-as-state.md)(initialCurrentContext: [Context](../current-context-as-state.md)): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Context](../current-context-as-state.md)>
@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](../current-context-as-state.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](../current-context-as-state.md) : [NavigationContext](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](../current-context-as-state.md)>> [NavigationContextState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md)<[Destination](../current-context-as-state.md), [Context](../current-context-as-state.md)>.[currentContextAsState](../current-context-as-state.md)(): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Context](../current-context-as-state.md)>
Obtains the changes to the [ComposeNavigationContextState.currentContext](../../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/current-context.md) value and returns it as a [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html). This allows it to be used in a [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) and cause recomposition when the value changes. | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/-companion/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/-companion/index.md new file mode 100644 index 0000000..4a96810 --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-compose](../../../../index.md)/[com.chrynan.navigation.compose](../../index.md)/[ComposeNavigationDestinationState](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/index.md new file mode 100644 index 0000000..c8fd85d --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/index.md @@ -0,0 +1,34 @@ +//[navigation-compose](../../../index.md)/[com.chrynan.navigation.compose](../index.md)/[ComposeNavigationDestinationState](index.md) + +# ComposeNavigationDestinationState + +[common]\ +@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +interface [ComposeNavigationDestinationState](index.md)<[Destination](index.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> : [NavigationDestinationState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md)<[Destination](index.md)> + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Properties + +| Name | Summary | +|---|---| +| [currentDestination](../-compose-navigator-state/index.md#1047421983%2FProperties%2F-1093353005) | [common]
abstract val [currentDestination](../-compose-navigator-state/index.md#1047421983%2FProperties%2F-1093353005): [Destination](index.md) | +| [destinationChanges](../-compose-navigator-state/index.md#1416376863%2FProperties%2F-1093353005) | [common]
abstract val [destinationChanges](../-compose-navigator-state/index.md#1416376863%2FProperties%2F-1093353005): Flow<[Destination](index.md)> | +| [initialDestination](../-compose-navigator-state/index.md#-1134545814%2FProperties%2F-1093353005) | [common]
abstract val [initialDestination](../-compose-navigator-state/index.md#-1134545814%2FProperties%2F-1093353005): [Destination](index.md) | + +## Inheritors + +| Name | +|---| +| [ComposeNavigatorState](../-compose-navigator-state/index.md) | + +## Extensions + +| Name | Summary | +|---|---| +| [currentDestinationAsState](../current-destination-as-state.md) | [common]
@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](../current-destination-as-state.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [NavigationDestinationState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md)<[Destination](../current-destination-as-state.md)>.[currentDestinationAsState](../current-destination-as-state.md)(initialCurrentKey: [Destination](../current-destination-as-state.md)): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Destination](../current-destination-as-state.md)>
@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](../current-destination-as-state.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [NavigationDestinationState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md)<[Destination](../current-destination-as-state.md)>.[currentDestinationAsState](../current-destination-as-state.md)(): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Destination](../current-destination-as-state.md)>
Obtains the changes to the [ComposeNavigationDestinationState.currentDestination](../../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/current-destination.md) value and returns it as a [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html). This allows it to be used in a [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) and cause recomposition when the value changes. | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-scope/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-scope/index.md index 0017ea1..9f70553 100644 --- a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-scope/index.md +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-scope/index.md @@ -18,6 +18,3 @@ interface [ComposeNavigationScope](index.md) : [NavigationScope](../../../../nav | Name | |---| | [Companion](-companion/index.md) | -| [ComposeNavigationKeyScope](../-compose-navigation-key-scope/index.md) | -| [ComposeNavigationIntentScope](../-compose-navigation-intent-scope/index.md) | -| [ComposeNavigationContentScope](../-compose-navigation-content-scope/index.md) | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-state/-companion/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-state/-companion/index.md new file mode 100644 index 0000000..be35aa6 --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-state/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-compose](../../../../index.md)/[com.chrynan.navigation.compose](../../index.md)/[ComposeNavigatorState](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-state/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-state/index.md new file mode 100644 index 0000000..f7a8b0b --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-state/index.md @@ -0,0 +1,32 @@ +//[navigation-compose](../../../index.md)/[com.chrynan.navigation.compose](../index.md)/[ComposeNavigatorState](index.md) + +# ComposeNavigatorState + +[common]\ +@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +interface [ComposeNavigatorState](index.md)<[Destination](index.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](index.md) : [NavigationContext](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](index.md)>> : [ComposeNavigationDestinationState](../-compose-navigation-destination-state/index.md)<[Destination](index.md)> , [ComposeNavigationContextState](../-compose-navigation-context-state/index.md)<[Destination](index.md), [Context](index.md)> + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Properties + +| Name | Summary | +|---|---| +| [contextChanges](index.md#-1880294209%2FProperties%2F-1093353005) | [common]
abstract val [contextChanges](index.md#-1880294209%2FProperties%2F-1093353005): Flow<[Context](index.md)> | +| [currentContext](index.md#-822285539%2FProperties%2F-1093353005) | [common]
abstract val [currentContext](index.md#-822285539%2FProperties%2F-1093353005): [Context](index.md) | +| [currentDestination](index.md#1047421983%2FProperties%2F-1093353005) | [common]
abstract val [currentDestination](index.md#1047421983%2FProperties%2F-1093353005): [Destination](index.md) | +| [destinationChanges](index.md#1416376863%2FProperties%2F-1093353005) | [common]
abstract val [destinationChanges](index.md#1416376863%2FProperties%2F-1093353005): Flow<[Destination](index.md)> | +| [initialContext](index.md#-1520396056%2FProperties%2F-1093353005) | [common]
abstract val [initialContext](index.md#-1520396056%2FProperties%2F-1093353005): [Context](index.md) | +| [initialDestination](index.md#-1134545814%2FProperties%2F-1093353005) | [common]
abstract val [initialDestination](index.md#-1134545814%2FProperties%2F-1093353005): [Destination](index.md) | + +## Extensions + +| Name | Summary | +|---|---| +| [currentContextAsState](../current-context-as-state.md) | [common]
@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](../current-context-as-state.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](../current-context-as-state.md) : [NavigationContext](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](../current-context-as-state.md)>> [NavigationContextState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md)<[Destination](../current-context-as-state.md), [Context](../current-context-as-state.md)>.[currentContextAsState](../current-context-as-state.md)(initialCurrentContext: [Context](../current-context-as-state.md)): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Context](../current-context-as-state.md)>
@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](../current-context-as-state.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](../current-context-as-state.md) : [NavigationContext](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](../current-context-as-state.md)>> [NavigationContextState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md)<[Destination](../current-context-as-state.md), [Context](../current-context-as-state.md)>.[currentContextAsState](../current-context-as-state.md)(): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Context](../current-context-as-state.md)>
Obtains the changes to the [ComposeNavigationContextState.currentContext](../../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/current-context.md) value and returns it as a [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html). This allows it to be used in a [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) and cause recomposition when the value changes. | +| [currentDestinationAsState](../current-destination-as-state.md) | [common]
@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](../current-destination-as-state.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [NavigationDestinationState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md)<[Destination](../current-destination-as-state.md)>.[currentDestinationAsState](../current-destination-as-state.md)(initialCurrentKey: [Destination](../current-destination-as-state.md)): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Destination](../current-destination-as-state.md)>
@[ExperimentalNavigationApi](../../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](../current-destination-as-state.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [NavigationDestinationState](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md)<[Destination](../current-destination-as-state.md)>.[currentDestinationAsState](../current-destination-as-state.md)(): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Destination](../current-destination-as-state.md)>
Obtains the changes to the [ComposeNavigationDestinationState.currentDestination](../../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/current-destination.md) value and returns it as a [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html). This allows it to be used in a [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) and cause recomposition when the value changes. | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-nav-container.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-nav-container.md index 626e57e..26fdaa5 100644 --- a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-nav-container.md +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-nav-container.md @@ -4,101 +4,39 @@ [common]\ -@Composable +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) @[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) -fun <[Context](-nav-container.md), [Key](-nav-container.md)> [NavContainer](-nav-container.md)(navigator: [ComposeNavigatorByContentViewModel](-compose-navigator-by-content-view-model/index.md)<[Context](-nav-container.md), [Key](-nav-container.md)>) +fun <[Destination](-nav-container.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](-nav-container.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](-nav-container.md)>> [NavContainer](-nav-container.md)(navigator: [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](-nav-container.md), [Context](-nav-container.md)>, content: @[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)[ComposeNavigationScope](-compose-navigation-scope/index.md).(context: [Context](-nav-container.md), destination: [Destination](-nav-container.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)) -Displays the content from a [navigator](-nav-container.md) in this Composable UI Container. - -When the [navigator](-nav-container.md) changes its content, even outside this [NavContainer](-nav-container.md), it will be reflected within this UI container. - -Example usage: - -val navigator = rememberNavigatorByContent("Greeting") { Text("Hello") }\ -\ -// The NavContainer will start by displaying the initial content, which in this case is "Hello".\ -NavContainer(navigator)\ -\ -// The above NavContainer will display "Good-bye" after the following call:\ -navigator.goTo("Farewell") { Text("Good-bye") } - -## See also - -common - -| | | -|---|---| -| [rememberNavigatorByContent](remember-navigator-by-content.md) | | - -[common]\ - -@Composable - -@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) - -fun <[Context](-nav-container.md), [Key](-nav-container.md)> [NavContainer](-nav-container.md)(navigator: [ComposeNavigatorByKeyViewModel](-compose-navigator-by-key-view-model/index.md)<[Context](-nav-container.md), [Key](-nav-container.md)>) - -Displays the content from a [navigator](-nav-container.md) in this Composable UI Container. - -When the [navigator](-nav-container.md) changes its content, even outside this [NavContainer](-nav-container.md), it will be reflected within this UI container. +A [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) that listens to navigation context and destination changes from the provided [navigator](-nav-container.md) and calls the provided [content](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) function with the latest values. Example usage: -val navigator = rememberNavigatorByKey("Greeting") { key ->\ - when(key) {\ - "Greeting" -> Text("Hello")\ - "Farewell" -> Text("Good-bye")\ - else -> Text("Unexpected Key: $key")\ - }\ -}\ -\ -// The NavContainer will start by displaying the initial content, which in this case is "Hello"\ -NavContainer(navigator)\ -\ -// The above NavContainer will display "Good Bye" after the following call:\ -navigator.goTo("Farewell") - -## See also - -common - -| | | -|---|---| -| [rememberNavigatorByKey](remember-navigator-by-key.md) | | +```kotlin +NavContainer(navigator) { context, destination -> + Text("context = $context; destination = $destination") +} +``` [common]\ -@Composable +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) @[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) -fun <[Context](-nav-container.md), [Intent](-nav-container.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [NavContainer](-nav-container.md)(navigator: [ComposeNavigationIntentNavigatorByKeyViewModel](-compose-navigation-intent-navigator-by-key-view-model/index.md)<[Context](-nav-container.md), [Intent](-nav-container.md)>) - -Displays the content from a [navigator](-nav-container.md) in this Composable UI Container. +fun <[Destination](-nav-container.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](-nav-container.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](-nav-container.md)>> [NavContainer](-nav-container.md)(navigator: [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](-nav-container.md), [Context](-nav-container.md)>, modifier: [Modifier](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.html), content: @[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)[ComposeNavigationScope](-compose-navigation-scope/index.md).(context: [Context](-nav-container.md), destination: [Destination](-nav-container.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)) -When the [navigator](-nav-container.md) changes its content, even outside this [NavContainer](-nav-container.md), it will be reflected within this UI container. +A [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) that listens to navigation context and destination changes from the provided [navigator](-nav-container.md) and calls the provided [content](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) function with the latest values. Example usage: -val navigator = rememberNavigatorByKey(HomeNavigationIntent.Greeting) { navigationIntent ->\ - when(navigationIntent) {\ - HomeNavigationIntent.Greeting -> Text("Hello")\ - HomeNavigationIntent.Farewell -> Text("Good-bye")\ - }\ -}\ -\ -// The NavContainer will start by displaying the initial content, which in this case is "Hello"\ -NavContainer(navigator)\ -\ -// The above NavContainer will display "Good Bye" after the following call:\ -navigator.goTo(HomeNavigationIntent.Farewell) - -## See also - -common - -| | | -|---|---| -| [rememberNavigatorByIntent](remember-navigator-by-intent.md) | | +```kotlin +NavContainer( + navigator = navigator, + modifier = modifier +) { context, destination -> + Text("context = $context; destination = $destination") +} +``` diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-navigation-container.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-navigation-container.md new file mode 100644 index 0000000..56a22db --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-navigation-container.md @@ -0,0 +1,24 @@ +//[navigation-compose](../../index.md)/[com.chrynan.navigation.compose](index.md)/[NavigationContainer](-navigation-container.md) + +# NavigationContainer + +[common]\ + +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) + +@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +fun <[Destination](-navigation-container.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](-navigation-container.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](-navigation-container.md)>> [NavigationContainer](-navigation-container.md)(navigator: [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](-navigation-container.md), [Context](-navigation-container.md)>, modifier: [Modifier](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.html) = Modifier, content: @[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)[BoxScope](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/BoxScope.html).(destinationAndContext: [DestinationAndContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/index.md)<[Destination](-navigation-container.md), [Context](-navigation-container.md)>) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)) + +A [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) that listens to navigation context and destination changes from the provided [navigator](-navigation-container.md) and calls the provided [content](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) function with the latest values. + +Example usage: + +```kotlin +NavContainer( + navigator = navigator, + modifier = modifier +) { (context, destination) -> + Text("context = $context; destination = $destination") +} +``` diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-saveable-context-stack/-saveable-context-stack.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-saveable-context-stack/-saveable-context-stack.md new file mode 100644 index 0000000..3067c3f --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-saveable-context-stack/-saveable-context-stack.md @@ -0,0 +1,6 @@ +//[navigation-compose](../../../index.md)/[com.chrynan.navigation.compose](../index.md)/[SaveableContextStack](index.md)/[SaveableContextStack](-saveable-context-stack.md) + +# SaveableContextStack + +[common]\ +fun [SaveableContextStack](-saveable-context-stack.md)() diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-saveable-context-stack/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-saveable-context-stack/index.md new file mode 100644 index 0000000..9af57c4 --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-saveable-context-stack/index.md @@ -0,0 +1,12 @@ +//[navigation-compose](../../../index.md)/[com.chrynan.navigation.compose](../index.md)/[SaveableContextStack](index.md) + +# SaveableContextStack + +[common]\ +class [SaveableContextStack](index.md) + +## Constructors + +| | | +|---|---| +| [SaveableContextStack](-saveable-context-stack.md) | [common]
fun [SaveableContextStack](-saveable-context-stack.md)() | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/collect-as-state.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/collect-as-state.md new file mode 100644 index 0000000..1c8d020 --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/collect-as-state.md @@ -0,0 +1,11 @@ +//[navigation-compose](../../index.md)/[com.chrynan.navigation.compose](index.md)/[collectAsState](collect-as-state.md) + +# collectAsState + +[common]\ + +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) + +fun <[T](collect-as-state.md)> [NavigationState](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/index.md)<[T](collect-as-state.md)>.[collectAsState](collect-as-state.md)(): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[T](collect-as-state.md)> + +Converts the [NavigationState.changes](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/changes.md) of this [NavigationState](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/index.md) to a Jetpack Compose [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html) so that every change causes a recomposition of the calling [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) function. diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-context-as-state.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-context-as-state.md index 73fae4e..b419c68 100644 --- a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-context-as-state.md +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-context-as-state.md @@ -6,27 +6,28 @@ @[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) -@Composable +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) -fun <[Context](current-context-as-state.md), [Key](current-context-as-state.md)> [ComposeContextNavigator](-compose-context-navigator/index.md)<[Context](current-context-as-state.md), [Key](current-context-as-state.md)>.[currentContextAsState](current-context-as-state.md)(initialCurrentContext: [Context](current-context-as-state.md)): State<[Context](current-context-as-state.md)> +fun <[Destination](current-context-as-state.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](current-context-as-state.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](current-context-as-state.md)>> [NavigationContextState](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md)<[Destination](current-context-as-state.md), [Context](current-context-as-state.md)>.[currentContextAsState](current-context-as-state.md)(initialCurrentContext: [Context](current-context-as-state.md)): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Context](current-context-as-state.md)> @[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) -@Composable +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) -fun <[Context](current-context-as-state.md), [Key](current-context-as-state.md)> [ComposeContextNavigator](-compose-context-navigator/index.md)<[Context](current-context-as-state.md), [Key](current-context-as-state.md)>.[currentContextAsState](current-context-as-state.md)(): State<[Context](current-context-as-state.md)> +fun <[Destination](current-context-as-state.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](current-context-as-state.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](current-context-as-state.md)>> [NavigationContextState](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md)<[Destination](current-context-as-state.md), [Context](current-context-as-state.md)>.[currentContextAsState](current-context-as-state.md)(): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Context](current-context-as-state.md)> -Obtains the changes to the [ComposeContextNavigator.currentContext](-compose-context-navigator/current-context.md) value and returns it as a State. This allows it to be used in a Composable and cause recomposition when the value changes. +Obtains the changes to the [ComposeNavigationContextState.currentContext](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/current-context.md) value and returns it as a [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html). This allows it to be used in a [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) and cause recomposition when the value changes. -If you just need to get the current scope value and do not need to cause recomposition when the value changes, simply use the [ComposeContextNavigator.currentContext](-compose-context-navigator/current-context.md) property. +If you just need to get the current scope value and do not need to cause recomposition when the value changes, simply use the [ComposeNavigationContextState.currentContext](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/current-context.md) property. -**Note:** Internally this function uses the [ComposeContextNavigator.contextChanges](-compose-context-navigator/context-changes.md) Flow and the collectAsState function using the [ComposeContextNavigator.currentContext](-compose-context-navigator/current-context.md) as the initial value. +**Note:** Internally this function uses the [ComposeNavigationContextState.contextChanges](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/context-changes.md) Flow and the [collectAsState](https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary.html) function using the [ComposeNavigationContextState.currentContext](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/current-context.md) as the initial value. -## See also +#### See also common -| | | -|---|---| -| [com.chrynan.navigation.compose.ComposeContextNavigator](-compose-context-navigator/context-changes.md) | | -| collectAsState | | +| | +|---| +| [ComposeNavigationContextState.currentContext](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/current-context.md) | +| [ComposeNavigationContextState.contextChanges](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-context-state/context-changes.md) | +| [collectAsState](https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary.html) | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-destination-as-state.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-destination-as-state.md new file mode 100644 index 0000000..97f6259 --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-destination-as-state.md @@ -0,0 +1,33 @@ +//[navigation-compose](../../index.md)/[com.chrynan.navigation.compose](index.md)/[currentDestinationAsState](current-destination-as-state.md) + +# currentDestinationAsState + +[common]\ + +@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) + +fun <[Destination](current-destination-as-state.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [NavigationDestinationState](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md)<[Destination](current-destination-as-state.md)>.[currentDestinationAsState](current-destination-as-state.md)(initialCurrentKey: [Destination](current-destination-as-state.md)): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Destination](current-destination-as-state.md)> + +@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) + +fun <[Destination](current-destination-as-state.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [NavigationDestinationState](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md)<[Destination](current-destination-as-state.md)>.[currentDestinationAsState](current-destination-as-state.md)(): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[Destination](current-destination-as-state.md)> + +Obtains the changes to the [ComposeNavigationDestinationState.currentDestination](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/current-destination.md) value and returns it as a [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html). This allows it to be used in a [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) and cause recomposition when the value changes. + +If you just need to get the current key value and do not need to cause recomposition when the value changes, simply use the [ComposeNavigationDestinationState.currentDestination](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/current-destination.md) property. + +**Note:** Internally this function uses the [ComposeNavigationDestinationState.destinationChanges](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/destination-changes.md) Flow and the [collectAsState](https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary.html) function using the [ComposeNavigationDestinationState.currentDestination](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/current-destination.md) as the initial value. + +#### See also + +common + +| | +|---| +| [ComposeNavigationDestinationState.currentDestination](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/current-destination.md) | +| [ComposeNavigationDestinationState.destinationChanges](../../../navigation-compose/com.chrynan.navigation.compose/-compose-navigation-destination-state/destination-changes.md) | +| [collectAsState](https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary.html) | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/index.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/index.md index fcf4fbd..191acd6 100644 --- a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/index.md +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/index.md @@ -1,36 +1,12 @@ //[navigation-compose](../../index.md)/[com.chrynan.navigation.compose](index.md) -# Package com.chrynan.navigation.compose - -## Types - -| Name | Summary | -|---|---| -| [BaseComposeNavigatorByContentViewModel](-base-compose-navigator-by-content-view-model/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
abstract class [BaseComposeNavigatorByContentViewModel](-base-compose-navigator-by-content-view-model/index.md)<[Context](-base-compose-navigator-by-content-view-model/index.md), [Key](-base-compose-navigator-by-content-view-model/index.md)> : ViewModel, [ComposeNavigatorByContent](-compose-navigator-by-content/index.md)<[Context](-base-compose-navigator-by-content-view-model/index.md), [Key](-base-compose-navigator-by-content-view-model/index.md)> | -| [BaseComposeNavigatorByKeyViewModel](-base-compose-navigator-by-key-view-model/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
abstract class [BaseComposeNavigatorByKeyViewModel](-base-compose-navigator-by-key-view-model/index.md)<[Context](-base-compose-navigator-by-key-view-model/index.md), [Key](-base-compose-navigator-by-key-view-model/index.md), [NavigationScope](-base-compose-navigator-by-key-view-model/index.md) : [ComposeNavigationKeyScope](-compose-navigation-key-scope/index.md)<[Context](-base-compose-navigator-by-key-view-model/index.md), [Key](-base-compose-navigator-by-key-view-model/index.md)>>(initialContext: [Context](-base-compose-navigator-by-key-view-model/index.md), keySaver: [Saver](-saver/index.md)<[Key](-base-compose-navigator-by-key-view-model/index.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)>, initialKeys: ([Context](-base-compose-navigator-by-key-view-model/index.md)) -> [Key](-base-compose-navigator-by-key-view-model/index.md)) : ViewModel, [ComposeNavigatorByKey](-compose-navigator-by-key/index.md)<[Context](-base-compose-navigator-by-key-view-model/index.md), [Key](-base-compose-navigator-by-key-view-model/index.md)> | -| [ComposeContextNavigator](-compose-context-navigator/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeContextNavigator](-compose-context-navigator/index.md)<[Context](-compose-context-navigator/index.md), [Key](-compose-context-navigator/index.md)> : [ComposeNavigator](-compose-navigator/index.md)<[Key](-compose-context-navigator/index.md)> | -| [ComposeNavigationContentScope](-compose-navigation-content-scope/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeNavigationContentScope](-compose-navigation-content-scope/index.md)<[Context](-compose-navigation-content-scope/index.md), [Key](-compose-navigation-content-scope/index.md)> : [ComposeNavigationScope](-compose-navigation-scope/index.md) | -| [ComposeNavigationIntentNavigatorByKeyViewModel](-compose-navigation-intent-navigator-by-key-view-model/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
class [ComposeNavigationIntentNavigatorByKeyViewModel](-compose-navigation-intent-navigator-by-key-view-model/index.md)<[Context](-compose-navigation-intent-navigator-by-key-view-model/index.md), [Intent](-compose-navigation-intent-navigator-by-key-view-model/index.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> : [BaseComposeNavigatorByKeyViewModel](-base-compose-navigator-by-key-view-model/index.md)<[Context](-compose-navigation-intent-navigator-by-key-view-model/index.md), [Intent](-compose-navigation-intent-navigator-by-key-view-model/index.md), [ComposeNavigationIntentScope](-compose-navigation-intent-scope/index.md)<[Context](-compose-navigation-intent-navigator-by-key-view-model/index.md), [Intent](-compose-navigation-intent-navigator-by-key-view-model/index.md)>> , [ComposeNavigationIntentStackNavigatorByKey](-compose-navigation-intent-stack-navigator-by-key/index.md)<[Context](-compose-navigation-intent-navigator-by-key-view-model/index.md), [Intent](-compose-navigation-intent-navigator-by-key-view-model/index.md)> | -| [ComposeNavigationIntentScope](-compose-navigation-intent-scope/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeNavigationIntentScope](-compose-navigation-intent-scope/index.md)<[Context](-compose-navigation-intent-scope/index.md), [Intent](-compose-navigation-intent-scope/index.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> : [ComposeNavigationScope](-compose-navigation-scope/index.md), [ComposeNavigationKeyScope](-compose-navigation-key-scope/index.md)<[Context](-compose-navigation-intent-scope/index.md), [Intent](-compose-navigation-intent-scope/index.md)> | -| [ComposeNavigationIntentStackNavigatorByKey](-compose-navigation-intent-stack-navigator-by-key/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeNavigationIntentStackNavigatorByKey](-compose-navigation-intent-stack-navigator-by-key/index.md)<[Context](-compose-navigation-intent-stack-navigator-by-key/index.md), [Intent](-compose-navigation-intent-stack-navigator-by-key/index.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> : [ComposeNavigatorByKey](-compose-navigator-by-key/index.md)<[Context](-compose-navigation-intent-stack-navigator-by-key/index.md), [Intent](-compose-navigation-intent-stack-navigator-by-key/index.md)> , [NavigationEventHandler](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/index.md)<[Intent](-compose-navigation-intent-stack-navigator-by-key/index.md), [ComposeNavigationIntentScope](-compose-navigation-intent-scope/index.md)<[Context](-compose-navigation-intent-stack-navigator-by-key/index.md), [Intent](-compose-navigation-intent-stack-navigator-by-key/index.md)>> , [NavigationEventNavigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-navigator/index.md)<[Intent](-compose-navigation-intent-stack-navigator-by-key/index.md)> | -| [ComposeNavigationKeyScope](-compose-navigation-key-scope/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeNavigationKeyScope](-compose-navigation-key-scope/index.md)<[Context](-compose-navigation-key-scope/index.md), [Key](-compose-navigation-key-scope/index.md)> : [ComposeNavigationScope](-compose-navigation-scope/index.md) | -| [ComposeNavigationScope](-compose-navigation-scope/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeNavigationScope](-compose-navigation-scope/index.md) : [NavigationScope](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-scope/index.md) | -| [ComposeNavigator](-compose-navigator/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeNavigator](-compose-navigator/index.md)<[Key](-compose-navigator/index.md)> : [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) | -| [ComposeNavigatorByContent](-compose-navigator-by-content/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeNavigatorByContent](-compose-navigator-by-content/index.md)<[Context](-compose-navigator-by-content/index.md), [Key](-compose-navigator-by-content/index.md)> : [ComposeNavigator](-compose-navigator/index.md)<[Key](-compose-navigator-by-content/index.md)> , [ComposeContextNavigator](-compose-context-navigator/index.md)<[Context](-compose-navigator-by-content/index.md), [Key](-compose-navigator-by-content/index.md)> , [StackNavigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-stack-navigator/index.md) | -| [ComposeNavigatorByContentViewModel](-compose-navigator-by-content-view-model/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
class [ComposeNavigatorByContentViewModel](-compose-navigator-by-content-view-model/index.md)<[Context](-compose-navigator-by-content-view-model/index.md), [Key](-compose-navigator-by-content-view-model/index.md)> : [BaseComposeNavigatorByContentViewModel](-base-compose-navigator-by-content-view-model/index.md)<[Context](-compose-navigator-by-content-view-model/index.md), [Key](-compose-navigator-by-content-view-model/index.md)> | -| [ComposeNavigatorByKey](-compose-navigator-by-key/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
interface [ComposeNavigatorByKey](-compose-navigator-by-key/index.md)<[Context](-compose-navigator-by-key/index.md), [Key](-compose-navigator-by-key/index.md)> : [ComposeNavigator](-compose-navigator/index.md)<[Key](-compose-navigator-by-key/index.md)> , [ComposeContextNavigator](-compose-context-navigator/index.md)<[Context](-compose-navigator-by-key/index.md), [Key](-compose-navigator-by-key/index.md)> , [StackNavigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-stack-navigator/index.md) | -| [ComposeNavigatorByKeyViewModel](-compose-navigator-by-key-view-model/index.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
class [ComposeNavigatorByKeyViewModel](-compose-navigator-by-key-view-model/index.md)<[Context](-compose-navigator-by-key-view-model/index.md), [Key](-compose-navigator-by-key-view-model/index.md)> : [BaseComposeNavigatorByKeyViewModel](-base-compose-navigator-by-key-view-model/index.md)<[Context](-compose-navigator-by-key-view-model/index.md), [Key](-compose-navigator-by-key-view-model/index.md), [ComposeNavigationKeyScope](-compose-navigation-key-scope/index.md)<[Context](-compose-navigator-by-key-view-model/index.md), [Key](-compose-navigator-by-key-view-model/index.md)>> | -| [Saver](-saver/index.md) | [common]
expect interface [Saver](-saver/index.md)<[Original](-saver/index.md), [Saveable](-saver/index.md) : [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)>
A component that can convert the type of the [Original](-saver/index.md) into the type of [Saveable](-saver/index.md) so that it can be serialized, saved, restored. This component is meant to represent the androidx.compose.runtime.saveable.Saver interface, but that component is not available for Jetpack Compose Web, so this expected interface is defined in the common source set. The Android and JVM targets should simply use a typealias to delegate to the androidx.compose.runtime.saveable.Saver interface. The JavaScript target should provide a default implementation.
[js, android, jvm]
[js]
actual interface [Saver](-saver/index.md)<[Original](-saver/index.md), [Saveable](-saver/index.md) : [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)>
[android, jvm]
actual typealias [Saver](-saver/index.md) = Saver<[Original](-saver/index.md), [Saveable](-saver/index.md)> | +# Package-level declarations ## Functions | Name | Summary | |---|---| -| [autoSaver](auto-saver.md) | [common]
expect fun <[T](auto-saver.md)> [autoSaver](auto-saver.md)(): [Saver](-saver/index.md)<[T](auto-saver.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)>
Retrieves a default implementation of a [Saver](-saver/index.md) interface which does not perform any conversion. Similar to the [Saver](-saver/index.md) interface, this function is meant to represent the androidx.compose.runtime.saveable.autoSaver function, but that function is not available for Jetpack Compose Web, so this expected function is defined in the common source set. The Android and JVM targets should simply delegate to the androidx.compose.runtime.saveable.autoSaver function. The JavaScript target should provide a default implementation.
[android, js, jvm]
[android, js, jvm]
actual fun <[T](auto-saver.md)> [autoSaver](auto-saver.md)(): [Saver](-saver/index.md)<[T](auto-saver.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> | -| [currentContextAsState](current-context-as-state.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](current-context-as-state.md), [Key](current-context-as-state.md)> [ComposeContextNavigator](-compose-context-navigator/index.md)<[Context](current-context-as-state.md), [Key](current-context-as-state.md)>.[currentContextAsState](current-context-as-state.md)(): State<[Context](current-context-as-state.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](current-context-as-state.md), [Key](current-context-as-state.md)> [ComposeContextNavigator](-compose-context-navigator/index.md)<[Context](current-context-as-state.md), [Key](current-context-as-state.md)>.[currentContextAsState](current-context-as-state.md)(initialCurrentContext: [Context](current-context-as-state.md)): State<[Context](current-context-as-state.md)>
Obtains the changes to the [ComposeContextNavigator.currentContext](-compose-context-navigator/current-context.md) value and returns it as a State. This allows it to be used in a Composable and cause recomposition when the value changes. | -| [currentKeyAsState](current-key-as-state.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Key](current-key-as-state.md)> [ComposeNavigator](-compose-navigator/index.md)<[Key](current-key-as-state.md)>.[currentKeyAsState](current-key-as-state.md)(): State<[Key](current-key-as-state.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Key](current-key-as-state.md)> [ComposeNavigator](-compose-navigator/index.md)<[Key](current-key-as-state.md)>.[currentKeyAsState](current-key-as-state.md)(initialCurrentKey: [Key](current-key-as-state.md)): State<[Key](current-key-as-state.md)>
Obtains the changes to the [ComposeNavigator.currentKey](-compose-navigator/current-key.md) value and returns it as a State. This allows it to be used in a Composable and cause recomposition when the value changes. | -| [goTo](go-to.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
fun <[Context](go-to.md), [Key](go-to.md)> [ComposeNavigatorByKey](-compose-navigator-by-key/index.md)<[Context](go-to.md), [Key](go-to.md)>.[goTo](go-to.md)(key: [Key](go-to.md))
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](go-to.md), [Key](go-to.md)> [ComposeNavigatorByContent](-compose-navigator-by-content/index.md)<[Context](go-to.md), [Key](go-to.md)>.[goTo](go-to.md)(key: [Key](go-to.md), content: @Composable[ComposeNavigationContentScope](-compose-navigation-content-scope/index.md)<[Context](go-to.md), [Key](go-to.md)>.() -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)) | -| [NavContainer](-nav-container.md) | [common]
@Composable
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
fun <[Context](-nav-container.md), [Intent](-nav-container.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [NavContainer](-nav-container.md)(navigator: [ComposeNavigationIntentNavigatorByKeyViewModel](-compose-navigation-intent-navigator-by-key-view-model/index.md)<[Context](-nav-container.md), [Intent](-nav-container.md)>)
@Composable
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
fun <[Context](-nav-container.md), [Key](-nav-container.md)> [NavContainer](-nav-container.md)(navigator: [ComposeNavigatorByContentViewModel](-compose-navigator-by-content-view-model/index.md)<[Context](-nav-container.md), [Key](-nav-container.md)>)
@Composable
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
fun <[Context](-nav-container.md), [Key](-nav-container.md)> [NavContainer](-nav-container.md)(navigator: [ComposeNavigatorByKeyViewModel](-compose-navigator-by-key-view-model/index.md)<[Context](-nav-container.md), [Key](-nav-container.md)>)
Displays the content from a [navigator](-nav-container.md) in this Composable UI Container. | -| [rememberNavigatorByContent](remember-navigator-by-content.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](remember-navigator-by-content.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Key](remember-navigator-by-content.md)>, [Key](remember-navigator-by-content.md)> [rememberNavigatorByContent](remember-navigator-by-content.md)(initialContext: [Context](remember-navigator-by-content.md), keySaver: [Saver](-saver/index.md)<[Key](remember-navigator-by-content.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), initialContent: ([Context](remember-navigator-by-content.md)) -> @Composable[ComposeNavigationContentScope](-compose-navigation-content-scope/index.md)<[Context](remember-navigator-by-content.md), [Key](remember-navigator-by-content.md)>.() -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [ComposeNavigatorByContentViewModel](-compose-navigator-by-content-view-model/index.md)<[Context](remember-navigator-by-content.md), [Key](remember-navigator-by-content.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](remember-navigator-by-content.md), [Key](remember-navigator-by-content.md)> [rememberNavigatorByContent](remember-navigator-by-content.md)(initialContext: [Context](remember-navigator-by-content.md), keySaver: [Saver](-saver/index.md)<[Key](remember-navigator-by-content.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), initialKeysAndContent: ([Context](remember-navigator-by-content.md)) -> [Pair](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-pair/index.html)<[Key](remember-navigator-by-content.md), @Composable[ComposeNavigationContentScope](-compose-navigation-content-scope/index.md)<[Context](remember-navigator-by-content.md), [Key](remember-navigator-by-content.md)>.() -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)>): [ComposeNavigatorByContentViewModel](-compose-navigator-by-content-view-model/index.md)<[Context](remember-navigator-by-content.md), [Key](remember-navigator-by-content.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Key](remember-navigator-by-content.md)> [rememberNavigatorByContent](remember-navigator-by-content.md)(initialKey: [Key](remember-navigator-by-content.md), keySaver: [Saver](-saver/index.md)<[Key](remember-navigator-by-content.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), initialContent: @Composable[ComposeNavigationContentScope](-compose-navigation-content-scope/index.md)<[Nothing](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-nothing/index.html)?, [Key](remember-navigator-by-content.md)>.() -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [ComposeNavigatorByContentViewModel](-compose-navigator-by-content-view-model/index.md)<[Nothing](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-nothing/index.html)?, [Key](remember-navigator-by-content.md)>
Creates and remembers a [ComposeNavigator](-compose-navigator/index.md) that can navigate with a key and Composable content. This allows for explicitly specifying the Composable content to navigate to at the [ComposeNavigatorByContent.goTo](-compose-navigator-by-content/go-to.md) function call site. Meaning the Composable content is more flexible and doesn't need to specified upfront when creating this [ComposeNavigatorByContent](-compose-navigator-by-content/index.md). | -| [rememberNavigatorByIntent](remember-navigator-by-intent.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](remember-navigator-by-intent.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Intent](remember-navigator-by-intent.md)>, [Intent](remember-navigator-by-intent.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [rememberNavigatorByIntent](remember-navigator-by-intent.md)(initialContext: [Context](remember-navigator-by-intent.md), keySaver: [Saver](-saver/index.md)<[Intent](remember-navigator-by-intent.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), content: @Composable[ComposeNavigationIntentScope](-compose-navigation-intent-scope/index.md)<[Context](remember-navigator-by-intent.md), [Intent](remember-navigator-by-intent.md)>.([Intent](remember-navigator-by-intent.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [ComposeNavigationIntentNavigatorByKeyViewModel](-compose-navigation-intent-navigator-by-key-view-model/index.md)<[Context](remember-navigator-by-intent.md), [Intent](remember-navigator-by-intent.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Intent](remember-navigator-by-intent.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [rememberNavigatorByIntent](remember-navigator-by-intent.md)(initialIntent: [Intent](remember-navigator-by-intent.md), keySaver: [Saver](-saver/index.md)<[Intent](remember-navigator-by-intent.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), content: @Composable[ComposeNavigationIntentScope](-compose-navigation-intent-scope/index.md)<[Nothing](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-nothing/index.html)?, [Intent](remember-navigator-by-intent.md)>.([Intent](remember-navigator-by-intent.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [ComposeNavigationIntentNavigatorByKeyViewModel](-compose-navigation-intent-navigator-by-key-view-model/index.md)<[Nothing](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-nothing/index.html)?, [Intent](remember-navigator-by-intent.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](remember-navigator-by-intent.md), [Intent](remember-navigator-by-intent.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [rememberNavigatorByIntent](remember-navigator-by-intent.md)(initialContext: [Context](remember-navigator-by-intent.md), initialIntents: ([Context](remember-navigator-by-intent.md)) -> [Intent](remember-navigator-by-intent.md), keySaver: [Saver](-saver/index.md)<[Intent](remember-navigator-by-intent.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), content: @Composable[ComposeNavigationIntentScope](-compose-navigation-intent-scope/index.md)<[Context](remember-navigator-by-intent.md), [Intent](remember-navigator-by-intent.md)>.([Intent](remember-navigator-by-intent.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [ComposeNavigationIntentNavigatorByKeyViewModel](-compose-navigation-intent-navigator-by-key-view-model/index.md)<[Context](remember-navigator-by-intent.md), [Intent](remember-navigator-by-intent.md)>
Creates and remembers a [ComposeNavigator](-compose-navigator/index.md) that can navigate with a [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md) as a key. This allows for specifying the Composable content up front when creating this [ComposeNavigatorByKey](-compose-navigator-by-key/index.md) and simply navigating with a [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md) key from the [ComposeNavigatorByKey.goTo](-compose-navigator-by-key/go-to.md) function. The returned [ComposeNavigator](-compose-navigator/index.md) implements the [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) interface. | -| [rememberNavigatorByKey](remember-navigator-by-key.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](remember-navigator-by-key.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Key](remember-navigator-by-key.md)>, [Key](remember-navigator-by-key.md)> [rememberNavigatorByKey](remember-navigator-by-key.md)(initialContext: [Context](remember-navigator-by-key.md), keySaver: [Saver](-saver/index.md)<[Key](remember-navigator-by-key.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), content: @Composable[ComposeNavigationKeyScope](-compose-navigation-key-scope/index.md)<[Context](remember-navigator-by-key.md), [Key](remember-navigator-by-key.md)>.([Key](remember-navigator-by-key.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [ComposeNavigatorByKeyViewModel](-compose-navigator-by-key-view-model/index.md)<[Context](remember-navigator-by-key.md), [Key](remember-navigator-by-key.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Key](remember-navigator-by-key.md)> [rememberNavigatorByKey](remember-navigator-by-key.md)(initialKey: [Key](remember-navigator-by-key.md), keySaver: [Saver](-saver/index.md)<[Key](remember-navigator-by-key.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), content: @Composable[ComposeNavigationKeyScope](-compose-navigation-key-scope/index.md)<[Nothing](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-nothing/index.html)?, [Key](remember-navigator-by-key.md)>.([Key](remember-navigator-by-key.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [ComposeNavigatorByKeyViewModel](-compose-navigator-by-key-view-model/index.md)<[Nothing](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-nothing/index.html)?, [Key](remember-navigator-by-key.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@Composable
fun <[Context](remember-navigator-by-key.md), [Key](remember-navigator-by-key.md)> [rememberNavigatorByKey](remember-navigator-by-key.md)(initialContext: [Context](remember-navigator-by-key.md), initialKeys: ([Context](remember-navigator-by-key.md)) -> [Key](remember-navigator-by-key.md), keySaver: [Saver](-saver/index.md)<[Key](remember-navigator-by-key.md), [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)> = autoSaver(), content: @Composable[ComposeNavigationKeyScope](-compose-navigation-key-scope/index.md)<[Context](remember-navigator-by-key.md), [Key](remember-navigator-by-key.md)>.([Key](remember-navigator-by-key.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [ComposeNavigatorByKeyViewModel](-compose-navigator-by-key-view-model/index.md)<[Context](remember-navigator-by-key.md), [Key](remember-navigator-by-key.md)>
Creates and remembers a [ComposeNavigator](-compose-navigator/index.md) that can navigate with a key. This allows for specifying the Composable content up front when creating this [ComposeNavigatorByKey](-compose-navigator-by-key/index.md) and simply navigating with a key from the [ComposeNavigatorByKey.goTo](-compose-navigator-by-key/go-to.md) function. | +| [collectAsState](collect-as-state.md) | [common]
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[T](collect-as-state.md)> [NavigationState](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/index.md)<[T](collect-as-state.md)>.[collectAsState](collect-as-state.md)(): [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html)<[T](collect-as-state.md)>
Converts the [NavigationState.changes](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/changes.md) of this [NavigationState](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/index.md) to a Jetpack Compose [State](https://developer.android.com/reference/kotlin/androidx/compose/runtime/State.html) so that every change causes a recomposition of the calling [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) function. | +| [NavigationContainer](-navigation-container.md) | [common]
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
fun <[Destination](-navigation-container.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](-navigation-container.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](-navigation-container.md)>> [NavigationContainer](-navigation-container.md)(navigator: [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](-navigation-container.md), [Context](-navigation-container.md)>, modifier: [Modifier](https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.html) = Modifier, content: @[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)[BoxScope](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/BoxScope.html).(destinationAndContext: [DestinationAndContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/index.md)<[Destination](-navigation-container.md), [Context](-navigation-container.md)>) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html))
A [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) that listens to navigation context and destination changes from the provided [navigator](-navigation-container.md) and calls the provided [content](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) function with the latest values. | +| [rememberNavigator](remember-navigator.md) | [common]
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](remember-navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](remember-navigator.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](remember-navigator.md)>> [rememberNavigator](remember-navigator.md)(initialContext: [Context](remember-navigator.md), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](remember-navigator.md), [Context](remember-navigator.md)>
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
fun <[Destination](remember-navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [rememberNavigator](remember-navigator.md)(initialDestination: [Destination](remember-navigator.md), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](remember-navigator.md), [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md)<[Destination](remember-navigator.md)>>
Creates and remembers a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) with a [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md). A [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) can be used to navigate between different UI content in an application. | +| [rememberSavableNavigator](remember-savable-navigator.md) | [common]
@ExperimentalSerializationApi
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
inline fun <[Destination](remember-savable-navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [rememberSavableNavigator](remember-savable-navigator.md)(initialDestination: [Destination](remember-savable-navigator.md), parcelable: Parcelable = Parcelable.Default, destinationSerializer: KSerializer<[Destination](remember-savable-navigator.md)> = parcelable.serializersModule.serializer(), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](remember-savable-navigator.md), [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md)<[Destination](remember-savable-navigator.md)>>
@ExperimentalSerializationApi
@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md)
@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html)
inline fun <[Destination](remember-savable-navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](remember-savable-navigator.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](remember-savable-navigator.md)>> [rememberSavableNavigator](remember-savable-navigator.md)(initialContext: [Context](remember-savable-navigator.md), parcelable: Parcelable = Parcelable.Default, destinationSerializer: KSerializer<[Destination](remember-savable-navigator.md)> = parcelable.serializersModule.serializer(), contextSerializer: KSerializer<[Context](remember-savable-navigator.md)> = parcelable.serializersModule.serializer(), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](remember-savable-navigator.md), [Context](remember-savable-navigator.md)>
Creates, remembers and saves a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) with a [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md). A [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) can be used to navigate between different UI content in an application. This differs from the [rememberNavigator](remember-navigator.md) function in that it allows restoring the [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) state between configuration changes via the rememberSavable function and using the provided KSerializers. | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator.md new file mode 100644 index 0000000..8de370a --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator.md @@ -0,0 +1,81 @@ +//[navigation-compose](../../index.md)/[com.chrynan.navigation.compose](index.md)/[rememberNavigator](remember-navigator.md) + +# rememberNavigator + +[common]\ + +@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) + +fun <[Destination](remember-navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [rememberNavigator](remember-navigator.md)(initialDestination: [Destination](remember-navigator.md), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](remember-navigator.md), [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md)<[Destination](remember-navigator.md)>> + +Creates and remembers a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) with a [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md). A [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) can be used to navigate between different UI content in an application. + +Example usage: + +```kotlin +val navigator = rememberNavigator(initialDestination = "Greeting") +``` + +#### Return + +A remembered [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) instance constructed using the provided values. + +#### Parameters + +common + +| | | +|---|---| +| initialDestination | The initial [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md) value to start at for this [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md). | +| duplicateDestinationStrategy | The [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) strategy for handling of duplicate destination content within a [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md) stack. Read the documentation on [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md). | +| destinationRetentionStrategy | The [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) strategy for handling of destination stacks within a [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md) when navigating between different [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)s. Read the documentation on [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DestinationRetention.RETAIN](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md). | + +#### See also + +| | | +|---|---| +| [rememberNavigator](remember-navigator.md) | For a version of this function that supports multiple [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)s. | +| [rememberSavableNavigator](remember-savable-navigator.md) | For a version of this function that saves the navigator across configuration changes. | +| [NavigationContainer](-navigation-container.md) | To display the [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) content for the current navigation context and keys. | +| [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) | For constructor functions that can be invoked outside [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) functions. | + +[common]\ + +@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) + +fun <[Destination](remember-navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](remember-navigator.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](remember-navigator.md)>> [rememberNavigator](remember-navigator.md)(initialContext: [Context](remember-navigator.md), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](remember-navigator.md), [Context](remember-navigator.md)> + +Creates and remembers a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) with a [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md). A [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) can be used to navigate between different UI content in an application. + +Example usage: + +```kotlin +val navigator = rememberNavigator(initialContext = MainContext.HOME) +``` + +#### Return + +A remembered [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) instance constructed using the provided values. + +#### Parameters + +common + +| | | +|---|---| +| initialContext | The initial [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md) value to start at for this [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md). | +| duplicateDestinationStrategy | The [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) strategy for handling of duplicate destination content within a [Context](remember-navigator.md) stack. Read the documentation on [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md). | +| destinationRetentionStrategy | The [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) strategy for handling of destination stacks within a [Context](remember-navigator.md) when navigating between different [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)s. Read the documentation on [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DestinationRetention.RETAIN](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md). | + +#### See also + +| | | +|---|---| +| [rememberNavigator](remember-navigator.md) | For a version of this function with only a single [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md). | +| [rememberSavableNavigator](remember-savable-navigator.md) | For a version of this function that saves the navigator across configuration changes. | +| [NavigationContainer](-navigation-container.md) | To display the [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) content for the current navigation context and keys. | +| [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) | For constructor functions that can be invoked outside [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) functions. | diff --git a/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-savable-navigator.md b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-savable-navigator.md new file mode 100644 index 0000000..dbdb434 --- /dev/null +++ b/docs/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-savable-navigator.md @@ -0,0 +1,90 @@ +//[navigation-compose](../../index.md)/[com.chrynan.navigation.compose](index.md)/[rememberSavableNavigator](remember-savable-navigator.md) + +# rememberSavableNavigator + +[common]\ + +@ExperimentalSerializationApi + +@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) + +inline fun <[Destination](remember-savable-navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [rememberSavableNavigator](remember-savable-navigator.md)(initialDestination: [Destination](remember-savable-navigator.md), parcelable: Parcelable = Parcelable.Default, destinationSerializer: KSerializer<[Destination](remember-savable-navigator.md)> = parcelable.serializersModule.serializer(), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](remember-savable-navigator.md), [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md)<[Destination](remember-savable-navigator.md)>> + +Creates, remembers and saves a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) with a [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md). A [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) can be used to navigate between different UI content in an application. This differs from the [rememberNavigator](remember-navigator.md) function in that it allows restoring the [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) state between configuration changes via the rememberSavable function and using the provided KSerializers. + +Example usage: + +```kotlin +val navigator = rememberNavigator(initialDestination = "Greeting") +``` + +#### Return + +A remembered [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) instance constructed using the provided values. + +#### Parameters + +common + +| | | +|---|---| +| initialDestination | The initial [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md) value to start at for this [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md). | +| parcelable | The Parcelable instance that is used to store and retrieve the [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) instance between configuration changes. | +| destinationSerializer | The KSerializer for the [Destination](remember-savable-navigator.md) type. | +| duplicateDestinationStrategy | The [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) strategy for handling of duplicate destination content within a [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md) stack. Read the documentation on [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md). | +| destinationRetentionStrategy | The [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) strategy for handling of destination stacks within a [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md) when navigating between different [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)s. Read the documentation on [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DestinationRetention.RETAIN](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md). | + +#### See also + +| | | +|---|---| +| [rememberNavigator](remember-navigator.md) | For a version of this function that supports multiple [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)s. | +| [rememberSavableNavigator](remember-savable-navigator.md) | For a version of this function that saves the navigator across configuration changes. | +| [NavigationContainer](-navigation-container.md) | To display the [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) content for the current navigation context and keys. | +| [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) | For constructor functions that can be invoked outside [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) functions. | + +[common]\ + +@ExperimentalSerializationApi + +@[ExperimentalNavigationApi](../../../navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md) + +@[Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) + +inline fun <[Destination](remember-savable-navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](remember-savable-navigator.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](remember-savable-navigator.md)>> [rememberSavableNavigator](remember-savable-navigator.md)(initialContext: [Context](remember-savable-navigator.md), parcelable: Parcelable = Parcelable.Default, destinationSerializer: KSerializer<[Destination](remember-savable-navigator.md)> = parcelable.serializersModule.serializer(), contextSerializer: KSerializer<[Context](remember-savable-navigator.md)> = parcelable.serializersModule.serializer(), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](remember-savable-navigator.md), [Context](remember-savable-navigator.md)> + +Creates, remembers and saves a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) with a [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md). A [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) can be used to navigate between different UI content in an application. This differs from the [rememberNavigator](remember-navigator.md) function in that it allows restoring the [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) state between configuration changes via the rememberSavable function and using the provided KSerializers. + +Example usage: + +```kotlin +val navigator = rememberNavigator(initialDestination = "Greeting") +``` + +#### Return + +A remembered [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) instance constructed using the provided values. + +#### Parameters + +common + +| | | +|---|---| +| initialContext | The initial [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md) value to start at for this [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md). | +| parcelable | The Parcelable instance that is used to store and retrieve the [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) instance between configuration changes. | +| destinationSerializer | The KSerializer for the [Destination](remember-savable-navigator.md) type. | +| contextSerializer | The KSerializer for the [Context](remember-savable-navigator.md) type. | +| duplicateDestinationStrategy | The [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) strategy for handling of duplicate destination content within a [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md) stack. Read the documentation on [NavigationStrategy.DuplicateDestination](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md). | +| destinationRetentionStrategy | The [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) strategy for handling of destination stacks within a [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md) when navigating between different [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)s. Read the documentation on [NavigationStrategy.DestinationRetention](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DestinationRetention.RETAIN](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md). | + +#### See also + +| | | +|---|---| +| [rememberNavigator](remember-navigator.md) | For a version of this function that supports multiple [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)s. | +| [rememberSavableNavigator](remember-savable-navigator.md) | For a version of this function that saves the navigator across configuration changes. | +| [NavigationContainer](-navigation-container.md) | To display the [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) content for the current navigation context and keys. | +| [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) | For constructor functions that can be invoked outside [Composable](https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable.html) functions. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-handler/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-handler/index.md index 9029fe5..3b7c3d9 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-handler/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-handler/index.md @@ -3,16 +3,10 @@ # AndroidNavigationHandler [android]\ -interface [AndroidNavigationHandler](index.md)<[Intent](index.md) : [NavigationIntent](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> : [NavigationEventHandler](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/index.md)<[Intent](index.md), [AndroidNavigationScope](../-android-navigation-scope/index.md)> - -A [NavigationHandler](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-handler/index.md) used on the Android platform that uses an [AndroidNavigationScope](../-android-navigation-scope/index.md). +fun interface [AndroidNavigationHandler](index.md)<[Destination](index.md) : [NavigationDestination](../../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](index.md) : [NavigationContext](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](index.md)>> ## Functions | Name | Summary | |---|---| -| [canGoBack](index.md#87869025%2FFunctions%2F2082272698) | [android]
open override fun [AndroidNavigationScope](../-android-navigation-scope/index.md).[canGoBack](index.md#87869025%2FFunctions%2F2082272698)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Determines whether a back navigation can be handled. | -| [onGoBack](index.md#-738819608%2FFunctions%2F2082272698) | [android]
abstract fun [AndroidNavigationScope](../-android-navigation-scope/index.md).[onGoBack](index.md#-738819608%2FFunctions%2F2082272698)() | -| [onGoTo](index.md#-2028661020%2FFunctions%2F2082272698) | [android]
abstract fun [AndroidNavigationScope](../-android-navigation-scope/index.md).[onGoTo](index.md#-2028661020%2FFunctions%2F2082272698)(value: [Intent](index.md)) | -| [onGoUp](index.md#-1289287332%2FFunctions%2F2082272698) | [android]
abstract fun [AndroidNavigationScope](../-android-navigation-scope/index.md).[onGoUp](index.md#-1289287332%2FFunctions%2F2082272698)() | -| [onNavigate](index.md#765672858%2FFunctions%2F2082272698) | [android]
open override fun [AndroidNavigationScope](../-android-navigation-scope/index.md).[onNavigate](index.md#765672858%2FFunctions%2F2082272698)(value: [NavigationEvent](../../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/index.md)<[Intent](index.md)>)
Handles the actual navigation to a different part of the app defined by the provided [value](index.md#765672858%2FFunctions%2F2082272698) using the [Scope](../../../../navigation-core/com.chrynan.navigation/-navigation-event-handler/index.md) scope. | +| [invoke](invoke.md) | [android]
abstract operator fun [AndroidNavigationScope](../-android-navigation-scope/index.md).[invoke](invoke.md)(context: [Context](index.md), destination: [Destination](index.md)) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-handler/invoke.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-handler/invoke.md new file mode 100644 index 0000000..48a870e --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-handler/invoke.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[AndroidNavigationHandler](index.md)/[invoke](invoke.md) + +# invoke + +[android]\ +abstract operator fun [AndroidNavigationScope](../-android-navigation-scope/index.md).[invoke](invoke.md)(context: [Context](index.md), destination: [Destination](index.md)) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/-base-navigator-impl.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/-base-navigator-impl.md new file mode 100644 index 0000000..00e5b5f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/-base-navigator-impl.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[BaseNavigatorImpl](-base-navigator-impl.md) + +# BaseNavigatorImpl + +[common]\ +fun <[State](index.md) : [BaseNavigatorStateImpl](../-base-navigator-state-impl/index.md)<[Destination](index.md), [Context](index.md)>> [BaseNavigatorImpl](-base-navigator-impl.md)(state: [State](index.md)) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/can-go-back.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/can-go-back.md new file mode 100644 index 0000000..ee26813 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/can-go-back.md @@ -0,0 +1,12 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[canGoBack](can-go-back.md) + +# canGoBack + +[common]\ +override fun [canGoBack](can-go-back.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Determines whether the [Navigator](../-navigator/index.md) can navigate back in the stack in the current [Context](index.md). + +#### Return + +`true` if this [Navigator](../-navigator/index.md) can navigate back, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/change-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/change-context.md new file mode 100644 index 0000000..d13e6cf --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/change-context.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[changeContext](change-context.md) + +# changeContext + +[common]\ +override fun [changeContext](change-context.md)(context: [Context](index.md)) + +Changes the current [Context](index.md) to the provided [context](change-context.md) value. The displayed [Destination](index.md) will top destination value in the stack associated with the provided [context](change-context.md), or the provided context's [NavigationContext.initialDestination](../-navigation-context/initial-destination.md) if there is currently no existing stack for the provided [context](change-context.md). + +#### Parameters + +common + +| | | +|---|---| +| context | The [NavigationContext](../-navigation-context/index.md) to change to. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/equals.md new file mode 100644 index 0000000..f801fc6 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/go-back.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/go-back.md new file mode 100644 index 0000000..71bbf72 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/go-back.md @@ -0,0 +1,12 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[goBack](go-back.md) + +# goBack + +[common]\ +override fun [goBack](go-back.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Performs a back navigation operation by removing the top destination from the stack in the current [Context](index.md) and displaying the next destination in the list. If this [Navigator](../-navigator/index.md) cannot navigate back, then this function will do nothing. + +#### Return + +`true` if the back navigation operation was successful, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/go-to.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/go-to.md new file mode 100644 index 0000000..08cda24 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/go-to.md @@ -0,0 +1,17 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[goTo](go-to.md) + +# goTo + +[common]\ +override fun [goTo](go-to.md)(destination: [Destination](index.md), strategy: [StackDuplicateContentStrategy](../-stack-duplicate-content-strategy/index.md)) + +Goes to the provided [destination](go-to.md) using the provided stack duplicate content [strategy](go-to.md). Depending on the provided [strategy](go-to.md) and the current [Context](index.md) stack, this will either clear the current [Context](index.md) stack to the last value that equals the provided [destination](go-to.md), or add the provided [destination](go-to.md) to the top of the current [Context](index.md) stack. + +#### Parameters + +common + +| | | +|---|---| +| destination | The [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) that is to be navigated to and added to the current [Context](index.md) stack. | +| strategy | The [StackDuplicateContentStrategy](../-stack-duplicate-content-strategy/index.md) defining what to do when there are duplicate [Destination](index.md) values within the current [Context](index.md) stack. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/hash-code.md new file mode 100644 index 0000000..443ca20 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/index.md new file mode 100644 index 0000000..d02d441 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/index.md @@ -0,0 +1,38 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md) + +# BaseNavigatorImpl + +[common]\ +abstract class [BaseNavigatorImpl](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>, [State](index.md) : [BaseNavigatorStateImpl](../-base-navigator-state-impl/index.md)<[Destination](index.md), [Context](index.md)>>(val state: [State](index.md)) : [ViewModel](../-view-model/index.md), [Navigator](../-navigator/index.md)<[Destination](index.md), [Context](index.md)> + +## Constructors + +| | | +|---|---| +| [BaseNavigatorImpl](-base-navigator-impl.md) | [common]
fun <[State](index.md) : [BaseNavigatorStateImpl](../-base-navigator-state-impl/index.md)<[Destination](index.md), [Context](index.md)>> [BaseNavigatorImpl](-base-navigator-impl.md)(state: [State](index.md)) | + +## Functions + +| Name | Summary | +|---|---| +| [canGoBack](can-go-back.md) | [common]
override fun [canGoBack](can-go-back.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Determines whether the [Navigator](../-navigator/index.md) can navigate back in the stack in the current [Context](index.md). | +| [changeContext](change-context.md) | [common]
override fun [changeContext](change-context.md)(context: [Context](index.md))
Changes the current [Context](index.md) to the provided [context](change-context.md) value. The displayed [Destination](index.md) will top destination value in the stack associated with the provided [context](change-context.md), or the provided context's [NavigationContext.initialDestination](../-navigation-context/initial-destination.md) if there is currently no existing stack for the provided [context](change-context.md). | +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [goBack](go-back.md) | [common]
override fun [goBack](go-back.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Performs a back navigation operation by removing the top destination from the stack in the current [Context](index.md) and displaying the next destination in the list. If this [Navigator](../-navigator/index.md) cannot navigate back, then this function will do nothing. | +| [goTo](go-to.md) | [common]
override fun [goTo](go-to.md)(destination: [Destination](index.md), strategy: [StackDuplicateContentStrategy](../-stack-duplicate-content-strategy/index.md))
Goes to the provided [destination](go-to.md) using the provided stack duplicate content [strategy](go-to.md). Depending on the provided [strategy](go-to.md) and the current [Context](index.md) stack, this will either clear the current [Context](index.md) stack to the last value that equals the provided [destination](go-to.md), or add the provided [destination](go-to.md) to the top of the current [Context](index.md) stack. | +| [goUp](../-navigator/go-up.md) | [common]
open fun [goUp](../-navigator/go-up.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Performs an "up" navigation. An "up" navigation is similar to a "back" navigation but may be slightly different. For instance, on Android, the "left arrow" button in the toolbar component of an application, performs the "up" operation, which is slightly different from the phones back button which performs a "back" operation. | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [navigate](../-navigator/navigate.md) | [common]
open fun [navigate](../-navigator/navigate.md)(event: [NavigationEvent](../-navigation-event/index.md)<[Destination](index.md)>)
Navigates to the provided [event](../-navigator/navigate.md). Currently, this default implementation delegates to the appropriate [goBack](../-navigator/go-back.md), [goUp](../-navigator/go-up.md), and [goTo](../-navigator/go-to.md) function depending on the provided [event](../-navigator/navigate.md) value. | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [state](state.md) | [common]
override val [state](state.md): [State](index.md)
The [NavigatorState](../-navigator-state/index.md) for this [Navigator](../-navigator/index.md) instance. This can be used to subscribe to destination or context changes, or get the current state values. | + +## Extensions + +| Name | Summary | +|---|---| +| [goTo](../go-to.md) | [common]
fun <[Destination](../go-to.md) : [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html), [Context](../go-to.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](../go-to.md)>> [Navigator](../-navigator/index.md)<[Destination](../go-to.md), [Context](../go-to.md)>.[goTo](../go-to.md)(destination: [Destination](../go-to.md))
Goes to the provided [destination](../go-to.md) using the provided stack duplicate content strategy. Depending on the current [Context](../go-to.md) stack, this will either clear the current [Context](../go-to.md) stack to the last value that equals the provided [destination](../go-to.md), or add the provided [destination](../go-to.md) to the top of the current [Context](../go-to.md) stack. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/state.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/state.md new file mode 100644 index 0000000..5ef64ba --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/state.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[state](state.md) + +# state + +[common]\ +override val [state](state.md): [State](index.md) + +The [NavigatorState](../-navigator-state/index.md) for this [Navigator](../-navigator/index.md) instance. This can be used to subscribe to destination or context changes, or get the current state values. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/to-string.md new file mode 100644 index 0000000..1a18ac2 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-impl/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorImpl](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/-base-navigator-state-impl.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/-base-navigator-state-impl.md new file mode 100644 index 0000000..d66cfb0 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/-base-navigator-state-impl.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[BaseNavigatorStateImpl](-base-navigator-state-impl.md) + +# BaseNavigatorStateImpl + +[common]\ +fun <[Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>> [BaseNavigatorStateImpl](-base-navigator-state-impl.md)(initialContext: [Context](index.md)) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/change.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/change.md new file mode 100644 index 0000000..beb3217 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/change.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[change](change.md) + +# change + +[common]\ +fun [change](change.md)(destination: [Destination](index.md) = currentDestination, context: [Context](index.md) = currentContext) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/context-changes.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/context-changes.md new file mode 100644 index 0000000..4f6ab78 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/context-changes.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[contextChanges](context-changes.md) + +# contextChanges + +[common]\ +override val [contextChanges](context-changes.md): Flow<[Context](index.md)> diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/current-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/current-context.md new file mode 100644 index 0000000..7dcf052 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/current-context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[currentContext](current-context.md) + +# currentContext + +[common]\ +override val [currentContext](current-context.md): [Context](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/current-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/current-destination.md new file mode 100644 index 0000000..26db83f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/current-destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[currentDestination](current-destination.md) + +# currentDestination + +[common]\ +override val [currentDestination](current-destination.md): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/destination-changes.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/destination-changes.md new file mode 100644 index 0000000..e908dd9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/destination-changes.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[destinationChanges](destination-changes.md) + +# destinationChanges + +[common]\ +override val [destinationChanges](destination-changes.md): Flow<[Destination](index.md)> diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/equals.md new file mode 100644 index 0000000..d2711f0 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/hash-code.md new file mode 100644 index 0000000..925a150 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/index.md new file mode 100644 index 0000000..105dd2a --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/index.md @@ -0,0 +1,33 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md) + +# BaseNavigatorStateImpl + +[common]\ +abstract class [BaseNavigatorStateImpl](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>>(val initialContext: [Context](index.md)) : [NavigatorState](../-navigator-state/index.md)<[Destination](index.md), [Context](index.md)> + +## Constructors + +| | | +|---|---| +| [BaseNavigatorStateImpl](-base-navigator-state-impl.md) | [common]
fun <[Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>> [BaseNavigatorStateImpl](-base-navigator-state-impl.md)(initialContext: [Context](index.md)) | + +## Functions + +| Name | Summary | +|---|---| +| [change](change.md) | [common]
fun [change](change.md)(destination: [Destination](index.md) = currentDestination, context: [Context](index.md) = currentContext) | +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [contextChanges](context-changes.md) | [common]
override val [contextChanges](context-changes.md): Flow<[Context](index.md)> | +| [currentContext](current-context.md) | [common]
override val [currentContext](current-context.md): [Context](index.md) | +| [currentDestination](current-destination.md) | [common]
override val [currentDestination](current-destination.md): [Destination](index.md) | +| [destinationChanges](destination-changes.md) | [common]
override val [destinationChanges](destination-changes.md): Flow<[Destination](index.md)> | +| [initialContext](initial-context.md) | [common]
override val [initialContext](initial-context.md): [Context](index.md) | +| [initialDestination](initial-destination.md) | [common]
override val [initialDestination](initial-destination.md): [Destination](index.md) | +| [isInitialized](is-initialized.md) | [common]
override var [isInitialized](is-initialized.md): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = false
Determines whether this component is currently initialized, typically meaning that it is ready for use. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/initial-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/initial-context.md new file mode 100644 index 0000000..87ffcb0 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/initial-context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[initialContext](initial-context.md) + +# initialContext + +[common]\ +override val [initialContext](initial-context.md): [Context](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/initial-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/initial-destination.md new file mode 100644 index 0000000..9b39f8b --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/initial-destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[initialDestination](initial-destination.md) + +# initialDestination + +[common]\ +override val [initialDestination](initial-destination.md): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/is-initialized.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/is-initialized.md new file mode 100644 index 0000000..4e2fc27 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/is-initialized.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[isInitialized](is-initialized.md) + +# isInitialized + +[common]\ +override var [isInitialized](is-initialized.md): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = false + +Determines whether this component is currently initialized, typically meaning that it is ready for use. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/to-string.md new file mode 100644 index 0000000..6ddb296 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-base-navigator-state-impl/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[BaseNavigatorStateImpl](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/-context-and-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/-context-and-destination.md new file mode 100644 index 0000000..a91729f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/-context-and-destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[ContextAndDestination](-context-and-destination.md) + +# ContextAndDestination + +[common]\ +constructor(context: [Context](index.md), destination: [Destination](index.md)) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/component1.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/component1.md new file mode 100644 index 0000000..ad3a6f5 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/component1.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[component1](component1.md) + +# component1 + +[common]\ +operator fun [component1](component1.md)(): [Context](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/component2.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/component2.md new file mode 100644 index 0000000..fa7709e --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/component2.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[component2](component2.md) + +# component2 + +[common]\ +operator fun [component2](component2.md)(): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/context.md new file mode 100644 index 0000000..6e87482 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[context](context.md) + +# context + +[common]\ +val [context](context.md): [Context](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/copy.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/copy.md new file mode 100644 index 0000000..cf0ddcc --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/copy.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[copy](copy.md) + +# copy + +[common]\ +fun [copy](copy.md)(context: [Context](index.md) = this.context, destination: [Destination](index.md) = this.destination): [ContextAndDestination](index.md)<[Context](index.md), [Destination](index.md)> + +Creates a copy of this [ContextAndDestination](index.md) instance, overriding the provided values. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/destination.md new file mode 100644 index 0000000..65f598b --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[destination](destination.md) + +# destination + +[common]\ +val [destination](destination.md): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/equals.md new file mode 100644 index 0000000..32abbcc --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/hash-code.md new file mode 100644 index 0000000..6373a9c --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/index.md new file mode 100644 index 0000000..90fbe69 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/index.md @@ -0,0 +1,34 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md) + +# ContextAndDestination + +[common]\ +@Serializable + +class [ContextAndDestination](index.md)<[Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>, [Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696)>(val context: [Context](index.md), val destination: [Destination](index.md)) + +A wrapper class around a [NavigationContext](../-navigation-context/index.md) and an associated [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696). + +## Constructors + +| | | +|---|---| +| [ContextAndDestination](-context-and-destination.md) | [common]
constructor(context: [Context](index.md), destination: [Destination](index.md)) | + +## Functions + +| Name | Summary | +|---|---| +| [component1](component1.md) | [common]
operator fun [component1](component1.md)(): [Context](index.md) | +| [component2](component2.md) | [common]
operator fun [component2](component2.md)(): [Destination](index.md) | +| [copy](copy.md) | [common]
fun [copy](copy.md)(context: [Context](index.md) = this.context, destination: [Destination](index.md) = this.destination): [ContextAndDestination](index.md)<[Context](index.md), [Destination](index.md)>
Creates a copy of this [ContextAndDestination](index.md) instance, overriding the provided values. | +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [context](context.md) | [common]
val [context](context.md): [Context](index.md) | +| [destination](destination.md) | [common]
val [destination](destination.md): [Destination](index.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/to-string.md new file mode 100644 index 0000000..369c8a1 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-context-and-destination/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ContextAndDestination](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/-destination-and-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/-destination-and-context.md new file mode 100644 index 0000000..c333d57 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/-destination-and-context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[DestinationAndContext](-destination-and-context.md) + +# DestinationAndContext + +[common]\ +constructor(destination: [Destination](index.md), context: [Context](index.md)) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/component1.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/component1.md new file mode 100644 index 0000000..e001c0b --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/component1.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[component1](component1.md) + +# component1 + +[common]\ +operator fun [component1](component1.md)(): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/component2.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/component2.md new file mode 100644 index 0000000..24e13bd --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/component2.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[component2](component2.md) + +# component2 + +[common]\ +operator fun [component2](component2.md)(): [Context](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/context.md new file mode 100644 index 0000000..81473df --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[context](context.md) + +# context + +[common]\ +val [context](context.md): [Context](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/copy.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/copy.md new file mode 100644 index 0000000..9032a86 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/copy.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[copy](copy.md) + +# copy + +[common]\ +fun [copy](copy.md)(destination: [Destination](index.md) = this.destination, context: [Context](index.md) = this.context): [DestinationAndContext](index.md)<[Destination](index.md), [Context](index.md)> + +Creates a copy of this [DestinationAndContext](index.md) instance, overriding the provided values. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/destination.md new file mode 100644 index 0000000..b93ba8e --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[destination](destination.md) + +# destination + +[common]\ +val [destination](destination.md): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/equals.md new file mode 100644 index 0000000..66681f7 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/hash-code.md new file mode 100644 index 0000000..f26c151 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/index.md new file mode 100644 index 0000000..2f98953 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/index.md @@ -0,0 +1,34 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md) + +# DestinationAndContext + +[common]\ +@Serializable + +class [DestinationAndContext](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>>(val destination: [Destination](index.md), val context: [Context](index.md)) + +A wrapper class around a [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) and an associated [NavigationContext](../-navigation-context/index.md). + +## Constructors + +| | | +|---|---| +| [DestinationAndContext](-destination-and-context.md) | [common]
constructor(destination: [Destination](index.md), context: [Context](index.md)) | + +## Functions + +| Name | Summary | +|---|---| +| [component1](component1.md) | [common]
operator fun [component1](component1.md)(): [Destination](index.md) | +| [component2](component2.md) | [common]
operator fun [component2](component2.md)(): [Context](index.md) | +| [copy](copy.md) | [common]
fun [copy](copy.md)(destination: [Destination](index.md) = this.destination, context: [Context](index.md) = this.context): [DestinationAndContext](index.md)<[Destination](index.md), [Context](index.md)>
Creates a copy of this [DestinationAndContext](index.md) instance, overriding the provided values. | +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [context](context.md) | [common]
val [context](context.md): [Context](index.md) | +| [destination](destination.md) | [common]
val [destination](destination.md): [Destination](index.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/to-string.md new file mode 100644 index 0000000..5a58cf6 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[DestinationAndContext](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md index 4bd03c5..87c68ca 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md @@ -8,9 +8,3 @@ annotation class [ExperimentalNavigationApi](index.md) Indicates that the component annotated with this annotation is experimental and could change or be removed in the future. - -## Constructors - -| | | -|---|---| -| [ExperimentalNavigationApi](-experimental-navigation-api.md) | [common]
fun [ExperimentalNavigationApi](-experimental-navigation-api.md)() | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/-companion/index.md new file mode 100644 index 0000000..5c405c2 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationContextState](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/context-changes.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/context-changes.md new file mode 100644 index 0000000..3ca7ccd --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/context-changes.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationContextState](index.md)/[contextChanges](context-changes.md) + +# contextChanges + +[common]\ +abstract val [contextChanges](context-changes.md): Flow<[Context](index.md)> diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/current-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/current-context.md new file mode 100644 index 0000000..6a56d2f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/current-context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationContextState](index.md)/[currentContext](current-context.md) + +# currentContext + +[common]\ +abstract val [currentContext](current-context.md): [Context](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md new file mode 100644 index 0000000..dbb873e --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/index.md @@ -0,0 +1,26 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationContextState](index.md) + +# NavigationContextState + +[common]\ +interface [NavigationContextState](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>> + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Properties + +| Name | Summary | +|---|---| +| [contextChanges](context-changes.md) | [common]
abstract val [contextChanges](context-changes.md): Flow<[Context](index.md)> | +| [currentContext](current-context.md) | [common]
abstract val [currentContext](current-context.md): [Context](index.md) | +| [initialContext](initial-context.md) | [common]
abstract val [initialContext](initial-context.md): [Context](index.md) | + +## Inheritors + +| Name | +|---| +| [NavigatorState](../-navigator-state/index.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/initial-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/initial-context.md new file mode 100644 index 0000000..38fddac --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context-state/initial-context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationContextState](index.md)/[initialContext](initial-context.md) + +# initialContext + +[common]\ +abstract val [initialContext](initial-context.md): [Context](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/-companion/index.md new file mode 100644 index 0000000..afd363c --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationContext](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md index 522e243..3191050 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md @@ -2,13 +2,24 @@ # NavigationContext -[common]\ -interface [NavigationContext](index.md)<[Key](index.md)> +interface [NavigationContext](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696)> -Represents a navigation context, or a container of a back stack of [Key](index.md)s. Navigation can take place within a [NavigationContext](index.md) typically by changing [Key](index.md) values. But an application may have multiple [NavigationContext](index.md)s that can be changed and navigated through. This allows for more complex navigation paradigms, such as retaining multiple back stacks for a bottom navigation UI component. +Represents a navigation context, or a container of a back stack of [Destination](index.md)s. Navigation can take place within a [NavigationContext](index.md) typically by changing [Destination](index.md) values. But an application may have multiple [NavigationContext](index.md)s that can be changed and navigated through. This allows for more complex navigation paradigms, such as retaining multiple back stacks for a bottom navigation UI component. + +#### Inheritors + +| | +|---| +| [SingleNavigationContext](../-single-navigation-context/index.md) | + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | ## Properties | Name | Summary | |---|---| -| [initialKey](initial-key.md) | [common]
abstract val [initialKey](initial-key.md): [Key](index.md)
The initial key value that should be displayed when first changing to this [NavigationContext](index.md) before any other navigation was performed. | +| [initialDestination](initial-destination.md) | [common]
abstract val [initialDestination](initial-destination.md): [Destination](index.md)
The initial key value that should be displayed when first changing to this [NavigationContext](index.md) before any other navigation was performed. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/initial-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/initial-destination.md new file mode 100644 index 0000000..c9d4bb0 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/initial-destination.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationContext](index.md)/[initialDestination](initial-destination.md) + +# initialDestination + +[common]\ +abstract val [initialDestination](initial-destination.md): [Destination](index.md) + +The initial key value that should be displayed when first changing to this [NavigationContext](index.md) before any other navigation was performed. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/-companion/index.md new file mode 100644 index 0000000..28e6186 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationDestinationState](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/current-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/current-destination.md new file mode 100644 index 0000000..b81644d --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/current-destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationDestinationState](index.md)/[currentDestination](current-destination.md) + +# currentDestination + +[common]\ +abstract val [currentDestination](current-destination.md): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/destination-changes.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/destination-changes.md new file mode 100644 index 0000000..98b5eb3 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/destination-changes.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationDestinationState](index.md)/[destinationChanges](destination-changes.md) + +# destinationChanges + +[common]\ +abstract val [destinationChanges](destination-changes.md): Flow<[Destination](index.md)> diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md new file mode 100644 index 0000000..b40aaba --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/index.md @@ -0,0 +1,26 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationDestinationState](index.md) + +# NavigationDestinationState + +[common]\ +interface [NavigationDestinationState](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696)> + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Properties + +| Name | Summary | +|---|---| +| [currentDestination](current-destination.md) | [common]
abstract val [currentDestination](current-destination.md): [Destination](index.md) | +| [destinationChanges](destination-changes.md) | [common]
abstract val [destinationChanges](destination-changes.md): Flow<[Destination](index.md)> | +| [initialDestination](initial-destination.md) | [common]
abstract val [initialDestination](initial-destination.md): [Destination](index.md) | + +## Inheritors + +| Name | +|---| +| [NavigatorState](../-navigator-state/index.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/initial-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/initial-destination.md new file mode 100644 index 0000000..24690bf --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-destination-state/initial-destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationDestinationState](index.md)/[initialDestination](initial-destination.md) + +# initialDestination + +[common]\ +abstract val [initialDestination](initial-destination.md): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-back/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-back/index.md index 5306009..36e3b58 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-back/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-back/index.md @@ -3,4 +3,4 @@ # Back [common]\ -class [Back](index.md)<[NavigationValue](index.md)> : [NavigationEvent](../index.md)<[NavigationValue](index.md)> +class [Back](index.md)<[Destination](index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696)> : [NavigationEvent](../index.md)<[Destination](index.md)> diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/elapsed-milliseconds.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/elapsed-milliseconds.md new file mode 100644 index 0000000..d3e85e8 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/elapsed-milliseconds.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Context](index.md)/[elapsedMilliseconds](elapsed-milliseconds.md) + +# elapsedMilliseconds + +[common]\ +open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/equals.md new file mode 100644 index 0000000..35b3cbd --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Context](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/hash-code.md new file mode 100644 index 0000000..e4c18c1 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Context](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/index.md new file mode 100644 index 0000000..9b40450 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/index.md @@ -0,0 +1,24 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Context](index.md) + +# Context + +[common]\ +class [Context](index.md)<[D](index.md) : [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696), [C](index.md) : [NavigationContext](../../../-navigation-context/index.md)<[D](index.md)>> : [NavigationEvent.Backward](../index.md)<[D](index.md), [C](index.md)> + +A [NavigationEvent](../../index.md) that changes goes back to the previous [NavigationContext](../../../-navigation-context/index.md). + +## Functions + +| Name | Summary | +|---|---| +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [direction](../direction.md) | [common]
open override val [direction](../direction.md): [NavigationEvent.Direction](../../-direction/index.md)
The navigation direction for this event. | +| [elapsedMilliseconds](elapsed-milliseconds.md) | [common]
open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)
The amount of milliseconds that have elapsed on the system when the event occurred. **Note:** This is not safe to persist or use between system reboots. | +| [type](type.md) | [common]
open override val [type](type.md): [NavigationEvent.Type](../../-type/index.md)
The type of [NavigationEvent](../../index.md) that occurred. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/to-string.md new file mode 100644 index 0000000..a05fc21 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Context](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/type.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/type.md new file mode 100644 index 0000000..323361d --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/type.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Context](index.md)/[type](type.md) + +# type + +[common]\ +open override val [type](type.md): [NavigationEvent.Type](../../-type/index.md) + +The type of [NavigationEvent](../../index.md) that occurred. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/elapsed-milliseconds.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/elapsed-milliseconds.md new file mode 100644 index 0000000..3dd78de --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/elapsed-milliseconds.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Destination](index.md)/[elapsedMilliseconds](elapsed-milliseconds.md) + +# elapsedMilliseconds + +[common]\ +open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/equals.md new file mode 100644 index 0000000..9785f29 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Destination](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/hash-code.md new file mode 100644 index 0000000..3ee3234 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Destination](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/index.md new file mode 100644 index 0000000..4fc131a --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/index.md @@ -0,0 +1,24 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Destination](index.md) + +# Destination + +[common]\ +class [Destination](index.md)<[D](index.md) : [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696), [C](index.md) : [NavigationContext](../../../-navigation-context/index.md)<[D](index.md)>> : [NavigationEvent.Backward](../index.md)<[D](index.md), [C](index.md)> + +A [NavigationEvent](../../index.md) that changes goes back to the previous [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../../../-navigation-context/index.md). + +## Functions + +| Name | Summary | +|---|---| +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [direction](../direction.md) | [common]
open override val [direction](../direction.md): [NavigationEvent.Direction](../../-direction/index.md)
The navigation direction for this event. | +| [elapsedMilliseconds](elapsed-milliseconds.md) | [common]
open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)
The amount of milliseconds that have elapsed on the system when the event occurred. **Note:** This is not safe to persist or use between system reboots. | +| [type](type.md) | [common]
open override val [type](type.md): [NavigationEvent.Type](../../-type/index.md)
The type of [NavigationEvent](../../index.md) that occurred. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/to-string.md new file mode 100644 index 0000000..9812b09 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Destination](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/type.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/type.md new file mode 100644 index 0000000..e9183b8 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/type.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Backward](../index.md)/[Destination](index.md)/[type](type.md) + +# type + +[common]\ +open override val [type](type.md): [NavigationEvent.Type](../../-type/index.md) + +The type of [NavigationEvent](../../index.md) that occurred. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/direction.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/direction.md new file mode 100644 index 0000000..b99e1ba --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/direction.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Backward](index.md)/[direction](direction.md) + +# direction + +[common]\ +open override val [direction](direction.md): [NavigationEvent.Direction](../-direction/index.md) + +The navigation direction for this event. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/elapsed-milliseconds.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/elapsed-milliseconds.md new file mode 100644 index 0000000..70e0960 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/elapsed-milliseconds.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Backward](index.md)/[elapsedMilliseconds](elapsed-milliseconds.md) + +# elapsedMilliseconds + +[common]\ +open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/equals.md new file mode 100644 index 0000000..29567dd --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Backward](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/hash-code.md new file mode 100644 index 0000000..35a92be --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Backward](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/index.md new file mode 100644 index 0000000..3323417 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/index.md @@ -0,0 +1,31 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Backward](index.md) + +# Backward + +@Serializable(with = [NavigationEventBackwardSerializer::class](../../../../../navigation-core/com.chrynan.navigation/-navigation-event-backward-serializer/index.md)) + +sealed class [Backward](index.md)<[D](index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696), [C](index.md) : [NavigationContext](../../-navigation-context/index.md)<[D](index.md)>> : [NavigationEvent](../index.md)<[D](index.md), [C](index.md)> + +A [NavigationEvent](../index.md) that represents a reversal of a previous navigation event. A [Backward](index.md) navigation event can be used to go to the previous [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../../-navigation-context/index.md), or going back to a previous [NavigationContext](../../-navigation-context/index.md) before a change in context. + +#### Inheritors + +| | +|---| +| [Destination](-destination/index.md) | +| [Context](-context/index.md) | + +## Types + +| Name | Summary | +|---|---| +| [Context](-context/index.md) | [common]
class [Context](-context/index.md)<[D](-context/index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696), [C](-context/index.md) : [NavigationContext](../../-navigation-context/index.md)<[D](-context/index.md)>> : [NavigationEvent.Backward](index.md)<[D](-context/index.md), [C](-context/index.md)>
A [NavigationEvent](../index.md) that changes goes back to the previous [NavigationContext](../../-navigation-context/index.md). | +| [Destination](-destination/index.md) | [common]
class [Destination](-destination/index.md)<[D](-destination/index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696), [C](-destination/index.md) : [NavigationContext](../../-navigation-context/index.md)<[D](-destination/index.md)>> : [NavigationEvent.Backward](index.md)<[D](-destination/index.md), [C](-destination/index.md)>
A [NavigationEvent](../index.md) that changes goes back to the previous [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../../-navigation-context/index.md). | + +## Properties + +| Name | Summary | +|---|---| +| [direction](direction.md) | [common]
open override val [direction](direction.md): [NavigationEvent.Direction](../-direction/index.md)
The navigation direction for this event. | +| [elapsedMilliseconds](../elapsed-milliseconds.md) | [common]
abstract val [elapsedMilliseconds](../elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)
The amount of milliseconds that have elapsed on the system when the event occurred. | +| [type](../type.md) | [common]
abstract val [type](../type.md): [NavigationEvent.Type](../-type/index.md)
The type of [NavigationEvent](../index.md) that occurred. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/instant.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/instant.md new file mode 100644 index 0000000..ea93763 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/instant.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Backward](index.md)/[instant](instant.md) + +# instant + +[common]\ +open override val [instant](instant.md): Instant diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/to-string.md new file mode 100644 index 0000000..f5fafe7 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Backward](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/type.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/type.md new file mode 100644 index 0000000..806dd63 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/type.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Backward](index.md)/[type](type.md) + +# type + +[common]\ +open override val [type](type.md): [NavigationEvent.Type](../-type/index.md) + +The type of [NavigationEvent](../index.md) that occurred. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/-b-a-c-k-w-a-r-d-s/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/-b-a-c-k-w-a-r-d-s/index.md new file mode 100644 index 0000000..8de494f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/-b-a-c-k-w-a-r-d-s/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Direction](../index.md)/[BACKWARDS](index.md) + +# BACKWARDS + +[common]\ +[BACKWARDS](index.md) + +The associated [NavigationEvent](../../index.md) causes a removal of a previous event change from a [Stack](../../../../../../navigation-core/com.chrynan.navigation/-stack/index.md). + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/-f-o-r-w-a-r-d-s/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/-f-o-r-w-a-r-d-s/index.md new file mode 100644 index 0000000..533910b --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/-f-o-r-w-a-r-d-s/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Direction](../index.md)/[FORWARDS](index.md) + +# FORWARDS + +[common]\ +[FORWARDS](index.md) + +The associated [NavigationEvent](../../index.md) causes an addition of the change to a [Stack](../../../../../../navigation-core/com.chrynan.navigation/-stack/index.md). + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/index.md new file mode 100644 index 0000000..5a07e2b --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/index.md @@ -0,0 +1,32 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Direction](index.md) + +# Direction + +[common]\ +@Serializable + +enum [Direction](index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationEvent.Direction](index.md)> + +Represents a direction for a [NavigationEvent](../index.md). A [NavigationEvent](../index.md) can either be a [FORWARDS](-f-o-r-w-a-r-d-s/index.md) direction event, meaning the change is added to a [Stack](../../../../../navigation-core/com.chrynan.navigation/-stack/index.md), or a [BACKWARDS](-b-a-c-k-w-a-r-d-s/index.md) direction event, meaning the change causes a removal from a [Stack](../../../../../navigation-core/com.chrynan.navigation/-stack/index.md). + +## Entries + +| | | +|---|---| +| [BACKWARDS](-b-a-c-k-w-a-r-d-s/index.md) | [common]
[BACKWARDS](-b-a-c-k-w-a-r-d-s/index.md)
The associated [NavigationEvent](../index.md) causes a removal of a previous event change from a [Stack](../../../../../navigation-core/com.chrynan.navigation/-stack/index.md). | +| [FORWARDS](-f-o-r-w-a-r-d-s/index.md) | [common]
[FORWARDS](-f-o-r-w-a-r-d-s/index.md)
The associated [NavigationEvent](../index.md) causes an addition of the change to a [Stack](../../../../../navigation-core/com.chrynan.navigation/-stack/index.md). | + +## Functions + +| Name | Summary | +|---|---| +| [valueOf](value-of.md) | [common]
fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationEvent.Direction](index.md)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) | +| [values](values.md) | [common]
fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationEvent.Direction](index.md)>
Returns an array containing the constants of this enum type, in the order they're declared. | + +## Properties + +| Name | Summary | +|---|---| +| [name](../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](serial-name.md) | [common]
val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/serial-name.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/serial-name.md new file mode 100644 index 0000000..5366f7d --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/serial-name.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Direction](index.md)/[serialName](serial-name.md) + +# serialName + +[common]\ +val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/value-of.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/value-of.md new file mode 100644 index 0000000..a5209d7 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/value-of.md @@ -0,0 +1,14 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Direction](index.md)/[valueOf](value-of.md) + +# valueOf + +[common]\ +fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationEvent.Direction](index.md) + +Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) + +#### Throws + +| | | +|---|---| +| [IllegalArgumentException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html) | if this enum type has no constant with the specified name | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/values.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/values.md new file mode 100644 index 0000000..7d034fa --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/values.md @@ -0,0 +1,10 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Direction](index.md)/[values](values.md) + +# values + +[common]\ +fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationEvent.Direction](index.md)> + +Returns an array containing the constants of this enum type, in the order they're declared. + +This method may be used to iterate over the constants. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/context.md new file mode 100644 index 0000000..7468683 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Context](index.md)/[context](context.md) + +# context + +[common]\ +val [context](context.md): [C](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/elapsed-milliseconds.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/elapsed-milliseconds.md new file mode 100644 index 0000000..0d9cf0f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/elapsed-milliseconds.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Context](index.md)/[elapsedMilliseconds](elapsed-milliseconds.md) + +# elapsedMilliseconds + +[common]\ +open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/equals.md new file mode 100644 index 0000000..bc88403 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Context](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/hash-code.md new file mode 100644 index 0000000..f09ded7 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Context](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/index.md new file mode 100644 index 0000000..b1357bf --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/index.md @@ -0,0 +1,27 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Context](index.md) + +# Context + +[common]\ +@Serializable + +class [Context](index.md)<[D](index.md) : [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696), [C](index.md) : [NavigationContext](../../../-navigation-context/index.md)<[D](index.md)>> : [NavigationEvent.Forward](../index.md)<[D](index.md), [C](index.md)> + +A [NavigationEvent](../../index.md) that changes the current [NavigationContext](../../../-navigation-context/index.md). + +## Functions + +| Name | Summary | +|---|---| +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [context](context.md) | [common]
val [context](context.md): [C](index.md)
The [NavigationContext](../../../-navigation-context/index.md) to go to. | +| [direction](../direction.md) | [common]
open override val [direction](../direction.md): [NavigationEvent.Direction](../../-direction/index.md)
The navigation direction for this event. | +| [elapsedMilliseconds](elapsed-milliseconds.md) | [common]
open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)
The amount of milliseconds that have elapsed on the system when the event occurred. **Note:** This is not safe to persist or use between system reboots. | +| [type](type.md) | [common]
open override val [type](type.md): [NavigationEvent.Type](../../-type/index.md)
The type of [NavigationEvent](../../index.md) that occurred. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/instant.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/instant.md new file mode 100644 index 0000000..09012bf --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/instant.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Context](index.md)/[instant](instant.md) + +# instant + +[common]\ +open override val [instant](instant.md): Instant diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/to-string.md new file mode 100644 index 0000000..9dcc442 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Context](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/type.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/type.md new file mode 100644 index 0000000..9dc0939 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/type.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Context](index.md)/[type](type.md) + +# type + +[common]\ +open override val [type](type.md): [NavigationEvent.Type](../../-type/index.md) + +The type of [NavigationEvent](../../index.md) that occurred. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/destination.md new file mode 100644 index 0000000..0341780 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Destination](index.md)/[destination](destination.md) + +# destination + +[common]\ +val [destination](destination.md): [D](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/elapsed-milliseconds.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/elapsed-milliseconds.md new file mode 100644 index 0000000..e8cadde --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/elapsed-milliseconds.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Destination](index.md)/[elapsedMilliseconds](elapsed-milliseconds.md) + +# elapsedMilliseconds + +[common]\ +open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/equals.md new file mode 100644 index 0000000..8bb4708 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Destination](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/hash-code.md new file mode 100644 index 0000000..69647a7 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Destination](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/index.md new file mode 100644 index 0000000..e4a24aa --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/index.md @@ -0,0 +1,27 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Destination](index.md) + +# Destination + +[common]\ +@Serializable + +class [Destination](index.md)<[D](index.md) : [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696), [C](index.md) : [NavigationContext](../../../-navigation-context/index.md)<[D](index.md)>> : [NavigationEvent.Forward](../index.md)<[D](index.md), [C](index.md)> + +A [NavigationEvent](../../index.md) that changes the [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../../../-navigation-context/index.md). + +## Functions + +| Name | Summary | +|---|---| +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [destination](destination.md) | [common]
val [destination](destination.md): [D](index.md)
The [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) to go to. This value will be added to the top of the [Stack](../../../../../../navigation-core/com.chrynan.navigation/-stack/index.md) of destinations within the current [NavigationContext](../../../-navigation-context/index.md). | +| [direction](../direction.md) | [common]
open override val [direction](../direction.md): [NavigationEvent.Direction](../../-direction/index.md)
The navigation direction for this event. | +| [elapsedMilliseconds](elapsed-milliseconds.md) | [common]
open override val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)
The amount of milliseconds that have elapsed on the system when the event occurred. **Note:** This is not safe to persist or use between system reboots. | +| [type](type.md) | [common]
open override val [type](type.md): [NavigationEvent.Type](../../-type/index.md)
The type of [NavigationEvent](../../index.md) that occurred. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/instant.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/instant.md new file mode 100644 index 0000000..8119d08 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/instant.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Destination](index.md)/[instant](instant.md) + +# instant + +[common]\ +open override val [instant](instant.md): Instant diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/to-string.md new file mode 100644 index 0000000..0fdfa2a --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Destination](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/type.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/type.md new file mode 100644 index 0000000..d5178d8 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/type.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Forward](../index.md)/[Destination](index.md)/[type](type.md) + +# type + +[common]\ +open override val [type](type.md): [NavigationEvent.Type](../../-type/index.md) + +The type of [NavigationEvent](../../index.md) that occurred. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/direction.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/direction.md new file mode 100644 index 0000000..3125371 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/direction.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Forward](index.md)/[direction](direction.md) + +# direction + +[common]\ +open override val [direction](direction.md): [NavigationEvent.Direction](../-direction/index.md) + +The navigation direction for this event. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/index.md new file mode 100644 index 0000000..3d041e4 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/index.md @@ -0,0 +1,31 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Forward](index.md) + +# Forward + +@Serializable(with = [NavigationEventForwardSerializer::class](../../../../../navigation-core/com.chrynan.navigation/-navigation-event-forward-serializer/index.md)) + +sealed class [Forward](index.md)<[D](index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696), [C](index.md) : [NavigationContext](../../-navigation-context/index.md)<[D](index.md)>> : [NavigationEvent](../index.md)<[D](index.md), [C](index.md)> + +A [NavigationEvent](../index.md) that represents a forward movement, or addition of a navigation change. These events can be reversed by a [Backward](../-backward/index.md) event. There are two forward navigation events: [Destination](-destination/index.md) representing a change in destination on the current context stack, and [Context](-context/index.md) representing a change in the context. + +#### Inheritors + +| | +|---| +| [Destination](-destination/index.md) | +| [Context](-context/index.md) | + +## Types + +| Name | Summary | +|---|---| +| [Context](-context/index.md) | [common]
@Serializable
class [Context](-context/index.md)<[D](-context/index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696), [C](-context/index.md) : [NavigationContext](../../-navigation-context/index.md)<[D](-context/index.md)>> : [NavigationEvent.Forward](index.md)<[D](-context/index.md), [C](-context/index.md)>
A [NavigationEvent](../index.md) that changes the current [NavigationContext](../../-navigation-context/index.md). | +| [Destination](-destination/index.md) | [common]
@Serializable
class [Destination](-destination/index.md)<[D](-destination/index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696), [C](-destination/index.md) : [NavigationContext](../../-navigation-context/index.md)<[D](-destination/index.md)>> : [NavigationEvent.Forward](index.md)<[D](-destination/index.md), [C](-destination/index.md)>
A [NavigationEvent](../index.md) that changes the [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../../-navigation-context/index.md). | + +## Properties + +| Name | Summary | +|---|---| +| [direction](direction.md) | [common]
open override val [direction](direction.md): [NavigationEvent.Direction](../-direction/index.md)
The navigation direction for this event. | +| [elapsedMilliseconds](../elapsed-milliseconds.md) | [common]
abstract val [elapsedMilliseconds](../elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)
The amount of milliseconds that have elapsed on the system when the event occurred. | +| [type](../type.md) | [common]
abstract val [type](../type.md): [NavigationEvent.Type](../-type/index.md)
The type of [NavigationEvent](../index.md) that occurred. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/destination.md new file mode 100644 index 0000000..4e21cff --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/destination.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[To](index.md)/[destination](destination.md) + +# destination + +[common]\ +val [destination](destination.md): [Destination](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/index.md index 3d8e14e..b361962 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/index.md @@ -3,10 +3,11 @@ # To [common]\ -data class [To](index.md)<[NavigationValue](index.md)> : [NavigationEvent](../index.md)<[NavigationValue](index.md)> +data class [To](index.md)<[Destination](index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696)> : [NavigationEvent](../index.md)<[Destination](index.md)> ## Properties | Name | Summary | |---|---| -| [value](value.md) | [common]
val [value](value.md): [NavigationValue](index.md) | +| [destination](destination.md) | [common]
val [destination](destination.md): [Destination](index.md) | +| [strategy](strategy.md) | [common]
val [strategy](strategy.md): [StackDuplicateContentStrategy](../../-stack-duplicate-content-strategy/index.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/strategy.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/strategy.md new file mode 100644 index 0000000..d1f83b6 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/strategy.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[To](index.md)/[strategy](strategy.md) + +# strategy + +[common]\ +val [strategy](strategy.md): [StackDuplicateContentStrategy](../../-stack-duplicate-content-strategy/index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d-s/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d-s/index.md new file mode 100644 index 0000000..3e67893 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d-s/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Type](../index.md)/[BACKWARDS](index.md) + +# BACKWARDS + +[common]\ +[BACKWARDS](index.md) + +Corresponds to the [NavigationEvent.Backward](../../-backward/index.md) type. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d_-c-o-n-t-e-x-t/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d_-c-o-n-t-e-x-t/index.md new file mode 100644 index 0000000..2209fb9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d_-c-o-n-t-e-x-t/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Type](../index.md)/[BACKWARD_CONTEXT](index.md) + +# BACKWARD_CONTEXT + +[common]\ +[BACKWARD_CONTEXT](index.md) + +Corresponds to the [NavigationEvent.Backward.Context](../../-backward/-context/index.md) type. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md new file mode 100644 index 0000000..ff6cd82 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Type](../index.md)/[BACKWARD_DESTINATION](index.md) + +# BACKWARD_DESTINATION + +[common]\ +[BACKWARD_DESTINATION](index.md) + +Corresponds to the [NavigationEvent.Backward.Destination](../../-backward/-destination/index.md) type. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-c-o-n-t-e-x-t/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-c-o-n-t-e-x-t/index.md new file mode 100644 index 0000000..e279069 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-c-o-n-t-e-x-t/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Type](../index.md)/[CONTEXT](index.md) + +# CONTEXT + +[common]\ +[CONTEXT](index.md) + +Corresponds to the [NavigationEvent.Forward.Context](../../-forward/-context/index.md) type. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-d-e-s-t-i-n-a-t-i-o-n/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-d-e-s-t-i-n-a-t-i-o-n/index.md new file mode 100644 index 0000000..1ed8ea9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-d-e-s-t-i-n-a-t-i-o-n/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Type](../index.md)/[DESTINATION](index.md) + +# DESTINATION + +[common]\ +[DESTINATION](index.md) + +Corresponds to the [NavigationEvent.Forward.Destination](../../-forward/-destination/index.md) type. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-f-o-r-w-a-r-d_-c-o-n-t-e-x-t/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-f-o-r-w-a-r-d_-c-o-n-t-e-x-t/index.md new file mode 100644 index 0000000..f831152 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-f-o-r-w-a-r-d_-c-o-n-t-e-x-t/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Type](../index.md)/[FORWARD_CONTEXT](index.md) + +# FORWARD_CONTEXT + +[common]\ +[FORWARD_CONTEXT](index.md) + +Corresponds to the [NavigationEvent.Forward.Context](../../-forward/-context/index.md) type. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-f-o-r-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-f-o-r-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md new file mode 100644 index 0000000..83ad673 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-f-o-r-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationEvent](../../index.md)/[Type](../index.md)/[FORWARD_DESTINATION](index.md) + +# FORWARD_DESTINATION + +[common]\ +[FORWARD_DESTINATION](index.md) + +Corresponds to the [NavigationEvent.Forward.Destination](../../-forward/-destination/index.md) type. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/index.md new file mode 100644 index 0000000..5bdc50d --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/index.md @@ -0,0 +1,32 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Type](index.md) + +# Type + +[common]\ +@Serializable + +enum [Type](index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationEvent.Type](index.md)> + +## Entries + +| | | +|---|---| +| [BACKWARD_CONTEXT](-b-a-c-k-w-a-r-d_-c-o-n-t-e-x-t/index.md) | [common]
[BACKWARD_CONTEXT](-b-a-c-k-w-a-r-d_-c-o-n-t-e-x-t/index.md)
Corresponds to the [NavigationEvent.Backward.Context](../-backward/-context/index.md) type. | +| [BACKWARD_DESTINATION](-b-a-c-k-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md) | [common]
[BACKWARD_DESTINATION](-b-a-c-k-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md)
Corresponds to the [NavigationEvent.Backward.Destination](../-backward/-destination/index.md) type. | +| [FORWARD_CONTEXT](-f-o-r-w-a-r-d_-c-o-n-t-e-x-t/index.md) | [common]
[FORWARD_CONTEXT](-f-o-r-w-a-r-d_-c-o-n-t-e-x-t/index.md)
Corresponds to the [NavigationEvent.Forward.Context](../-forward/-context/index.md) type. | +| [FORWARD_DESTINATION](-f-o-r-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md) | [common]
[FORWARD_DESTINATION](-f-o-r-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md)
Corresponds to the [NavigationEvent.Forward.Destination](../-forward/-destination/index.md) type. | + +## Functions + +| Name | Summary | +|---|---| +| [valueOf](value-of.md) | [common]
fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationEvent.Type](index.md)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) | +| [values](values.md) | [common]
fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationEvent.Type](index.md)>
Returns an array containing the constants of this enum type, in the order they're declared. | + +## Properties + +| Name | Summary | +|---|---| +| [name](../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](serial-name.md) | [common]
val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/serial-name.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/serial-name.md new file mode 100644 index 0000000..dd35480 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/serial-name.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Type](index.md)/[serialName](serial-name.md) + +# serialName + +[common]\ +val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/value-of.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/value-of.md new file mode 100644 index 0000000..df961c7 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/value-of.md @@ -0,0 +1,14 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Type](index.md)/[valueOf](value-of.md) + +# valueOf + +[common]\ +fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationEvent.Type](index.md) + +Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) + +#### Throws + +| | | +|---|---| +| [IllegalArgumentException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html) | if this enum type has no constant with the specified name | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/values.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/values.md new file mode 100644 index 0000000..ab8934d --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/values.md @@ -0,0 +1,10 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationEvent](../index.md)/[Type](index.md)/[values](values.md) + +# values + +[common]\ +fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationEvent.Type](index.md)> + +Returns an array containing the constants of this enum type, in the order they're declared. + +This method may be used to iterate over the constants. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-up/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-up/index.md index b9fe111..785dffb 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-up/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-up/index.md @@ -3,4 +3,4 @@ # Up [common]\ -class [Up](index.md)<[NavigationValue](index.md)> : [NavigationEvent](../index.md)<[NavigationValue](index.md)> +class [Up](index.md)<[Destination](index.md) : [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696)> : [NavigationEvent](../index.md)<[Destination](index.md)> diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/direction.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/direction.md new file mode 100644 index 0000000..2c76b93 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/direction.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationEvent](index.md)/[direction](direction.md) + +# direction + +[common]\ +abstract val [direction](direction.md): [NavigationEvent.Direction](-direction/index.md) + +The navigation direction for this event. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/elapsed-milliseconds.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/elapsed-milliseconds.md new file mode 100644 index 0000000..d0e73be --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/elapsed-milliseconds.md @@ -0,0 +1,10 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationEvent](index.md)/[elapsedMilliseconds](elapsed-milliseconds.md) + +# elapsedMilliseconds + +[common]\ +abstract val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) + +The amount of milliseconds that have elapsed on the system when the event occurred. + +**Note:** This is not safe to persist or use between system reboots. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/index.md index 0ef1986..1349836 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/index.md @@ -2,33 +2,39 @@ # NavigationEvent -[common]\ -sealed class [NavigationEvent](index.md)<[NavigationValue](index.md)> +@Serializable(with = [NavigationEventSerializer::class](../../../../navigation-core/com.chrynan.navigation/-navigation-event-serializer/index.md)) -An event that is sent to a [Navigator](../-navigator/index.md) to coordinate the navigation between screens. +sealed class [NavigationEvent](index.md)<[D](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [C](index.md) : [NavigationContext](../-navigation-context/index.md)<[D](index.md)>> -## See also +Represents a navigation event that is sent to a [Navigator](../-navigator/index.md) to coordinate the navigation between UI components, such as "screens" within an application. A [NavigationEvent](index.md) can be a [NavigationEvent.Forward.Destination](-forward/-destination/index.md) representing a change in a [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) in the current context, a [NavigationEvent.Forward.Context](-forward/-context/index.md) representing a change in [NavigationContext](../-navigation-context/index.md), or a [NavigationEvent.Backward](-backward/index.md) representing a back tracking of a previous [NavigationEvent](index.md). -common +#### See also -| | | -|---|---| -| Navigator.navigate | | -| [com.chrynan.navigation.NavigationHandler](../-navigation-handler/on-navigate.md) | | +| | +|---| +| [Navigator.dispatch](../-navigator/dispatch.md) | + +#### Inheritors + +| | +|---| +| [Backward](-backward/index.md) | +| [Forward](-forward/index.md) | ## Types | Name | Summary | |---|---| -| [Back](-back/index.md) | [common]
class [Back](-back/index.md)<[NavigationValue](-back/index.md)> : [NavigationEvent](index.md)<[NavigationValue](-back/index.md)> | +| [Backward](-backward/index.md) | [common]
@Serializable(with = [NavigationEventBackwardSerializer::class](../../../../navigation-core/com.chrynan.navigation/-navigation-event-backward-serializer/index.md))
sealed class [Backward](-backward/index.md)<[D](-backward/index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [C](-backward/index.md) : [NavigationContext](../-navigation-context/index.md)<[D](-backward/index.md)>> : [NavigationEvent](index.md)<[D](-backward/index.md), [C](-backward/index.md)>
A [NavigationEvent](index.md) that represents a reversal of a previous navigation event. A [Backward](-backward/index.md) navigation event can be used to go to the previous [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../-navigation-context/index.md), or going back to a previous [NavigationContext](../-navigation-context/index.md) before a change in context. | | [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | -| [To](-to/index.md) | [common]
data class [To](-to/index.md)<[NavigationValue](-to/index.md)> : [NavigationEvent](index.md)<[NavigationValue](-to/index.md)> | -| [Up](-up/index.md) | [common]
class [Up](-up/index.md)<[NavigationValue](-up/index.md)> : [NavigationEvent](index.md)<[NavigationValue](-up/index.md)> | +| [Direction](-direction/index.md) | [common]
@Serializable
enum [Direction](-direction/index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationEvent.Direction](-direction/index.md)>
Represents a direction for a [NavigationEvent](index.md). A [NavigationEvent](index.md) can either be a [FORWARDS](-direction/-f-o-r-w-a-r-d-s/index.md) direction event, meaning the change is added to a [Stack](../../../../navigation-core/com.chrynan.navigation/-stack/index.md), or a [BACKWARDS](-direction/-b-a-c-k-w-a-r-d-s/index.md) direction event, meaning the change causes a removal from a [Stack](../../../../navigation-core/com.chrynan.navigation/-stack/index.md). | +| [Forward](-forward/index.md) | [common]
@Serializable(with = [NavigationEventForwardSerializer::class](../../../../navigation-core/com.chrynan.navigation/-navigation-event-forward-serializer/index.md))
sealed class [Forward](-forward/index.md)<[D](-forward/index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [C](-forward/index.md) : [NavigationContext](../-navigation-context/index.md)<[D](-forward/index.md)>> : [NavigationEvent](index.md)<[D](-forward/index.md), [C](-forward/index.md)>
A [NavigationEvent](index.md) that represents a forward movement, or addition of a navigation change. These events can be reversed by a [Backward](-backward/index.md) event. There are two forward navigation events: [Destination](-forward/-destination/index.md) representing a change in destination on the current context stack, and [Context](-forward/-context/index.md) representing a change in the context. | +| [Type](-type/index.md) | [common]
@Serializable
enum [Type](-type/index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationEvent.Type](-type/index.md)> | -## Inheritors +## Properties -| Name | -|---| -| [Back](-back/index.md) | -| [Up](-up/index.md) | -| [To](-to/index.md) | +| Name | Summary | +|---|---| +| [direction](direction.md) | [common]
abstract val [direction](direction.md): [NavigationEvent.Direction](-direction/index.md)
The navigation direction for this event. | +| [elapsedMilliseconds](elapsed-milliseconds.md) | [common]
abstract val [elapsedMilliseconds](elapsed-milliseconds.md): [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)
The amount of milliseconds that have elapsed on the system when the event occurred. | +| [type](type.md) | [common]
abstract val [type](type.md): [NavigationEvent.Type](-type/index.md)
The type of [NavigationEvent](index.md) that occurred. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/instant.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/instant.md new file mode 100644 index 0000000..9d56732 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/instant.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationEvent](index.md)/[instant](instant.md) + +# instant + +[common]\ +abstract val [instant](instant.md): Instant + +The Instant that the event occurred. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/type.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/type.md new file mode 100644 index 0000000..71b453b --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/type.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationEvent](index.md)/[type](type.md) + +# type + +[common]\ +abstract val [type](type.md): [NavigationEvent.Type](-type/index.md) + +The type of [NavigationEvent](index.md) that occurred. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/-companion/index.md new file mode 100644 index 0000000..f7069b3 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStateStore](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/context.md new file mode 100644 index 0000000..9554f0e --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/context.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationStateStore](index.md)/[context](context.md) + +# context + +[common]\ +abstract val [context](context.md): [NavigationState](../-navigation-state/index.md)<[Context](index.md)> + +A [NavigationState](../-navigation-state/index.md) of [NavigationContext](../-navigation-context/index.md)s. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/destination.md new file mode 100644 index 0000000..58f1137 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/destination.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationStateStore](index.md)/[destination](destination.md) + +# destination + +[common]\ +abstract val [destination](destination.md): [NavigationState](../-navigation-state/index.md)<[Destination](index.md)> + +A [NavigationState](../-navigation-state/index.md) of [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696)s. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/event.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/event.md new file mode 100644 index 0000000..c333242 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/event.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationStateStore](index.md)/[event](event.md) + +# event + +[common]\ +abstract val [event](event.md): [NavigationState](../-navigation-state/index.md)<[NavigationEvent](../-navigation-event/index.md)<[Destination](index.md), [Context](index.md)>?> + +A [NavigationState](../-navigation-state/index.md) of [NavigationEvent](../-navigation-event/index.md)s. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/index.md new file mode 100644 index 0000000..7e87152 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/index.md @@ -0,0 +1,24 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationStateStore](index.md) + +# NavigationStateStore + +[common]\ +@Serializable(with = [NavigationStateStoreSerializer::class](../../../../navigation-core/com.chrynan.navigation/-navigation-state-store-serializer/index.md)) + +interface [NavigationStateStore](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>> + +Represents a store of navigation state information that is useful for a [Navigator](../-navigator/index.md). + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Properties + +| Name | Summary | +|---|---| +| [context](context.md) | [common]
abstract val [context](context.md): [NavigationState](../-navigation-state/index.md)<[Context](index.md)>
A [NavigationState](../-navigation-state/index.md) of [NavigationContext](../-navigation-context/index.md)s. | +| [destination](destination.md) | [common]
abstract val [destination](destination.md): [NavigationState](../-navigation-state/index.md)<[Destination](index.md)>
A [NavigationState](../-navigation-state/index.md) of [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696)s. | +| [event](event.md) | [common]
abstract val [event](event.md): [NavigationState](../-navigation-state/index.md)<[NavigationEvent](../-navigation-event/index.md)<[Destination](index.md), [Context](index.md)>?>
A [NavigationState](../-navigation-state/index.md) of [NavigationEvent](../-navigation-event/index.md)s. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/-companion/index.md new file mode 100644 index 0000000..1f9a4e9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationState](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/changes.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/changes.md new file mode 100644 index 0000000..ce0e4b1 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/changes.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationState](index.md)/[changes](changes.md) + +# changes + +[common]\ +abstract val [changes](changes.md): Flow<[T](index.md)> + +The changes in the underlying wrapped state value. This is a shareable Flow that can be subscribed to for the purposes of listening to state changes. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/current.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/current.md new file mode 100644 index 0000000..e0b8962 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/current.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationState](index.md)/[current](current.md) + +# current + +[common]\ +abstract val [current](current.md): [T](index.md) + +The current state value. This value can change over time, so subsequent calls to access this property can return different values. Use the [changes](changes.md) property to subscribe to the changes. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/index.md new file mode 100644 index 0000000..9e05497 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/index.md @@ -0,0 +1,26 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationState](index.md) + +# NavigationState + +[common]\ +@Serializable(with = [NavigationStateSerializer::class](../../../../navigation-core/com.chrynan.navigation/-navigation-state-serializer/index.md)) + +interface [NavigationState](index.md)<[T](index.md)> + +A generic wrapper around the state of a navigation component. This provides a way to access the retained [initial](initial.md) state value, the [current](current.md) state value, and [changes](changes.md) to the state value. + +Though this component can be generally useful for any type of state management, it is meant for use within the context of this navigation library (hence, the name of the component), and is exposed so that the wrapped state values can be accessed. This component is a sealed interface so that it cannot be inherited outside of this library, and creation of the component is internal. If you need something like this component externally, consider using a state management library like [cycle](https://github.com/chRyNaN/cycle). + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Properties + +| Name | Summary | +|---|---| +| [changes](changes.md) | [common]
abstract val [changes](changes.md): Flow<[T](index.md)>
The changes in the underlying wrapped state value. This is a shareable Flow that can be subscribed to for the purposes of listening to state changes. | +| [current](current.md) | [common]
abstract val [current](current.md): [T](index.md)
The current state value. This value can change over time, so subsequent calls to access this property can return different values. Use the [changes](changes.md) property to subscribe to the changes. | +| [initial](initial.md) | [common]
abstract val [initial](initial.md): [T](index.md)
The initial state value when this component was first created. This value does not change when the wrapped state value changes, so subsequent calls to access this property will always return the same value. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/initial.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/initial.md new file mode 100644 index 0000000..9b9d9ae --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/initial.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationState](index.md)/[initial](initial.md) + +# initial + +[common]\ +abstract val [initial](initial.md): [T](index.md) + +The initial state value when this component was first created. This value does not change when the wrapped state value changes, so subsequent calls to access this property will always return the same value. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-a-c-r-o-s-s_-c-o-n-t-e-x-t-s/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-a-c-r-o-s-s_-c-o-n-t-e-x-t-s/index.md new file mode 100644 index 0000000..9ede2f9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-a-c-r-o-s-s_-c-o-n-t-e-x-t-s/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[BackwardsNavigation](../index.md)/[ACROSS_CONTEXTS](index.md) + +# ACROSS_CONTEXTS + +[common]\ +[ACROSS_CONTEXTS](index.md) + +Indicates that navigation across [NavigationContext](../../../-navigation-context/index.md)s is allowed, meaning that navigation can either be to the previous [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../../../-navigation-context/index.md) or to the previous [NavigationContext](../../../-navigation-context/index.md) depending on whether the previous [NavigationEvent](../../../-navigation-event/index.md) was a [NavigationEvent.Forward.Destination](../../../-navigation-event/-forward/-destination/index.md) or [NavigationEvent.Forward.Context](../../../-navigation-event/-forward/-context/index.md) event + +## Properties + +| Name | Summary | +|---|---| +| [name](../../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-companion/index.md new file mode 100644 index 0000000..d91dbb9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[BackwardsNavigation](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-i-n_-c-o-n-t-e-x-t/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-i-n_-c-o-n-t-e-x-t/index.md new file mode 100644 index 0000000..e517c85 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/-i-n_-c-o-n-t-e-x-t/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[BackwardsNavigation](../index.md)/[IN_CONTEXT](index.md) + +# IN_CONTEXT + +[common]\ +[IN_CONTEXT](index.md) + +Indicates that navigation to the previous [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) in the current [NavigationContext](../../../-navigation-context/index.md) should occur + +## Properties + +| Name | Summary | +|---|---| +| [name](../../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/index.md new file mode 100644 index 0000000..4a42906 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/index.md @@ -0,0 +1,38 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[BackwardsNavigation](index.md) + +# BackwardsNavigation + +[common]\ +@Serializable + +enum [BackwardsNavigation](index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationStrategy.BackwardsNavigation](index.md)> + +Represents the type of supported back navigation. An [IN_CONTEXT](-i-n_-c-o-n-t-e-x-t/index.md) value indicates that navigation to the previous [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) in the current [NavigationContext](../../-navigation-context/index.md) should occur. An [ACROSS_CONTEXTS](-a-c-r-o-s-s_-c-o-n-t-e-x-t-s/index.md) value indicates that navigation across [NavigationContext](../../-navigation-context/index.md)s is allowed, meaning that navigation can either be to the previous [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../../-navigation-context/index.md) or to the previous [NavigationContext](../../-navigation-context/index.md) depending on whether the previous [NavigationEvent](../../-navigation-event/index.md) was a [NavigationEvent.Forward.Destination](../../-navigation-event/-forward/-destination/index.md) or [NavigationEvent.Forward.Context](../../-navigation-event/-forward/-context/index.md) event. + +## Entries + +| | | +|---|---| +| [IN_CONTEXT](-i-n_-c-o-n-t-e-x-t/index.md) | [common]
[IN_CONTEXT](-i-n_-c-o-n-t-e-x-t/index.md)
Indicates that navigation to the previous [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) in the current [NavigationContext](../../-navigation-context/index.md) should occur | +| [ACROSS_CONTEXTS](-a-c-r-o-s-s_-c-o-n-t-e-x-t-s/index.md) | [common]
[ACROSS_CONTEXTS](-a-c-r-o-s-s_-c-o-n-t-e-x-t-s/index.md)
Indicates that navigation across [NavigationContext](../../-navigation-context/index.md)s is allowed, meaning that navigation can either be to the previous [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../../-navigation-context/index.md) or to the previous [NavigationContext](../../-navigation-context/index.md) depending on whether the previous [NavigationEvent](../../-navigation-event/index.md) was a [NavigationEvent.Forward.Destination](../../-navigation-event/-forward/-destination/index.md) or [NavigationEvent.Forward.Context](../../-navigation-event/-forward/-context/index.md) event | + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Functions + +| Name | Summary | +|---|---| +| [valueOf](value-of.md) | [common]
fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationStrategy.BackwardsNavigation](index.md)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) | +| [values](values.md) | [common]
fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationStrategy.BackwardsNavigation](index.md)>
Returns an array containing the constants of this enum type, in the order they're declared. | + +## Properties + +| Name | Summary | +|---|---| +| [name](../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](serial-name.md) | [common]
val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/serial-name.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/serial-name.md new file mode 100644 index 0000000..0af7aef --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/serial-name.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[BackwardsNavigation](index.md)/[serialName](serial-name.md) + +# serialName + +[common]\ +val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/value-of.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/value-of.md new file mode 100644 index 0000000..341b5be --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/value-of.md @@ -0,0 +1,14 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[BackwardsNavigation](index.md)/[valueOf](value-of.md) + +# valueOf + +[common]\ +fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationStrategy.BackwardsNavigation](index.md) + +Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) + +#### Throws + +| | | +|---|---| +| [IllegalArgumentException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html) | if this enum type has no constant with the specified name | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/values.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/values.md new file mode 100644 index 0000000..c1ee59d --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-backwards-navigation/values.md @@ -0,0 +1,10 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[BackwardsNavigation](index.md)/[values](values.md) + +# values + +[common]\ +fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationStrategy.BackwardsNavigation](index.md)> + +Returns an array containing the constants of this enum type, in the order they're declared. + +This method may be used to iterate over the constants. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-companion/index.md new file mode 100644 index 0000000..8070030 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md new file mode 100644 index 0000000..61ce87f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[DestinationRetention](../index.md)/[CLEAR](index.md) + +# CLEAR + +[common]\ +[CLEAR](index.md) + +Indicates that the [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) data structure associated with a [NavigationContext](../../../-navigation-context/index.md) should be cleared before navigating to a different [NavigationContext](../../../-navigation-context/index.md), so that the [NavigationContext.initialDestination](../../../-navigation-context/initial-destination.md) value will be displayed when navigating back. + +## Properties + +| Name | Summary | +|---|---| +| [name](index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-companion/index.md new file mode 100644 index 0000000..a43fd55 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[DestinationRetention](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md new file mode 100644 index 0000000..5cbd5e1 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[DestinationRetention](../index.md)/[RETAIN](index.md) + +# RETAIN + +[common]\ +[RETAIN](index.md) + +Indicates that the [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) data structure associated with a [NavigationContext](../../../-navigation-context/index.md) should be kept when navigation to a different [NavigationContext](../../../-navigation-context/index.md), so that the state can be restored when navigating back. + +## Properties + +| Name | Summary | +|---|---| +| [name](../-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md new file mode 100644 index 0000000..40e0ed2 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md @@ -0,0 +1,38 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[DestinationRetention](index.md) + +# DestinationRetention + +[common]\ +@Serializable + +enum [DestinationRetention](index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationStrategy.DestinationRetention](index.md)> + +Represents the approach for retaining the [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) data structures associated with a particular [NavigationContext](../../-navigation-context/index.md), when navigating to other [NavigationContext](../../-navigation-context/index.md)s. A [RETAIN](-r-e-t-a-i-n/index.md) value indicates that the [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) data structure associated with a [NavigationContext](../../-navigation-context/index.md) should be kept when navigation to a different [NavigationContext](../../-navigation-context/index.md), so that the state can be restored when navigating back. A [CLEAR](-c-l-e-a-r/index.md) value indicates that the [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) data structure associated with a [NavigationContext](../../-navigation-context/index.md) should be cleared before navigating to a different [NavigationContext](../../-navigation-context/index.md), so that the [NavigationContext.initialDestination](../../-navigation-context/initial-destination.md) value will be displayed when navigating back. + +## Entries + +| | | +|---|---| +| [RETAIN](-r-e-t-a-i-n/index.md) | [common]
[RETAIN](-r-e-t-a-i-n/index.md)
Indicates that the [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) data structure associated with a [NavigationContext](../../-navigation-context/index.md) should be kept when navigation to a different [NavigationContext](../../-navigation-context/index.md), so that the state can be restored when navigating back. | +| [CLEAR](-c-l-e-a-r/index.md) | [common]
[CLEAR](-c-l-e-a-r/index.md)
Indicates that the [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) data structure associated with a [NavigationContext](../../-navigation-context/index.md) should be cleared before navigating to a different [NavigationContext](../../-navigation-context/index.md), so that the [NavigationContext.initialDestination](../../-navigation-context/initial-destination.md) value will be displayed when navigating back. | + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Functions + +| Name | Summary | +|---|---| +| [valueOf](value-of.md) | [common]
fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationStrategy.DestinationRetention](index.md)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) | +| [values](values.md) | [common]
fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationStrategy.DestinationRetention](index.md)>
Returns an array containing the constants of this enum type, in the order they're declared. | + +## Properties + +| Name | Summary | +|---|---| +| [name](-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](serial-name.md) | [common]
val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/serial-name.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/serial-name.md new file mode 100644 index 0000000..bb07f90 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/serial-name.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[DestinationRetention](index.md)/[serialName](serial-name.md) + +# serialName + +[common]\ +val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/value-of.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/value-of.md new file mode 100644 index 0000000..8136ec8 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/value-of.md @@ -0,0 +1,14 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[DestinationRetention](index.md)/[valueOf](value-of.md) + +# valueOf + +[common]\ +fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationStrategy.DestinationRetention](index.md) + +Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) + +#### Throws + +| | | +|---|---| +| [IllegalArgumentException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html) | if this enum type has no constant with the specified name | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/values.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/values.md new file mode 100644 index 0000000..252fd82 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/values.md @@ -0,0 +1,10 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[DestinationRetention](index.md)/[values](values.md) + +# values + +[common]\ +fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationStrategy.DestinationRetention](index.md)> + +Returns an array containing the constants of this enum type, in the order they're declared. + +This method may be used to iterate over the constants. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md new file mode 100644 index 0000000..844ffc7 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[DuplicateDestination](../index.md)/[ALLOW_DUPLICATES](index.md) + +# ALLOW_DUPLICATES + +[common]\ +[ALLOW_DUPLICATES](index.md) + +When a duplicate [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) is added to a navigation [Stack](../../../../../../navigation-core/com.chrynan.navigation/-stack/index.md), the duplicate item is added on top of the stack. For instance, consider the following stack of items (the first item being the bottom of the stack and the last item being the top of the stack): `[A, B, C, D]`. If we were to add a value of `A` to the top of the stack, it would be considered a duplicate since `A` already exists as the first item in the stack. Adding the value of `A` to this stack using an [ALLOW_DUPLICATES](index.md) strategy would result in the stack looking as follows: `[A, B, C, D, A]`. This has the result of navigating to the item still, allowing duplicates, and without altering the rest of the stack. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-c-l-e-a-r_-t-o_-o-r-i-g-i-n-a-l/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-c-l-e-a-r_-t-o_-o-r-i-g-i-n-a-l/index.md new file mode 100644 index 0000000..a19197b --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-c-l-e-a-r_-t-o_-o-r-i-g-i-n-a-l/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[DuplicateDestination](../index.md)/[CLEAR_TO_ORIGINAL](index.md) + +# CLEAR_TO_ORIGINAL + +[common]\ +[CLEAR_TO_ORIGINAL](index.md) + +When a duplicate [NavigationDestination](../../../index.md#1223765350%2FClasslikes%2F-215881696) is added to a navigation [Stack](../../../../../../navigation-core/com.chrynan.navigation/-stack/index.md), all the items on top of the existing duplicate item in the stack are cleared off. For instance, consider the following stack of items (the first item being the bottom of the stack and the last item being the top of the stack): `[A, B, C, D]`. If we were to add a value of `A` to the top of the stack, it would be considered a duplicate since `A` already exists as the first item in the stack. Adding the value of `A` to this stack using a [CLEAR_TO_ORIGINAL](index.md) strategy would result in the stack looking as follows: `[A]`. All the items are popped off the stack (or "cleared") until the original item. This has the result of navigating to the item still, but altering the stack so that the item is back on top. + +## Properties + +| Name | Summary | +|---|---| +| [name](../../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](../serial-name.md) | [common]
val [serialName](../serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-companion/index.md new file mode 100644 index 0000000..da2795a --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../../index.md)/[com.chrynan.navigation](../../../index.md)/[NavigationStrategy](../../index.md)/[DuplicateDestination](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md new file mode 100644 index 0000000..11a2cbd --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md @@ -0,0 +1,38 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[DuplicateDestination](index.md) + +# DuplicateDestination + +[common]\ +@Serializable + +enum [DuplicateDestination](index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationStrategy.DuplicateDestination](index.md)> + +Represents the approach to take when adding a [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) to a navigation [Stack](../../../../../navigation-core/com.chrynan.navigation/-stack/index.md) and there already exists the same item in the [Stack](../../../../../navigation-core/com.chrynan.navigation/-stack/index.md). + +## Entries + +| | | +|---|---| +| [CLEAR_TO_ORIGINAL](-c-l-e-a-r_-t-o_-o-r-i-g-i-n-a-l/index.md) | [common]
[CLEAR_TO_ORIGINAL](-c-l-e-a-r_-t-o_-o-r-i-g-i-n-a-l/index.md)
When a duplicate [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) is added to a navigation [Stack](../../../../../navigation-core/com.chrynan.navigation/-stack/index.md), all the items on top of the existing duplicate item in the stack are cleared off. For instance, consider the following stack of items (the first item being the bottom of the stack and the last item being the top of the stack): `[A, B, C, D]`. If we were to add a value of `A` to the top of the stack, it would be considered a duplicate since `A` already exists as the first item in the stack. Adding the value of `A` to this stack using a [CLEAR_TO_ORIGINAL](-c-l-e-a-r_-t-o_-o-r-i-g-i-n-a-l/index.md) strategy would result in the stack looking as follows: `[A]`. All the items are popped off the stack (or "cleared") until the original item. This has the result of navigating to the item still, but altering the stack so that the item is back on top. | +| [ALLOW_DUPLICATES](-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md) | [common]
[ALLOW_DUPLICATES](-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md)
When a duplicate [NavigationDestination](../../index.md#1223765350%2FClasslikes%2F-215881696) is added to a navigation [Stack](../../../../../navigation-core/com.chrynan.navigation/-stack/index.md), the duplicate item is added on top of the stack. For instance, consider the following stack of items (the first item being the bottom of the stack and the last item being the top of the stack): `[A, B, C, D]`. If we were to add a value of `A` to the top of the stack, it would be considered a duplicate since `A` already exists as the first item in the stack. Adding the value of `A` to this stack using an [ALLOW_DUPLICATES](-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md) strategy would result in the stack looking as follows: `[A, B, C, D, A]`. This has the result of navigating to the item still, allowing duplicates, and without altering the rest of the stack. | + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Functions + +| Name | Summary | +|---|---| +| [valueOf](value-of.md) | [common]
fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationStrategy.DuplicateDestination](index.md)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) | +| [values](values.md) | [common]
fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationStrategy.DuplicateDestination](index.md)>
Returns an array containing the constants of this enum type, in the order they're declared. | + +## Properties + +| Name | Summary | +|---|---| +| [name](../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../-destination-retention/-c-l-e-a-r/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../-destination-retention/-c-l-e-a-r/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [serialName](serial-name.md) | [common]
val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/serial-name.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/serial-name.md new file mode 100644 index 0000000..6f5924c --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/serial-name.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[DuplicateDestination](index.md)/[serialName](serial-name.md) + +# serialName + +[common]\ +val [serialName](serial-name.md): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/value-of.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/value-of.md new file mode 100644 index 0000000..1c8aca1 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/value-of.md @@ -0,0 +1,14 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[DuplicateDestination](index.md)/[valueOf](value-of.md) + +# valueOf + +[common]\ +fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [NavigationStrategy.DuplicateDestination](index.md) + +Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) + +#### Throws + +| | | +|---|---| +| [IllegalArgumentException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html) | if this enum type has no constant with the specified name | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/values.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/values.md new file mode 100644 index 0000000..6a9fb40 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/values.md @@ -0,0 +1,10 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigationStrategy](../index.md)/[DuplicateDestination](index.md)/[values](values.md) + +# values + +[common]\ +fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[NavigationStrategy.DuplicateDestination](index.md)> + +Returns an array containing the constants of this enum type, in the order they're declared. + +This method may be used to iterate over the constants. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/index.md new file mode 100644 index 0000000..5dd40bf --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/index.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationStrategy](index.md) + +# NavigationStrategy + +[common]\ +interface [NavigationStrategy](index.md) + +A component that encapsulates the various navigation policies for a [Navigator](../-navigator/index.md). + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | +| [DestinationRetention](-destination-retention/index.md) | [common]
@Serializable
enum [DestinationRetention](-destination-retention/index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationStrategy.DestinationRetention](-destination-retention/index.md)>
Represents the approach for retaining the [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) data structures associated with a particular [NavigationContext](../-navigation-context/index.md), when navigating to other [NavigationContext](../-navigation-context/index.md)s. A [RETAIN](-destination-retention/-r-e-t-a-i-n/index.md) value indicates that the [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) data structure associated with a [NavigationContext](../-navigation-context/index.md) should be kept when navigation to a different [NavigationContext](../-navigation-context/index.md), so that the state can be restored when navigating back. A [CLEAR](-destination-retention/-c-l-e-a-r/index.md) value indicates that the [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) data structure associated with a [NavigationContext](../-navigation-context/index.md) should be cleared before navigating to a different [NavigationContext](../-navigation-context/index.md), so that the [NavigationContext.initialDestination](../-navigation-context/initial-destination.md) value will be displayed when navigating back. | +| [DuplicateDestination](-duplicate-destination/index.md) | [common]
@Serializable
enum [DuplicateDestination](-duplicate-destination/index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[NavigationStrategy.DuplicateDestination](-duplicate-destination/index.md)>
Represents the approach to take when adding a [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) to a navigation [Stack](../../../../navigation-core/com.chrynan.navigation/-stack/index.md) and there already exists the same item in the [Stack](../../../../navigation-core/com.chrynan.navigation/-stack/index.md). | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-view-model/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-view-model/index.md new file mode 100644 index 0000000..3906708 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigation-view-model/index.md @@ -0,0 +1,20 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigationViewModel](index.md) + +# NavigationViewModel + +[common]\ +expect abstract class [NavigationViewModel](index.md) + +Represents a "ViewModel" component used for navigation purposes. This component should not be used outside this navigation library. + +[android]\ +actual abstract class [NavigationViewModel](index.md) : [ViewModel](https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModel.html) + +[js, jvm, native]\ +actual abstract class [NavigationViewModel](index.md) + +## Functions + +| Name | Summary | +|---|---| +| [addCloseable](index.md#264516373%2FFunctions%2F2082272698) | [android]
open fun [addCloseable](index.md#264516373%2FFunctions%2F2082272698)(@[NonNull](https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html)p0: [Closeable](https://developer.android.com/reference/kotlin/java/io/Closeable.html)) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/-companion/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/-companion/index.md new file mode 100644 index 0000000..59e24b8 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/-companion/index.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../../index.md)/[com.chrynan.navigation](../../index.md)/[NavigatorState](../index.md)/[Companion](index.md) + +# Companion + +[common]\ +object [Companion](index.md) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/index.md new file mode 100644 index 0000000..f437c8e --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/index.md @@ -0,0 +1,32 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigatorState](index.md) + +# NavigatorState + +[common]\ +interface [NavigatorState](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>> : [NavigationDestinationState](../-navigation-destination-state/index.md)<[Destination](index.md)> , [NavigationContextState](../-navigation-context-state/index.md)<[Destination](index.md), [Context](index.md)> + +Represents the state of a [Navigator](../-navigator/index.md), including providing the currently displayed [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) and [NavigationContext](../-navigation-context/index.md) values. + +## Types + +| Name | Summary | +|---|---| +| [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | + +## Properties + +| Name | Summary | +|---|---| +| [contextChanges](../-navigation-context-state/context-changes.md) | [common]
abstract val [contextChanges](../-navigation-context-state/context-changes.md): Flow<[Context](index.md)> | +| [currentContext](../-navigation-context-state/current-context.md) | [common]
abstract val [currentContext](../-navigation-context-state/current-context.md): [Context](index.md) | +| [currentDestination](../-navigation-destination-state/current-destination.md) | [common]
abstract val [currentDestination](../-navigation-destination-state/current-destination.md): [Destination](index.md) | +| [destinationChanges](../-navigation-destination-state/destination-changes.md) | [common]
abstract val [destinationChanges](../-navigation-destination-state/destination-changes.md): Flow<[Destination](index.md)> | +| [initialContext](../-navigation-context-state/initial-context.md) | [common]
abstract val [initialContext](../-navigation-context-state/initial-context.md): [Context](index.md) | +| [initialDestination](../-navigation-destination-state/initial-destination.md) | [common]
abstract val [initialDestination](../-navigation-destination-state/initial-destination.md): [Destination](index.md) | +| [isInitialized](is-initialized.md) | [common]
abstract val [isInitialized](is-initialized.md): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Determines whether this component is currently initialized, typically meaning that it is ready for use. | + +## Inheritors + +| Name | +|---| +| [BaseNavigatorStateImpl](../-base-navigator-state-impl/index.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/is-initialized.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/is-initialized.md new file mode 100644 index 0000000..bfdbbb6 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator-state/is-initialized.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[NavigatorState](index.md)/[isInitialized](is-initialized.md) + +# isInitialized + +[common]\ +abstract val [isInitialized](is-initialized.md): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Determines whether this component is currently initialized, typically meaning that it is ready for use. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator.md new file mode 100644 index 0000000..526ae42 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator.md @@ -0,0 +1,39 @@ +//[navigation-core](../../index.md)/[com.chrynan.navigation](index.md)/[Navigator](-navigator.md) + +# Navigator + +[common]\ + +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](-navigator.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](-navigator.md) : [NavigationContext](-navigation-context/index.md)<[Destination](-navigator.md)>> [Navigator](-navigator.md)(initialContext: [Context](-navigator.md), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](-navigator/index.md)<[Destination](-navigator.md), [Context](-navigator.md)> + +Creates a [Navigator](-navigator/index.md) instance with the provided values. + +#### Parameters + +common + +| | | +|---|---| +| initialContext | The initial [NavigationContext](-navigation-context/index.md) value to start at for this [Navigator](-navigator/index.md). | +| duplicateDestinationStrategy | The [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) strategy for handling of duplicate destination content within a [Context](-navigator.md) stack. Read the documentation on [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES](-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md). | +| destinationRetentionStrategy | The [NavigationStrategy.DestinationRetention](-navigation-strategy/-destination-retention/index.md) strategy for handling of destination stacks within a [Context](-navigator.md) when navigating between different [NavigationContext](-navigation-context/index.md)s. Read the documentation on [NavigationStrategy.DestinationRetention](-navigation-strategy/-destination-retention/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DestinationRetention.RETAIN](-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md). | + +[common]\ + +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](-navigator.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696)> [Navigator](-navigator.md)(initialDestination: [Destination](-navigator.md), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](-navigator/index.md)<[Destination](-navigator.md), [SingleNavigationContext](-single-navigation-context/index.md)<[Destination](-navigator.md)>> + +Creates a [Navigator](-navigator/index.md) instance with the provided values using the [SingleNavigationContext](-single-navigation-context/index.md). + +#### Parameters + +common + +| | | +|---|---| +| initialDestination | The initial [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696) value to start at for this [Navigator](-navigator/index.md). | +| duplicateDestinationStrategy | The [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) strategy for handling of duplicate destination content within a [NavigationContext](-navigation-context/index.md) stack. Read the documentation on [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES](-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md). | +| destinationRetentionStrategy | The [NavigationStrategy.DestinationRetention](-navigation-strategy/-destination-retention/index.md) strategy for handling of destination stacks within a [NavigationContext](-navigation-context/index.md) when navigating between different [NavigationContext](-navigation-context/index.md)s. Read the documentation on [NavigationStrategy.DestinationRetention](-navigation-strategy/-destination-retention/index.md) for more information about the supported operations. Defaults to [NavigationStrategy.DestinationRetention.RETAIN](-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md). | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-go-back.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-go-back.md new file mode 100644 index 0000000..78fdef9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-go-back.md @@ -0,0 +1,12 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[canGoBack](can-go-back.md) + +# canGoBack + +[common]\ +abstract fun [canGoBack](can-go-back.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Determines whether this [Navigator](index.md) can navigate back. + +#### Return + +`true` if this [Navigator](index.md) can navigate back, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-pop-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-pop-context.md new file mode 100644 index 0000000..1e55cdb --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-pop-context.md @@ -0,0 +1,12 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[canPopContext](can-pop-context.md) + +# canPopContext + +[common]\ +abstract fun [canPopContext](can-pop-context.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Determines whether this [Navigator](index.md) can navigate back to a previous context. + +#### Return + +`true` if this [Navigator](index.md) can navigate back to a previous context, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-pop-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-pop-destination.md new file mode 100644 index 0000000..fef14f1 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-pop-destination.md @@ -0,0 +1,12 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[canPopDestination](can-pop-destination.md) + +# canPopDestination + +[common]\ +abstract fun [canPopDestination](can-pop-destination.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Determines whether this [Navigator](index.md) can navigate back to a previous destination in the current context. + +#### Return + +`true` if this [Navigator](index.md) can navigate back to a previous destination in the current context, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/change-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/change-context.md new file mode 100644 index 0000000..121bd6c --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/change-context.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[changeContext](change-context.md) + +# changeContext + +[common]\ +abstract fun [changeContext](change-context.md)(context: [Context](index.md)) + +Changes the current [Context](index.md) to the provided [context](change-context.md) value. The displayed [Destination](index.md) will top destination value in the stack associated with the provided [context](change-context.md), or the provided context's [NavigationContext.initialDestination](../-navigation-context/initial-destination.md) if there is currently no existing stack for the provided [context](change-context.md). + +#### Parameters + +common + +| | | +|---|---| +| context | The [NavigationContext](../-navigation-context/index.md) to change to. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/dispatch.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/dispatch.md new file mode 100644 index 0000000..da0043f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/dispatch.md @@ -0,0 +1,22 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[dispatch](dispatch.md) + +# dispatch + +[common]\ +abstract fun [dispatch](dispatch.md)(event: [NavigationEvent](../-navigation-event/index.md)<[Destination](index.md), [Context](index.md)>): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Dispatches the provided navigation [event](dispatch.md) which mutates the underlying state values if the navigation event can be performed. + +!Note The creation of [NavigationEvent](../-navigation-event/index.md)s is handled internally within this library's components, therefore, instead of invoking this function explicitly, use the [popDestination](../pop-destination.md), [push](../push.md), and [push](../push.md) functions. + +#### Return + +`true` if the navigation event was handled, or `false` if the event could not be handled (ex: a back navigation event was provided but there are no destinations to go back to). If `false` is returned, the underlying state values were not mutated. + +#### Parameters + +common + +| | | +|---|---| +| event | The [NavigationEvent](../-navigation-event/index.md) that represents the navigation action to be performed. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-back.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-back.md new file mode 100644 index 0000000..78ba739 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-back.md @@ -0,0 +1,12 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[goBack](go-back.md) + +# goBack + +[common]\ +abstract fun [goBack](go-back.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Performs a back navigation operation by removing the top destination from the stack in the current [Context](index.md) and displaying the next destination in the list. If this [Navigator](index.md) cannot navigate back, then this function will do nothing. + +#### Return + +`true` if the back navigation operation was successful, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-to.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-to.md new file mode 100644 index 0000000..8b063a7 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-to.md @@ -0,0 +1,17 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[goTo](go-to.md) + +# goTo + +[common]\ +abstract fun [goTo](go-to.md)(destination: [Destination](index.md), strategy: [StackDuplicateContentStrategy](../-stack-duplicate-content-strategy/index.md)) + +Goes to the provided [destination](go-to.md) using the provided stack duplicate content [strategy](go-to.md). Depending on the provided [strategy](go-to.md) and the current [Context](index.md) stack, this will either clear the current [Context](index.md) stack to the last value that equals the provided [destination](go-to.md), or add the provided [destination](go-to.md) to the top of the current [Context](index.md) stack. + +#### Parameters + +common + +| | | +|---|---| +| destination | The [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) that is to be navigated to and added to the current [Context](index.md) stack. | +| strategy | The [StackDuplicateContentStrategy](../-stack-duplicate-content-strategy/index.md) defining what to do when there are duplicate [Destination](index.md) values within the current [Context](index.md) stack. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-up.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-up.md new file mode 100644 index 0000000..69d006e --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/go-up.md @@ -0,0 +1,10 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[goUp](go-up.md) + +# goUp + +[common]\ +open fun [goUp](go-up.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Performs an "up" navigation. An "up" navigation is similar to a "back" navigation but may be slightly different. For instance, on Android, the "left arrow" button in the toolbar component of an application, performs the "up" operation, which is slightly different from the phones back button which performs a "back" operation. + +Currently, this defaults to the same operation as the [goBack](go-back.md) function. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md index 5e2d331..9aa7822 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md @@ -2,12 +2,39 @@ # Navigator -[common]\ -interface [Navigator](index.md) +@[ExperimentalNavigationApi](../-experimental-navigation-api/index.md) -A [Navigator](index.md) is responsible for changing and showing the different Screens in the application. +@Serializable(with = [NavigatorSerializer::class](../../../../navigation-core/com.chrynan.navigation/-navigator-serializer/index.md)) -A [Navigator](index.md) is platform and UI framework dependent, so each implementation depends on the particular UI framework used, for example, Jetpack Compose. +interface [Navigator](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](index.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)>> + +A [Navigator](index.md) is responsible for coordinating the navigation between the different UI component groupings in an application. It is a stateful component that reacts to [NavigationEvent](../-navigation-event/index.md)s that are emitted via calls to the navigation functions ([push](../push.md), [popDestination](../pop-destination.md), and [push](../push.md)) and updates its stored state values which can be accessed via its state [store](store.md). It is up to the user of a [Navigator](index.md) to subscribe to the state changes of this component and update the associated UI accordingly. + +## Example usage: + +```kotlin +// Create a Navigator instance. +val navigator = Navigator(initialContext = mainAppContext) + +// Listen to destination changes and update the UI accordingly. +navigator.store.destination.changes + .onEach { destination -> + // Update the UI + } + .launchIn(coroutineScope) + +// Perform navigation to different destinations. +navigator.goTo(destination = Destinations.HOME) +``` + +#### See also + +| | | +|---|---| +| [Navigator](index.md) | The [Navigator](index.md) constructor function for creating an instance of this interface. | +| [push](../push.md) | For navigating to a different [NavigationContext](../-navigation-context/index.md). | +| [popDestination](../pop-destination.md) | For navigating backward to the previous [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../-navigation-context/index.md). | +| [popContext](../pop-context.md) | For navigating backward to the previous [NavigationContext](../-navigation-context/index.md). | ## Types @@ -15,9 +42,22 @@ A [Navigator](index.md) is platform and UI framework dependent, so each implemen |---|---| | [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | -## Inheritors +## Functions + +| Name | Summary | +|---|---| +| [canPopContext](can-pop-context.md) | [common]
abstract fun [canPopContext](can-pop-context.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Determines whether this [Navigator](index.md) can navigate back to a previous context. | +| [canPopDestination](can-pop-destination.md) | [common]
abstract fun [canPopDestination](can-pop-destination.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Determines whether this [Navigator](index.md) can navigate back to a previous destination in the current context. | +| [changeContext](../change-context.md) | [common]
@[ExperimentalNavigationApi](../-experimental-navigation-api/index.md)
fun <[Destination](../change-context.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](../change-context.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](../change-context.md)>> [Navigator](index.md)<[Destination](../change-context.md), [Context](../change-context.md)>.[~~changeContext~~](../change-context.md)(context: [Context](../change-context.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Convenience function for the [Navigator.push](../push.md) function. | +| [dispatch](dispatch.md) | [common]
abstract fun [dispatch](dispatch.md)(event: [NavigationEvent](../-navigation-event/index.md)<[Destination](index.md), [Context](index.md)>): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Dispatches the provided navigation [event](dispatch.md) which mutates the underlying state values if the navigation event can be performed. | +| [goTo](../go-to.md) | [common]
@[ExperimentalNavigationApi](../-experimental-navigation-api/index.md)
fun <[Destination](../go-to.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](../go-to.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](../go-to.md)>> [Navigator](index.md)<[Destination](../go-to.md), [Context](../go-to.md)>.[~~goTo~~](../go-to.md)(destination: [Destination](../go-to.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Convenience function for the [Navigator.push](../push.md) function. | +| [popContext](../pop-context.md) | [common]
@[ExperimentalNavigationApi](../-experimental-navigation-api/index.md)
fun <[Destination](../pop-context.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](../pop-context.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](../pop-context.md)>> [Navigator](index.md)<[Destination](../pop-context.md), [Context](../pop-context.md)>.[popContext](../pop-context.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Performs a back navigation operation, if possible, by moving to the previous [NavigationContext](../-navigation-context/index.md). If this [Navigator](index.md) cannot navigate to a previous [NavigationContext](../-navigation-context/index.md), then this function will do nothing and return `false`. | +| [popDestination](../pop-destination.md) | [common]
@[ExperimentalNavigationApi](../-experimental-navigation-api/index.md)
fun <[Destination](../pop-destination.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](../pop-destination.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](../pop-destination.md)>> [Navigator](index.md)<[Destination](../pop-destination.md), [Context](../pop-destination.md)>.[popDestination](../pop-destination.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Performs a back navigation operation, if possible, by removing the top [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](../-navigation-context/index.md). If this [Navigator](index.md) cannot navigate to a previous [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), then this function will do nothing and return `false`. | +| [push](../push.md) | [common]
@[ExperimentalNavigationApi](../-experimental-navigation-api/index.md)
fun <[Destination](../push.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](../push.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](../push.md)>> [Navigator](index.md)<[Destination](../push.md), [Context](../push.md)>.[push](../push.md)(context: [Context](../push.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Changes the current [Context](../push.md) to the provided [context](../push.md) value. The displayed [Destination](../push.md) will be the top destination value in the stack associated with the provided [context](../push.md), or the provided context's [NavigationContext.initialDestination](../-navigation-context/initial-destination.md) if there is currently no existing stack for the provided [context](../push.md).
[common]
@[ExperimentalNavigationApi](../-experimental-navigation-api/index.md)
fun <[Destination](../push.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696), [Context](../push.md) : [NavigationContext](../-navigation-context/index.md)<[Destination](../push.md)>> [Navigator](index.md)<[Destination](../push.md), [Context](../push.md)>.[push](../push.md)(destination: [Destination](../push.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Navigates to the provided [destination](../push.md) in the current [NavigationContext](../-navigation-context/index.md). Depending on the provided [NavigationStrategy.DuplicateDestination](../-navigation-strategy/-duplicate-destination/index.md) when creating this [Navigator](index.md), and the current [Context](../push.md) stack, this will either clear the current [Context](../push.md) stack to the last value that equals the provided [destination](../push.md), or add the provided [destination](../push.md) to the top of the current [Context](../push.md) stack. | +| [reset](reset.md) | [common]
abstract fun [reset](reset.md)()
Resets this [Navigator](index.md) back to its initial state. | + +## Properties -| Name | -|---| -| [NavigationEventNavigator](../-navigation-event-navigator/index.md) | -| [StackNavigator](../-stack-navigator/index.md) | +| Name | Summary | +|---|---| +| [store](store.md) | [common]
abstract val [store](store.md): [NavigationStateStore](../-navigation-state-store/index.md)<[Destination](index.md), [Context](index.md)>
The [NavigationStateStore](../-navigation-state-store/index.md) containing the latest [NavigationState](../-navigation-state/index.md)s for each navigation value. This is useful to get the initial, current, or subscribe to the changes in value of the different navigation components. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/navigate.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/navigate.md new file mode 100644 index 0000000..96a0ae9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/navigate.md @@ -0,0 +1,16 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[navigate](navigate.md) + +# navigate + +[common]\ +open fun [navigate](navigate.md)(event: [NavigationEvent](../-navigation-event/index.md)<[Destination](index.md)>) + +Navigates to the provided [event](navigate.md). Currently, this default implementation delegates to the appropriate [goBack](go-back.md), [goUp](go-up.md), and [goTo](go-to.md) function depending on the provided [event](navigate.md) value. + +#### Parameters + +common + +| | | +|---|---| +| event | The [NavigationEvent](../-navigation-event/index.md) that represents the navigation action to be performed. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/reset.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/reset.md new file mode 100644 index 0000000..04b83e5 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/reset.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[reset](reset.md) + +# reset + +[common]\ +abstract fun [reset](reset.md)() + +Resets this [Navigator](index.md) back to its initial state. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/state.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/state.md new file mode 100644 index 0000000..72fa323 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/state.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[state](state.md) + +# state + +[common]\ +abstract val [state](state.md): [NavigatorState](../-navigator-state/index.md)<[Destination](index.md), [Context](index.md)> + +The [NavigatorState](../-navigator-state/index.md) for this [Navigator](index.md) instance. This can be used to subscribe to destination or context changes, or get the current state values. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/store.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/store.md new file mode 100644 index 0000000..8a4cc41 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-navigator/store.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[Navigator](index.md)/[store](store.md) + +# store + +[common]\ +abstract val [store](store.md): [NavigationStateStore](../-navigation-state-store/index.md)<[Destination](index.md), [Context](index.md)> + +The [NavigationStateStore](../-navigation-state-store/index.md) containing the latest [NavigationState](../-navigation-state/index.md)s for each navigation value. This is useful to get the initial, current, or subscribe to the changes in value of the different navigation components. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/-single-navigation-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/-single-navigation-context.md new file mode 100644 index 0000000..d49344c --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/-single-navigation-context.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[SingleNavigationContext](index.md)/[SingleNavigationContext](-single-navigation-context.md) + +# SingleNavigationContext + +[common]\ +fun <[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696)> [SingleNavigationContext](-single-navigation-context.md)(initialDestination: [Destination](index.md)) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/equals.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/equals.md new file mode 100644 index 0000000..9528df8 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/equals.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[SingleNavigationContext](index.md)/[equals](equals.md) + +# equals + +[common]\ +open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/hash-code.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/hash-code.md new file mode 100644 index 0000000..ee85db9 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/hash-code.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[SingleNavigationContext](index.md)/[hashCode](hash-code.md) + +# hashCode + +[common]\ +open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md new file mode 100644 index 0000000..1cbee81 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md @@ -0,0 +1,32 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[SingleNavigationContext](index.md) + +# SingleNavigationContext + +[common]\ +@Serializable + +class [SingleNavigationContext](index.md)<[Destination](index.md) : [NavigationDestination](../index.md#1223765350%2FClasslikes%2F-215881696)> : [NavigationContext](../-navigation-context/index.md)<[Destination](index.md)> + +An implementation of the [NavigationContext](../-navigation-context/index.md) interface that doesn't have multiple contexts. Typically, a [NavigationContext](../-navigation-context/index.md) will either be a sealed class or an enum representing the different contexts for navigation. This is common, for instance, for a UI with a bottom navigation bar, where each navigation item in that bottom navigation bar component would be a different context. Each context would retain its own stack of destinations in the [Navigator](../-navigator/index.md). However, sometimes it may be preferable to have only a single context for navigation, and in this case, this class can be used. + +**Note:** That this class has an internal constructor and therefore can only be constructed from within this library. This is by design to prevent providing numerous instances of the [SingleNavigationContext](index.md) in the [Navigator.push](../push.md) function. + +Example usage: + +```kotlin +SingleNavigationContext(initialDestination = "Home") +``` + +## Functions + +| Name | Summary | +|---|---| +| [equals](equals.md) | [common]
open operator override fun [equals](equals.md)(other: [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | +| [hashCode](hash-code.md) | [common]
open override fun [hashCode](hash-code.md)(): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [toString](to-string.md) | [common]
open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | + +## Properties + +| Name | Summary | +|---|---| +| [initialDestination](initial-destination.md) | [common]
open override val [initialDestination](initial-destination.md): [Destination](index.md)
The initial key value that should be displayed when first changing to this [NavigationContext](../-navigation-context/index.md) before any other navigation was performed. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/initial-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/initial-destination.md new file mode 100644 index 0000000..b57e5df --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/initial-destination.md @@ -0,0 +1,8 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[SingleNavigationContext](index.md)/[initialDestination](initial-destination.md) + +# initialDestination + +[common]\ +open override val [initialDestination](initial-destination.md): [Destination](index.md) + +The initial key value that should be displayed when first changing to this [NavigationContext](../-navigation-context/index.md) before any other navigation was performed. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/to-string.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/to-string.md new file mode 100644 index 0000000..aa48d3f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/to-string.md @@ -0,0 +1,6 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[SingleNavigationContext](index.md)/[toString](to-string.md) + +# toString + +[common]\ +open override fun [toString](to-string.md)(): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-a-d-d_-t-o_-s-t-a-c-k/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-a-d-d_-t-o_-s-t-a-c-k/index.md index 742c787..4d61422 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-a-d-d_-t-o_-s-t-a-c-k/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-a-d-d_-t-o_-s-t-a-c-k/index.md @@ -3,11 +3,11 @@ # ADD_TO_STACK [common]\ -[ADD_TO_STACK](index.md)() +[ADD_TO_STACK](index.md) ## Properties | Name | Summary | |---|---| -| [name](../-c-l-e-a-r_-s-t-a-c-k/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../-c-l-e-a-r_-s-t-a-c-k/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | -| [ordinal](../-c-l-e-a-r_-s-t-a-c-k/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../-c-l-e-a-r_-s-t-a-c-k/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [name](index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-c-l-e-a-r_-s-t-a-c-k/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-c-l-e-a-r_-s-t-a-c-k/index.md index d1b59c0..08d3a8c 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-c-l-e-a-r_-s-t-a-c-k/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-c-l-e-a-r_-s-t-a-c-k/index.md @@ -3,11 +3,11 @@ # CLEAR_STACK [common]\ -[CLEAR_STACK](index.md)() +[CLEAR_STACK](index.md) ## Properties | Name | Summary | |---|---| -| [name](index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | -| [ordinal](index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [name](../-a-d-d_-t-o_-s-t-a-c-k/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](../-a-d-d_-t-o_-s-t-a-c-k/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](../-a-d-d_-t-o_-s-t-a-c-k/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](../-a-d-d_-t-o_-s-t-a-c-k/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/index.md index 6168754..fad0d02 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/index.md @@ -9,8 +9,8 @@ enum [StackDuplicateContentStrategy](index.md) : [Enum](https://kotlinlang.org/a | | | |---|---| -| [ADD_TO_STACK](-a-d-d_-t-o_-s-t-a-c-k/index.md) | [common]
[ADD_TO_STACK](-a-d-d_-t-o_-s-t-a-c-k/index.md)() | -| [CLEAR_STACK](-c-l-e-a-r_-s-t-a-c-k/index.md) | [common]
[CLEAR_STACK](-c-l-e-a-r_-s-t-a-c-k/index.md)() | +| [CLEAR_STACK](-c-l-e-a-r_-s-t-a-c-k/index.md) | [common]
[CLEAR_STACK](-c-l-e-a-r_-s-t-a-c-k/index.md) | +| [ADD_TO_STACK](-a-d-d_-t-o_-s-t-a-c-k/index.md) | [common]
[ADD_TO_STACK](-a-d-d_-t-o_-s-t-a-c-k/index.md) | ## Types @@ -18,9 +18,16 @@ enum [StackDuplicateContentStrategy](index.md) : [Enum](https://kotlinlang.org/a |---|---| | [Companion](-companion/index.md) | [common]
object [Companion](-companion/index.md) | +## Functions + +| Name | Summary | +|---|---| +| [valueOf](value-of.md) | [common]
fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [StackDuplicateContentStrategy](index.md)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) | +| [values](values.md) | [common]
fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[StackDuplicateContentStrategy](index.md)>
Returns an array containing the constants of this enum type, in the order they're declared. | + ## Properties | Name | Summary | |---|---| -| [name](-c-l-e-a-r_-s-t-a-c-k/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](-c-l-e-a-r_-s-t-a-c-k/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | -| [ordinal](-c-l-e-a-r_-s-t-a-c-k/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](-c-l-e-a-r_-s-t-a-c-k/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | +| [name](-a-d-d_-t-o_-s-t-a-c-k/index.md#-372974862%2FProperties%2F-215881696) | [common]
val [name](-a-d-d_-t-o_-s-t-a-c-k/index.md#-372974862%2FProperties%2F-215881696): [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | +| [ordinal](-a-d-d_-t-o_-s-t-a-c-k/index.md#-739389684%2FProperties%2F-215881696) | [common]
val [ordinal](-a-d-d_-t-o_-s-t-a-c-k/index.md#-739389684%2FProperties%2F-215881696): [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/value-of.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/value-of.md new file mode 100644 index 0000000..b79af0f --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/value-of.md @@ -0,0 +1,14 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[StackDuplicateContentStrategy](index.md)/[valueOf](value-of.md) + +# valueOf + +[common]\ +fun [valueOf](value-of.md)(value: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)): [StackDuplicateContentStrategy](index.md) + +Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.) + +#### Throws + +| | | +|---|---| +| [IllegalArgumentException](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-illegal-argument-exception/index.html) | if this enum type has no constant with the specified name | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/values.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/values.md new file mode 100644 index 0000000..cde3fb0 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/values.md @@ -0,0 +1,10 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[StackDuplicateContentStrategy](index.md)/[values](values.md) + +# values + +[common]\ +fun [values](values.md)(): [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[StackDuplicateContentStrategy](index.md)> + +Returns an array containing the constants of this enum type, in the order they're declared. + +This method may be used to iterate over the constants. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/-view-model/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/-view-model/index.md new file mode 100644 index 0000000..7310a9d --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/-view-model/index.md @@ -0,0 +1,24 @@ +//[navigation-core](../../../index.md)/[com.chrynan.navigation](../index.md)/[ViewModel](index.md) + +# ViewModel + +[common]\ +expect abstract class [ViewModel](index.md) + +[android]\ +actual abstract class [ViewModel](index.md) : [ViewModel](https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModel.html) + +[js, jvm]\ +actual abstract class [ViewModel](index.md) + +## Functions + +| Name | Summary | +|---|---| +| [addCloseable](index.md#264516373%2FFunctions%2F2082272698) | [android]
open fun [addCloseable](index.md#264516373%2FFunctions%2F2082272698)(@[NonNull](https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html)p0: [Closeable](https://developer.android.com/reference/kotlin/java/io/Closeable.html)) | + +## Inheritors + +| Name | +|---| +| [BaseNavigatorImpl](../-base-navigator-impl/index.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/change-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/change-context.md new file mode 100644 index 0000000..0155bdd --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/change-context.md @@ -0,0 +1,30 @@ +//[navigation-core](../../index.md)/[com.chrynan.navigation](index.md)/[changeContext](change-context.md) + +# changeContext + +[common]\ + +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](change-context.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](change-context.md) : [NavigationContext](-navigation-context/index.md)<[Destination](change-context.md)>> [Navigator](-navigator/index.md)<[Destination](change-context.md), [Context](change-context.md)>.[~~changeContext~~](change-context.md)(context: [Context](change-context.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +--- + +### Deprecated + +#### Replace with + +```kotlin +com.chrynan.navigation.Navigator.push +``` +--- + +Convenience function for the [Navigator.push](push.md) function. + +!Warning This function is deprecated and will be replaced with the [Navigator.push](push.md) function. + +#### See also + +| | +|---| +| [push](push.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/go-back.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/go-back.md index 743bfcf..b72a092 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/go-back.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/go-back.md @@ -3,6 +3,13 @@ # goBack [common]\ -fun <[I](go-back.md) : [NavigationIntent](-navigation-intent/index.md)> [NavigationEventNavigator](-navigation-event-navigator/index.md)<[I](go-back.md)>.[goBack](go-back.md)() -A convenience function for calling [NavigationEventNavigator.navigate](-navigation-event-navigator/navigate.md) with [NavigationEvent.Back](-navigation-event/-back/index.md). +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](go-back.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](go-back.md) : [NavigationContext](-navigation-context/index.md)<[Destination](go-back.md)>> [Navigator](-navigator/index.md)<[Destination](go-back.md), [Context](go-back.md)>.[goBack](go-back.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Performs a back navigation operation, if possible, by removing the top [NavigationEvent.Forward](-navigation-event/-forward/index.md) event from the internal navigation stack. If this [Navigator](-navigator/index.md) cannot navigate back, then this function will do nothing and return `false`. + +#### Return + +`true` if the back navigation operation was successful, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/go-to.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/go-to.md index 45ef511..47200fc 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/go-to.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/go-to.md @@ -3,6 +3,28 @@ # goTo [common]\ -fun <[NavigationValue](go-to.md)> [NavigationEventNavigator](-navigation-event-navigator/index.md)<[NavigationValue](go-to.md)>.[goTo](go-to.md)(intent: [NavigationValue](go-to.md)) -A convenience function for calling [NavigationEventNavigator.navigate](-navigation-event-navigator/navigate.md) with [NavigationEvent.To](-navigation-event/-to/index.md). +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](go-to.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](go-to.md) : [NavigationContext](-navigation-context/index.md)<[Destination](go-to.md)>> [Navigator](-navigator/index.md)<[Destination](go-to.md), [Context](go-to.md)>.[~~goTo~~](go-to.md)(destination: [Destination](go-to.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +--- + +### Deprecated + +#### Replace with + +```kotlin +com.chrynan.navigation.Navigator.push +``` +--- + +Convenience function for the [Navigator.push](push.md) function. + +!Warning This function is deprecated and will be replaced with the [Navigator.push](push.md) function. + +#### See also + +| | +|---| +| [push](push.md) | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/index.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/index.md index 6da8cfa..b252456 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/index.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/index.md @@ -1,30 +1,30 @@ //[navigation-core](../../index.md)/[com.chrynan.navigation](index.md) -# Package com.chrynan.navigation +# Package-level declarations ## Types | Name | Summary | |---|---| -| [AndroidNavigationHandler](-android-navigation-handler/index.md) | [android]
interface [AndroidNavigationHandler](-android-navigation-handler/index.md)<[Intent](-android-navigation-handler/index.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> : [NavigationEventHandler](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/index.md)<[Intent](-android-navigation-handler/index.md), [AndroidNavigationScope](-android-navigation-scope/index.md)>
A [NavigationHandler](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-handler/index.md) used on the Android platform that uses an [AndroidNavigationScope](-android-navigation-scope/index.md). | -| [AndroidNavigationScope](-android-navigation-scope/index.md) | [android]
interface [AndroidNavigationScope](-android-navigation-scope/index.md) : [NavigationScope](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-scope/index.md)
A [NavigationScope](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-scope/index.md) used on the Android platform that has access to a parent [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html) that can be used to change Activities or Fragments. | +| [DestinationAndContext](-destination-and-context/index.md) | [common]
@Serializable
class [DestinationAndContext](-destination-and-context/index.md)<[Destination](-destination-and-context/index.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](-destination-and-context/index.md) : [NavigationContext](-navigation-context/index.md)<[Destination](-destination-and-context/index.md)>>(val destination: [Destination](-destination-and-context/index.md), val context: [Context](-destination-and-context/index.md))
A wrapper class around a [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696) and an associated [NavigationContext](-navigation-context/index.md). | | [ExperimentalNavigationApi](-experimental-navigation-api/index.md) | [common]
@[Target](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-target/index.html)(allowedTargets = [[AnnotationTarget.CLASS](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-annotation-target/-c-l-a-s-s/index.html), [AnnotationTarget.FUNCTION](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-annotation-target/-f-u-n-c-t-i-o-n/index.html), [AnnotationTarget.FIELD](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-annotation-target/-f-i-e-l-d/index.html), [AnnotationTarget.PROPERTY](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.annotation/-annotation-target/-p-r-o-p-e-r-t-y/index.html)])
annotation class [ExperimentalNavigationApi](-experimental-navigation-api/index.md)
Indicates that the component annotated with this annotation is experimental and could change or be removed in the future. | -| [NavigationContext](-navigation-context/index.md) | [common]
interface [NavigationContext](-navigation-context/index.md)<[Key](-navigation-context/index.md)>
Represents a navigation context, or a container of a back stack of [Key](-navigation-context/index.md)s. Navigation can take place within a [NavigationContext](-navigation-context/index.md) typically by changing [Key](-navigation-context/index.md) values. But an application may have multiple [NavigationContext](-navigation-context/index.md)s that can be changed and navigated through. This allows for more complex navigation paradigms, such as retaining multiple back stacks for a bottom navigation UI component. | -| [NavigationEvent](-navigation-event/index.md) | [common]
sealed class [NavigationEvent](-navigation-event/index.md)<[NavigationValue](-navigation-event/index.md)>
An event that is sent to a [Navigator](-navigator/index.md) to coordinate the navigation between screens. | -| [NavigationEventHandler](-navigation-event-handler/index.md) | [common]
interface [NavigationEventHandler](-navigation-event-handler/index.md)<[NavigationValue](-navigation-event-handler/index.md), [Scope](-navigation-event-handler/index.md) : [NavigationScope](-navigation-scope/index.md)> : [NavigationHandler](-navigation-handler/index.md)<[NavigationEvent](-navigation-event/index.md)<[NavigationValue](-navigation-event-handler/index.md)>, [Scope](-navigation-event-handler/index.md)> , [StackNavigationHandler](-stack-navigation-handler/index.md)<[NavigationEvent](-navigation-event/index.md)<[NavigationValue](-navigation-event-handler/index.md)>, [Scope](-navigation-event-handler/index.md)>
A [NavigationHandler](-navigation-handler/index.md) that provides distinct functions for each of the possible [NavigationEvent](-navigation-event/index.md)s. | -| [NavigationEventNavigator](-navigation-event-navigator/index.md) | [common]
interface [NavigationEventNavigator](-navigation-event-navigator/index.md)<[NavigationValue](-navigation-event-navigator/index.md)> : [Navigator](-navigator/index.md), [StackNavigator](-stack-navigator/index.md)
A [Navigator](-navigator/index.md) that navigates using [NavigationEvent](-navigation-event/index.md)s. This is typically the base [Navigator](-navigator/index.md) but not every UI framework can use it, such as Jetpack Compose, so it is separate from the [Navigator](-navigator/index.md) interface. | -| [NavigationHandler](-navigation-handler/index.md) | [common]
fun interface [NavigationHandler](-navigation-handler/index.md)<[NavigationValue](-navigation-handler/index.md) : [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html), [Scope](-navigation-handler/index.md) : [NavigationScope](-navigation-scope/index.md)>
Handles the navigation from a [Navigator](-navigator/index.md). | -| [NavigationIntent](-navigation-intent/index.md) | [common]
interface [NavigationIntent](-navigation-intent/index.md)
Represents an intent to move to a different screen in the application. This is similar to an Intent from the MVI design pattern, but for navigation purposes. | -| [NavigationScope](-navigation-scope/index.md) | [common]
interface [NavigationScope](-navigation-scope/index.md)
Provides the ability for extra platform specific parameters to be provided to a [Navigator](-navigator/index.md). | -| [Navigator](-navigator/index.md) | [common]
interface [Navigator](-navigator/index.md)
A [Navigator](-navigator/index.md) is responsible for changing and showing the different Screens in the application. | -| [StackDuplicateContentStrategy](-stack-duplicate-content-strategy/index.md) | [common]
enum [StackDuplicateContentStrategy](-stack-duplicate-content-strategy/index.md) : [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)<[StackDuplicateContentStrategy](-stack-duplicate-content-strategy/index.md)> | -| [StackNavigationHandler](-stack-navigation-handler/index.md) | [common]
interface [StackNavigationHandler](-stack-navigation-handler/index.md)<[NavigationValue](-stack-navigation-handler/index.md) : [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html), [Scope](-stack-navigation-handler/index.md) : [NavigationScope](-navigation-scope/index.md)> : [NavigationHandler](-navigation-handler/index.md)<[NavigationValue](-stack-navigation-handler/index.md), [Scope](-stack-navigation-handler/index.md)>
An extension on the [NavigationHandler](-navigation-handler/index.md) that provides functions to determine back navigation capability. | -| [StackNavigator](-stack-navigator/index.md) | [common]
interface [StackNavigator](-stack-navigator/index.md) : [Navigator](-navigator/index.md)
A [Navigator](-navigator/index.md) that retains a stack of navigation items and can handle back navigation. | +| [NavigationContext](-navigation-context/index.md) | [common]
interface [NavigationContext](-navigation-context/index.md)<[Destination](-navigation-context/index.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696)>
Represents a navigation context, or a container of a back stack of [Destination](-navigation-context/index.md)s. Navigation can take place within a [NavigationContext](-navigation-context/index.md) typically by changing [Destination](-navigation-context/index.md) values. But an application may have multiple [NavigationContext](-navigation-context/index.md)s that can be changed and navigated through. This allows for more complex navigation paradigms, such as retaining multiple back stacks for a bottom navigation UI component. | +| [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696) | [common]
typealias [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696) = [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)
Represents an intent to move to a different screen in the application. This is similar to an Intent from the MVI design pattern, but for navigation purposes.
For example:
```kotlin sealed class HomeScreenDestination {
object Feed : HomeScreenDestination() } ``` | +| [NavigationEvent](-navigation-event/index.md) | [common]
@Serializable(with = [NavigationEventSerializer::class](../../../navigation-core/com.chrynan.navigation/-navigation-event-serializer/index.md))
sealed class [NavigationEvent](-navigation-event/index.md)<[D](-navigation-event/index.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [C](-navigation-event/index.md) : [NavigationContext](-navigation-context/index.md)<[D](-navigation-event/index.md)>>
Represents a navigation event that is sent to a [Navigator](-navigator/index.md) to coordinate the navigation between UI components, such as "screens" within an application. A [NavigationEvent](-navigation-event/index.md) can be a [NavigationEvent.Forward.Destination](-navigation-event/-forward/-destination/index.md) representing a change in a [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696) in the current context, a [NavigationEvent.Forward.Context](-navigation-event/-forward/-context/index.md) representing a change in [NavigationContext](-navigation-context/index.md), or a [NavigationEvent.Backward](-navigation-event/-backward/index.md) representing a back tracking of a previous [NavigationEvent](-navigation-event/index.md). | +| [NavigationState](-navigation-state/index.md) | [common]
@Serializable(with = [NavigationStateSerializer::class](../../../navigation-core/com.chrynan.navigation/-navigation-state-serializer/index.md))
interface [NavigationState](-navigation-state/index.md)<[T](-navigation-state/index.md)>
A generic wrapper around the state of a navigation component. This provides a way to access the retained [initial](-navigation-state/initial.md) state value, the [current](-navigation-state/current.md) state value, and [changes](-navigation-state/changes.md) to the state value. | +| [NavigationStateStore](-navigation-state-store/index.md) | [common]
@Serializable(with = [NavigationStateStoreSerializer::class](../../../navigation-core/com.chrynan.navigation/-navigation-state-store-serializer/index.md))
interface [NavigationStateStore](-navigation-state-store/index.md)<[Destination](-navigation-state-store/index.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](-navigation-state-store/index.md) : [NavigationContext](-navigation-context/index.md)<[Destination](-navigation-state-store/index.md)>>
Represents a store of navigation state information that is useful for a [Navigator](-navigator/index.md). | +| [NavigationStrategy](-navigation-strategy/index.md) | [common]
interface [NavigationStrategy](-navigation-strategy/index.md)
A component that encapsulates the various navigation policies for a [Navigator](-navigator/index.md). | +| [NavigationViewModel](-navigation-view-model/index.md) | [common]
expect abstract class [NavigationViewModel](-navigation-view-model/index.md)
Represents a "ViewModel" component used for navigation purposes. This component should not be used outside this navigation library.
[android, js, jvm, native]
[android]
actual abstract class [NavigationViewModel](-navigation-view-model/index.md) : [ViewModel](https://developer.android.com/reference/kotlin/androidx/lifecycle/ViewModel.html)
[js, jvm, native]
actual abstract class [NavigationViewModel](-navigation-view-model/index.md) | +| [Navigator](-navigator/index.md) | [common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
@Serializable(with = [NavigatorSerializer::class](../../../navigation-core/com.chrynan.navigation/-navigator-serializer/index.md))
interface [Navigator](-navigator/index.md)<[Destination](-navigator/index.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](-navigator/index.md) : [NavigationContext](-navigation-context/index.md)<[Destination](-navigator/index.md)>>
A [Navigator](-navigator/index.md) is responsible for coordinating the navigation between the different UI component groupings in an application. It is a stateful component that reacts to [NavigationEvent](-navigation-event/index.md)s that are emitted via calls to the navigation functions ([push](push.md), [popDestination](pop-destination.md), and [push](push.md)) and updates its stored state values which can be accessed via its state [store](-navigator/store.md). It is up to the user of a [Navigator](-navigator/index.md) to subscribe to the state changes of this component and update the associated UI accordingly. | +| [SingleNavigationContext](-single-navigation-context/index.md) | [common]
@Serializable
class [SingleNavigationContext](-single-navigation-context/index.md)<[Destination](-single-navigation-context/index.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696)> : [NavigationContext](-navigation-context/index.md)<[Destination](-single-navigation-context/index.md)>
An implementation of the [NavigationContext](-navigation-context/index.md) interface that doesn't have multiple contexts. Typically, a [NavigationContext](-navigation-context/index.md) will either be a sealed class or an enum representing the different contexts for navigation. This is common, for instance, for a UI with a bottom navigation bar, where each navigation item in that bottom navigation bar component would be a different context. Each context would retain its own stack of destinations in the [Navigator](-navigator/index.md). However, sometimes it may be preferable to have only a single context for navigation, and in this case, this class can be used. | ## Functions | Name | Summary | |---|---| -| [goTo](go-to.md) | [common]
fun <[NavigationValue](go-to.md)> [NavigationEventNavigator](-navigation-event-navigator/index.md)<[NavigationValue](go-to.md)>.[goTo](go-to.md)(intent: [NavigationValue](go-to.md))
A convenience function for calling [NavigationEventNavigator.navigate](-navigation-event-navigator/navigate.md) with [NavigationEvent.To](-navigation-event/-to/index.md). | -| [goUp](go-up.md) | [common]
fun <[NavigationValue](go-up.md)> [NavigationEventNavigator](-navigation-event-navigator/index.md)<[NavigationValue](go-up.md)>.[goUp](go-up.md)()
A convenience function for calling [NavigationEventNavigator.navigate](-navigation-event-navigator/navigate.md) with [NavigationEvent.Up](-navigation-event/-up/index.md). | -| [navigator](navigator.md) | [android]
fun <[Intent](navigator.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [navigator](navigator.md)(activity: [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html), handler: [AndroidNavigationHandler](-android-navigation-handler/index.md)<[Intent](navigator.md)>): [NavigationEventNavigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-navigator/index.md)<[Intent](navigator.md)>
Creates a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) using the provided [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html) in the [AndroidNavigationScope](-android-navigation-scope/index.md) and the provided [handler](navigator.md).
[android]
fun <[Intent](navigator.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [navigator](navigator.md)(activity: [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html), canGoBack: () -> [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = { false }, onGoBack: () -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) = { activity.onBackPressed() }, onGoUp: () -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) = { activity.onBackPressed() }, onGoTo: ([Intent](navigator.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [NavigationEventNavigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-navigator/index.md)<[Intent](navigator.md)>
Creates a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) using the provided [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html) in the [AndroidNavigationScope](-android-navigation-scope/index.md) and the provided [onGoBack](navigator.md), [onGoUp](navigator.md), and [onGoTo](navigator.md) functions to construct an [AndroidNavigationHandler](-android-navigation-handler/index.md). | +| [changeContext](change-context.md) | [common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
fun <[Destination](change-context.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](change-context.md) : [NavigationContext](-navigation-context/index.md)<[Destination](change-context.md)>> [Navigator](-navigator/index.md)<[Destination](change-context.md), [Context](change-context.md)>.[~~changeContext~~](change-context.md)(context: [Context](change-context.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Convenience function for the [Navigator.push](push.md) function. | +| [goTo](go-to.md) | [common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
fun <[Destination](go-to.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](go-to.md) : [NavigationContext](-navigation-context/index.md)<[Destination](go-to.md)>> [Navigator](-navigator/index.md)<[Destination](go-to.md), [Context](go-to.md)>.[~~goTo~~](go-to.md)(destination: [Destination](go-to.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Convenience function for the [Navigator.push](push.md) function. | +| [Navigator](-navigator.md) | [common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
fun <[Destination](-navigator.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](-navigator.md) : [NavigationContext](-navigation-context/index.md)<[Destination](-navigator.md)>> [Navigator](-navigator.md)(initialContext: [Context](-navigator.md), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](-navigator/index.md)<[Destination](-navigator.md), [Context](-navigator.md)>
Creates a [Navigator](-navigator/index.md) instance with the provided values.
[common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
fun <[Destination](-navigator.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696)> [Navigator](-navigator.md)(initialDestination: [Destination](-navigator.md), duplicateDestinationStrategy: [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, destinationRetentionStrategy: [NavigationStrategy.DestinationRetention](-navigation-strategy/-destination-retention/index.md) = NavigationStrategy.DestinationRetention.RETAIN): [Navigator](-navigator/index.md)<[Destination](-navigator.md), [SingleNavigationContext](-single-navigation-context/index.md)<[Destination](-navigator.md)>>
Creates a [Navigator](-navigator/index.md) instance with the provided values using the [SingleNavigationContext](-single-navigation-context/index.md). | +| [popContext](pop-context.md) | [common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
fun <[Destination](pop-context.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](pop-context.md) : [NavigationContext](-navigation-context/index.md)<[Destination](pop-context.md)>> [Navigator](-navigator/index.md)<[Destination](pop-context.md), [Context](pop-context.md)>.[popContext](pop-context.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Performs a back navigation operation, if possible, by moving to the previous [NavigationContext](-navigation-context/index.md). If this [Navigator](-navigator/index.md) cannot navigate to a previous [NavigationContext](-navigation-context/index.md), then this function will do nothing and return `false`. | +| [popDestination](pop-destination.md) | [common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
fun <[Destination](pop-destination.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](pop-destination.md) : [NavigationContext](-navigation-context/index.md)<[Destination](pop-destination.md)>> [Navigator](-navigator/index.md)<[Destination](pop-destination.md), [Context](pop-destination.md)>.[popDestination](pop-destination.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Performs a back navigation operation, if possible, by removing the top [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](-navigation-context/index.md). If this [Navigator](-navigator/index.md) cannot navigate to a previous [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), then this function will do nothing and return `false`. | +| [push](push.md) | [common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
fun <[Destination](push.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](push.md) : [NavigationContext](-navigation-context/index.md)<[Destination](push.md)>> [Navigator](-navigator/index.md)<[Destination](push.md), [Context](push.md)>.[push](push.md)(context: [Context](push.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Changes the current [Context](push.md) to the provided [context](push.md) value. The displayed [Destination](push.md) will be the top destination value in the stack associated with the provided [context](push.md), or the provided context's [NavigationContext.initialDestination](-navigation-context/initial-destination.md) if there is currently no existing stack for the provided [context](push.md).
[common]
@[ExperimentalNavigationApi](-experimental-navigation-api/index.md)
fun <[Destination](push.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](push.md) : [NavigationContext](-navigation-context/index.md)<[Destination](push.md)>> [Navigator](-navigator/index.md)<[Destination](push.md), [Context](push.md)>.[push](push.md)(destination: [Destination](push.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Navigates to the provided [destination](push.md) in the current [NavigationContext](-navigation-context/index.md). Depending on the provided [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) when creating this [Navigator](-navigator/index.md), and the current [Context](push.md) stack, this will either clear the current [Context](push.md) stack to the last value that equals the provided [destination](push.md), or add the provided [destination](push.md) to the top of the current [Context](push.md) stack. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/navigator.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/navigator.md index d6e410a..75893cd 100644 --- a/docs/navigation-core/navigation-core/com.chrynan.navigation/navigator.md +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/navigator.md @@ -3,31 +3,27 @@ # navigator [android]\ -fun <[Intent](navigator.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [navigator](navigator.md)(activity: [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html), handler: [AndroidNavigationHandler](-android-navigation-handler/index.md)<[Intent](navigator.md)>): [NavigationEventNavigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-navigator/index.md)<[Intent](navigator.md)> +fun <[Destination](navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](navigator.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](navigator.md)>> [navigator](navigator.md)(initialContext: [Context](navigator.md)): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](navigator.md), [Context](navigator.md)> -Creates a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) using the provided [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html) in the [AndroidNavigationScope](-android-navigation-scope/index.md) and the provided [handler](navigator.md). +Creates a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) using the provided [initialContext](navigator.md). Example usage: -val navigator = navigator(activity, AndroidNavigationHandler { event ->\ - when (event) {\ - is NavigationEvent.Back -> activity.onBackPressed()\ - is NavigationEvent.Up -> activity.onBackPressed()\ - is NavigationEvent.To -> { ... }\ - }\ -})\ -\ -navigator.goBack() +```kotlin +val navigator = navigator(initialContext = AppContext.Home) + +navigator.goTo(destination) +``` [android]\ -fun <[Intent](navigator.md) : [NavigationIntent](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md)> [navigator](navigator.md)(activity: [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html), canGoBack: () -> [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) = { false }, onGoBack: () -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) = { activity.onBackPressed() }, onGoUp: () -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) = { activity.onBackPressed() }, onGoTo: ([Intent](navigator.md)) -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)): [NavigationEventNavigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-navigator/index.md)<[Intent](navigator.md)> +fun <[Destination](navigator.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md)> [navigator](navigator.md)(initialDestination: [Destination](navigator.md)): [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](navigator.md), [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md)<[Destination](navigator.md)>> -Creates a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) using the provided [Activity](https://developer.android.com/reference/kotlin/android/app/Activity.html) in the [AndroidNavigationScope](-android-navigation-scope/index.md) and the provided [onGoBack](navigator.md), [onGoUp](navigator.md), and [onGoTo](navigator.md) functions to construct an [AndroidNavigationHandler](-android-navigation-handler/index.md). +Creates a [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md) with a [SingleNavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md) using the provided [initialDestination](navigator.md). Example usage: -val navigator = navigator<NavigationIntent>(activity = activity, onGoTo = { navigationIntent ->\ - activity.startActivity(...)\ -})\ -\ -navigator.goBack() +```kotlin +val navigator = navigator(initialDestination = destination) + +navigator.goTo(otherDestination) +``` diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/pop-context.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/pop-context.md new file mode 100644 index 0000000..511684e --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/pop-context.md @@ -0,0 +1,15 @@ +//[navigation-core](../../index.md)/[com.chrynan.navigation](index.md)/[popContext](pop-context.md) + +# popContext + +[common]\ + +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](pop-context.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](pop-context.md) : [NavigationContext](-navigation-context/index.md)<[Destination](pop-context.md)>> [Navigator](-navigator/index.md)<[Destination](pop-context.md), [Context](pop-context.md)>.[popContext](pop-context.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Performs a back navigation operation, if possible, by moving to the previous [NavigationContext](-navigation-context/index.md). If this [Navigator](-navigator/index.md) cannot navigate to a previous [NavigationContext](-navigation-context/index.md), then this function will do nothing and return `false`. + +#### Return + +`true` if the back navigation operation was successful, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/pop-destination.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/pop-destination.md new file mode 100644 index 0000000..678a111 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/pop-destination.md @@ -0,0 +1,15 @@ +//[navigation-core](../../index.md)/[com.chrynan.navigation](index.md)/[popDestination](pop-destination.md) + +# popDestination + +[common]\ + +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](pop-destination.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](pop-destination.md) : [NavigationContext](-navigation-context/index.md)<[Destination](pop-destination.md)>> [Navigator](-navigator/index.md)<[Destination](pop-destination.md), [Context](pop-destination.md)>.[popDestination](pop-destination.md)(): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Performs a back navigation operation, if possible, by removing the top [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696) within the current [NavigationContext](-navigation-context/index.md). If this [Navigator](-navigator/index.md) cannot navigate to a previous [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), then this function will do nothing and return `false`. + +#### Return + +`true` if the back navigation operation was successful, `false` otherwise. diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/push.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/push.md new file mode 100644 index 0000000..4360801 --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/push.md @@ -0,0 +1,43 @@ +//[navigation-core](../../index.md)/[com.chrynan.navigation](index.md)/[push](push.md) + +# push + +[common]\ + +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](push.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](push.md) : [NavigationContext](-navigation-context/index.md)<[Destination](push.md)>> [Navigator](-navigator/index.md)<[Destination](push.md), [Context](push.md)>.[push](push.md)(destination: [Destination](push.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Navigates to the provided [destination](push.md) in the current [NavigationContext](-navigation-context/index.md). Depending on the provided [NavigationStrategy.DuplicateDestination](-navigation-strategy/-duplicate-destination/index.md) when creating this [Navigator](-navigator/index.md), and the current [Context](push.md) stack, this will either clear the current [Context](push.md) stack to the last value that equals the provided [destination](push.md), or add the provided [destination](push.md) to the top of the current [Context](push.md) stack. + +#### Return + +`true` if the navigation operation was successful, `false` otherwise. + +#### Parameters + +common + +| | | +|---|---| +| destination | The [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696) that is to be navigated to and added to the current [Context](push.md) stack. | + +[common]\ + +@[ExperimentalNavigationApi](-experimental-navigation-api/index.md) + +fun <[Destination](push.md) : [NavigationDestination](index.md#1223765350%2FClasslikes%2F-215881696), [Context](push.md) : [NavigationContext](-navigation-context/index.md)<[Destination](push.md)>> [Navigator](-navigator/index.md)<[Destination](push.md), [Context](push.md)>.[push](push.md)(context: [Context](push.md)): [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) + +Changes the current [Context](push.md) to the provided [context](push.md) value. The displayed [Destination](push.md) will be the top destination value in the stack associated with the provided [context](push.md), or the provided context's [NavigationContext.initialDestination](-navigation-context/initial-destination.md) if there is currently no existing stack for the provided [context](push.md). + +#### Return + +`true` if the navigation operation was successful, `false` otherwise. + +#### Parameters + +common + +| | | +|---|---| +| context | The [NavigationContext](-navigation-context/index.md) to change to. | diff --git a/docs/navigation-core/navigation-core/com.chrynan.navigation/register-navigation-handler.md b/docs/navigation-core/navigation-core/com.chrynan.navigation/register-navigation-handler.md new file mode 100644 index 0000000..0631c2d --- /dev/null +++ b/docs/navigation-core/navigation-core/com.chrynan.navigation/register-navigation-handler.md @@ -0,0 +1,6 @@ +//[navigation-core](../../index.md)/[com.chrynan.navigation](index.md)/[registerNavigationHandler](register-navigation-handler.md) + +# registerNavigationHandler + +[android]\ +fun <[Destination](register-navigation-handler.md) : [NavigationDestination](../../../navigation-core/com.chrynan.navigation/-navigation-destination/index.md), [Context](register-navigation-handler.md) : [NavigationContext](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md)<[Destination](register-navigation-handler.md)>> [AppCompatActivity](https://developer.android.com/reference/kotlin/androidx/appcompat/app/AppCompatActivity.html).[registerNavigationHandler](register-navigation-handler.md)(navigator: [Navigator](../../../navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md)<[Destination](register-navigation-handler.md), [Context](register-navigation-handler.md)>, eventDispatcher: CoroutineDispatcher = Dispatchers.IO, handlerDispatcher: CoroutineDispatcher = Dispatchers.Main, handler: [AndroidNavigationHandler](-android-navigation-handler/index.md)<[Destination](register-navigation-handler.md), [Context](register-navigation-handler.md)>) diff --git a/docs/package-list b/docs/package-list index 4521664..1e970bf 100644 --- a/docs/package-list +++ b/docs/package-list @@ -1,143 +1,123 @@ $dokka.format:gfm-v1 $dokka.linkExtension:md $dokka.location:com.chrynan.navigation.compose////PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/index.md -$dokka.location:com.chrynan.navigation.compose//NavContainer/#com.chrynan.navigation.compose.ComposeNavigationIntentNavigatorByKeyViewModel[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-nav-container.md -$dokka.location:com.chrynan.navigation.compose//NavContainer/#com.chrynan.navigation.compose.ComposeNavigatorByContentViewModel[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-nav-container.md -$dokka.location:com.chrynan.navigation.compose//NavContainer/#com.chrynan.navigation.compose.ComposeNavigatorByKeyViewModel[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-nav-container.md -$dokka.location:com.chrynan.navigation.compose//autoSaver/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/auto-saver.md -$dokka.location:com.chrynan.navigation.compose//currentContextAsState/com.chrynan.navigation.compose.ComposeContextNavigator[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])]#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-context-as-state.md -$dokka.location:com.chrynan.navigation.compose//currentContextAsState/com.chrynan.navigation.compose.ComposeContextNavigator[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])]#TypeParam(bounds=[kotlin.Any?])/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-context-as-state.md -$dokka.location:com.chrynan.navigation.compose//currentKeyAsState/com.chrynan.navigation.compose.ComposeNavigator[TypeParam(bounds=[kotlin.Any?])]#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-key-as-state.md -$dokka.location:com.chrynan.navigation.compose//currentKeyAsState/com.chrynan.navigation.compose.ComposeNavigator[TypeParam(bounds=[kotlin.Any?])]#TypeParam(bounds=[kotlin.Any?])/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/current-key-as-state.md -$dokka.location:com.chrynan.navigation.compose//goTo/com.chrynan.navigation.compose.ComposeNavigatorByContent[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])]#TypeParam(bounds=[kotlin.Any?])#kotlin.Function1[com.chrynan.navigation.compose.ComposeNavigationContentScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])],kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/go-to.md -$dokka.location:com.chrynan.navigation.compose//goTo/com.chrynan.navigation.compose.ComposeNavigatorByKey[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])]#TypeParam(bounds=[kotlin.Any?])/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/go-to.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByContent/#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any?])]])#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[kotlin.Any?]),kotlin.Any]#kotlin.Function1[TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any?])]]),kotlin.Function1[com.chrynan.navigation.compose.ComposeNavigationContentScope[TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any?])]]),TypeParam(bounds=[kotlin.Any?])],kotlin.Unit]]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-content.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByContent/#TypeParam(bounds=[kotlin.Any?])#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[kotlin.Any?]),kotlin.Any]#kotlin.Function1[TypeParam(bounds=[kotlin.Any?]),kotlin.Pair[TypeParam(bounds=[kotlin.Any?]),kotlin.Function1[com.chrynan.navigation.compose.ComposeNavigationContentScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])],kotlin.Unit]]]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-content.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByContent/#TypeParam(bounds=[kotlin.Any?])#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[kotlin.Any?]),kotlin.Any]#kotlin.Function1[com.chrynan.navigation.compose.ComposeNavigationContentScope[kotlin.Nothing?,TypeParam(bounds=[kotlin.Any?])],kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-content.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByIntent/#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]])#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[com.chrynan.navigation.NavigationIntent]),kotlin.Any]#kotlin.Function2[com.chrynan.navigation.compose.ComposeNavigationIntentScope[TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]]),TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])],TypeParam(bounds=[com.chrynan.navigation.NavigationIntent]),kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-intent.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByIntent/#TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[com.chrynan.navigation.NavigationIntent]),kotlin.Any]#kotlin.Function2[com.chrynan.navigation.compose.ComposeNavigationIntentScope[kotlin.Nothing?,TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])],TypeParam(bounds=[com.chrynan.navigation.NavigationIntent]),kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-intent.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByIntent/#TypeParam(bounds=[kotlin.Any?])#kotlin.Function1[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[com.chrynan.navigation.NavigationIntent]),kotlin.Any]#kotlin.Function2[com.chrynan.navigation.compose.ComposeNavigationIntentScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])],TypeParam(bounds=[com.chrynan.navigation.NavigationIntent]),kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-intent.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByKey/#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any?])]])#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[kotlin.Any?]),kotlin.Any]#kotlin.Function2[com.chrynan.navigation.compose.ComposeNavigationKeyScope[TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any?])]]),TypeParam(bounds=[kotlin.Any?])],TypeParam(bounds=[kotlin.Any?]),kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-key.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByKey/#TypeParam(bounds=[kotlin.Any?])#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[kotlin.Any?]),kotlin.Any]#kotlin.Function2[com.chrynan.navigation.compose.ComposeNavigationKeyScope[kotlin.Nothing?,TypeParam(bounds=[kotlin.Any?])],TypeParam(bounds=[kotlin.Any?]),kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-key.md -$dokka.location:com.chrynan.navigation.compose//rememberNavigatorByKey/#TypeParam(bounds=[kotlin.Any?])#kotlin.Function1[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])]#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[kotlin.Any?]),kotlin.Any]#kotlin.Function2[com.chrynan.navigation.compose.ComposeNavigationKeyScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])],TypeParam(bounds=[kotlin.Any?]),kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator-by-key.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByContentViewModel///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-content-view-model/index.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByContentViewModel/BaseComposeNavigatorByContentViewModel/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-content-view-model/-base-compose-navigator-by-content-view-model.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/index.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/BaseComposeNavigatorByKeyViewModel/#TypeParam(bounds=[kotlin.Any?])#com.chrynan.navigation.compose.Saver[TypeParam(bounds=[kotlin.Any?]),kotlin.Any]#kotlin.Function1[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/-base-compose-navigator-by-key-view-model.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/canGoBack/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/can-go-back.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/changeContext/#TypeParam(bounds=[kotlin.Any?])/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/change-context.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/contextChanges/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/context-changes.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/currentContext/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/current-context.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/currentKey/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/current-key.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/goBack/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/go-back.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/goTo/#TypeParam(bounds=[kotlin.Any?])#com.chrynan.navigation.StackDuplicateContentStrategy/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/go-to.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/initialContext/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/initial-context.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/initialKey/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/initial-key.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/isInitialized/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/is-initialized.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/keyChanges/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/key-changes.md -$dokka.location:com.chrynan.navigation.compose/BaseComposeNavigatorByKeyViewModel/keySaver/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-base-compose-navigator-by-key-view-model/key-saver.md -$dokka.location:com.chrynan.navigation.compose/ComposeContextNavigator.Companion///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-context-navigator/-companion/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeContextNavigator///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-context-navigator/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeContextNavigator/changeContext/#TypeParam(bounds=[kotlin.Any?])/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-context-navigator/change-context.md -$dokka.location:com.chrynan.navigation.compose/ComposeContextNavigator/contextChanges/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-context-navigator/context-changes.md -$dokka.location:com.chrynan.navigation.compose/ComposeContextNavigator/currentContext/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-context-navigator/current-context.md -$dokka.location:com.chrynan.navigation.compose/ComposeContextNavigator/initialContext/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-context-navigator/initial-context.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationContentScope.Companion///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-content-scope/-companion/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationContentScope///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-content-scope/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationContentScope/navigator/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-content-scope/navigator.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentNavigatorByKeyViewModel///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-navigator-by-key-view-model/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentNavigatorByKeyViewModel/goBack/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-navigator-by-key-view-model/go-back.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentNavigatorByKeyViewModel/scope/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-navigator-by-key-view-model/scope.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentScope.Companion///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-scope/-companion/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentScope///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-scope/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentScope/navigator/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-scope/navigator.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentStackNavigatorByKey///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-stack-navigator-by-key/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentStackNavigatorByKey/navigate/#com.chrynan.navigation.NavigationEvent[TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-stack-navigator-by-key/navigate.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentStackNavigatorByKey/onGoBack/com.chrynan.navigation.compose.ComposeNavigationIntentScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-stack-navigator-by-key/on-go-back.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentStackNavigatorByKey/onGoTo/com.chrynan.navigation.compose.ComposeNavigationIntentScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]#TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-stack-navigator-by-key/on-go-to.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentStackNavigatorByKey/onGoUp/com.chrynan.navigation.compose.ComposeNavigationIntentScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-stack-navigator-by-key/on-go-up.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationIntentStackNavigatorByKey/scope/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-intent-stack-navigator-by-key/scope.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationKeyScope.Companion///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-key-scope/-companion/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationKeyScope///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-key-scope/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationKeyScope/navigator/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-key-scope/navigator.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationScope.Companion///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-scope/-companion/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigationScope///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigation-scope/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigator.Companion///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator/-companion/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigator///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigator/currentKey/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator/current-key.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigator/initialKey/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator/initial-key.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigator/isInitialized/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator/is-initialized.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigator/keyChanges/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator/key-changes.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigator/keySaver/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator/key-saver.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContent.Companion///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content/-companion/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContent///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContent/goTo/#TypeParam(bounds=[kotlin.Any?])#com.chrynan.navigation.StackDuplicateContentStrategy#kotlin.Function1[com.chrynan.navigation.compose.ComposeNavigationContentScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])],kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content/go-to.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/canGoBack/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/can-go-back.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/changeContext/#TypeParam(bounds=[kotlin.Any?])/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/change-context.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/contextChanges/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/context-changes.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/currentContext/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/current-context.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/currentKey/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/current-key.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/goBack/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/go-back.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/goTo/#TypeParam(bounds=[kotlin.Any?])#com.chrynan.navigation.StackDuplicateContentStrategy#kotlin.Function1[com.chrynan.navigation.compose.ComposeNavigationContentScope[TypeParam(bounds=[kotlin.Any?]),TypeParam(bounds=[kotlin.Any?])],kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/go-to.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/initialContext/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/initial-context.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/initialKey/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/initial-key.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/isInitialized/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/is-initialized.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/keyChanges/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/key-changes.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByContentViewModel/keySaver/#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-content-view-model/key-saver.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByKey.Companion///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-key/-companion/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByKey///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-key/index.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByKey/goTo/#TypeParam(bounds=[kotlin.Any?])#com.chrynan.navigation.StackDuplicateContentStrategy/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-key/go-to.md -$dokka.location:com.chrynan.navigation.compose/ComposeNavigatorByKeyViewModel///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-compose-navigator-by-key-view-model/index.md -$dokka.location:com.chrynan.navigation.compose/Saver///PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-saver/index.md +$dokka.location:com.chrynan.navigation.compose//NavigationContainer/#com.chrynan.navigation.Navigator[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]#androidx.compose.ui.Modifier#kotlin.Function2[androidx.compose.foundation.layout.BoxScope,com.chrynan.navigation.DestinationAndContext[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])],kotlin.Unit]/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/-navigation-container.md +$dokka.location:com.chrynan.navigation.compose//collectAsState/com.chrynan.navigation.NavigationState[TypeParam(bounds=[kotlin.Any?])]#/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/collect-as-state.md +$dokka.location:com.chrynan.navigation.compose//rememberNavigator/#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])#com.chrynan.navigation.NavigationStrategy.DuplicateDestination#com.chrynan.navigation.NavigationStrategy.DestinationRetention/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator.md +$dokka.location:com.chrynan.navigation.compose//rememberNavigator/#TypeParam(bounds=[kotlin.Any])#com.chrynan.navigation.NavigationStrategy.DuplicateDestination#com.chrynan.navigation.NavigationStrategy.DestinationRetention/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-navigator.md +$dokka.location:com.chrynan.navigation.compose//rememberSavableNavigator/#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])#com.chrynan.parcelable.core.Parcelable#kotlinx.serialization.KSerializer[TypeParam(bounds=[kotlin.Any])]#kotlinx.serialization.KSerializer[TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]#com.chrynan.navigation.NavigationStrategy.DuplicateDestination#com.chrynan.navigation.NavigationStrategy.DestinationRetention/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-savable-navigator.md +$dokka.location:com.chrynan.navigation.compose//rememberSavableNavigator/#TypeParam(bounds=[kotlin.Any])#com.chrynan.parcelable.core.Parcelable#kotlinx.serialization.KSerializer[TypeParam(bounds=[kotlin.Any])]#com.chrynan.navigation.NavigationStrategy.DuplicateDestination#com.chrynan.navigation.NavigationStrategy.DestinationRetention/PointingToDeclaration/navigation-compose/navigation-compose/com.chrynan.navigation.compose/remember-savable-navigator.md $dokka.location:com.chrynan.navigation////PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/index.md -$dokka.location:com.chrynan.navigation//goTo/com.chrynan.navigation.NavigationEventNavigator[TypeParam(bounds=[kotlin.Any?])]#TypeParam(bounds=[kotlin.Any?])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/go-to.md -$dokka.location:com.chrynan.navigation//goUp/com.chrynan.navigation.NavigationEventNavigator[TypeParam(bounds=[kotlin.Any?])]#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/go-up.md -$dokka.location:com.chrynan.navigation//navigator/#android.app.Activity#com.chrynan.navigation.AndroidNavigationHandler[TypeParam(bounds=[com.chrynan.navigation.NavigationIntent])]/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/navigator.md -$dokka.location:com.chrynan.navigation//navigator/#android.app.Activity#kotlin.Function0[kotlin.Boolean]#kotlin.Function0[kotlin.Unit]#kotlin.Function0[kotlin.Unit]#kotlin.Function1[TypeParam(bounds=[com.chrynan.navigation.NavigationIntent]),kotlin.Unit]/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/navigator.md -$dokka.location:com.chrynan.navigation/AndroidNavigationHandler///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-handler/index.md -$dokka.location:com.chrynan.navigation/AndroidNavigationScope///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-scope/index.md -$dokka.location:com.chrynan.navigation/AndroidNavigationScope/activity/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-android-navigation-scope/activity.md +$dokka.location:com.chrynan.navigation//Navigator/#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])#com.chrynan.navigation.NavigationStrategy.DuplicateDestination#com.chrynan.navigation.NavigationStrategy.DestinationRetention/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator.md +$dokka.location:com.chrynan.navigation//Navigator/#TypeParam(bounds=[kotlin.Any])#com.chrynan.navigation.NavigationStrategy.DuplicateDestination#com.chrynan.navigation.NavigationStrategy.DestinationRetention/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator.md +$dokka.location:com.chrynan.navigation//changeContext/com.chrynan.navigation.Navigator[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/change-context.md +$dokka.location:com.chrynan.navigation//goTo/com.chrynan.navigation.Navigator[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]#TypeParam(bounds=[kotlin.Any])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/go-to.md +$dokka.location:com.chrynan.navigation//popContext/com.chrynan.navigation.Navigator[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/pop-context.md +$dokka.location:com.chrynan.navigation//popDestination/com.chrynan.navigation.Navigator[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/pop-destination.md +$dokka.location:com.chrynan.navigation//push/com.chrynan.navigation.Navigator[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/push.md +$dokka.location:com.chrynan.navigation//push/com.chrynan.navigation.Navigator[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]#TypeParam(bounds=[kotlin.Any])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/push.md +$dokka.location:com.chrynan.navigation/DestinationAndContext///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/index.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/DestinationAndContext/#TypeParam(bounds=[kotlin.Any])#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/-destination-and-context.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/component1/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/component1.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/component2/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/component2.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/context/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/context.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/copy/#TypeParam(bounds=[kotlin.Any])#TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/copy.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/destination/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/destination.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/equals/#kotlin.Any?/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/equals.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/hashCode/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/hash-code.md +$dokka.location:com.chrynan.navigation/DestinationAndContext/toString/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-destination-and-context/to-string.md $dokka.location:com.chrynan.navigation/ExperimentalNavigationApi///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/index.md -$dokka.location:com.chrynan.navigation/ExperimentalNavigationApi/ExperimentalNavigationApi/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-experimental-navigation-api/-experimental-navigation-api.md +$dokka.location:com.chrynan.navigation/NavigationContext.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/-companion/index.md $dokka.location:com.chrynan.navigation/NavigationContext///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/index.md -$dokka.location:com.chrynan.navigation/NavigationContext/initialKey/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/initial-key.md -$dokka.location:com.chrynan.navigation/NavigationEvent.Back///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-back/index.md +$dokka.location:com.chrynan.navigation/NavigationContext/initialDestination/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-context/initial-destination.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Context///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Context/elapsedMilliseconds/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/elapsed-milliseconds.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Context/equals/#kotlin.Any?/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/equals.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Context/hashCode/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/hash-code.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Context/toString/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/to-string.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Context/type/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-context/type.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Destination///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Destination/elapsedMilliseconds/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/elapsed-milliseconds.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Destination/equals/#kotlin.Any?/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/equals.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Destination/hashCode/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/hash-code.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Destination/toString/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/to-string.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward.Destination/type/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/-destination/type.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Backward/direction/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-backward/direction.md $dokka.location:com.chrynan.navigation/NavigationEvent.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-companion/index.md -$dokka.location:com.chrynan.navigation/NavigationEvent.To///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/index.md -$dokka.location:com.chrynan.navigation/NavigationEvent.To/value/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-to/value.md -$dokka.location:com.chrynan.navigation/NavigationEvent.Up///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-up/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Direction.BACKWARDS///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/-b-a-c-k-w-a-r-d-s/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Direction.FORWARDS///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/-f-o-r-w-a-r-d-s/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Direction///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Direction/serialName/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/serial-name.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Direction/valueOf/#kotlin.String/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/value-of.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Direction/values/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-direction/values.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Context///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Context/context/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/context.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Context/elapsedMilliseconds/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/elapsed-milliseconds.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Context/equals/#kotlin.Any?/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/equals.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Context/hashCode/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/hash-code.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Context/toString/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/to-string.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Context/type/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-context/type.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Destination///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Destination/destination/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/destination.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Destination/elapsedMilliseconds/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/elapsed-milliseconds.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Destination/equals/#kotlin.Any?/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/equals.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Destination/hashCode/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/hash-code.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Destination/toString/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/to-string.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward.Destination/type/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/-destination/type.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Forward/direction/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-forward/direction.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Type.BACKWARD_CONTEXT///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d_-c-o-n-t-e-x-t/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Type.BACKWARD_DESTINATION///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-b-a-c-k-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Type.FORWARD_CONTEXT///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-f-o-r-w-a-r-d_-c-o-n-t-e-x-t/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Type.FORWARD_DESTINATION///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/-f-o-r-w-a-r-d_-d-e-s-t-i-n-a-t-i-o-n/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Type///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Type/serialName/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/serial-name.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Type/valueOf/#kotlin.String/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/value-of.md +$dokka.location:com.chrynan.navigation/NavigationEvent.Type/values/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/-type/values.md $dokka.location:com.chrynan.navigation/NavigationEvent///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/index.md -$dokka.location:com.chrynan.navigation/NavigationEventHandler.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/-companion/index.md -$dokka.location:com.chrynan.navigation/NavigationEventHandler///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/index.md -$dokka.location:com.chrynan.navigation/NavigationEventHandler/canGoBack/TypeParam(bounds=[com.chrynan.navigation.NavigationScope])#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/can-go-back.md -$dokka.location:com.chrynan.navigation/NavigationEventHandler/onGoBack/TypeParam(bounds=[com.chrynan.navigation.NavigationScope])#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/on-go-back.md -$dokka.location:com.chrynan.navigation/NavigationEventHandler/onGoTo/TypeParam(bounds=[com.chrynan.navigation.NavigationScope])#TypeParam(bounds=[kotlin.Any?])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/on-go-to.md -$dokka.location:com.chrynan.navigation/NavigationEventHandler/onGoUp/TypeParam(bounds=[com.chrynan.navigation.NavigationScope])#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/on-go-up.md -$dokka.location:com.chrynan.navigation/NavigationEventHandler/onNavigate/TypeParam(bounds=[com.chrynan.navigation.NavigationScope])#com.chrynan.navigation.NavigationEvent[TypeParam(bounds=[kotlin.Any?])]/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-handler/on-navigate.md -$dokka.location:com.chrynan.navigation/NavigationEventNavigator///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-navigator/index.md -$dokka.location:com.chrynan.navigation/NavigationEventNavigator/goBack/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-navigator/go-back.md -$dokka.location:com.chrynan.navigation/NavigationEventNavigator/navigate/#com.chrynan.navigation.NavigationEvent[TypeParam(bounds=[kotlin.Any?])]/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event-navigator/navigate.md -$dokka.location:com.chrynan.navigation/NavigationHandler.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-handler/-companion/index.md -$dokka.location:com.chrynan.navigation/NavigationHandler///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-handler/index.md -$dokka.location:com.chrynan.navigation/NavigationHandler/onNavigate/TypeParam(bounds=[com.chrynan.navigation.NavigationScope])#TypeParam(bounds=[kotlin.Any])/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-handler/on-navigate.md -$dokka.location:com.chrynan.navigation/NavigationIntent.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/-companion/index.md -$dokka.location:com.chrynan.navigation/NavigationIntent///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-intent/index.md -$dokka.location:com.chrynan.navigation/NavigationScope.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-scope/-companion/index.md -$dokka.location:com.chrynan.navigation/NavigationScope///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-scope/index.md +$dokka.location:com.chrynan.navigation/NavigationEvent/direction/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/direction.md +$dokka.location:com.chrynan.navigation/NavigationEvent/elapsedMilliseconds/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/elapsed-milliseconds.md +$dokka.location:com.chrynan.navigation/NavigationEvent/type/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-event/type.md +$dokka.location:com.chrynan.navigation/NavigationState.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/-companion/index.md +$dokka.location:com.chrynan.navigation/NavigationState///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/index.md +$dokka.location:com.chrynan.navigation/NavigationState/changes/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/changes.md +$dokka.location:com.chrynan.navigation/NavigationState/current/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/current.md +$dokka.location:com.chrynan.navigation/NavigationState/initial/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state/initial.md +$dokka.location:com.chrynan.navigation/NavigationStateStore.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/-companion/index.md +$dokka.location:com.chrynan.navigation/NavigationStateStore///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/index.md +$dokka.location:com.chrynan.navigation/NavigationStateStore/context/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/context.md +$dokka.location:com.chrynan.navigation/NavigationStateStore/destination/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/destination.md +$dokka.location:com.chrynan.navigation/NavigationStateStore/event/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-state-store/event.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-companion/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DestinationRetention.CLEAR///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-c-l-e-a-r/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DestinationRetention.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-companion/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DestinationRetention.RETAIN///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/-r-e-t-a-i-n/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DestinationRetention///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DestinationRetention/serialName/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/serial-name.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DestinationRetention/valueOf/#kotlin.String/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/value-of.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DestinationRetention/values/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-destination-retention/values.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-a-l-l-o-w_-d-u-p-l-i-c-a-t-e-s/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DuplicateDestination.CLEAR_TO_ORIGINAL///PointingToDeclaration/{"org.jetbrains.dokka.links.EnumEntryDRIExtra":{"key":"org.jetbrains.dokka.links.EnumEntryDRIExtra"}}navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-c-l-e-a-r_-t-o_-o-r-i-g-i-n-a-l/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DuplicateDestination.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/-companion/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DuplicateDestination///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/index.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DuplicateDestination/serialName/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/serial-name.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DuplicateDestination/valueOf/#kotlin.String/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/value-of.md +$dokka.location:com.chrynan.navigation/NavigationStrategy.DuplicateDestination/values/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/-duplicate-destination/values.md +$dokka.location:com.chrynan.navigation/NavigationStrategy///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-strategy/index.md +$dokka.location:com.chrynan.navigation/NavigationViewModel///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigation-view-model/index.md $dokka.location:com.chrynan.navigation/Navigator.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator/-companion/index.md $dokka.location:com.chrynan.navigation/Navigator///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator/index.md -$dokka.location:com.chrynan.navigation/StackDuplicateContentStrategy.ADD_TO_STACK///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-a-d-d_-t-o_-s-t-a-c-k/index.md -$dokka.location:com.chrynan.navigation/StackDuplicateContentStrategy.CLEAR_STACK///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-c-l-e-a-r_-s-t-a-c-k/index.md -$dokka.location:com.chrynan.navigation/StackDuplicateContentStrategy.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/-companion/index.md -$dokka.location:com.chrynan.navigation/StackDuplicateContentStrategy///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-duplicate-content-strategy/index.md -$dokka.location:com.chrynan.navigation/StackNavigationHandler.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-navigation-handler/-companion/index.md -$dokka.location:com.chrynan.navigation/StackNavigationHandler///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-navigation-handler/index.md -$dokka.location:com.chrynan.navigation/StackNavigationHandler/canGoBack/TypeParam(bounds=[com.chrynan.navigation.NavigationScope])#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-navigation-handler/can-go-back.md -$dokka.location:com.chrynan.navigation/StackNavigator.Companion///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-navigator/-companion/index.md -$dokka.location:com.chrynan.navigation/StackNavigator///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-navigator/index.md -$dokka.location:com.chrynan.navigation/StackNavigator/canGoBack/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-navigator/can-go-back.md -$dokka.location:com.chrynan.navigation/StackNavigator/goBack/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-stack-navigator/go-back.md +$dokka.location:com.chrynan.navigation/Navigator/canPopContext/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-pop-context.md +$dokka.location:com.chrynan.navigation/Navigator/canPopDestination/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator/can-pop-destination.md +$dokka.location:com.chrynan.navigation/Navigator/dispatch/#com.chrynan.navigation.NavigationEvent[TypeParam(bounds=[kotlin.Any]),TypeParam(bounds=[com.chrynan.navigation.NavigationContext[TypeParam(bounds=[kotlin.Any])]])]/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator/dispatch.md +$dokka.location:com.chrynan.navigation/Navigator/reset/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator/reset.md +$dokka.location:com.chrynan.navigation/Navigator/store/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-navigator/store.md +$dokka.location:com.chrynan.navigation/SingleNavigationContext///PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/index.md +$dokka.location:com.chrynan.navigation/SingleNavigationContext/equals/#kotlin.Any?/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/equals.md +$dokka.location:com.chrynan.navigation/SingleNavigationContext/hashCode/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/hash-code.md +$dokka.location:com.chrynan.navigation/SingleNavigationContext/initialDestination/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/initial-destination.md +$dokka.location:com.chrynan.navigation/SingleNavigationContext/toString/#/PointingToDeclaration/navigation-core/navigation-core/com.chrynan.navigation/-single-navigation-context/to-string.md module:navigation-compose com.chrynan.navigation.compose module:navigation-core diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a2..8049c68 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/navigation-compose/api/android/navigation-compose.api b/navigation-compose/api/android/navigation-compose.api new file mode 100644 index 0000000..968e79d --- /dev/null +++ b/navigation-compose/api/android/navigation-compose.api @@ -0,0 +1,20 @@ +public final class com/chrynan/navigation/compose/BuildConfig { + public static final field BUILD_TYPE Ljava/lang/String; + public static final field DEBUG Z + public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; + public fun ()V +} + +public final class com/chrynan/navigation/compose/NavigationContainerKt { + public static final fun NavigationContainer (Lcom/chrynan/navigation/Navigator;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V +} + +public final class com/chrynan/navigation/compose/NavigationStateComposeUtilsKt { + public static final fun collectAsState (Lcom/chrynan/navigation/NavigationState;Landroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; +} + +public final class com/chrynan/navigation/compose/RememberComposeNavigatorUtilsKt { + public static final fun rememberNavigator (Lcom/chrynan/navigation/NavigationContext;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;Landroidx/compose/runtime/Composer;II)Lcom/chrynan/navigation/Navigator; + public static final fun rememberNavigator (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;Landroidx/compose/runtime/Composer;II)Lcom/chrynan/navigation/Navigator; +} + diff --git a/navigation-compose/api/jvm/navigation-compose.api b/navigation-compose/api/jvm/navigation-compose.api new file mode 100644 index 0000000..1d4be37 --- /dev/null +++ b/navigation-compose/api/jvm/navigation-compose.api @@ -0,0 +1,13 @@ +public final class com/chrynan/navigation/compose/NavigationContainerKt { + public static final fun NavigationContainer (Lcom/chrynan/navigation/Navigator;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V +} + +public final class com/chrynan/navigation/compose/NavigationStateComposeUtilsKt { + public static final fun collectAsState (Lcom/chrynan/navigation/NavigationState;Landroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; +} + +public final class com/chrynan/navigation/compose/RememberComposeNavigatorUtilsKt { + public static final fun rememberNavigator (Lcom/chrynan/navigation/NavigationContext;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;Landroidx/compose/runtime/Composer;II)Lcom/chrynan/navigation/Navigator; + public static final fun rememberNavigator (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;Landroidx/compose/runtime/Composer;II)Lcom/chrynan/navigation/Navigator; +} + diff --git a/navigation-compose/build.gradle.kts b/navigation-compose/build.gradle.kts index e037982..55da714 100644 --- a/navigation-compose/build.gradle.kts +++ b/navigation-compose/build.gradle.kts @@ -1,4 +1,5 @@ import com.chrynan.navigation.buildSrc.LibraryConstants +import com.chrynan.navigation.buildSrc.isBuildingOnOSX import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -23,8 +24,10 @@ kotlin { js(IR) { browser() } - ios() - iosSimulatorArm64() + if (isBuildingOnOSX()) { + ios() + iosSimulatorArm64() + } } sourceSets { all { @@ -37,8 +40,16 @@ kotlin { implementation(compose.runtime) implementation(compose.ui) implementation(compose.foundation) + + api("com.chrynan.parcelable:parcelable-core:_") + api("com.chrynan.parcelable:parcelable-compose:_") } } + if (isBuildingOnOSX()) { + val iosMain by sourceSets.getting + val iosSimulatorArm64Main by sourceSets.getting + iosSimulatorArm64Main.dependsOn(iosMain) + } } } @@ -83,7 +94,7 @@ android { tasks.withType { duplicatesStrategy = DuplicatesStrategy.INHERIT } dependencies { - implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1") + implementation(AndroidX.lifecycle.viewModelCompose) } afterEvaluate { diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeContextNavigationEvent.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeContextNavigationEvent.kt deleted file mode 100644 index 59920d6..0000000 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeContextNavigationEvent.kt +++ /dev/null @@ -1,12 +0,0 @@ -@file:Suppress("unused") - -package com.chrynan.navigation.compose - -/** - * - * @param [keyBackStackCount] The amount of keys in the back stack when first navigating to this [context]. - */ -internal data class ComposeContextNavigationEvent( - val context: Context, - val keyBackStackCount: Int -) diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigationScope.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigationScope.kt deleted file mode 100644 index 7a4b06f..0000000 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigationScope.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.chrynan.navigation.compose - -import com.chrynan.navigation.ExperimentalNavigationApi -import com.chrynan.navigation.NavigationScope - -@ExperimentalNavigationApi -interface ComposeNavigationScope : NavigationScope { - - companion object : ComposeNavigationScope -} diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigatorImpl.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigatorImpl.kt deleted file mode 100644 index 3623bfc..0000000 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigatorImpl.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.chrynan.navigation.compose - -import com.chrynan.navigation.* - -@ExperimentalNavigationApi -internal class ComposeNavigatorImpl>( - initialContext: Context -) : BaseNavigatorImpl>( - state = ComposeNavigatorStateImpl(initialContext = initialContext) -) diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigatorState.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigatorState.kt deleted file mode 100644 index 9972601..0000000 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/ComposeNavigatorState.kt +++ /dev/null @@ -1,36 +0,0 @@ -@file:Suppress("unused") - -package com.chrynan.navigation.compose - -import com.chrynan.navigation.* - -@ExperimentalNavigationApi -interface ComposeNavigationDestinationState : - NavigationDestinationState { - - companion object -} - -@ExperimentalNavigationApi -interface ComposeNavigationContextState> : - NavigationContextState { - - companion object -} - -@ExperimentalNavigationApi -interface ComposeNavigatorState> : - ComposeNavigationDestinationState, - ComposeNavigationContextState { - - companion object -} - -@ExperimentalNavigationApi -internal class ComposeNavigatorStateImpl>( - initialContext: Context -) : BaseNavigatorStateImpl(initialContext = initialContext), - ComposeNavigatorState { - - companion object -} diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/FlowStateUtils.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/FlowStateUtils.kt deleted file mode 100644 index f94edc4..0000000 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/FlowStateUtils.kt +++ /dev/null @@ -1,84 +0,0 @@ -@file:Suppress("unused") - -package com.chrynan.navigation.compose - -import androidx.compose.runtime.* -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.suspendCancellableCoroutine -import kotlinx.coroutines.withContext -import kotlin.coroutines.CoroutineContext -import kotlin.coroutines.EmptyCoroutineContext -import kotlin.experimental.ExperimentalTypeInference - -/** - * Similar to the [collectAsState] function but allows providing the [MutableState] to be used. - * - * @see [collectAsState] - */ -@Composable -internal fun Flow.collectAsStateIn( - state: MutableState, - context: CoroutineContext = EmptyCoroutineContext -): State = produceStateIn(state = state, this, context) { - if (context == EmptyCoroutineContext) { - collect { value = it } - } else withContext(context) { - collect { value = it } - } -} - -/** - * Similar to the [produceState] function but allows providing the [MutableState] to be used. - * - * @see [produceState] - */ -@Composable -@OptIn(ExperimentalTypeInference::class) -private fun produceStateIn( - state: MutableState, - @BuilderInference producer: suspend ProduceStateScope.() -> Unit -): State { - val result = remember { state } - - LaunchedEffect(Unit) { - ProduceStateScopeImpl(result, coroutineContext).producer() - } - - return result -} - -/** - * Similar to the [produceState] function but allows providing the [MutableState] to be used. - * - * @see [produceState] - */ -@Composable -@OptIn(ExperimentalTypeInference::class) -private fun produceStateIn( - state: MutableState, - vararg keys: Any?, - @BuilderInference producer: suspend ProduceStateScope.() -> Unit -): State { - val result = remember { state } - - @Suppress("CHANGING_ARGUMENTS_EXECUTION_ORDER_FOR_NAMED_VARARGS") - (LaunchedEffect(keys = keys) { - ProduceStateScopeImpl(state = result, coroutineContext = coroutineContext).producer() - }) - - return result -} - -private class ProduceStateScopeImpl( - state: MutableState, - override val coroutineContext: CoroutineContext -) : ProduceStateScope, MutableState by state { - - override suspend fun awaitDispose(onDispose: () -> Unit): Nothing { - try { - suspendCancellableCoroutine { } - } finally { - onDispose() - } - } -} diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavContainer.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavContainer.kt deleted file mode 100644 index b3b6300..0000000 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavContainer.kt +++ /dev/null @@ -1,61 +0,0 @@ -package com.chrynan.navigation.compose - -import androidx.compose.foundation.layout.Box -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import com.chrynan.navigation.ExperimentalNavigationApi -import com.chrynan.navigation.NavigationContext -import com.chrynan.navigation.NavigationDestination -import com.chrynan.navigation.Navigator - -/** - * A [Composable] that listens to navigation context and destination changes from the provided [navigator] and calls - * the provided [content] [Composable] function with the latest values. - * - * Example usage: - * ```kotlin - * NavContainer(navigator) { context, destination -> - * Text("context = $context; destination = $destination") - * } - * ``` - */ -@Composable -@ExperimentalNavigationApi -fun > NavContainer( - navigator: Navigator, - content: @Composable ComposeNavigationScope.(context: Context, destination: Destination) -> Unit -) { - val context = navigator.state.currentContextAsState() - val destination = navigator.state.currentDestinationAsState() - - content(ComposeNavigationScope, context.value, destination.value) -} - -/** - * A [Composable] that listens to navigation context and destination changes from the provided [navigator] and calls - * the provided [content] [Composable] function with the latest values. - * - * Example usage: - * ```kotlin - * NavContainer( - * navigator = navigator, - * modifier = modifier - * ) { context, destination -> - * Text("context = $context; destination = $destination") - * } - * ``` - */ -@Composable -@ExperimentalNavigationApi -fun > NavContainer( - navigator: Navigator, - modifier: Modifier, - content: @Composable ComposeNavigationScope.(context: Context, destination: Destination) -> Unit -) { - val context = navigator.state.currentContextAsState() - val destination = navigator.state.currentDestinationAsState() - - Box(modifier = modifier) { - content(ComposeNavigationScope, context.value, destination.value) - } -} diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavigationContainer.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavigationContainer.kt new file mode 100644 index 0000000..0654ac4 --- /dev/null +++ b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavigationContainer.kt @@ -0,0 +1,37 @@ +package com.chrynan.navigation.compose + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxScope +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import com.chrynan.navigation.* + +/** + * A [Composable] that listens to navigation context and destination changes from the provided [navigator] and calls + * the provided [content] [Composable] function with the latest values. + * + * Example usage: + * ```kotlin + * NavContainer( + * navigator = navigator, + * modifier = modifier + * ) { (context, destination) -> + * Text("context = $context; destination = $destination") + * } + * ``` + */ +@Suppress("FunctionName") +@Composable +@ExperimentalNavigationApi +fun > NavigationContainer( + navigator: Navigator, + modifier: Modifier = Modifier, + content: @Composable BoxScope.(destinationAndContext: DestinationAndContext) -> Unit +) { + val context = navigator.store.context.collectAsState() + val destination = navigator.store.destination.collectAsState() + + Box(modifier = modifier) { + content(this, DestinationAndContext(context = context.value, destination = destination.value)) + } +} diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavigationStateComposeUtils.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavigationStateComposeUtils.kt new file mode 100644 index 0000000..e25338d --- /dev/null +++ b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/NavigationStateComposeUtils.kt @@ -0,0 +1,15 @@ +package com.chrynan.navigation.compose + +import androidx.compose.runtime.Composable +import androidx.compose.runtime.State +import androidx.compose.runtime.collectAsState +import com.chrynan.navigation.NavigationState +import kotlinx.coroutines.flow.StateFlow + +/** + * Converts the [NavigationState.changes] of this [NavigationState] to a Jetpack Compose [State] so that every change + * causes a recomposition of the calling [Composable] function. + */ +@Composable +fun NavigationState.collectAsState(): State = + (this.changes as? StateFlow)?.collectAsState() ?: this.changes.collectAsState(initial = this.initial) diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/RememberComposeNavigatorUtils.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/RememberComposeNavigatorUtils.kt index 8d64241..0fe6ecf 100644 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/RememberComposeNavigatorUtils.kt +++ b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/RememberComposeNavigatorUtils.kt @@ -5,84 +5,204 @@ package com.chrynan.navigation.compose import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import com.chrynan.navigation.* +import com.chrynan.parcelable.compose.rememberSavable +import com.chrynan.parcelable.core.Parcelable +import kotlinx.serialization.ExperimentalSerializationApi +import kotlinx.serialization.KSerializer +import kotlinx.serialization.serializer /** - * Creates and remembers a [Navigator]. A [Navigator] can be used to navigate between different UI content in an - * application. + * Creates and remembers a [Navigator] with a [SingleNavigationContext]. A [Navigator] can be used to navigate between + * different UI content in an application. * * Example usage: * ```kotlin * val navigator = rememberNavigator(initialDestination = "Greeting") + * ``` * - * // The NavContainer will start by displaying the initial content, which in this case is "Hello" - * NavContainer(navigator) { _, key -> - * when (key) { - * "Greeting" -> Text("Hello") - * "Farewell" -> Text("Good-bye") - * else -> Text("Unexpected Key: $key") - * } - * } + * @param [initialDestination] The initial [NavigationDestination] value to start at for this [Navigator]. + * @param [duplicateDestinationStrategy] The [NavigationStrategy.DuplicateDestination] strategy for handling of + * duplicate destination content within a [NavigationContext] stack. Read the documentation on + * [NavigationStrategy.DuplicateDestination] for more information about the supported operations. Defaults to + * [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES]. + * @param [destinationRetentionStrategy] The [NavigationStrategy.DestinationRetention] strategy for handling of + * destination stacks within a [NavigationContext] when navigating between different [NavigationContext]s. Read the + * documentation on [NavigationStrategy.DestinationRetention] for more information about the supported operations. + * Defaults to [NavigationStrategy.DestinationRetention.RETAIN]. * - * // The above NavContainer will display "Good Bye" after the following call: - * navigator.goTo("Farewell") + * @return A remembered [Navigator] instance constructed using the provided values. * - * // Goes back to the initial content: "Hello": - * navigator.goBack() + * @see [rememberNavigator] For a version of this function that supports multiple [NavigationContext]s. + * @see [rememberSavableNavigator] For a version of this function that saves the navigator across configuration + * changes. + * @see [NavigationContainer] To display the [Composable] content for the current navigation context and keys. + * @see [Navigator] For constructor functions that can be invoked outside [Composable] functions. + */ +@ExperimentalNavigationApi +@Composable +fun rememberNavigator( + initialDestination: Destination, + duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, + destinationRetentionStrategy: NavigationStrategy.DestinationRetention = NavigationStrategy.DestinationRetention.RETAIN +): Navigator> = remember { + Navigator( + initialDestination = initialDestination, + duplicateDestinationStrategy = duplicateDestinationStrategy, + destinationRetentionStrategy = destinationRetentionStrategy + ) +} + +/** + * Creates and remembers a [Navigator] with a [SingleNavigationContext]. A [Navigator] can be used to navigate between + * different UI content in an application. + * + * Example usage: + * ```kotlin + * val navigator = rememberNavigator(initialContext = MainContext.HOME) * ``` * - * **Note:** Use the [NavContainer] to display the [Composable] content for the current navigation context and keys. + * @param [initialContext] The initial [NavigationContext] value to start at for this [Navigator]. + * @param [duplicateDestinationStrategy] The [NavigationStrategy.DuplicateDestination] strategy for handling of + * duplicate destination content within a [Context] stack. Read the documentation on + * [NavigationStrategy.DuplicateDestination] for more information about the supported operations. Defaults to + * [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES]. + * @param [destinationRetentionStrategy] The [NavigationStrategy.DestinationRetention] strategy for handling of + * destination stacks within a [Context] when navigating between different [NavigationContext]s. Read the documentation + * on [NavigationStrategy.DestinationRetention] for more information about the supported operations. Defaults to + * [NavigationStrategy.DestinationRetention.RETAIN]. * - * **Note:** This function differs slightly from the [rememberNavigator] function in that it only uses a single - * scope of type [Nothing]. This means that scopes cannot be changed on the returned [ComposeNavigatorImpl]. + * @return A remembered [Navigator] instance constructed using the provided values. * - * @see [rememberNavigator] + * @see [rememberNavigator] For a version of this function with only a single [NavigationContext]. + * @see [rememberSavableNavigator] For a version of this function that saves the navigator across configuration + * changes. + * @see [NavigationContainer] To display the [Composable] content for the current navigation context and keys. + * @see [Navigator] For constructor functions that can be invoked outside [Composable] functions. */ @ExperimentalNavigationApi @Composable -fun rememberNavigator( - initialDestination: Destination -): Navigator> = remember { - ComposeNavigatorImpl(initialContext = SingleNavigationContext(initialDestination = initialDestination)) +fun > rememberNavigator( + initialContext: Context, + duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, + destinationRetentionStrategy: NavigationStrategy.DestinationRetention = NavigationStrategy.DestinationRetention.RETAIN +): Navigator = remember { + Navigator( + initialContext = initialContext, + duplicateDestinationStrategy = duplicateDestinationStrategy, + destinationRetentionStrategy = destinationRetentionStrategy + ) } /** - * Creates and remembers a [Navigator]. A [Navigator] can be used to navigate between different UI content in an - * application. + * Creates, remembers and saves a [Navigator] with a [SingleNavigationContext]. A [Navigator] can be used to navigate + * between different UI content in an application. This differs from the [rememberNavigator] function in that it allows + * restoring the [Navigator] state between configuration changes via the [rememberSavable] function and using the + * provided [KSerializer]s. * * Example usage: * ```kotlin - * val navigator = rememberNavigator(initialContext = BottomNavBarItem.HELLO) + * val navigator = rememberNavigator(initialDestination = "Greeting") + * ``` * - * // The NavContainer will start by displaying the initial content, which in this case is "Hello" - * NavContainer(navigator) { context, key -> - * when (key) { - * "Greeting" -> Text("Hello") - * "Farewell" -> Text("Good-bye") - * else -> Text("Unexpected Key: $key") - * } - * } + * @param [initialDestination] The initial [NavigationDestination] value to start at for this [Navigator]. + * @param [parcelable] The [Parcelable] instance that is used to store and retrieve the [Navigator] instance between + * configuration changes. + * @param [destinationSerializer] The [KSerializer] for the [Destination] type. + * @param [duplicateDestinationStrategy] The [NavigationStrategy.DuplicateDestination] strategy for handling of + * duplicate destination content within a [NavigationContext] stack. Read the documentation on + * [NavigationStrategy.DuplicateDestination] for more information about the supported operations. Defaults to + * [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES]. + * @param [destinationRetentionStrategy] The [NavigationStrategy.DestinationRetention] strategy for handling of + * destination stacks within a [NavigationContext] when navigating between different [NavigationContext]s. Read the + * documentation on [NavigationStrategy.DestinationRetention] for more information about the supported operations. + * Defaults to [NavigationStrategy.DestinationRetention.RETAIN]. * - * // The above NavContainer will display "Good Bye" after the following call: - * navigator.goTo("Farewell") + * @return A remembered [Navigator] instance constructed using the provided values. * - * // Goes back to the initial content: "Hello": - * navigator.goBack() + * @see [rememberNavigator] For a version of this function that supports multiple [NavigationContext]s. + * @see [rememberSavableNavigator] For a version of this function that saves the navigator across configuration + * changes. + * @see [NavigationContainer] To display the [Composable] content for the current navigation context and keys. + * @see [Navigator] For constructor functions that can be invoked outside [Composable] functions. + */ +@ExperimentalSerializationApi +@ExperimentalNavigationApi +@Composable +inline fun rememberSavableNavigator( + initialDestination: Destination, + parcelable: Parcelable = Parcelable.Default, + destinationSerializer: KSerializer = parcelable.serializersModule.serializer(), + duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, + destinationRetentionStrategy: NavigationStrategy.DestinationRetention = NavigationStrategy.DestinationRetention.RETAIN +): Navigator> = + rememberSavable( + parcelable = parcelable, + serializer = Navigator.serializer( + destinationSerializer, + SingleNavigationContext.serializer(destinationSerializer) + ) + ) { + Navigator( + initialDestination = initialDestination, + duplicateDestinationStrategy = duplicateDestinationStrategy, + destinationRetentionStrategy = destinationRetentionStrategy + ) + } + +/** + * Creates, remembers and saves a [Navigator] with a [SingleNavigationContext]. A [Navigator] can be used to navigate + * between different UI content in an application. This differs from the [rememberNavigator] function in that it allows + * restoring the [Navigator] state between configuration changes via the [rememberSavable] function and using the + * provided [KSerializer]s. * - * // Changes the scope to BottomNavBarItem.GOODBYE and displays its initial key, which in this case is "Farewell" - * navigator.changeContext(BottomNavBarItem.GOODBYE) + * Example usage: + * ```kotlin + * val navigator = rememberNavigator(initialDestination = "Greeting") * ``` * - * **Note:** Use the [NavContainer] to display the [Composable] content for the current navigation context and keys. + * @param [initialContext] The initial [NavigationContext] value to start at for this [Navigator]. + * @param [parcelable] The [Parcelable] instance that is used to store and retrieve the [Navigator] instance between + * configuration changes. + * @param [destinationSerializer] The [KSerializer] for the [Destination] type. + * @param [contextSerializer] The [KSerializer] for the [Context] type. + * @param [duplicateDestinationStrategy] The [NavigationStrategy.DuplicateDestination] strategy for handling of + * duplicate destination content within a [NavigationContext] stack. Read the documentation on + * [NavigationStrategy.DuplicateDestination] for more information about the supported operations. Defaults to + * [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES]. + * @param [destinationRetentionStrategy] The [NavigationStrategy.DestinationRetention] strategy for handling of + * destination stacks within a [NavigationContext] when navigating between different [NavigationContext]s. Read the + * documentation on [NavigationStrategy.DestinationRetention] for more information about the supported operations. + * Defaults to [NavigationStrategy.DestinationRetention.RETAIN]. * - * **Note:** That this function differs slightly from the [rememberNavigator] function in that this function allows - * changing of scopes, which is useful for more complex navigation. + * @return A remembered [Navigator] instance constructed using the provided values. * - * @see [rememberNavigator] + * @see [rememberNavigator] For a version of this function that supports multiple [NavigationContext]s. + * @see [rememberSavableNavigator] For a version of this function that saves the navigator across configuration + * changes. + * @see [NavigationContainer] To display the [Composable] content for the current navigation context and keys. + * @see [Navigator] For constructor functions that can be invoked outside [Composable] functions. */ +@ExperimentalSerializationApi @ExperimentalNavigationApi @Composable -fun > rememberNavigator( - initialContext: Context -): Navigator = remember { - ComposeNavigatorImpl(initialContext = initialContext) -} +inline fun > rememberSavableNavigator( + initialContext: Context, + parcelable: Parcelable = Parcelable.Default, + destinationSerializer: KSerializer = parcelable.serializersModule.serializer(), + contextSerializer: KSerializer = parcelable.serializersModule.serializer(), + duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, + destinationRetentionStrategy: NavigationStrategy.DestinationRetention = NavigationStrategy.DestinationRetention.RETAIN +): Navigator = + rememberSavable( + parcelable = parcelable, + serializer = Navigator.serializer( + destinationSerializer, + contextSerializer + ) + ) { + Navigator( + initialContext = initialContext, + duplicateDestinationStrategy = duplicateDestinationStrategy, + destinationRetentionStrategy = destinationRetentionStrategy + ) + } diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/SaveableContextStack.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/SaveableContextStack.kt deleted file mode 100644 index dc7805b..0000000 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/SaveableContextStack.kt +++ /dev/null @@ -1,4 +0,0 @@ -package com.chrynan.navigation.compose - -class SaveableContextStack { -} \ No newline at end of file diff --git a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/StateUtils.kt b/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/StateUtils.kt deleted file mode 100644 index 4ed778f..0000000 --- a/navigation-compose/src/commonMain/kotlin/com.chrynan.navigation.compose/StateUtils.kt +++ /dev/null @@ -1,90 +0,0 @@ -@file:Suppress("unused") - -package com.chrynan.navigation.compose - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.State -import androidx.compose.runtime.collectAsState -import com.chrynan.navigation.* - -/** - * Obtains the changes to the [ComposeNavigationDestinationState.currentDestination] value and returns it as a [State]. This allows it to be - * used in a [Composable] and cause recomposition when the value changes. - * - * If you just need to get the current key value and do not need to cause recomposition when the value changes, simply - * use the [ComposeNavigationDestinationState.currentDestination] property. - * - * **Note:** Internally this function uses the [ComposeNavigationDestinationState.destinationChanges] Flow and the [collectAsState] function - * using the [ComposeNavigationDestinationState.currentDestination] as the initial value. - * - * @see [ComposeNavigationDestinationState.currentDestination] - * @see [ComposeNavigationDestinationState.destinationChanges] - * @see [collectAsState] - */ -@ExperimentalNavigationApi -@Composable -fun NavigationDestinationState.currentDestinationAsState( - initialCurrentKey: Destination -): State = destinationChanges.collectAsState(initial = initialCurrentKey) - -/** - * Obtains the changes to the [ComposeNavigationDestinationState.currentDestination] value and returns it as a [State]. This allows it to be - * used in a [Composable] and cause recomposition when the value changes. - * - * If you just need to get the current key value and do not need to cause recomposition when the value changes, simply - * use the [ComposeNavigationDestinationState.currentDestination] property. - * - * **Note:** Internally this function uses the [ComposeNavigationDestinationState.destinationChanges] Flow and the [collectAsState] function - * using the [ComposeNavigationDestinationState.currentDestination] as the initial value. - * - * @see [ComposeNavigationDestinationState.currentDestination] - * @see [ComposeNavigationDestinationState.destinationChanges] - * @see [collectAsState] - */ -// **Note:** For some reason adding a default value to the `initialCurrentKey` parameter in the [currentKeyAsState] -// function is causing an issue so this function is needed for the default case. -@ExperimentalNavigationApi -@Composable -fun NavigationDestinationState.currentDestinationAsState(): State = - destinationChanges.collectAsState(initial = currentDestination) - -/** - * Obtains the changes to the [ComposeNavigationContextState.currentContext] value and returns it as a [State]. This allows it - * to be used in a [Composable] and cause recomposition when the value changes. - * - * If you just need to get the current scope value and do not need to cause recomposition when the value changes, simply - * use the [ComposeNavigationContextState.currentContext] property. - * - * **Note:** Internally this function uses the [ComposeNavigationContextState.contextChanges] Flow and the [collectAsState] - * function using the [ComposeNavigationContextState.currentContext] as the initial value. - * - * @see [ComposeNavigationContextState.currentContext] - * @see [ComposeNavigationContextState.contextChanges] - * @see [collectAsState] - */ -@ExperimentalNavigationApi -@Composable -fun > NavigationContextState.currentContextAsState( - initialCurrentContext: Context -): State = contextChanges.collectAsState(initial = initialCurrentContext) - -/** - * Obtains the changes to the [ComposeNavigationContextState.currentContext] value and returns it as a [State]. This allows it - * to be used in a [Composable] and cause recomposition when the value changes. - * - * If you just need to get the current scope value and do not need to cause recomposition when the value changes, simply - * use the [ComposeNavigationContextState.currentContext] property. - * - * **Note:** Internally this function uses the [ComposeNavigationContextState.contextChanges] Flow and the [collectAsState] - * function using the [ComposeNavigationContextState.currentContext] as the initial value. - * - * @see [ComposeNavigationContextState.currentContext] - * @see [ComposeNavigationContextState.contextChanges] - * @see [collectAsState] - */ -// **Note:** For some reason adding a default value to the `initialCurrentScope` parameter in the [currentScopeAsState] -// function is causing an issue so this function is needed for the default case. -@ExperimentalNavigationApi -@Composable -fun > NavigationContextState.currentContextAsState(): State = - contextChanges.collectAsState(initial = currentContext) diff --git a/navigation-core/api/android/navigation-core.api b/navigation-core/api/android/navigation-core.api new file mode 100644 index 0000000..7a868db --- /dev/null +++ b/navigation-core/api/android/navigation-core.api @@ -0,0 +1,287 @@ +public final class com/chrynan/navigation/DestinationAndContext { + public static final field Companion Lcom/chrynan/navigation/DestinationAndContext$Companion; + public synthetic fun (ILjava/lang/Object;Lcom/chrynan/navigation/NavigationContext;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationContext;)V + public final fun component1 ()Ljava/lang/Object; + public final fun component2 ()Lcom/chrynan/navigation/NavigationContext; + public final fun copy (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationContext;)Lcom/chrynan/navigation/DestinationAndContext; + public static synthetic fun copy$default (Lcom/chrynan/navigation/DestinationAndContext;Ljava/lang/Object;Lcom/chrynan/navigation/NavigationContext;ILjava/lang/Object;)Lcom/chrynan/navigation/DestinationAndContext; + public fun equals (Ljava/lang/Object;)Z + public final fun getContext ()Lcom/chrynan/navigation/NavigationContext; + public final fun getDestination ()Ljava/lang/Object; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/DestinationAndContext;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V +} + +public final class com/chrynan/navigation/DestinationAndContext$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public synthetic fun (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/DestinationAndContext; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/DestinationAndContext;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/DestinationAndContext$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public abstract interface annotation class com/chrynan/navigation/ExperimentalNavigationApi : java/lang/annotation/Annotation { +} + +public abstract interface class com/chrynan/navigation/NavigationContext { + public static final field Companion Lcom/chrynan/navigation/NavigationContext$Companion; + public abstract fun getInitialDestination ()Ljava/lang/Object; +} + +public final class com/chrynan/navigation/NavigationContext$Companion { +} + +public abstract class com/chrynan/navigation/NavigationEvent { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Companion; + public abstract fun getDirection ()Lcom/chrynan/navigation/NavigationEvent$Direction; + public abstract fun getElapsedMilliseconds ()J + public abstract fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; +} + +public abstract class com/chrynan/navigation/NavigationEvent$Backward : com/chrynan/navigation/NavigationEvent { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Backward$Companion; + public fun getDirection ()Lcom/chrynan/navigation/NavigationEvent$Direction; +} + +public final class com/chrynan/navigation/NavigationEvent$Backward$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Backward$Context : com/chrynan/navigation/NavigationEvent$Backward { + public fun ()V + public fun equals (Ljava/lang/Object;)Z + public fun getElapsedMilliseconds ()J + public fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class com/chrynan/navigation/NavigationEvent$Backward$Destination : com/chrynan/navigation/NavigationEvent$Backward { + public fun ()V + public fun equals (Ljava/lang/Object;)Z + public fun getElapsedMilliseconds ()J + public fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class com/chrynan/navigation/NavigationEvent$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Direction : java/lang/Enum { + public static final field BACKWARDS Lcom/chrynan/navigation/NavigationEvent$Direction; + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Direction$Companion; + public static final field FORWARDS Lcom/chrynan/navigation/NavigationEvent$Direction; + public final fun getSerialName ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/NavigationEvent$Direction; + public static fun values ()[Lcom/chrynan/navigation/NavigationEvent$Direction; +} + +public final class com/chrynan/navigation/NavigationEvent$Direction$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public abstract class com/chrynan/navigation/NavigationEvent$Forward : com/chrynan/navigation/NavigationEvent { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Forward$Companion; + public fun getDirection ()Lcom/chrynan/navigation/NavigationEvent$Direction; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Context : com/chrynan/navigation/NavigationEvent$Forward { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Forward$Context$Companion; + public synthetic fun (IJLcom/chrynan/navigation/NavigationContext;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getContext ()Lcom/chrynan/navigation/NavigationContext; + public fun getElapsedMilliseconds ()J + public fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/NavigationEvent$Forward$Context;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Context$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public synthetic fun (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/NavigationEvent$Forward$Context; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/NavigationEvent$Forward$Context;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Context$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Destination : com/chrynan/navigation/NavigationEvent$Forward { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Forward$Destination$Companion; + public synthetic fun (IJLjava/lang/Object;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getDestination ()Ljava/lang/Object; + public fun getElapsedMilliseconds ()J + public fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/NavigationEvent$Forward$Destination;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Destination$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public synthetic fun (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/NavigationEvent$Forward$Destination; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/NavigationEvent$Forward$Destination;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Destination$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Type : java/lang/Enum { + public static final field BACKWARD_CONTEXT Lcom/chrynan/navigation/NavigationEvent$Type; + public static final field BACKWARD_DESTINATION Lcom/chrynan/navigation/NavigationEvent$Type; + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Type$Companion; + public static final field FORWARD_CONTEXT Lcom/chrynan/navigation/NavigationEvent$Type; + public static final field FORWARD_DESTINATION Lcom/chrynan/navigation/NavigationEvent$Type; + public final fun getSerialName ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/NavigationEvent$Type; + public static fun values ()[Lcom/chrynan/navigation/NavigationEvent$Type; +} + +public final class com/chrynan/navigation/NavigationEvent$Type$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public abstract interface class com/chrynan/navigation/NavigationState { + public static final field Companion Lcom/chrynan/navigation/NavigationState$Companion; + public abstract fun getChanges ()Lkotlinx/coroutines/flow/Flow; + public abstract fun getCurrent ()Ljava/lang/Object; + public abstract fun getInitial ()Ljava/lang/Object; +} + +public final class com/chrynan/navigation/NavigationState$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public abstract interface class com/chrynan/navigation/NavigationStateStore { + public static final field Companion Lcom/chrynan/navigation/NavigationStateStore$Companion; + public abstract fun getContext ()Lcom/chrynan/navigation/NavigationState; + public abstract fun getDestination ()Lcom/chrynan/navigation/NavigationState; + public abstract fun getEvent ()Lcom/chrynan/navigation/NavigationState; +} + +public final class com/chrynan/navigation/NavigationStateStore$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public abstract interface class com/chrynan/navigation/NavigationStrategy { + public static final field Companion Lcom/chrynan/navigation/NavigationStrategy$Companion; +} + +public final class com/chrynan/navigation/NavigationStrategy$Companion { +} + +public final class com/chrynan/navigation/NavigationStrategy$DestinationRetention : java/lang/Enum { + public static final field CLEAR Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention; + public static final field Companion Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention$Companion; + public static final field RETAIN Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention; + public final fun getSerialName ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention; + public static fun values ()[Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention; +} + +public final class com/chrynan/navigation/NavigationStrategy$DestinationRetention$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationStrategy$DuplicateDestination : java/lang/Enum { + public static final field ALLOW_DUPLICATES Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination; + public static final field CLEAR_TO_ORIGINAL Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination; + public static final field Companion Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination$Companion; + public final fun getSerialName ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination; + public static fun values ()[Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination; +} + +public final class com/chrynan/navigation/NavigationStrategy$DuplicateDestination$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public abstract class com/chrynan/navigation/NavigationViewModel : androidx/lifecycle/ViewModel { +} + +public abstract interface class com/chrynan/navigation/Navigator { + public static final field Companion Lcom/chrynan/navigation/Navigator$Companion; + public abstract fun canPopContext ()Z + public abstract fun canPopDestination ()Z + public abstract fun dispatch (Lcom/chrynan/navigation/NavigationEvent;)Z + public abstract fun getStore ()Lcom/chrynan/navigation/NavigationStateStore; + public abstract fun reset ()V +} + +public final class com/chrynan/navigation/Navigator$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigatorKt { + public static final fun Navigator (Lcom/chrynan/navigation/NavigationContext;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;)Lcom/chrynan/navigation/Navigator; + public static final fun Navigator (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;)Lcom/chrynan/navigation/Navigator; + public static synthetic fun Navigator$default (Lcom/chrynan/navigation/NavigationContext;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;ILjava/lang/Object;)Lcom/chrynan/navigation/Navigator; + public static synthetic fun Navigator$default (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;ILjava/lang/Object;)Lcom/chrynan/navigation/Navigator; + public static final fun changeContext (Lcom/chrynan/navigation/Navigator;Lcom/chrynan/navigation/NavigationContext;)Z + public static final fun goTo (Lcom/chrynan/navigation/Navigator;Ljava/lang/Object;)Z + public static final fun popContext (Lcom/chrynan/navigation/Navigator;)Z + public static final fun popDestination (Lcom/chrynan/navigation/Navigator;)Z + public static final fun push (Lcom/chrynan/navigation/Navigator;Lcom/chrynan/navigation/NavigationContext;)Z + public static final fun push (Lcom/chrynan/navigation/Navigator;Ljava/lang/Object;)Z +} + +public final class com/chrynan/navigation/SingleNavigationContext : com/chrynan/navigation/NavigationContext { + public static final field Companion Lcom/chrynan/navigation/SingleNavigationContext$Companion; + public synthetic fun (ILjava/lang/Object;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public fun getInitialDestination ()Ljava/lang/Object; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/SingleNavigationContext;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;)V +} + +public final class com/chrynan/navigation/SingleNavigationContext$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public synthetic fun (Lkotlinx/serialization/KSerializer;)V + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/SingleNavigationContext; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/SingleNavigationContext;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/SingleNavigationContext$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/android/BuildConfig { + public static final field BUILD_TYPE Ljava/lang/String; + public static final field DEBUG Z + public static final field LIBRARY_PACKAGE_NAME Ljava/lang/String; + public fun ()V +} + diff --git a/navigation-core/api/jvm/navigation-core.api b/navigation-core/api/jvm/navigation-core.api new file mode 100644 index 0000000..8509f9c --- /dev/null +++ b/navigation-core/api/jvm/navigation-core.api @@ -0,0 +1,280 @@ +public final class com/chrynan/navigation/DestinationAndContext { + public static final field Companion Lcom/chrynan/navigation/DestinationAndContext$Companion; + public synthetic fun (ILjava/lang/Object;Lcom/chrynan/navigation/NavigationContext;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationContext;)V + public final fun component1 ()Ljava/lang/Object; + public final fun component2 ()Lcom/chrynan/navigation/NavigationContext; + public final fun copy (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationContext;)Lcom/chrynan/navigation/DestinationAndContext; + public static synthetic fun copy$default (Lcom/chrynan/navigation/DestinationAndContext;Ljava/lang/Object;Lcom/chrynan/navigation/NavigationContext;ILjava/lang/Object;)Lcom/chrynan/navigation/DestinationAndContext; + public fun equals (Ljava/lang/Object;)Z + public final fun getContext ()Lcom/chrynan/navigation/NavigationContext; + public final fun getDestination ()Ljava/lang/Object; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/DestinationAndContext;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V +} + +public final class com/chrynan/navigation/DestinationAndContext$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public synthetic fun (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/DestinationAndContext; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/DestinationAndContext;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/DestinationAndContext$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public abstract interface annotation class com/chrynan/navigation/ExperimentalNavigationApi : java/lang/annotation/Annotation { +} + +public abstract interface class com/chrynan/navigation/NavigationContext { + public static final field Companion Lcom/chrynan/navigation/NavigationContext$Companion; + public abstract fun getInitialDestination ()Ljava/lang/Object; +} + +public final class com/chrynan/navigation/NavigationContext$Companion { +} + +public abstract class com/chrynan/navigation/NavigationEvent { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Companion; + public abstract fun getDirection ()Lcom/chrynan/navigation/NavigationEvent$Direction; + public abstract fun getElapsedMilliseconds ()J + public abstract fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; +} + +public abstract class com/chrynan/navigation/NavigationEvent$Backward : com/chrynan/navigation/NavigationEvent { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Backward$Companion; + public fun getDirection ()Lcom/chrynan/navigation/NavigationEvent$Direction; +} + +public final class com/chrynan/navigation/NavigationEvent$Backward$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Backward$Context : com/chrynan/navigation/NavigationEvent$Backward { + public fun ()V + public fun equals (Ljava/lang/Object;)Z + public fun getElapsedMilliseconds ()J + public fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class com/chrynan/navigation/NavigationEvent$Backward$Destination : com/chrynan/navigation/NavigationEvent$Backward { + public fun ()V + public fun equals (Ljava/lang/Object;)Z + public fun getElapsedMilliseconds ()J + public fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class com/chrynan/navigation/NavigationEvent$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Direction : java/lang/Enum { + public static final field BACKWARDS Lcom/chrynan/navigation/NavigationEvent$Direction; + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Direction$Companion; + public static final field FORWARDS Lcom/chrynan/navigation/NavigationEvent$Direction; + public final fun getSerialName ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/NavigationEvent$Direction; + public static fun values ()[Lcom/chrynan/navigation/NavigationEvent$Direction; +} + +public final class com/chrynan/navigation/NavigationEvent$Direction$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public abstract class com/chrynan/navigation/NavigationEvent$Forward : com/chrynan/navigation/NavigationEvent { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Forward$Companion; + public fun getDirection ()Lcom/chrynan/navigation/NavigationEvent$Direction; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Context : com/chrynan/navigation/NavigationEvent$Forward { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Forward$Context$Companion; + public synthetic fun (IJLcom/chrynan/navigation/NavigationContext;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getContext ()Lcom/chrynan/navigation/NavigationContext; + public fun getElapsedMilliseconds ()J + public fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/NavigationEvent$Forward$Context;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Context$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public synthetic fun (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/NavigationEvent$Forward$Context; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/NavigationEvent$Forward$Context;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Context$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Destination : com/chrynan/navigation/NavigationEvent$Forward { + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Forward$Destination$Companion; + public synthetic fun (IJLjava/lang/Object;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getDestination ()Ljava/lang/Object; + public fun getElapsedMilliseconds ()J + public fun getType ()Lcom/chrynan/navigation/NavigationEvent$Type; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/NavigationEvent$Forward$Destination;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Destination$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public synthetic fun (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)V + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/NavigationEvent$Forward$Destination; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/NavigationEvent$Forward$Destination;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Forward$Destination$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationEvent$Type : java/lang/Enum { + public static final field BACKWARD_CONTEXT Lcom/chrynan/navigation/NavigationEvent$Type; + public static final field BACKWARD_DESTINATION Lcom/chrynan/navigation/NavigationEvent$Type; + public static final field Companion Lcom/chrynan/navigation/NavigationEvent$Type$Companion; + public static final field FORWARD_CONTEXT Lcom/chrynan/navigation/NavigationEvent$Type; + public static final field FORWARD_DESTINATION Lcom/chrynan/navigation/NavigationEvent$Type; + public final fun getSerialName ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/NavigationEvent$Type; + public static fun values ()[Lcom/chrynan/navigation/NavigationEvent$Type; +} + +public final class com/chrynan/navigation/NavigationEvent$Type$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public abstract interface class com/chrynan/navigation/NavigationState { + public static final field Companion Lcom/chrynan/navigation/NavigationState$Companion; + public abstract fun getChanges ()Lkotlinx/coroutines/flow/Flow; + public abstract fun getCurrent ()Ljava/lang/Object; + public abstract fun getInitial ()Ljava/lang/Object; +} + +public final class com/chrynan/navigation/NavigationState$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public abstract interface class com/chrynan/navigation/NavigationStateStore { + public static final field Companion Lcom/chrynan/navigation/NavigationStateStore$Companion; + public abstract fun getContext ()Lcom/chrynan/navigation/NavigationState; + public abstract fun getDestination ()Lcom/chrynan/navigation/NavigationState; + public abstract fun getEvent ()Lcom/chrynan/navigation/NavigationState; +} + +public final class com/chrynan/navigation/NavigationStateStore$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public abstract interface class com/chrynan/navigation/NavigationStrategy { + public static final field Companion Lcom/chrynan/navigation/NavigationStrategy$Companion; +} + +public final class com/chrynan/navigation/NavigationStrategy$Companion { +} + +public final class com/chrynan/navigation/NavigationStrategy$DestinationRetention : java/lang/Enum { + public static final field CLEAR Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention; + public static final field Companion Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention$Companion; + public static final field RETAIN Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention; + public final fun getSerialName ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention; + public static fun values ()[Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention; +} + +public final class com/chrynan/navigation/NavigationStrategy$DestinationRetention$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigationStrategy$DuplicateDestination : java/lang/Enum { + public static final field ALLOW_DUPLICATES Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination; + public static final field CLEAR_TO_ORIGINAL Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination; + public static final field Companion Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination$Companion; + public final fun getSerialName ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination; + public static fun values ()[Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination; +} + +public final class com/chrynan/navigation/NavigationStrategy$DuplicateDestination$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public abstract class com/chrynan/navigation/NavigationViewModel { +} + +public abstract interface class com/chrynan/navigation/Navigator { + public static final field Companion Lcom/chrynan/navigation/Navigator$Companion; + public abstract fun canPopContext ()Z + public abstract fun canPopDestination ()Z + public abstract fun dispatch (Lcom/chrynan/navigation/NavigationEvent;)Z + public abstract fun getStore ()Lcom/chrynan/navigation/NavigationStateStore; + public abstract fun reset ()V +} + +public final class com/chrynan/navigation/Navigator$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/NavigatorKt { + public static final fun Navigator (Lcom/chrynan/navigation/NavigationContext;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;)Lcom/chrynan/navigation/Navigator; + public static final fun Navigator (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;)Lcom/chrynan/navigation/Navigator; + public static synthetic fun Navigator$default (Lcom/chrynan/navigation/NavigationContext;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;ILjava/lang/Object;)Lcom/chrynan/navigation/Navigator; + public static synthetic fun Navigator$default (Ljava/lang/Object;Lcom/chrynan/navigation/NavigationStrategy$DuplicateDestination;Lcom/chrynan/navigation/NavigationStrategy$DestinationRetention;ILjava/lang/Object;)Lcom/chrynan/navigation/Navigator; + public static final fun changeContext (Lcom/chrynan/navigation/Navigator;Lcom/chrynan/navigation/NavigationContext;)Z + public static final fun goTo (Lcom/chrynan/navigation/Navigator;Ljava/lang/Object;)Z + public static final fun popContext (Lcom/chrynan/navigation/Navigator;)Z + public static final fun popDestination (Lcom/chrynan/navigation/Navigator;)Z + public static final fun push (Lcom/chrynan/navigation/Navigator;Lcom/chrynan/navigation/NavigationContext;)Z + public static final fun push (Lcom/chrynan/navigation/Navigator;Ljava/lang/Object;)Z +} + +public final class com/chrynan/navigation/SingleNavigationContext : com/chrynan/navigation/NavigationContext { + public static final field Companion Lcom/chrynan/navigation/SingleNavigationContext$Companion; + public synthetic fun (ILjava/lang/Object;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public fun getInitialDestination ()Ljava/lang/Object; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/SingleNavigationContext;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;)V +} + +public final class com/chrynan/navigation/SingleNavigationContext$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public synthetic fun (Lkotlinx/serialization/KSerializer;)V + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/SingleNavigationContext; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/SingleNavigationContext;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/SingleNavigationContext$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + diff --git a/navigation-core/build.gradle.kts b/navigation-core/build.gradle.kts index eb13c28..9affc34 100644 --- a/navigation-core/build.gradle.kts +++ b/navigation-core/build.gradle.kts @@ -1,4 +1,7 @@ import com.chrynan.navigation.buildSrc.LibraryConstants +import com.chrynan.navigation.buildSrc.isBuildingOnLinux +import com.chrynan.navigation.buildSrc.isBuildingOnOSX +import com.chrynan.navigation.buildSrc.isBuildingOnWindows import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -6,6 +9,7 @@ plugins { id("com.android.library") id("maven-publish") id("org.jetbrains.dokka") + kotlin("plugin.serialization") } group = LibraryConstants.group @@ -16,30 +20,65 @@ kotlin { publishAllLibraryVariants() publishLibraryVariantsGroupedByFlavor = true } + targets { + // Enable the default target hierarchy: + targetHierarchy.default() + android() + jvm() - js(BOTH) { - browser() + + js(IR) { + browser { + testTask { + useKarma { + useFirefox() + } + } + } nodejs() } - ios() - iosSimulatorArm64() + + if (isBuildingOnOSX()) { + ios() + iosSimulatorArm64() + tvos() + watchos() + macosX64() + macosArm64() + } + + if (isBuildingOnLinux()) { + linuxX64() + } + + if (isBuildingOnWindows()) { + mingwX64() + } } sourceSets { all { languageSettings.optIn("kotlin.RequiresOptIn") } + val commonMain by getting { dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib-common") + implementation(Kotlin.stdlib.common) - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation(KotlinX.coroutines.core) + api(KotlinX.serialization.core) } } - val iosMain by sourceSets.getting - val iosSimulatorArm64Main by sourceSets.getting - iosSimulatorArm64Main.dependsOn(iosMain) + + val commonTest by getting { + dependencies { + implementation(kotlin("test")) + implementation(KotlinX.coroutines.test) + } + } + + val nativeMain by sourceSets.getting } } @@ -85,12 +124,12 @@ tasks.withType { duplicatesStrategy = DuplicatesStrategy.INHERIT } // Android Specific Dependencies dependencies { - implementation("androidx.activity:activity-ktx:1.6.0") - implementation("androidx.fragment:fragment-ktx:1.5.3") - implementation("androidx.core:core-ktx:1.9.0") - implementation("androidx.appcompat:appcompat:1.5.1") + implementation(AndroidX.activity.ktx) + implementation(AndroidX.fragment.ktx) + implementation(AndroidX.core.ktx) + implementation(AndroidX.appCompat) - api("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1") + api(AndroidX.lifecycle.viewModelKtx) } afterEvaluate { diff --git a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigationLifecycleObserver.kt b/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigationLifecycleObserver.kt deleted file mode 100644 index 0d89412..0000000 --- a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigationLifecycleObserver.kt +++ /dev/null @@ -1,65 +0,0 @@ -package com.chrynan.navigation - -import android.app.Activity -import androidx.appcompat.app.AppCompatActivity -import androidx.lifecycle.DefaultLifecycleObserver -import androidx.lifecycle.LifecycleOwner -import androidx.lifecycle.lifecycleScope -import kotlinx.coroutines.* -import kotlinx.coroutines.flow.* - -fun interface AndroidNavigationHandler> { - - operator fun AndroidNavigationScope.invoke(context: Context, destination: Destination) -} - -@OptIn(FlowPreview::class) -internal class AndroidNavigationLifecycleObserver>( - activity: Activity, - private val navigator: Navigator, - private val handler: AndroidNavigationHandler, - private val coroutineScope: CoroutineScope, - private val eventDispatcher: CoroutineDispatcher, - private val handlerDispatcher: CoroutineDispatcher -) : DefaultLifecycleObserver { - - private var job: Job? = null - - private val navigationScope = AndroidNavigationScope(activity = activity) - - override fun onResume(owner: LifecycleOwner) { - super.onResume(owner) - - job = navigator.state.contextChanges - .flatMapConcat { context -> navigator.state.destinationChanges.map { destination -> context to destination } } - .flowOn(eventDispatcher) - .onEach { handler.apply { navigationScope(it.first, it.second) } } - .flowOn(handlerDispatcher) - .launchIn(coroutineScope) - } - - override fun onPause(owner: LifecycleOwner) { - super.onPause(owner) - - job?.cancel() - job = null - } -} - -fun > AppCompatActivity.registerNavigationHandler( - navigator: Navigator, - eventDispatcher: CoroutineDispatcher = Dispatchers.IO, - handlerDispatcher: CoroutineDispatcher = Dispatchers.Main, - handler: AndroidNavigationHandler -) { - val observer = AndroidNavigationLifecycleObserver( - activity = this, - navigator = navigator, - handler = handler, - coroutineScope = lifecycleScope, - eventDispatcher = eventDispatcher, - handlerDispatcher = handlerDispatcher - ) - - lifecycle.addObserver(observer) -} diff --git a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigationScope.kt b/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigationScope.kt deleted file mode 100644 index bcf57bd..0000000 --- a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigationScope.kt +++ /dev/null @@ -1,25 +0,0 @@ -@file:Suppress("unused") - -package com.chrynan.navigation - -import android.app.Activity - -/** - * A [NavigationScope] used on the Android platform that has access to a parent [Activity] that can be used to change - * Activities or Fragments. - */ -interface AndroidNavigationScope : NavigationScope { - - val activity: Activity -} - -internal class SimpleAndroidNavigationScope( - override val activity: Activity, -) : AndroidNavigationScope - -@Suppress("FunctionName") -internal fun AndroidNavigationScope( - activity: Activity, -): AndroidNavigationScope = SimpleAndroidNavigationScope( - activity = activity -) diff --git a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigator.kt b/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigator.kt deleted file mode 100644 index 4730a32..0000000 --- a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidNavigator.kt +++ /dev/null @@ -1,33 +0,0 @@ -@file:Suppress("unused") - -package com.chrynan.navigation - -/** - * Creates a [Navigator] using the provided [initialContext]. - * - * Example usage: - * ``` - * val navigator = navigator(initialContext = AppContext.Home) - * - * navigator.goTo(destination) - * ``` - */ -fun > navigator( - initialContext: Context -): Navigator = - NavigatorImpl(initialContext = initialContext) - -/** - * Creates a [Navigator] with a [SingleNavigationContext] using the provided [initialDestination]. - * - * Example usage: - * ``` - * val navigator = navigator(initialDestination = destination) - * - * navigator.goTo(otherDestination) - * ``` - */ -fun navigator( - initialDestination: Destination -): Navigator> = - NavigatorImpl(initialContext = SingleNavigationContext(initialDestination = initialDestination)) diff --git a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidTimeUtils.kt b/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidTimeUtils.kt new file mode 100644 index 0000000..2d1e01c --- /dev/null +++ b/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidTimeUtils.kt @@ -0,0 +1,9 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds + +internal actual fun elapsedSystemTime(): Duration = + System.currentTimeMillis().milliseconds diff --git a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidViewModel.kt b/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidViewModel.kt index e304d9b..d5b4200 100644 --- a/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidViewModel.kt +++ b/navigation-core/src/androidMain/kotlin/com.chrynan.navigation/AndroidViewModel.kt @@ -2,4 +2,4 @@ package com.chrynan.navigation -actual abstract class ViewModel internal actual constructor(): androidx.lifecycle.ViewModel() +actual abstract class NavigationViewModel internal actual constructor() : androidx.lifecycle.ViewModel() diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/DestinationAndContext.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/DestinationAndContext.kt new file mode 100644 index 0000000..27a24d1 --- /dev/null +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/DestinationAndContext.kt @@ -0,0 +1,49 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * A wrapper class around a [NavigationDestination] and an associated [NavigationContext]. + */ +@Serializable +class DestinationAndContext>( + @SerialName(value = "destination") val destination: Destination, + @SerialName(value = "context") val context: Context +) { + + /** + * Creates a copy of this [DestinationAndContext] instance, overriding the provided values. + */ + fun copy( + destination: Destination = this.destination, + context: Context = this.context + ): DestinationAndContext = DestinationAndContext( + destination = destination, + context = context + ) + + operator fun component1(): Destination = destination + + operator fun component2(): Context = context + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is DestinationAndContext<*, *>) return false + + if (context != other.context) return false + + return destination == other.destination + } + + override fun hashCode(): Int { + var result = context.hashCode() + result = 31 * result + destination.hashCode() + return result + } + + override fun toString(): String = + "DestinationAndContext(destination=$destination, context=$context)" +} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContext.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContext.kt index 3ff97c0..23e32fe 100644 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContext.kt +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContext.kt @@ -1,5 +1,8 @@ package com.chrynan.navigation +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + /** * Represents a navigation context, or a container of a back stack of [Destination]s. Navigation can take place within * a [NavigationContext] typically by changing [Destination] values. But an application may have multiple @@ -39,25 +42,31 @@ interface NavigationContext { * the [Navigator]. However, sometimes it may be preferable to have only a single context for navigation, and in this * case, this class can be used. * + * **Note:** That this class has an internal constructor and therefore can only be constructed from within this + * library. This is by design to prevent providing numerous instances of the [SingleNavigationContext] in the + * [Navigator.push] function. + * * Example usage: * * ```kotlin * SingleNavigationContext(initialDestination = "Home") * ``` */ -class SingleNavigationContext(override val initialDestination: Destination) : - NavigationContext { +@Serializable +class SingleNavigationContext internal constructor( + @SerialName(value = "initial_destination") override val initialDestination: Destination +) : NavigationContext { override fun equals(other: Any?): Boolean { if (this === other) return true - if (other == null || other !is SingleNavigationContext<*>) return false - - if (initialDestination != other.initialDestination) return false + if (other !is SingleNavigationContext<*>) return false - return true + return initialDestination == other.initialDestination } - override fun hashCode(): Int = initialDestination.hashCode() + override fun hashCode(): Int = + initialDestination.hashCode() - override fun toString(): String = "SingleNavigationContext(initialDestination=$initialDestination)" + override fun toString(): String = + "SingleNavigationContext(initialDestination=$initialDestination)" } diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContextStacks.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContextStacks.kt new file mode 100644 index 0000000..934c30f --- /dev/null +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContextStacks.kt @@ -0,0 +1,210 @@ +package com.chrynan.navigation + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.MapSerializer +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.descriptors.buildClassSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +/** + * A component that wraps a [Map] of [NavigationContext] to [MutableStack] of [NavigationDestination]s and provides + * convenience functions for accessing and altering the values. Note that this component is mutable. + */ +@Serializable(with = NavigationContextStacksSerializer::class) +internal class NavigationContextStacks> internal constructor( + internal val initialContext: Context, + contextStacks: Map> = emptyMap() +) { + + private val destinationStacksByContext: MutableMap> = + mutableMapOf(initialContext to mutableStackOf(initialContext.initialDestination)).apply { + contextStacks.entries.forEach { entry -> + this[entry.key] = entry.value.toMutableStack() + } + } + + /** + * Retrieves the [Stack] of [Destination]s for the provided [Context]. + */ + operator fun get(context: Context): Stack = + destinationStacksByContext[context]?.toStack() ?: stackOf(context.initialDestination) + + /** + * Retrieves the current [Destination] on top of the [Stack] for the provided [Context] without removing it. + */ + fun peek(context: Context): Destination = + get(context = context).peekOrNull() ?: context.initialDestination + + /** + * Removes and returns the [Destination] on top of the [Stack] for the provided [Context], or `null` if the item + * cannot be removed. There must always be at least one item within a [Destination] [Stack], attempting to remove + * that item will fail and return `null` instead. + */ + fun pop(context: Context): Destination? { + val stack = destinationStacksByContext[context] ?: return null + + if (stack.size <= 1) return null + + val removed = stack.pop() + + destinationStacksByContext[context] = stack + + return removed + } + + /** + * Pushes the provided [destination] to the top of the [Stack] of [Destination]s for the provided [context]. + */ + fun push(context: Context, destination: Destination) { + val stack = destinationStacksByContext[context] ?: mutableStackOf(context.initialDestination) + + stack.push(destination) + + destinationStacksByContext[context] = stack + } + + /** + * Pushes the provided [destination] to the top of the [Stack] of [Destination]s for the provided [context], but + * if the provided [destination] already exists in the [Stack] of [Destination]s for the provided [context], all + * the items on top of it will be popped from the stack. + */ + fun pushDropping(context: Context, destination: Destination) { + val stack = destinationStacksByContext[context] ?: mutableStackOf(context.initialDestination) + + val index = stack.indexOf(destination) + + if (index == -1) { + stack.push(destination) + + destinationStacksByContext[context] = stack + } else { + val dropCount = (stack.size - (stack.size - index)) + 1 + + val newStack = stack.toList().drop(dropCount).toMutableStack() + + newStack.push(destination) + + destinationStacksByContext[context] = newStack + } + } + + /** + * Pushes all the provided [destinations] to the top of the [Stack] of [Destination]s for the provided [context]. + */ + fun pushAll(context: Context, destinations: Stack) { + val stack = destinationStacksByContext[context] ?: mutableStackOf(context.initialDestination) + + destinations.forEach { destination -> stack.push(destination) } + + destinationStacksByContext[context] = stack + } + + /** + * Clears the stack for the provided [context] and resets it back to its initial state. + */ + fun clear(context: Context) { + destinationStacksByContext[context] = mutableStackOf(context.initialDestination) + } + + /** + * Clears all the [Stack]s of [Destination]s for all the [Context]s. This resets the internal data structure back + * to its initial state. + */ + fun clearAll() { + destinationStacksByContext.clear() + destinationStacksByContext[initialContext] = mutableStackOf(initialContext.initialDestination) + } + + /** + * Returns a [Map] of the [Context] to [Stack] of [Destination]s. + */ + fun toMap(): Map> = destinationStacksByContext + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is NavigationContextStacks<*, *>) return false + + if (initialContext != other.initialContext) return false + + return destinationStacksByContext == other.destinationStacksByContext + } + + override fun hashCode(): Int { + var result = initialContext.hashCode() + result = 31 * result + destinationStacksByContext.hashCode() + return result + } + + override fun toString(): String = + "NavigationContextStacks(" + + "initialContext=$initialContext, " + + "destinationStacksByContext=$destinationStacksByContext)" +} + +/** + * Pops the top destination off the provided [context] stack and returns the new top destination, or `null` if the + * provided [context] stack could not be popped (there must be at least one item in the stack at all times). + */ +internal fun > NavigationContextStacks.popToPreviousDestinationForContext( + context: Context +): Destination? { + this.pop(context) ?: return null + + return this.peek(context) +} + +/** + * A [KSerializer] for [NavigationContextStacks]. + */ +internal class NavigationContextStacksSerializer> internal constructor( + destinationSerializer: KSerializer, + private val contextSerializer: KSerializer +) : KSerializer> { + + private val stackSerializer = StackSerializer(destinationSerializer) + private val mapSerializer = MapSerializer(contextSerializer, stackSerializer) + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor(serialName = "NavigationContextStacks") { + element(elementName = "initialContext", descriptor = contextSerializer.descriptor) + element(elementName = "context_stacks", descriptor = mapSerializer.descriptor) + } + + override fun serialize(encoder: Encoder, value: NavigationContextStacks) { + val compositeEncoder = encoder.beginStructure(descriptor) + compositeEncoder.encodeSerializableElement( + serializer = contextSerializer, + descriptor = descriptor, + index = 0, + value = value.initialContext + ) + compositeEncoder.encodeSerializableElement( + serializer = mapSerializer, + descriptor = descriptor, + index = 1, + value = value.toMap() + ) + compositeEncoder.endStructure(descriptor) + } + + override fun deserialize(decoder: Decoder): NavigationContextStacks { + val compositeDecoder = decoder.beginStructure(descriptor) + val initialContext = compositeDecoder.decodeSerializableElement( + deserializer = contextSerializer, + descriptor = descriptor, + index = 0 + ) + val contextStacks = compositeDecoder.decodeSerializableElement( + deserializer = mapSerializer, + descriptor = descriptor, + index = 1 + ) + compositeDecoder.endStructure(descriptor) + + return NavigationContextStacks( + initialContext = initialContext, + contextStacks = contextStacks + ) + } +} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContextState.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContextState.kt deleted file mode 100644 index e35d712..0000000 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationContextState.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.chrynan.navigation - -import kotlinx.coroutines.flow.Flow - -interface NavigationContextState> { - - val initialContext: Context - - val currentContext: Context - - val contextChanges: Flow - - companion object -} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationIntent.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationDestination.kt similarity index 83% rename from navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationIntent.kt rename to navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationDestination.kt index 8a02c6e..e1941c5 100644 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationIntent.kt +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationDestination.kt @@ -6,7 +6,7 @@ package com.chrynan.navigation * * For example: * ``` - * sealed class HomeScreenDestination : NavigationDestination() { + * sealed class HomeScreenDestination { * * object Feed : HomeScreenDestination() * } diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationDestinationState.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationDestinationState.kt deleted file mode 100644 index 5f9e674..0000000 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationDestinationState.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.chrynan.navigation - -import kotlinx.coroutines.flow.Flow - -interface NavigationDestinationState { - - val initialDestination: Destination - - val currentDestination: Destination - - val destinationChanges: Flow - - companion object -} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationEvent.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationEvent.kt index 6987f83..6207829 100644 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationEvent.kt +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationEvent.kt @@ -2,22 +2,484 @@ package com.chrynan.navigation +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + /** - * An event that is sent to a [Navigator] to coordinate the navigation between screens. + * Represents a navigation event that is sent to a [Navigator] to coordinate the navigation between UI components, such + * as "screens" within an application. A [NavigationEvent] can be a [NavigationEvent.Forward.Destination] representing + * a change in a [NavigationDestination] in the current context, a [NavigationEvent.Forward.Context] representing a + * change in [NavigationContext], or a [NavigationEvent.Backward] representing a back tracking of a previous + * [NavigationEvent]. * - * @see [Navigator.navigate] - * @see [NavigationHandler.onNavigate] + * @see [Navigator.dispatch] */ -sealed class NavigationEvent { +@Serializable(with = NavigationEventSerializer::class) +sealed class NavigationEvent> private constructor() { + + /** + * The amount of milliseconds that have elapsed on the system when the event occurred. + * + * **Note:** This is not safe to persist or use between system reboots. + */ + abstract val elapsedMilliseconds: Long + + /** + * The navigation direction for this event. + */ + abstract val direction: Direction + + /** + * The type of [NavigationEvent] that occurred. + */ + abstract val type: Type + + /** + * Creates a serializable [Snapshot] instance of this [NavigationEvent]. + */ + internal abstract fun toSnapshot(): Snapshot + + /** + * Represents a direction for a [NavigationEvent]. A [NavigationEvent] can either be a [FORWARDS] direction event, + * meaning the change is added to a [Stack], or a [BACKWARDS] direction event, meaning the change causes a removal + * from a [Stack]. + */ + @Serializable + enum class Direction(val serialName: String) { + + /** + * The associated [NavigationEvent] causes a removal of a previous event change from a [Stack]. + */ + @SerialName(value = "backwards") + BACKWARDS(serialName = "backwards"), + + /** + * The associated [NavigationEvent] causes an addition of the change to a [Stack]. + */ + @SerialName(value = "forwards") + FORWARDS(serialName = "forwards") + } + + @Serializable + enum class Type(val serialName: String) { + + /** + * Corresponds to the [NavigationEvent.Backward.Context] type. + */ + @SerialName(value = "backward_context") + BACKWARD_CONTEXT(serialName = "backward_context"), + + /** + * Corresponds to the [NavigationEvent.Backward.Destination] type. + */ + @SerialName(value = "backward_destination") + BACKWARD_DESTINATION(serialName = "backward_destination"), + + /** + * Corresponds to the [NavigationEvent.Forward.Context] type. + */ + @SerialName(value = "forward_context") + FORWARD_CONTEXT(serialName = "forward_context"), + + /** + * Corresponds to the [NavigationEvent.Forward.Destination] type. + */ + @SerialName(value = "forward_destination") + FORWARD_DESTINATION(serialName = "forward_destination") + } + + /** + * A [NavigationEvent] that represents a reversal of a previous navigation event. A [Backward] navigation event can + * be used to go to the previous [NavigationDestination] within the current [NavigationContext], or going back to a + * previous [NavigationContext] before a change in context. + * + * @property [elapsedMilliseconds] The amount of milliseconds that have elapsed on the system when the event + * occurred. **Note:** This is not safe to persist or use between system reboots. + */ + @Serializable(with = NavigationEventBackwardSerializer::class) + @SerialName(value = "backward") + sealed class Backward> private constructor() : + NavigationEvent() { + + override val direction: Direction = Direction.BACKWARDS + + /** + * A [NavigationEvent] that changes goes back to the previous [NavigationDestination] within the current + * [NavigationContext]. + * + * @property [elapsedMilliseconds] The amount of milliseconds that have elapsed on the system when the event + * occurred. **Note:** This is not safe to persist or use between system reboots. + */ + @SerialName(value = "backward_destination") + class Destination> internal constructor( + @SerialName(value = "instant") override val elapsedMilliseconds: Long = elapsedSystemTime().inWholeMilliseconds + ) : Backward() { + + @Transient + override val type: Type = Type.BACKWARD_DESTINATION + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Destination<*, *>) return false + + return elapsedMilliseconds == other.elapsedMilliseconds + } + + override fun hashCode(): Int = + elapsedMilliseconds.hashCode() + + override fun toString(): String = + "NavigationEvent.Backward.Destination(elapsedMilliseconds=$elapsedMilliseconds)" + } + + /** + * A [NavigationEvent] that changes goes back to the previous [NavigationContext]. + * + * @property [elapsedMilliseconds] The amount of milliseconds that have elapsed on the system when the event + * occurred. **Note:** This is not safe to persist or use between system reboots. + */ + @SerialName(value = "backward_context") + class Context> internal constructor( + @SerialName(value = "instant") override val elapsedMilliseconds: Long = elapsedSystemTime().inWholeMilliseconds + ) : Backward() { + + @Transient + override val type: Type = Type.BACKWARD_CONTEXT + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Context<*, *>) return false + + return elapsedMilliseconds == other.elapsedMilliseconds + } + + override fun hashCode(): Int = + elapsedMilliseconds.hashCode() + + override fun toString(): String = + "NavigationEvent.Backward.Context(elapsedMilliseconds=$elapsedMilliseconds)" + } + + override fun toSnapshot(): Snapshot = Snapshot( + type = type, + direction = direction, + elapsedMilliseconds = elapsedMilliseconds + ) + } + + /** + * A [NavigationEvent] that represents a forward movement, or addition of a navigation change. These events can be + * reversed by a [Backward] event. There are two forward navigation events: [Destination] representing a change in + * destination on the current context stack, and [Context] representing a change in the context. + */ + @Serializable(with = NavigationEventForwardSerializer::class) + @SerialName(value = "forward") + sealed class Forward> private constructor() : + NavigationEvent() { + + override val direction: Direction = Direction.FORWARDS + + /** + * A [NavigationEvent] that changes the [NavigationDestination] within the current [NavigationContext]. + * + * @property [elapsedMilliseconds] The amount of milliseconds that have elapsed on the system when the event + * occurred. **Note:** This is not safe to persist or use between system reboots. + * @property [destination] The [NavigationDestination] to go to. This value will be added to the top of the [Stack] + * of destinations within the current [NavigationContext]. + */ + @Serializable + @SerialName(value = "forward_destination") + class Destination> internal constructor( + @SerialName(value = "instant") override val elapsedMilliseconds: Long = elapsedSystemTime().inWholeMilliseconds, + @SerialName(value = "destination") val destination: D + ) : Forward() { + + @Transient + override val type: Type = Type.FORWARD_DESTINATION + + override fun toSnapshot(): Snapshot = Snapshot( + type = type, + direction = direction, + elapsedMilliseconds = elapsedMilliseconds, + destination = destination + ) + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Destination<*, *>) return false + + if (elapsedMilliseconds != other.elapsedMilliseconds) return false + + return destination == other.destination + } + + override fun hashCode(): Int { + var result = elapsedMilliseconds.hashCode() + result = 31 * result + destination.hashCode() + return result + } + + override fun toString(): String = + "NavigationEvent.Forward.Destination(elapsedMilliseconds=$elapsedMilliseconds, destination=$destination)" + } + + /** + * A [NavigationEvent] that changes the current [NavigationContext]. + * + * @property [elapsedMilliseconds] The amount of milliseconds that have elapsed on the system when the event + * occurred. **Note:** This is not safe to persist or use between system reboots. + * @property [context] The [NavigationContext] to go to. + */ + @Serializable + @SerialName(value = "forward_context") + class Context> internal constructor( + @SerialName(value = "instant") override val elapsedMilliseconds: Long = elapsedSystemTime().inWholeMilliseconds, + @SerialName(value = "context") val context: C + ) : Forward() { + + @Transient + override val type: Type = Type.FORWARD_CONTEXT + + override fun toSnapshot(): Snapshot = Snapshot( + type = type, + direction = direction, + elapsedMilliseconds = elapsedMilliseconds, + context = context + ) + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Context<*, *>) return false + + if (elapsedMilliseconds != other.elapsedMilliseconds) return false + + return context == other.context + } + + override fun hashCode(): Int { + var result = elapsedMilliseconds.hashCode() + result = 31 * result + context.hashCode() + return result + } + + override fun toString(): String = + "NavigationEvent.Forward.Context(elapsedMilliseconds=$elapsedMilliseconds, context=$context)" + } + } + + @Serializable + internal class Snapshot>( + @SerialName(value = "type") val type: Type, + @SerialName(value = "direction") val direction: Direction, + @SerialName(value = "elapsed_milliseconds") val elapsedMilliseconds: Long, + @SerialName(value = "destination") val destination: Destination? = null, + @SerialName(value = "context") val context: Context? = null + ) { + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Snapshot<*, *>) return false - class Back internal constructor() : NavigationEvent() + if (type != other.type) return false + if (direction != other.direction) return false + if (elapsedMilliseconds != other.elapsedMilliseconds) return false + if (destination != other.destination) return false - class Up internal constructor() : NavigationEvent() + return context == other.context + } - data class To internal constructor( - val destination: Destination, - val strategy: StackDuplicateContentStrategy = StackDuplicateContentStrategy.CLEAR_STACK - ) : NavigationEvent() + override fun hashCode(): Int { + var result = type.hashCode() + result = 31 * result + direction.hashCode() + result = 31 * result + elapsedMilliseconds.hashCode() + result = 31 * result + (destination?.hashCode() ?: 0) + result = 31 * result + (context?.hashCode() ?: 0) + return result + } + + override fun toString(): String = + "Snapshot(" + + "type=$type, " + + "direction=$direction, " + + "elapsedMilliseconds=$elapsedMilliseconds, " + + "destination=$destination, " + + "context=$context)" + } companion object } + +/** + * Creates a [NavigationEvent] instance with the provided [NavigationEvent.Snapshot]. + */ +internal fun > NavigationEvent( + snapshot: NavigationEvent.Snapshot +): NavigationEvent = + when (snapshot.type) { + NavigationEvent.Type.BACKWARD_DESTINATION -> NavigationEvent.Backward.Destination(elapsedMilliseconds = snapshot.elapsedMilliseconds) + + NavigationEvent.Type.BACKWARD_CONTEXT -> NavigationEvent.Backward.Context(elapsedMilliseconds = snapshot.elapsedMilliseconds) + + NavigationEvent.Type.FORWARD_DESTINATION -> NavigationEvent.Forward.Destination( + elapsedMilliseconds = snapshot.elapsedMilliseconds, + destination = snapshot.destination!! + ) + + NavigationEvent.Type.FORWARD_CONTEXT -> NavigationEvent.Forward.Context( + elapsedMilliseconds = snapshot.elapsedMilliseconds, + context = snapshot.context!! + ) + } + +internal class NavigationEventSerializer>( + destinationSerializer: KSerializer, + contextSerializer: KSerializer +) : KSerializer> { + + private val delegateSerializer = NavigationEvent.Snapshot.serializer( + destinationSerializer, + contextSerializer + ) + + override val descriptor: SerialDescriptor = destinationSerializer.descriptor + + override fun serialize(encoder: Encoder, value: NavigationEvent) { + encoder.encodeSerializableValue( + serializer = delegateSerializer, + value = value.toSnapshot() + ) + } + + override fun deserialize(decoder: Decoder): NavigationEvent { + val snapshot = decoder.decodeSerializableValue(deserializer = delegateSerializer) + + return NavigationEvent(snapshot = snapshot) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is NavigationEventSerializer<*, *>) return false + + if (delegateSerializer != other.delegateSerializer) return false + + return descriptor == other.descriptor + } + + override fun hashCode(): Int { + var result = delegateSerializer.hashCode() + result = 31 * result + descriptor.hashCode() + return result + } + + override fun toString(): String = + "NavigationEventSerializer(" + + "delegateSerializer=$delegateSerializer, " + + "descriptor=$descriptor)" +} + +internal class NavigationEventBackwardSerializer>( + destinationSerializer: KSerializer, + contextSerializer: KSerializer +) : KSerializer> { + + private val delegateSerializer = NavigationEvent.Snapshot.serializer( + destinationSerializer, + contextSerializer + ) + + override val descriptor: SerialDescriptor = destinationSerializer.descriptor + + override fun serialize(encoder: Encoder, value: NavigationEvent.Backward) { + encoder.encodeSerializableValue( + serializer = delegateSerializer, + value = value.toSnapshot() + ) + } + + override fun deserialize(decoder: Decoder): NavigationEvent.Backward { + val snapshot = decoder.decodeSerializableValue(deserializer = delegateSerializer) + + val event = NavigationEvent(snapshot = snapshot) + + if (event !is NavigationEvent.Backward) { + throw SerializationException("${this::class.simpleName} only works for ${NavigationEvent.Backward::class.simpleName} types.") + } + + return event + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is NavigationEventBackwardSerializer<*, *>) return false + + if (delegateSerializer != other.delegateSerializer) return false + + return descriptor == other.descriptor + } + + override fun hashCode(): Int { + var result = delegateSerializer.hashCode() + result = 31 * result + descriptor.hashCode() + return result + } + + override fun toString(): String = + "NavigationEventBackwardSerializer(" + + "delegateSerializer=$delegateSerializer, " + + "descriptor=$descriptor)" +} + + +internal class NavigationEventForwardSerializer>( + destinationSerializer: KSerializer, + contextSerializer: KSerializer +) : KSerializer> { + + private val delegateSerializer = NavigationEvent.Snapshot.serializer( + destinationSerializer, + contextSerializer + ) + + override val descriptor: SerialDescriptor = destinationSerializer.descriptor + + override fun serialize(encoder: Encoder, value: NavigationEvent.Forward) { + encoder.encodeSerializableValue( + serializer = delegateSerializer, + value = value.toSnapshot() + ) + } + + override fun deserialize(decoder: Decoder): NavigationEvent.Forward { + val snapshot = decoder.decodeSerializableValue(deserializer = delegateSerializer) + + val event = NavigationEvent(snapshot = snapshot) + + if (event !is NavigationEvent.Forward) { + throw SerializationException("${this::class.simpleName} only works for ${NavigationEvent.Forward::class.simpleName} types.") + } + + return event + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is NavigationEventForwardSerializer<*, *>) return false + + if (delegateSerializer != other.delegateSerializer) return false + + return descriptor == other.descriptor + } + + override fun hashCode(): Int { + var result = delegateSerializer.hashCode() + result = 31 * result + descriptor.hashCode() + return result + } + + override fun toString(): String = + "NavigationEventForwardSerializer(" + + "delegateSerializer=$delegateSerializer, " + + "descriptor=$descriptor)" +} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationScope.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationScope.kt deleted file mode 100644 index 1c35f2a..0000000 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationScope.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.chrynan.navigation - -/** - * Provides the ability for extra platform specific parameters to be provided to a [Navigator]. - */ -interface NavigationScope { - - companion object -} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationState.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationState.kt new file mode 100644 index 0000000..9568ee8 --- /dev/null +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationState.kt @@ -0,0 +1,248 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializable +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.descriptors.buildClassSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +/** + * A generic wrapper around the state of a navigation component. This provides a way to access the retained [initial] + * state value, the [current] state value, and [changes] to the state value. + * + * Though this component can be generally useful for any type of state management, it is meant for use within the + * context of this navigation library (hence, the name of the component), and is exposed so that the wrapped state + * values can be accessed. This component is a sealed interface so that it cannot be inherited outside of this library, + * and creation of the component is internal. If you need something like this component externally, consider using a + * state management library like [cycle](https://github.com/chRyNaN/cycle). + */ +@Serializable(with = NavigationStateSerializer::class) +sealed interface NavigationState { + + /** + * The initial state value when this component was first created. This value does not change when the wrapped state + * value changes, so subsequent calls to access this property will always return the same value. + */ + val initial: T + + /** + * The current state value. This value can change over time, so subsequent calls to access this property can return + * different values. Use the [changes] property to subscribe to the changes. + */ + val current: T + + /** + * The changes in the underlying wrapped state value. This is a shareable [Flow] that can be subscribed to for the + * purposes of listening to state changes. + */ + val changes: Flow + + companion object +} + +/** + * A mutable version of [NavigationState] that allows changing of the underlying wrapped state value. + */ +@Serializable(with = MutableNavigationStateSerializer::class) +internal sealed interface MutableNavigationState : NavigationState { + + /** + * Updates the [current] state value to be the provided [state] value. This will cause the [state] value to be + * emitted to [changes]. + */ + fun update(state: T) + + /** + * Resets the state back to its [initial] value. This will cause the [initial] value to be emitted to [changes]. + */ + fun reset() + + companion object +} + +/** + * Creates a [MutableNavigationState] instance with the provided [initial] and [current] values. + */ +internal fun mutableNavigationStateOf(initial: T, current: T = initial): MutableNavigationState = + StateFlowMutableNavigationState(initial = initial, current = current) + +/** + * Converts this [NavigationState] into a [MutableNavigationState] instance. + */ +internal fun NavigationState.toMutableNavigationState(): MutableNavigationState = + if (this is MutableNavigationState) { + this + } else { + StateFlowMutableNavigationState(initial = this.initial, current = this.current) + } + +/** + * An implementation of a [NavigationState] and [MutableNavigationState] backed by a provided [MutableStateFlow]. + */ +internal class StateFlowMutableNavigationState internal constructor( + override val initial: T, + current: T = initial +) : MutableNavigationState { + + private val stateFlow: MutableStateFlow = MutableStateFlow(value = current) + + override val current: T + get() = stateFlow.value + + override val changes: Flow + get() = stateFlow.asStateFlow() + + override fun update(state: T) { + stateFlow.value = state + } + + override fun reset() { + stateFlow.value = initial + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is StateFlowMutableNavigationState<*>) return false + + if (stateFlow != other.stateFlow) return false + + return initial == other.initial + } + + override fun hashCode(): Int { + var result = stateFlow.hashCode() + result = 31 * result + (initial?.hashCode() ?: 0) + return result + } + + override fun toString(): String = + "StateFlowMutableNavigationState(initial=$initial, current=$current, changes=$changes)" +} + +/** + * A [KSerializer] for a [NavigationState]. + */ +internal class NavigationStateSerializer internal constructor( + private val elementSerializer: KSerializer +) : KSerializer> { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor(serialName = "NavigationState") { + element(elementName = "initial", descriptor = elementSerializer.descriptor) + element(elementName = "current", descriptor = elementSerializer.descriptor) + } + + override fun serialize(encoder: Encoder, value: NavigationState) { + val compositeEncoder = encoder.beginStructure(descriptor) + compositeEncoder.encodeSerializableElement( + serializer = elementSerializer, + descriptor = descriptor, + index = 0, + value = value.initial + ) + compositeEncoder.encodeSerializableElement( + serializer = elementSerializer, + descriptor = descriptor, + index = 1, + value = value.current + ) + compositeEncoder.endStructure(descriptor) + } + + override fun deserialize(decoder: Decoder): NavigationState { + val compositeDecoder = decoder.beginStructure(descriptor) + val initial = compositeDecoder.decodeSerializableElement( + deserializer = elementSerializer, + descriptor = descriptor, + index = 0 + ) + val current = compositeDecoder.decodeSerializableElement( + deserializer = elementSerializer, + descriptor = descriptor, + index = 1 + ) + compositeDecoder.endStructure(descriptor) + + return mutableNavigationStateOf(initial = initial, current = current) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + + if (other !is NavigationStateSerializer<*>) return false + + return elementSerializer == other.elementSerializer + } + + override fun hashCode(): Int = + elementSerializer.hashCode() + + override fun toString(): String = + "NavigationStateSerializer(elementSerializer=$elementSerializer)" +} + +/** + * A [KSerializer] for a [NavigationState]. + */ +internal class MutableNavigationStateSerializer internal constructor( + private val elementSerializer: KSerializer +) : KSerializer> { + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor(serialName = "MutableNavigationState") { + element(elementName = "initial", descriptor = elementSerializer.descriptor) + element(elementName = "current", descriptor = elementSerializer.descriptor) + } + + override fun serialize(encoder: Encoder, value: MutableNavigationState) { + val compositeEncoder = encoder.beginStructure(descriptor) + compositeEncoder.encodeSerializableElement( + serializer = elementSerializer, + descriptor = descriptor, + index = 0, + value = value.initial + ) + compositeEncoder.encodeSerializableElement( + serializer = elementSerializer, + descriptor = descriptor, + index = 1, + value = value.current + ) + compositeEncoder.endStructure(descriptor) + } + + override fun deserialize(decoder: Decoder): MutableNavigationState { + val compositeDecoder = decoder.beginStructure(descriptor) + val initial = compositeDecoder.decodeSerializableElement( + deserializer = elementSerializer, + descriptor = descriptor, + index = 0 + ) + val current = compositeDecoder.decodeSerializableElement( + deserializer = elementSerializer, + descriptor = descriptor, + index = 1 + ) + compositeDecoder.endStructure(descriptor) + + return mutableNavigationStateOf(initial = initial, current = current) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + + if (other !is MutableNavigationStateSerializer<*>) return false + + return elementSerializer == other.elementSerializer + } + + override fun hashCode(): Int = + elementSerializer.hashCode() + + override fun toString(): String = + "MutableNavigationStateSerializer(elementSerializer=$elementSerializer)" +} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationStateStore.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationStateStore.kt new file mode 100644 index 0000000..64c2c71 --- /dev/null +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationStateStore.kt @@ -0,0 +1,337 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.nullable +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.descriptors.buildClassSerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +/** + * Represents a store of navigation state information that is useful for a [Navigator]. + */ +@Serializable(with = NavigationStateStoreSerializer::class) +sealed interface NavigationStateStore> { + + /** + * A [NavigationState] of [NavigationEvent]s. + */ + val event: NavigationState?> + + /** + * A [NavigationState] of [NavigationDestination]s. + */ + val destination: NavigationState + + /** + * A [NavigationState] of [NavigationContext]s. + */ + val context: NavigationState + + companion object +} + +/** + * A mutable version of a [NavigationStateStore]. + */ +@Serializable(with = MutableNavigationStateStoreSerializer::class) +internal sealed interface MutableNavigationStateStore> : + NavigationStateStore { + + /** + * Updates this [NavigationStateStore]'s state values to the provided values. Each parameter value defaults to its + * associated current value, which means if the value is not explicitly provided when invoking this function, then + * that state value will not change. + */ + fun update( + event: NavigationEvent? = this.event.current, + destination: Destination = this.destination.current, + context: Context = this.context.current + ) + + /** + * Resets the underlying state values back to their initial values. + */ + fun reset() + + companion object +} + +/** + * Creates a [MutableNavigationStateStore] instance with the provided [initialContext] value. + */ +internal fun > mutableNavigationStateStoreOf( + initialContext: Context, + initialEvent: NavigationEvent? = null, + initialDestination: Destination = initialContext.initialDestination, + currentContext: Context = initialContext, + currentEvent: NavigationEvent? = initialEvent, + currentDestination: Destination = initialDestination +): MutableNavigationStateStore = + MutableNavigationStateStoreImpl( + initialContext = initialContext, + initialEvent = initialEvent, + initialDestination = initialDestination, + currentContext = currentContext, + currentEvent = currentEvent, + currentDestination = currentDestination + ) + +/** + * Converts this [NavigationStateStore] into a [MutableNavigationStateStore] instance. + */ +internal fun > NavigationStateStore.toMutableNavigationStateStore(): MutableNavigationStateStore = + if (this is MutableNavigationStateStore) { + this + } else { + MutableNavigationStateStoreImpl( + initialContext = context.initial, + initialEvent = event.initial, + initialDestination = destination.initial, + currentContext = context.current, + currentEvent = event.current, + currentDestination = destination.current + ) + } + +/** + * A [MutableNavigationStateStore] implementation that stores [NavigationContext]s and their associated + * [NavigationDestination] [Stack]s in an in-memory [Map]. + */ +internal class MutableNavigationStateStoreImpl> internal constructor( + initialEvent: NavigationEvent?, + initialDestination: Destination, + initialContext: Context, + currentContext: Context, + currentEvent: NavigationEvent?, + currentDestination: Destination +) : MutableNavigationStateStore { + + override val event: NavigationState?> + get() = mutableEvent + override val destination: NavigationState + get() = mutableDestination + override val context: NavigationState + get() = mutableContext + + private val mutableEvent: MutableNavigationState?> = + mutableNavigationStateOf(initial = initialEvent, current = currentEvent) + private val mutableDestination: MutableNavigationState = + mutableNavigationStateOf(initial = initialDestination, current = currentDestination) + private val mutableContext: MutableNavigationState = + mutableNavigationStateOf(initial = initialContext, current = currentContext) + + override fun update(event: NavigationEvent?, destination: Destination, context: Context) { + this.mutableContext.update(state = context) + this.mutableDestination.update(state = destination) + this.mutableEvent.update(state = event) + } + + override fun reset() { + mutableContext.reset() + mutableDestination.reset() + mutableEvent.reset() + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is MutableNavigationStateStoreImpl<*, *>) return false + + if (event != other.event) return false + if (destination != other.destination) return false + if (context != other.context) return false + + return context == other.context + } + + override fun hashCode(): Int { + var result = event.hashCode() + result = 31 * result + destination.hashCode() + result = 31 * result + context.hashCode() + return result + } + + override fun toString(): String = + "MutableNavigationStateStoreImpl(event=$event, destination=$destination, context=$context)" +} + +/** + * A [KSerializer] for [NavigationStateStore]. + */ +internal class NavigationStateStoreSerializer> internal constructor( + destinationSerializer: KSerializer, + contextSerializer: KSerializer +) : KSerializer> { + + private val eventStateSerializer = + NavigationState.serializer(NavigationEvent.serializer(destinationSerializer, contextSerializer).nullable) + private val destinationStateSerializer = NavigationState.serializer(destinationSerializer) + private val contextStateSerializer = NavigationState.serializer(contextSerializer) + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor(serialName = "NavigationStateStore") { + element( + elementName = "event", + descriptor = eventStateSerializer.descriptor + ) + element(elementName = "destination", descriptor = destinationStateSerializer.descriptor) + element(elementName = "context", descriptor = contextStateSerializer.descriptor) + } + + override fun serialize(encoder: Encoder, value: NavigationStateStore) { + val compositeEncoder = encoder.beginStructure(descriptor) + compositeEncoder.encodeSerializableElement( + serializer = eventStateSerializer, + descriptor = descriptor, + index = 0, + value = value.event + ) + compositeEncoder.encodeSerializableElement( + serializer = destinationStateSerializer, + descriptor = descriptor, + index = 1, + value = value.destination + ) + compositeEncoder.encodeSerializableElement( + serializer = contextStateSerializer, + descriptor = descriptor, + index = 2, + value = value.context + ) + compositeEncoder.endStructure(descriptor) + } + + override fun deserialize(decoder: Decoder): NavigationStateStore { + val compositeDecoder = decoder.beginStructure(descriptor) + val event = compositeDecoder.decodeSerializableElement( + deserializer = eventStateSerializer, + descriptor = descriptor, + index = 0 + ) + val destination = compositeDecoder.decodeSerializableElement( + deserializer = destinationStateSerializer, + descriptor = descriptor, + index = 1 + ) + val context = compositeDecoder.decodeSerializableElement( + deserializer = contextStateSerializer, + descriptor = descriptor, + index = 2 + ) + compositeDecoder.endStructure(descriptor) + + return mutableNavigationStateStoreOf( + initialEvent = event.initial, + currentEvent = event.current, + initialDestination = destination.initial, + currentDestination = destination.current, + initialContext = context.initial, + currentContext = context.current + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + + if (other !is NavigationStateStoreSerializer<*, *>) return false + + return descriptor == other.descriptor + } + + override fun hashCode(): Int = + descriptor.hashCode() + + override fun toString(): String = + "NavigationStateStoreSerializer(descriptor=$descriptor)" +} + +/** + * A [KSerializer] for [MutableNavigationStateStore]. + */ +internal class MutableNavigationStateStoreSerializer> internal constructor( + destinationSerializer: KSerializer, + contextSerializer: KSerializer +) : KSerializer> { + + private val eventStateSerializer = + NavigationState.serializer(NavigationEvent.serializer(destinationSerializer, contextSerializer).nullable) + private val destinationStateSerializer = NavigationState.serializer(destinationSerializer) + private val contextStateSerializer = NavigationState.serializer(contextSerializer) + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor(serialName = "NavigationStateStore") { + element( + elementName = "event", + descriptor = eventStateSerializer.descriptor + ) + element(elementName = "destination", descriptor = destinationStateSerializer.descriptor) + element(elementName = "context", descriptor = contextStateSerializer.descriptor) + } + + override fun serialize(encoder: Encoder, value: MutableNavigationStateStore) { + val compositeEncoder = encoder.beginStructure(descriptor) + compositeEncoder.encodeSerializableElement( + serializer = eventStateSerializer, + descriptor = descriptor, + index = 0, + value = value.event + ) + compositeEncoder.encodeSerializableElement( + serializer = destinationStateSerializer, + descriptor = descriptor, + index = 1, + value = value.destination + ) + compositeEncoder.encodeSerializableElement( + serializer = contextStateSerializer, + descriptor = descriptor, + index = 2, + value = value.context + ) + compositeEncoder.endStructure(descriptor) + } + + override fun deserialize(decoder: Decoder): MutableNavigationStateStore { + val compositeDecoder = decoder.beginStructure(descriptor) + val event = compositeDecoder.decodeSerializableElement( + deserializer = eventStateSerializer, + descriptor = descriptor, + index = 0 + ) + val destination = compositeDecoder.decodeSerializableElement( + deserializer = destinationStateSerializer, + descriptor = descriptor, + index = 1 + ) + val context = compositeDecoder.decodeSerializableElement( + deserializer = contextStateSerializer, + descriptor = descriptor, + index = 2 + ) + compositeDecoder.endStructure(descriptor) + + return mutableNavigationStateStoreOf( + initialEvent = event.initial, + currentEvent = event.current, + initialDestination = destination.initial, + currentDestination = destination.current, + initialContext = context.initial, + currentContext = context.current + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + + if (other !is NavigationStateStoreSerializer<*, *>) return false + + return descriptor == other.descriptor + } + + override fun hashCode(): Int = + descriptor.hashCode() + + override fun toString(): String = + "MutableNavigationStateStoreSerializer(descriptor=$descriptor)" +} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationStrategy.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationStrategy.kt new file mode 100644 index 0000000..4b7d75a --- /dev/null +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationStrategy.kt @@ -0,0 +1,80 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * A component that encapsulates the various navigation policies for a [Navigator]. + */ +sealed interface NavigationStrategy { + + /** + * Represents the approach to take when adding a [NavigationDestination] to a navigation [Stack] and there already + * exists the same item in the [Stack]. + */ + @Serializable + enum class DuplicateDestination(val serialName: String) { + + /** + * When a duplicate [NavigationDestination] is added to a navigation [Stack], all the items on top of the existing + * duplicate item in the stack are cleared off. For instance, consider the following stack of items (the first item + * being the bottom of the stack and the last item being the top of the stack): `[A, B, C, D]`. If we were to add a + * value of `A` to the top of the stack, it would be considered a duplicate since `A` already exists as the first + * item in the stack. Adding the value of `A` to this stack using a [CLEAR_TO_ORIGINAL] strategy would result in + * the stack looking as follows: `[A]`. All the items are popped off the stack (or "cleared") until the original + * item. This has the result of navigating to the item still, but altering the stack so that the item is back on + * top. + */ + @SerialName(value = "clear_to_original") + CLEAR_TO_ORIGINAL(serialName = "clear_to_original"), + + /** + * When a duplicate [NavigationDestination] is added to a navigation [Stack], the duplicate item is added on top of + * the stack. For instance, consider the following stack of items (the first item being the bottom of the stack and + * the last item being the top of the stack): `[A, B, C, D]`. If we were to add a value of `A` to the top of the + * stack, it would be considered a duplicate since `A` already exists as the first item in the stack. Adding the + * value of `A` to this stack using an [ALLOW_DUPLICATES] strategy would result in the stack looking as follows: + * `[A, B, C, D, A]`. This has the result of navigating to the item still, allowing duplicates, and without + * altering the rest of the stack. + */ + @SerialName(value = "allow_duplicates") + ALLOW_DUPLICATES(serialName = "allow_duplicates"); + + companion object + } + + /** + * Represents the approach for retaining the [NavigationDestination] data structures associated with a particular + * [NavigationContext], when navigating to other [NavigationContext]s. A [RETAIN] value indicates that the + * [NavigationDestination] data structure associated with a [NavigationContext] should be kept when navigation to a + * different [NavigationContext], so that the state can be restored when navigating back. A [CLEAR] value indicates + * that the [NavigationDestination] data structure associated with a [NavigationContext] should be cleared before + * navigating to a different [NavigationContext], so that the [NavigationContext.initialDestination] value will be + * displayed when navigating back. + */ + @Serializable + enum class DestinationRetention(val serialName: String) { + + /** + * Indicates that the [NavigationDestination] data structure associated with a [NavigationContext] should be + * kept when navigation to a different [NavigationContext], so that the state can be restored when navigating + * back. + */ + @SerialName(value = "retain") + RETAIN(serialName = "retain"), + + /** + * Indicates that the [NavigationDestination] data structure associated with a [NavigationContext] should be + * cleared before navigating to a different [NavigationContext], so that the + * [NavigationContext.initialDestination] value will be displayed when navigating back. + */ + @SerialName(value = "clear") + CLEAR(serialName = "clear"); + + companion object + } + + companion object +} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationViewModel.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationViewModel.kt new file mode 100644 index 0000000..a21bd09 --- /dev/null +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigationViewModel.kt @@ -0,0 +1,7 @@ +package com.chrynan.navigation + +/** + * Represents a "ViewModel" component used for navigation purposes. This component should not be used outside this + * navigation library. + */ +expect abstract class NavigationViewModel internal constructor() diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/Navigator.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/Navigator.kt index 948765b..82593de 100644 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/Navigator.kt +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/Navigator.kt @@ -2,193 +2,622 @@ package com.chrynan.navigation +import kotlinx.serialization.KSerializer +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.descriptors.buildClassSerialDescriptor +import kotlinx.serialization.descriptors.element +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + /** * A [Navigator] is responsible for coordinating the navigation between the different UI component groupings in an - * application. + * application. It is a stateful component that reacts to [NavigationEvent]s that are emitted via calls to the + * navigation functions ([push], [popDestination], and [push]) and updates its stored state values which can be + * accessed via its state [store]. It is up to the user of a [Navigator] to subscribe to the state changes of this + * component and update the associated UI accordingly. + * + * ## Example usage: + * + * ```kotlin + * // Create a Navigator instance. + * val navigator = Navigator(initialContext = mainAppContext) + * + * // Listen to destination changes and update the UI accordingly. + * navigator.store.destination.changes + * .onEach { destination -> + * // Update the UI + * } + * .launchIn(coroutineScope) + * + * // Perform navigation to different destinations. + * navigator.goTo(destination = Destinations.HOME) + * ``` * - * A [Navigator] is platform and UI framework dependent, so each implementation depends on the particular UI framework - * used, for example, Jetpack Compose. + * @see [Navigator] The [Navigator] constructor function for creating an instance of this interface. + * @see [push] For navigating to a new [NavigationDestination] within the current [NavigationContext]. + * @see [popDestination] For navigating backward to the previous [NavigationDestination] within the current + * [NavigationContext]. + * @see [popContext] For navigating backward to the previous [NavigationContext]. + * @see [push] For navigating to a different [NavigationContext]. */ -interface Navigator> { +@ExperimentalNavigationApi +@Serializable(with = NavigatorSerializer::class) +sealed interface Navigator> { /** - * The [NavigatorState] for this [Navigator] instance. This can be used to subscribe to destination or context - * changes, or get the current state values. + * The [NavigationStateStore] containing the latest [NavigationState]s for each navigation value. This is useful to + * get the initial, current, or subscribe to the changes in value of the different navigation components. */ - val state: NavigatorState + val store: NavigationStateStore /** - * Navigates to the provided [event]. Currently, this default implementation delegates to the appropriate [goBack], - * [goUp], and [goTo] function depending on the provided [event] value. + * Dispatches the provided navigation [event] which mutates the underlying state values if the navigation event can + * be performed. * - * @param [event] The [NavigationEvent] that represents the navigation action to be performed. - */ - fun navigate(event: NavigationEvent) { - when (event) { - is NavigationEvent.Back -> goBack() - is NavigationEvent.Up -> goUp() - is NavigationEvent.To -> goTo(destination = event.destination, strategy = event.strategy) - } - } - - /** - * Determines whether the [Navigator] can navigate back in the stack in the current [Context]. + * > [!Note] The creation of [NavigationEvent]s is handled internally within this library's components, + * > therefore, instead of invoking this function explicitly, use the [popDestination], [push], and [push] + * > functions. * - * @return `true` if this [Navigator] can navigate back, `false` otherwise. - */ - fun canGoBack(): Boolean - - /** - * Performs a back navigation operation by removing the top destination from the stack in the current [Context] and - * displaying the next destination in the list. If this [Navigator] cannot navigate back, then this function will - * do nothing. + * @param [event] The [NavigationEvent] that represents the navigation action to be performed. * - * @return `true` if the back navigation operation was successful, `false` otherwise. + * @return `true` if the navigation event was handled, or `false` if the event could not be handled (ex: a back + * navigation event was provided but there are no destinations to go back to). If `false` is returned, the + * underlying state values were not mutated. */ - fun goBack(): Boolean + fun dispatch(event: NavigationEvent): Boolean /** - * Performs an "up" navigation. An "up" navigation is similar to a "back" navigation but may be slightly different. - * For instance, on Android, the "left arrow" button in the toolbar component of an application, performs the "up" - * operation, which is slightly different from the phones back button which performs a "back" operation. + * Determines whether this [Navigator] can navigate back to a previous destination in the current context. * - * Currently, this defaults to the same operation as the [goBack] function. + * @return `true` if this [Navigator] can navigate back to a previous destination in the current context, `false` + * otherwise. */ - fun goUp() = goBack() + fun canPopDestination(): Boolean /** - * Goes to the provided [destination] using the provided stack duplicate content [strategy]. Depending on the - * provided [strategy] and the current [Context] stack, this will either clear the current [Context] stack to the - * last value that equals the provided [destination], or add the provided [destination] to the top of the current - * [Context] stack. + * Determines whether this [Navigator] can navigate back to a previous context. * - * @param [destination] The [NavigationDestination] that is to be navigated to and added to the current [Context] - * stack. - * @param [strategy] The [StackDuplicateContentStrategy] defining what to do when there are duplicate [Destination] - * values within the current [Context] stack. + * @return `true` if this [Navigator] can navigate back to a previous context, `false` otherwise. */ - fun goTo(destination: Destination, strategy: StackDuplicateContentStrategy) + fun canPopContext(): Boolean /** - * Changes the current [Context] to the provided [context] value. The displayed [Destination] will top destination - * value in the stack associated with the provided [context], or the provided context's - * [NavigationContext.initialDestination] if there is currently no existing stack for the provided [context]. - * - * @param [context] The [NavigationContext] to change to. + * Resets this [Navigator] back to its initial state. */ - fun changeContext(context: Context) + fun reset() companion object } /** - * Goes to the provided [destination] using the provided stack duplicate content [strategy]. Depending on the current - * [Context] stack, this will either clear the current [Context] stack to the last value that equals the provided - * [destination], or add the provided [destination] to the top of the current [Context] stack. + * Performs a back navigation operation, if possible, by removing the top [NavigationDestination] within the current + * [NavigationContext]. If this [Navigator] cannot navigate to a previous [NavigationDestination], then this function + * will do nothing and return `false`. + * + * @return `true` if the back navigation operation was successful, `false` otherwise. + */ +@ExperimentalNavigationApi +fun > Navigator.popDestination(): Boolean = + dispatch(event = NavigationEvent.Backward.Destination()) + +/** + * Performs a back navigation operation, if possible, by moving to the previous [NavigationContext]. If this + * [Navigator] cannot navigate to a previous [NavigationContext], then this function will do nothing and return + * `false`. + * + * @return `true` if the back navigation operation was successful, `false` otherwise. + */ +@ExperimentalNavigationApi +fun > Navigator.popContext(): Boolean = + dispatch(event = NavigationEvent.Backward.Context()) + +/** + * Navigates to the provided [destination] in the current [NavigationContext]. Depending on the provided + * [NavigationStrategy.DuplicateDestination] when creating this [Navigator], and the current [Context] stack, this will + * either clear the current [Context] stack to the last value that equals the provided [destination], or add the + * provided [destination] to the top of the current [Context] stack. * * @param [destination] The [NavigationDestination] that is to be navigated to and added to the current [Context] * stack. + * + * @return `true` if the navigation operation was successful, `false` otherwise. + */ +@ExperimentalNavigationApi +fun > Navigator.push( + destination: Destination +): Boolean = dispatch(event = NavigationEvent.Forward.Destination(destination = destination)) + +/** + * Changes the current [Context] to the provided [context] value. The displayed [Destination] will be the top + * destination value in the stack associated with the provided [context], or the provided context's + * [NavigationContext.initialDestination] if there is currently no existing stack for the provided [context]. + * + * @param [context] The [NavigationContext] to change to. + * + * @return `true` if the navigation operation was successful, `false` otherwise. + */ +@ExperimentalNavigationApi +fun > Navigator.push( + context: Context +): Boolean = dispatch(event = NavigationEvent.Forward.Context(context = context)) + +/** + * Convenience function for the [Navigator.push] function. + * + * > [!Warning] This function is deprecated and will be replaced with the [Navigator.push] function. + * + * @see [Navigator.push] + */ +@Deprecated( + message = "", + level = DeprecationLevel.WARNING, + replaceWith = ReplaceWith( + expression = "com.chrynan.navigation.Navigator.push" + ) +) +@ExperimentalNavigationApi +fun > Navigator.goTo( + destination: Destination +): Boolean = dispatch(event = NavigationEvent.Forward.Destination(destination = destination)) + +/** + * Convenience function for the [Navigator.push] function. + * + * > [!Warning] This function is deprecated and will be replaced with the [Navigator.push] function. + * + * @see [Navigator.push] + */ +@Deprecated( + message = "", + level = DeprecationLevel.WARNING, + replaceWith = ReplaceWith( + expression = "com.chrynan.navigation.Navigator.push" + ) +) +@ExperimentalNavigationApi +fun > Navigator.changeContext( + context: Context +): Boolean = dispatch(event = NavigationEvent.Forward.Context(context = context)) + +/** + * Creates a [Navigator] instance with the provided values. + * + * @param [initialContext] The initial [NavigationContext] value to start at for this [Navigator]. + * @param [duplicateDestinationStrategy] The [NavigationStrategy.DuplicateDestination] strategy for handling of + * duplicate destination content within a [Context] stack. Read the documentation on + * [NavigationStrategy.DuplicateDestination] for more information about the supported operations. Defaults to + * [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES]. + * @param [destinationRetentionStrategy] The [NavigationStrategy.DestinationRetention] strategy for handling of + * destination stacks within a [Context] when navigating between different [NavigationContext]s. Read the documentation + * on [NavigationStrategy.DestinationRetention] for more information about the supported operations. Defaults to + * [NavigationStrategy.DestinationRetention.RETAIN]. + */ +@ExperimentalNavigationApi +fun > Navigator( + initialContext: Context, + duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, + destinationRetentionStrategy: NavigationStrategy.DestinationRetention = NavigationStrategy.DestinationRetention.RETAIN +): Navigator = + NavigatorImpl( + initialContext = initialContext, + duplicateDestinationStrategy = duplicateDestinationStrategy, + destinationRetentionStrategy = destinationRetentionStrategy + ) + +/** + * Creates a [Navigator] instance with the provided values using the [SingleNavigationContext]. + * + * @param [initialDestination] The initial [NavigationDestination] value to start at for this [Navigator]. + * @param [duplicateDestinationStrategy] The [NavigationStrategy.DuplicateDestination] strategy for handling of + * duplicate destination content within a [NavigationContext] stack. Read the documentation on + * [NavigationStrategy.DuplicateDestination] for more information about the supported operations. Defaults to + * [NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES]. + * @param [destinationRetentionStrategy] The [NavigationStrategy.DestinationRetention] strategy for handling of + * destination stacks within a [NavigationContext] when navigating between different [NavigationContext]s. Read the + * documentation on [NavigationStrategy.DestinationRetention] for more information about the supported operations. + * Defaults to [NavigationStrategy.DestinationRetention.RETAIN]. */ -// Note: This is needed because defaults aren't working for @Composable functions for interfaces. -fun > Navigator.goTo(destination: Destination) = - goTo(destination = destination, strategy = StackDuplicateContentStrategy.CLEAR_STACK) +@ExperimentalNavigationApi +fun Navigator( + initialDestination: Destination, + duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, + destinationRetentionStrategy: NavigationStrategy.DestinationRetention = NavigationStrategy.DestinationRetention.RETAIN +): Navigator> = + NavigatorImpl( + initialContext = SingleNavigationContext(initialDestination = initialDestination), + duplicateDestinationStrategy = duplicateDestinationStrategy, + destinationRetentionStrategy = destinationRetentionStrategy + ) + +/** + * Represents a snapshot of a [Navigator] that can be persisted and obtained later to create a [Navigator] with the + * same values of this snapshot. + */ +@Serializable +@ExperimentalNavigationApi +internal class NavigatorSnapshot> internal constructor( + @SerialName(value = "initial_context") val initialContext: Context, + @SerialName(value = "duplication_destination_strategy") val duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination, + @SerialName(value = "destination_retention_strategy") val destinationRetentionStrategy: NavigationStrategy.DestinationRetention, + @SerialName(value = "state_store") val stateStore: NavigationStateStore, + @SerialName(value = "context_stacks") val contextStacks: NavigationContextStacks, + @SerialName(value = "context_event_stack") val contextEventStack: MutableStack> +) { + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + if (other !is NavigatorSnapshot<*, *>) return false + + if (initialContext != other.initialContext) return false + if (duplicateDestinationStrategy != other.duplicateDestinationStrategy) return false + if (destinationRetentionStrategy != other.destinationRetentionStrategy) return false + if (stateStore != other.stateStore) return false + if (contextStacks != other.contextStacks) return false + + return contextEventStack == other.contextEventStack + } + + override fun hashCode(): Int { + var result = initialContext.hashCode() + result = 31 * result + duplicateDestinationStrategy.hashCode() + result = 31 * result + destinationRetentionStrategy.hashCode() + result = 31 * result + stateStore.hashCode() + result = 31 * result + contextStacks.hashCode() + result = 31 * result + contextEventStack.hashCode() + return result + } + + override fun toString(): String = + "NavigatorSnapshot(" + + "initialContext=$initialContext, " + + "duplicateDestinationStrategy=$duplicateDestinationStrategy, " + + "destinationRetentionStrategy=$destinationRetentionStrategy, " + + "stateStore=$stateStore, " + + "contextStacks=$contextStacks, " + + "contextEventStack=$contextEventStack)" +} -abstract class BaseNavigatorImpl, State : BaseNavigatorStateImpl>( - final override val state: State -) : ViewModel(), +/** + * An implementation of the [Navigator] interface. + */ +@ExperimentalNavigationApi +internal class NavigatorImpl> : Navigator { - private val contextKeyStack = mutableMapOf(state.initialContext to mutableListOf(state.initialDestination)) + internal constructor( + initialContext: Context, + duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination = NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES, + destinationRetentionStrategy: NavigationStrategy.DestinationRetention = NavigationStrategy.DestinationRetention.RETAIN + ) { + this.initialContext = initialContext + this.duplicateDestinationStrategy = duplicateDestinationStrategy + this.destinationRetentionStrategy = destinationRetentionStrategy + this.mutableStore = mutableNavigationStateStoreOf(initialContext = initialContext) + this.navigationStacks = NavigationContextStacks(initialContext = initialContext) + this.contextEventStack = mutableStackOf(NavigationEvent.Forward.Context(context = initialContext)) + } - final override fun goTo(destination: Destination, strategy: StackDuplicateContentStrategy) { - val currentScope = state.currentContext - val currentKeyStack = contextKeyStack[currentScope] ?: mutableListOf() + internal constructor(snapshot: NavigatorSnapshot) { + this.initialContext = snapshot.initialContext + this.duplicateDestinationStrategy = snapshot.duplicateDestinationStrategy + this.destinationRetentionStrategy = snapshot.destinationRetentionStrategy + this.mutableStore = snapshot.stateStore.toMutableNavigationStateStore() + this.navigationStacks = snapshot.contextStacks + this.contextEventStack = snapshot.contextEventStack + } - // If we are already displaying this key on the current scoped stack, then return. - if (destination == currentKeyStack.lastOrNull()) return + private val initialContext: Context + private val duplicateDestinationStrategy: NavigationStrategy.DuplicateDestination + private val destinationRetentionStrategy: NavigationStrategy.DestinationRetention - if (strategy == StackDuplicateContentStrategy.CLEAR_STACK && currentKeyStack.contains(destination)) { - // Go Back to the content with the provided key using the updated content - var lastKey = currentKeyStack.lastOrNull() + private val mutableStore: MutableNavigationStateStore - while (lastKey != null && lastKey != destination) { - currentKeyStack.removeLast() - lastKey = currentKeyStack.lastOrNull() - } + private val navigationStacks: NavigationContextStacks - // Replace the content with the updated content - contextKeyStack[currentScope] = currentKeyStack - state.change(destination = destination) - } else { - // Go to the provided content - currentKeyStack.add(destination) - contextKeyStack[currentScope] = currentKeyStack - state.change(destination = destination) + private val contextEventStack: MutableStack> + + override val store: NavigationStateStore + get() = mutableStore + + override fun dispatch(event: NavigationEvent): Boolean = + when (event) { + is NavigationEvent.Backward -> handleBack(event = event) + + is NavigationEvent.Forward.Destination -> handleDestination(event = event) + + is NavigationEvent.Forward.Context -> handleContext(event = event) } + + override fun canPopContext(): Boolean = + contextEventStack.size > 1 // There must always be at least one item (the initial item) in the stack. + + override fun canPopDestination(): Boolean = + navigationStacks.get(context = store.context.current).size > 1 // There must always be at least one item (the initial item) in the stack. + + override fun reset() { + // Reset the store + mutableStore.reset() + + // Clear the stack values + navigationStacks.clearAll() + contextEventStack.clear() + + // Reset the stack values + // The NavigationStacks component already handles that internally. + contextEventStack.push(NavigationEvent.Forward.Context(context = initialContext)) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is NavigatorImpl<*, *>) return false + + if (initialContext != other.initialContext) return false + if (duplicateDestinationStrategy != other.duplicateDestinationStrategy) return false + if (destinationRetentionStrategy != other.destinationRetentionStrategy) return false + if (mutableStore != other.mutableStore) return false + if (navigationStacks != other.navigationStacks) return false + if (contextEventStack != other.contextEventStack) return false + + return store == other.store } - final override fun goBack(): Boolean { - val wentBack = canGoBack() + override fun hashCode(): Int { + var result = initialContext.hashCode() + result = 31 * result + duplicateDestinationStrategy.hashCode() + result = 31 * result + destinationRetentionStrategy.hashCode() + result = 31 * result + mutableStore.hashCode() + result = 31 * result + navigationStacks.hashCode() + result = 31 * result + contextEventStack.hashCode() + result = 31 * result + store.hashCode() + return result + } - if (wentBack) { - val currentScope = state.currentContext - val currentKeyStack = contextKeyStack[currentScope] ?: mutableListOf() - currentKeyStack.removeLast() - contextKeyStack[currentScope] = currentKeyStack - state.change(destination = currentKeyStack.last()) + override fun toString(): String = + "NavigatorImpl(" + + "initialContext=$initialContext, " + + "duplicateDestinationStrategy=$duplicateDestinationStrategy, " + + "destinationRetentionStrategy=$destinationRetentionStrategy, " + + "contextEventStack=$contextEventStack, " + + "store=$store)" + + /** + * Creates a [NavigatorSnapshot] from the current state of this [Navigator] instance. This can be used to later + * create a [Navigator] instance with the same values. + */ + fun snapshot(): NavigatorSnapshot = + NavigatorSnapshot( + initialContext = this.initialContext, + duplicateDestinationStrategy = this.duplicateDestinationStrategy, + destinationRetentionStrategy = this.destinationRetentionStrategy, + stateStore = this.mutableStore, + contextStacks = this.navigationStacks, + contextEventStack = this.contextEventStack + ) + + /** + * Performs the destination change operation for the provided [NavigationEvent.Forward.Destination] event. + */ + private fun handleDestination(event: NavigationEvent.Forward.Destination): Boolean { + val context = store.context.current + + if (duplicateDestinationStrategy == NavigationStrategy.DuplicateDestination.ALLOW_DUPLICATES) { + navigationStacks.push(context = context, destination = event.destination) + } else { + navigationStacks.pushDropping(context = context, destination = event.destination) } - return wentBack + mutableStore.update( + event = event, + destination = event.destination + ) + + return true } - final override fun canGoBack(): Boolean { - val currentKeyStack = contextKeyStack[state.currentContext] ?: mutableListOf() + /** + * Performs the context change operation for the provided [NavigationEvent.Forward.Context] event. + */ + private fun handleContext(event: NavigationEvent.Forward.Context): Boolean { + contextEventStack.push(event) - return currentKeyStack.size > 1 + if (destinationRetentionStrategy == NavigationStrategy.DestinationRetention.CLEAR) { + navigationStacks.clear(context = event.context) + } + + mutableStore.update( + event = event, + context = event.context, + destination = navigationStacks.peek(context = event.context) + ) + + return true } - final override fun changeContext(context: Context) { - if (context == state.currentContext) return + /** + * Performs the back operation for the provided [NavigationEvent.Backward] event. + */ + private fun handleBack(event: NavigationEvent.Backward): Boolean { + when (event) { + is NavigationEvent.Backward.Context -> { + if (!canPopContext()) return false - val keyStack = contextKeyStack[context] + contextEventStack.pop() - if (keyStack.isNullOrEmpty()) { - val key = context.initialDestination - val newKeyStack = mutableListOf(key) - contextKeyStack[context] = newKeyStack - state.change(destination = key, context = context) - } else { - val key = keyStack.last() - state.change(destination = key, context = context) + // Get the current context after we popped the last context change from the top of the stack. + val newCurrentContextEvent = contextEventStack.peek() + val newDestination = navigationStacks.get(context = newCurrentContextEvent.context).peek() + + mutableStore.update( + event = event, + context = newCurrentContextEvent.context, + destination = newDestination + ) + + return true + } + + is NavigationEvent.Backward.Destination -> { + if (!canPopDestination()) return false + + val context = store.context.current + val destination = navigationStacks.popToPreviousDestinationForContext(context = context) ?: return false + + mutableStore.update( + event = event, + context = context, + destination = destination + ) + + return true + } } } +} + +/** + * A [KSerializer] for the [Navigator] component. + */ +@ExperimentalNavigationApi +internal class NavigatorSerializer> internal constructor( + destinationSerializer: KSerializer, + private val contextSerializer: KSerializer +) : KSerializer> { + + private val stateStoreSerializer = NavigationStateStore.serializer(destinationSerializer, contextSerializer) + private val contextStacksSerializer = NavigationContextStacks.serializer(destinationSerializer, contextSerializer) + private val contextEventStackSerializer = + StackSerializer(NavigationEvent.Forward.Context.serializer(destinationSerializer, contextSerializer)) + + override val descriptor: SerialDescriptor = buildClassSerialDescriptor("Navigator") { + element(elementName = "initial_context", descriptor = contextSerializer.descriptor) + element(elementName = "duplication_destination_strategy") + element(elementName = "destination_retention_strategy") + element(elementName = "state_store", descriptor = stateStoreSerializer.descriptor) + element(elementName = "context_stacks", descriptor = contextStacksSerializer.descriptor) + element(elementName = "context_event_stack", descriptor = contextStacksSerializer.descriptor) + } + + override fun serialize(encoder: Encoder, value: Navigator) { + require(value is NavigatorImpl) { "Only NavigatorImpl is supported for serialization." } + + val snapshot = value.snapshot() + + val compositeEncoder = encoder.beginStructure(descriptor) + compositeEncoder.encodeSerializableElement( + descriptor = descriptor, + index = 0, + serializer = contextSerializer, + value = snapshot.initialContext + ) + compositeEncoder.encodeSerializableElement( + descriptor = descriptor, + index = 1, + serializer = NavigationStrategy.DuplicateDestination.serializer(), + value = snapshot.duplicateDestinationStrategy + ) + compositeEncoder.encodeSerializableElement( + descriptor = descriptor, + index = 2, + serializer = NavigationStrategy.DestinationRetention.serializer(), + value = snapshot.destinationRetentionStrategy + ) + compositeEncoder.encodeSerializableElement( + descriptor = descriptor, + index = 3, + serializer = stateStoreSerializer, + value = snapshot.stateStore + ) + compositeEncoder.encodeSerializableElement( + descriptor = descriptor, + index = 4, + serializer = contextStacksSerializer, + value = snapshot.contextStacks + ) + compositeEncoder.encodeSerializableElement( + descriptor = descriptor, + index = 5, + serializer = contextEventStackSerializer, + value = snapshot.contextEventStack + ) + compositeEncoder.endStructure(descriptor) + } + + override fun deserialize(decoder: Decoder): Navigator { + val compositeDecoder = decoder.beginStructure(descriptor) + val initialContext = compositeDecoder.decodeSerializableElement( + descriptor = descriptor, + index = 0, + deserializer = contextSerializer + ) + val duplicateDestinationStrategy = compositeDecoder.decodeSerializableElement( + descriptor = descriptor, + index = 1, + deserializer = NavigationStrategy.DuplicateDestination.serializer() + ) + val destinationRetentionStrategy = compositeDecoder.decodeSerializableElement( + descriptor = descriptor, + index = 2, + deserializer = NavigationStrategy.DestinationRetention.serializer() + ) + val stateStore = compositeDecoder.decodeSerializableElement( + descriptor = descriptor, + index = 3, + deserializer = stateStoreSerializer + ) + val contextStacks = compositeDecoder.decodeSerializableElement( + descriptor = descriptor, + index = 4, + deserializer = contextStacksSerializer + ) + val contextEventStack = compositeDecoder.decodeSerializableElement( + descriptor = descriptor, + index = 5, + deserializer = contextEventStackSerializer + ) + compositeDecoder.endStructure(descriptor) + + val snapshot = NavigatorSnapshot( + initialContext = initialContext, + duplicateDestinationStrategy = duplicateDestinationStrategy, + destinationRetentionStrategy = destinationRetentionStrategy, + stateStore = stateStore, + contextStacks = contextStacks, + contextEventStack = contextEventStack.toMutableStack() + ) + + return NavigatorImpl(snapshot = snapshot) + } override fun equals(other: Any?): Boolean { if (this === other) return true - if (other == null || other !is BaseNavigatorImpl<*, *, *>) return false + if (other !is NavigatorSerializer<*, *>) return false - if (state != other.state) return false - if (contextKeyStack != other.contextKeyStack) return false + if (contextSerializer != other.contextSerializer) return false + if (descriptor != other.descriptor) return false + if (stateStoreSerializer != other.stateStoreSerializer) return false + if (contextStacksSerializer != other.contextStacksSerializer) return false - return true + return contextEventStackSerializer == other.contextEventStackSerializer } override fun hashCode(): Int { - var result = state.hashCode() - - result = 31 * result + contextKeyStack.hashCode() - + var result = contextSerializer.hashCode() + result = 31 * result + descriptor.hashCode() + result = 31 * result + stateStoreSerializer.hashCode() + result = 31 * result + contextStacksSerializer.hashCode() + result = 31 * result + contextEventStackSerializer.hashCode() return result } override fun toString(): String = - "BaseNavigatorImpl(" + - "state=$state, " + - "contextKeyStack=$contextKeyStack)" + "NavigatorSerializer(" + + "contextSerializer=$contextSerializer, " + + "descriptor=$descriptor, " + + "stateStoreSerializer=$stateStoreSerializer, " + + "contextStacksSerializer=$contextStacksSerializer, " + + "contextEventStackSerializer=$contextEventStackSerializer)" } - -internal class NavigatorImpl>( - initialContext: Context -) : BaseNavigatorImpl>( - state = NavigatorStateImpl(initialContext = initialContext) -) diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigatorState.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigatorState.kt deleted file mode 100644 index f9fee75..0000000 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/NavigatorState.kt +++ /dev/null @@ -1,98 +0,0 @@ -package com.chrynan.navigation - -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.map - -/** - * Represents the state of a [Navigator], including providing the currently displayed [NavigationDestination] and - * [NavigationContext] values. - */ -interface NavigatorState> : - NavigationDestinationState, - NavigationContextState { - - /** - * Determines whether this component is currently initialized, typically meaning that it is ready for use. - */ - val isInitialized: Boolean - - companion object -} - -abstract class BaseNavigatorStateImpl>( - final override val initialContext: Context -) : NavigatorState { - - final override var isInitialized: Boolean = false - - final override val currentContext: Context - get() = mutableStateFlow.value.context - - final override val contextChanges: Flow - get() = mutableStateFlow.asStateFlow() - .map { it.context } - - final override val initialDestination: Destination = initialContext.initialDestination - - final override val currentDestination: Destination - get() = mutableStateFlow.value.destination - - final override val destinationChanges: Flow - get() = mutableStateFlow.asStateFlow() - .map { it.destination } - - private val mutableStateFlow = MutableStateFlow(Event(context = initialContext, destination = initialDestination)) - - fun change( - destination: Destination = currentDestination, - context: Context = currentContext - ) { - mutableStateFlow.value = Event(destination = destination, context = context) - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this::class != other::class) return false - - other as BaseNavigatorStateImpl<*, *> - - if (initialContext != other.initialContext) return false - if (isInitialized != other.isInitialized) return false - if (currentContext != other.currentContext) return false - if (initialDestination != other.initialDestination) return false - if (currentDestination != other.currentDestination) return false - - return true - } - - override fun hashCode(): Int { - var result = initialContext.hashCode() - - result = 31 * result + isInitialized.hashCode() - result = 31 * result + currentContext.hashCode() - result = 31 * result + initialDestination.hashCode() - result = 31 * result + currentDestination.hashCode() - - return result - } - - override fun toString(): String { - return "NavigatorStateImpl(" + - "initialContext=$initialContext, " + - "isInitialized=$isInitialized, " + - "currentContext=$currentContext, " + - "initialDestination=$initialDestination, " + - "currentDestination=$currentDestination)" - } - - private data class Event>( - val context: Context, - val destination: Destination - ) -} - -internal class NavigatorStateImpl>( - initialContext: Context -) : BaseNavigatorStateImpl(initialContext = initialContext) diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/Stack.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/Stack.kt new file mode 100644 index 0000000..81f01ae --- /dev/null +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/Stack.kt @@ -0,0 +1,276 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +import kotlinx.serialization.KSerializer +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.ListSerializer +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +/** + * Represents a LIFO (last in, first out) Queue [Collection]. + */ +@Serializable(with = StackSerializer::class) +internal interface Stack : Collection { + + /** + * Retrieves the top element from this [Stack] without removing it. + * + * @throws [NoSuchElementException] - if the list is empty. + */ + fun peek(): E + + companion object +} + +/** + * Retrieves the top element from this [Stack] without removing it, or `null` if this [Stack] is empty. + */ +internal fun Stack.peekOrNull(): E? = + try { + peek() + } catch (_: NoSuchElementException) { + null + } + +/** + * Represents a mutable LIFO (last in, first out) Queue [MutableCollection] + */ +@Serializable(with = MutableStackSerializer::class) +internal interface MutableStack : Stack, + MutableCollection { + + /** + * Removes and returns the top element from this [Stack]. + * + * @throws [NoSuchElementException] - if the list is empty. + */ + fun pop(): E + + /** + * Adds the provided [element] to the end of this queue [MutableList]. + */ + fun push(element: E) + + companion object +} + +/** + * Removes and returns the top element from this [Stack], or `null` if this [Stack] is empty. + */ +internal fun MutableStack.popOrNull(): E? = + try { + pop() + } catch (_: NoSuchElementException) { + null + } + +/** + * Returns a new read-only [Stack] using the provided ordered [elements]. The first provided element is the top of the + * resulting [Stack] and the last provided element is the bottom of the resulting [Stack]. + */ +internal fun stackOf(vararg elements: E): Stack = + ReadOnlyStack(elements = elements.toList()) + +/** + * Returns a [MutableStack] using the provided ordered [elements]. The first provided element is the top of the + * resulting [Stack] and the last provided element is the bottom of the resulting [Stack]. + */ +internal fun mutableStackOf(vararg elements: E): MutableStack = + ArrayListMutableStack(elements = elements.toList()) + +/** + * Returns a [Stack] containing all the elements in this [Collection]. Note that iterator order of the elements of this + * [Collection] matters; the first item in this collection will be the top of the resulting [Stack] and the last item + * in this collection will be the bottom of the resulting [Stack], which matches the [Stack.iterator] order. This will + * make a copy of this collection using [Collection.toList] to obtain the order of the items. + * + * Note that a copy of this [Collection] will be wrapped in the returned [Stack], so that mutations to this + * [Collection] will not affect the resulting [Stack]. + */ +internal fun Collection.toStack(): Stack = + ReadOnlyStack(elements = this) + +/** + * Returns a [MutableStack] containing all the elements in this [Collection]. Note that iterator order of the elements + * of this [Collection] matters; the first item in this collection will be the top of the resulting [Stack] and the + * last item in this collection will be the bottom of the resulting [Stack], which matches the [Stack.iterator] order. + * This will make a copy of this collection using [Collection.toList] to obtain the order of the items. + * + * Note that a copy of this [Collection] will be wrapped in the returned [Stack], so that mutations to this + * [Collection] will not affect the resulting [Stack]. + */ +internal fun Collection.toMutableStack(): MutableStack = + ArrayListMutableStack(elements = this) + +/** + * A read-only version of a [Stack]. This takes the elements provided in the constructor and makes a copy of that + * collection, so further mutations to that elements collection will not affect this [Stack]. + */ +internal class ReadOnlyStack internal constructor(elements: Collection) : Stack { + + override val size: Int + get() = list.size + + private val list = elements.toList() + + override fun peek(): E = + list.get(index = 0) + + override fun isEmpty(): Boolean = + list.isEmpty() + + override fun iterator(): Iterator = + list.iterator() + + override fun containsAll(elements: Collection): Boolean = + this.list.containsAll(elements) + + override fun contains(element: E): Boolean = + list.contains(element) + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Stack<*>) return false + + return toList() == other.toList() + } + + override fun hashCode(): Int = + list.hashCode() + + override fun toString(): String = + "ReadOnlyStack(size=$size, elements=[${list.joinToString(separator = ",")}])" +} + +/** + * A mutable version of a [Stack] that is backed by an [ArrayList]. This takes the elements provided in the constructor + * and makes a copy of that collection, so further mutations to that elements collection will not affect this [Stack]. + */ +internal class ArrayListMutableStack internal constructor(elements: Collection) : MutableStack { + + override val size: Int + get() = list.size + + private val list = ArrayList(elements.toList()) + + override fun pop(): E = + list.removeFirst() + + override fun push(element: E) = + list.add(index = 0, element = element) + + override fun peek(): E = + list.get(index = 0) + + override fun isEmpty(): Boolean = + list.isEmpty() + + override fun iterator(): MutableIterator = + list.iterator() + + override fun clear() = + list.clear() + + override fun retainAll(elements: Collection): Boolean = + list.retainAll(elements) + + override fun removeAll(elements: Collection): Boolean = + list.removeAll(elements) + + override fun remove(element: E): Boolean = + list.remove(element) + + override fun addAll(elements: Collection): Boolean = + list.addAll(elements) + + override fun add(element: E): Boolean = + list.add(element) + + override fun containsAll(elements: Collection): Boolean = + list.containsAll(elements) + + override fun contains(element: E): Boolean = + list.contains(element) + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is Stack<*>) return false + + return toList() == other.toList() + } + + override fun hashCode(): Int = + list.hashCode() + + override fun toString(): String = + "ArrayListMutableStack(size=$size, elements=[${list.joinToString(separator = ",")}])" +} + +/** + * A [KSerializer] for a [Stack]. + */ +internal class StackSerializer internal constructor( + elementSerializer: KSerializer +) : KSerializer> { + + private val delegateSerializer = ListSerializer(elementSerializer = elementSerializer) + + override val descriptor: SerialDescriptor + get() = delegateSerializer.descriptor + + override fun serialize(encoder: Encoder, value: Stack) { + delegateSerializer.serialize(encoder = encoder, value = value.toList()) + } + + override fun deserialize(decoder: Decoder): Stack = + delegateSerializer.deserialize(decoder = decoder).toStack() + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is StackSerializer<*>) return false + + return delegateSerializer == other.delegateSerializer + } + + override fun hashCode(): Int = + delegateSerializer.hashCode() + + override fun toString(): String = + "StackSerializer(delegateSerializer=$delegateSerializer)" +} + +/** + * A [KSerializer] for a [MutableStack]. + */ +internal class MutableStackSerializer internal constructor( + elementSerializer: KSerializer +) : KSerializer> { + + private val delegateSerializer = ListSerializer(elementSerializer = elementSerializer) + + override val descriptor: SerialDescriptor + get() = delegateSerializer.descriptor + + override fun serialize(encoder: Encoder, value: MutableStack) { + delegateSerializer.serialize(encoder = encoder, value = value.toList()) + } + + override fun deserialize(decoder: Decoder): MutableStack = + delegateSerializer.deserialize(decoder = decoder).toMutableStack() + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is MutableStackSerializer<*>) return false + + return delegateSerializer == other.delegateSerializer + } + + override fun hashCode(): Int = + delegateSerializer.hashCode() + + override fun toString(): String = + "MutableStackSerializer(delegateSerializer=$delegateSerializer)" +} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/StackDuplicateContentStrategy.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/StackDuplicateContentStrategy.kt deleted file mode 100644 index 2107784..0000000 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/StackDuplicateContentStrategy.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.chrynan.navigation - -@Suppress("unused") -enum class StackDuplicateContentStrategy { - - CLEAR_STACK, - ADD_TO_STACK; - - companion object -} diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/TimeUtils.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/TimeUtils.kt new file mode 100644 index 0000000..1707156 --- /dev/null +++ b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/TimeUtils.kt @@ -0,0 +1,8 @@ +package com.chrynan.navigation + +import kotlin.time.Duration + +/** + * Retrieves the current elapsed system time since the system booted. + */ +internal expect fun elapsedSystemTime(): Duration diff --git a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/ViewModel.kt b/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/ViewModel.kt deleted file mode 100644 index b6f2910..0000000 --- a/navigation-core/src/commonMain/kotlin/com.chrynan.navigation/ViewModel.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.chrynan.navigation - -expect abstract class ViewModel internal constructor() diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/ArrayListMutableStackTest.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/ArrayListMutableStackTest.kt new file mode 100644 index 0000000..00608e6 --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/ArrayListMutableStackTest.kt @@ -0,0 +1,120 @@ +package com.chrynan.navigation + +import kotlin.test.Test +import kotlin.test.assertContentEquals +import kotlin.test.assertEquals + +internal class ArrayListMutableStackTest { + + @Test + fun peekReturnsTheFirstItem() { + val elements = listOf(1, 2, 3) + + val stack = ArrayListMutableStack(elements) + + assertEquals(expected = 3, actual = stack.size) + assertEquals(expected = 1, actual = stack.peek()) + assertEquals(expected = 3, actual = stack.size) + } + + @Test + fun popReturnsTheFirstItem() { + val elements = listOf(1, 2, 3) + + val stack = ArrayListMutableStack(elements) + + assertEquals(expected = 3, actual = stack.size) + assertEquals(expected = 1, actual = stack.pop()) + assertEquals(expected = 2, actual = stack.size) + } + + @Test + fun pushAddsItemToTheTopOfStack() { + val elements = listOf(1, 2, 3) + + val stack = ArrayListMutableStack(elements) + + assertEquals(expected = 3, actual = stack.size) + + stack.push(4) + + assertEquals(expected = 4, actual = stack.size) + assertEquals(expected = 4, actual = stack.peek()) + assertEquals(expected = 4, actual = stack.first()) + } + + @Test + fun mutatingWrappedStackElementsDoesNotEffectStack() { + val elements = mutableListOf(1, 2, 3) + + val stack = ArrayListMutableStack(elements) + + assertEquals(expected = 3, actual = stack.size) + assertContentEquals(expected = listOf(1, 2, 3), actual = stack.toList()) + + elements.removeLast() + + assertEquals(expected = 3, actual = stack.size) + assertContentEquals(expected = listOf(1, 2, 3), actual = stack.toList()) + } + + @Test + fun isEmptyReturnsCorrectly() { + val emptyStack = ArrayListMutableStack(emptyList()) + val nonEmptyStack = ArrayListMutableStack(listOf(1)) + + assertEquals(expected = true, actual = emptyStack.isEmpty()) + assertEquals(expected = 0, actual = emptyStack.size) + + assertEquals(expected = false, actual = nonEmptyStack.isEmpty()) + assertEquals(expected = 1, actual = nonEmptyStack.size) + } + + @Test + fun containsReturnsCorrectly() { + val elements = listOf(1, 2, 3) + + val stack = ArrayListMutableStack(elements) + + assertEquals(expected = false, actual = stack.contains(0)) + assertEquals(expected = true, actual = stack.contains(1)) + assertEquals(expected = true, actual = stack.contains(2)) + assertEquals(expected = true, actual = stack.contains(3)) + assertEquals(expected = false, actual = stack.contains(4)) + } + + @Test + fun containsAllReturnsCorrectly() { + val elements = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) + + val stack = ArrayListMutableStack(elements) + + assertEquals(expected = true, actual = stack.containsAll(listOf(0, 3, 6, 9))) + assertEquals(expected = true, actual = stack.containsAll(listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))) + assertEquals(expected = true, actual = stack.containsAll(listOf(1))) + assertEquals(expected = false, actual = stack.containsAll(listOf(10))) + assertEquals(expected = false, actual = stack.containsAll(listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))) + assertEquals(expected = false, actual = stack.containsAll(listOf(0, 3, 11))) + assertEquals(expected = true, actual = stack.containsAll(listOf())) + } + + @Test + fun readOnlyStackEqualsArrayListMutableStackWithSameContents() { + val readOnlyStack = ReadOnlyStack(listOf(1, 2, 3)) + val arrayListMutableStack = ArrayListMutableStack(listOf(1, 2, 3)) + + assertEquals(expected = true, actual = readOnlyStack == arrayListMutableStack) + } + + @Test + fun iteratorStartsWithTheTopOfTheStack(){ + val stack = ArrayListMutableStack(listOf(3, 2, 1)) + + val iterator = stack.iterator() + + assertEquals(expected = 3, actual = iterator.next()) + assertEquals(expected = 2, actual = iterator.next()) + assertEquals(expected = 1, actual = iterator.next()) + assertEquals(expected = false, actual = iterator.hasNext()) + } +} diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/DestinationAndContextTest.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/DestinationAndContextTest.kt new file mode 100644 index 0000000..2924cff --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/DestinationAndContextTest.kt @@ -0,0 +1,110 @@ +package com.chrynan.navigation + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals + +class DestinationAndContextTest { + + @Test + fun componentOneIsDestination() { + val value = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.FAVORITES + ) + + assertEquals(expected = TestDestination.FAVORITES, actual = value.component1()) + } + + @Test + fun componentTwoIsContext() { + val value = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.FAVORITES + ) + + assertEquals(expected = TestContext.Home, actual = value.component2()) + } + + @Test + fun copyWithUpdatedContextWorks() { + val value = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.HOME + ) + + val newValue = value.copy(context = TestContext.Favorites) + + assertEquals(expected = TestContext.Favorites, actual = newValue.context) + assertEquals(expected = TestDestination.HOME, actual = newValue.destination) + } + + @Test + fun copyWithUpdatedDestinationWorks() { + val value = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.HOME + ) + + val newValue = value.copy(destination = TestDestination.FAVORITES) + + assertEquals(expected = TestContext.Home, actual = newValue.context) + assertEquals(expected = TestDestination.FAVORITES, actual = newValue.destination) + } + + @Test + fun sameValuesAreEqual() { + val one = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.HOME + ) + val two = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.HOME + ) + + assertEquals(one, two) + } + + @Test + fun differentValuesAreNotEqual() { + val one = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.HOME + ) + val two = DestinationAndContext( + context = TestContext.Favorites, + destination = TestDestination.FAVORITES + ) + + assertNotEquals(one, two) + } + + @Test + fun differentContextValuesAreNotEqual() { + val one = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.HOME + ) + val two = DestinationAndContext( + context = TestContext.Favorites, + destination = TestDestination.HOME + ) + + assertNotEquals(one, two) + } + + @Test + fun differentDestinationValuesAreNotEqual() { + val one = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.HOME + ) + val two = DestinationAndContext( + context = TestContext.Home, + destination = TestDestination.SETTINGS + ) + + assertNotEquals(one, two) + } +} diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/MutableNavigationStateStoreImplTest.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/MutableNavigationStateStoreImplTest.kt new file mode 100644 index 0000000..5377597 --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/MutableNavigationStateStoreImplTest.kt @@ -0,0 +1,207 @@ +package com.chrynan.navigation + +import kotlin.test.Test +import kotlin.test.assertEquals + +class MutableNavigationStateStoreImplTest { + + @Test + fun currentValuesDefaultToInitial() { + val stateStore = mutableNavigationStateStoreOf( + initialContext = TestContext.Home + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + } + + @Test + fun providingInitialAndCurrentValuesWorksCorrectly() { + val currentEvent: NavigationEvent = + NavigationEvent.Forward.Context(context = TestContext.Settings) + + val stateStore = mutableNavigationStateStoreOf( + initialContext = TestContext.Home, + currentContext = TestContext.Settings, + initialDestination = TestContext.Home.initialDestination, + currentDestination = TestContext.Settings.initialDestination, + initialEvent = null, + currentEvent = currentEvent + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Settings) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Settings.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = currentEvent) + } + + @Test + fun updatingNoValuesRemainsTheSame() { + val stateStore = mutableNavigationStateStoreOf( + initialContext = TestContext.Home + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + + stateStore.update() + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + } + + @Test + fun updatingContextChangesTheContextValue() { + val stateStore = mutableNavigationStateStoreOf( + initialContext = TestContext.Home + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + + stateStore.update(context = TestContext.Favorites) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Favorites) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + } + + @Test + fun updatingDestinationChangesTheDestinationValue() { + val stateStore = mutableNavigationStateStoreOf( + initialContext = TestContext.Home + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + + stateStore.update(destination = TestDestination.FAVORITES) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestDestination.FAVORITES) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + } + + @Test + fun updatingEventChangesTheEventValue() { + val stateStore = mutableNavigationStateStoreOf( + initialContext = TestContext.Home + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + + val currentEvent: NavigationEvent = + NavigationEvent.Forward.Context(context = TestContext.Settings) + + stateStore.update(event = currentEvent) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = currentEvent) + } + + @Test + fun updatingEverythingChangesEverything() { + val stateStore = mutableNavigationStateStoreOf( + initialContext = TestContext.Home + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + + val currentEvent: NavigationEvent = + NavigationEvent.Forward.Context(context = TestContext.Favorites) + + stateStore.update( + context = TestContext.Favorites, + destination = TestDestination.FAVORITES, + event = currentEvent + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Favorites) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestDestination.FAVORITES) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = currentEvent) + } + + @Test + fun resetChangesEverythingBackToInitialValues() { + val stateStore = mutableNavigationStateStoreOf( + initialContext = TestContext.Home + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + + val currentEvent: NavigationEvent = + NavigationEvent.Forward.Context(context = TestContext.Favorites) + + stateStore.update( + context = TestContext.Favorites, + destination = TestDestination.FAVORITES, + event = currentEvent + ) + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Favorites) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestDestination.FAVORITES) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = currentEvent) + + stateStore.reset() + + assertEquals(expected = stateStore.context.initial, actual = TestContext.Home) + assertEquals(expected = stateStore.context.current, actual = TestContext.Home) + assertEquals(expected = stateStore.destination.initial, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.destination.current, actual = TestContext.Home.initialDestination) + assertEquals(expected = stateStore.event.initial, actual = null) + assertEquals(expected = stateStore.event.current, actual = null) + } +} diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/NavigationContextStacksTest.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/NavigationContextStacksTest.kt new file mode 100644 index 0000000..3747f54 --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/NavigationContextStacksTest.kt @@ -0,0 +1,263 @@ +package com.chrynan.navigation + +import kotlin.test.Test +import kotlin.test.assertEquals + +internal class NavigationContextStacksTest { + + @Test + fun initialContextIsReturnedCorrectly() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + val stack = stacks[TestContext.Home] + + assertEquals(expected = 1, actual = stack.size) + assertEquals(expected = TestDestination.HOME, actual = stack.peek()) + } + + @Test + fun getDefaultsToStackOfInitialDestination() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + val stack = stacks[TestContext.Favorites] + + assertEquals(expected = 1, actual = stack.size) + assertEquals(expected = TestDestination.FAVORITES, actual = stack.peek()) + } + + @Test + fun peekDefaultsToInitialDestination() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + val destination = stacks.peek(context = TestContext.Favorites) + + assertEquals(expected = TestDestination.FAVORITES, actual = destination) + } + + @Test + fun peekReturnsCorrectValue() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + val destination = stacks.peek(context = TestContext.Home) + + assertEquals(expected = TestDestination.HOME, actual = destination) + } + + @Test + fun popReturnsNullForNonExistingContext() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + val destination = stacks.pop(context = TestContext.Favorites) + + assertEquals(expected = null, actual = destination) + } + + @Test + fun popReturnsNullForStackWithInitialDestination() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + val destination = stacks.pop(context = TestContext.Home) + + assertEquals(expected = null, actual = destination) + } + + @Test + fun popRemoveAndReturnsDestinationCorrectly() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Home, destination = TestDestination.ITEM_DETAILS) + + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = stacks.peek(context = TestContext.Home)) + + val destination = stacks.pop(context = TestContext.Home) + + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = destination) + assertEquals(expected = TestDestination.HOME, actual = stacks.peek(context = TestContext.Home)) + } + + @Test + fun pushFirstTimeContextResultsInInitialDestinationAndNewDestination() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Favorites, destination = TestDestination.CHANNEL_DETAILS) + + val stack = stacks[TestContext.Favorites] + + assertEquals(expected = 2, actual = stack.size) + assertEquals(expected = TestDestination.CHANNEL_DETAILS, actual = stack.peek()) + assertEquals(expected = TestDestination.CHANNEL_DETAILS, actual = stack.first()) + assertEquals(expected = TestDestination.FAVORITES, actual = stack.last()) + } + + @Test + fun pushInitialDestinationResultsInDuplicates() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Home, destination = TestDestination.HOME) + + val stack = stacks[TestContext.Home] + + assertEquals(expected = 2, actual = stack.size) + assertEquals(expected = TestDestination.HOME, actual = stack.peek()) + assertEquals(expected = TestDestination.HOME, actual = stack.first()) + } + + @Test + fun pushAddsItemToTopOfStack() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Home, destination = TestDestination.ITEM_DETAILS) + + val stack = stacks[TestContext.Home] + + assertEquals(expected = 2, actual = stack.size) + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = stack.peek()) + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = stack.first()) + assertEquals(expected = TestDestination.HOME, actual = stack.last()) + } + + @Test + fun pushAllAddsItemsToTopOfStack() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.pushAll( + context = TestContext.Home, + destinations = stackOf(TestDestination.ITEM_DETAILS, TestDestination.FAVORITES) + ) + + val stack = stacks[TestContext.Home].toMutableStack() + + assertEquals(expected = 3, actual = stack.size) + assertEquals(expected = TestDestination.FAVORITES, actual = stack.pop()) + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = stack.pop()) + assertEquals(expected = TestDestination.HOME, actual = stack.peek()) + } + + @Test + fun clearResetsStackToInitialState() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Home, destination = TestDestination.ITEM_DETAILS) + stacks.push(context = TestContext.Home, destination = TestDestination.CHANNEL_DETAILS) + + stacks.push(context = TestContext.Favorites, destination = TestDestination.SETTINGS) + + val homeStack = stacks[TestContext.Home] + val favoriteStack = stacks[TestContext.Favorites] + + assertEquals(expected = 3, actual = homeStack.size) + assertEquals(expected = TestDestination.CHANNEL_DETAILS, actual = homeStack.peek()) + assertEquals(expected = 2, actual = favoriteStack.size) + assertEquals(expected = TestDestination.SETTINGS, actual = favoriteStack.peek()) + + stacks.clear(context = TestContext.Home) + + val updatedHomeStack = stacks[TestContext.Home] + val updatedFavoriteStack = stacks[TestContext.Favorites] + + assertEquals(expected = 1, actual = updatedHomeStack.size) + assertEquals(expected = TestDestination.HOME, actual = updatedHomeStack.peek()) + assertEquals(expected = 2, actual = updatedFavoriteStack.size) + assertEquals(expected = TestDestination.SETTINGS, actual = updatedFavoriteStack.peek()) + } + + @Test + fun clearAllResetsStacksToInitialState() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Home, destination = TestDestination.ITEM_DETAILS) + + stacks.push(context = TestContext.Favorites, destination = TestDestination.CHANNEL_DETAILS) + + stacks.clearAll() + + val homeStack = stacks[TestContext.Home] + val favoritesStack = stacks[TestContext.Favorites] + + assertEquals(expected = 1, actual = homeStack.size) + assertEquals(expected = TestDestination.HOME, actual = homeStack.peek()) + + assertEquals(expected = 1, actual = favoritesStack.size) + assertEquals(expected = TestDestination.FAVORITES, actual = favoritesStack.peek()) + } + + @Test + fun pushDroppingPopsTheStackToTheItem() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Home, destination = TestDestination.ITEM_DETAILS) + stacks.push(context = TestContext.Home, destination = TestDestination.FAVORITES) + stacks.push(context = TestContext.Home, destination = TestDestination.SETTINGS) + stacks.push(context = TestContext.Home, destination = TestDestination.CHANNEL_DETAILS) + + val initialStack = stacks[TestContext.Home] + + assertEquals(expected = 5, actual = initialStack.size) + assertEquals(expected = TestDestination.CHANNEL_DETAILS, actual = initialStack.peek()) + + stacks.pushDropping(context = TestContext.Home, TestDestination.FAVORITES) + + val updatedStack = stacks[TestContext.Home] + + assertEquals(expected = true, actual = TestDestination.FAVORITES == TestDestination.FAVORITES) + assertEquals(expected = 3, actual = updatedStack.size) + assertEquals(expected = TestDestination.FAVORITES, actual = updatedStack.peek()) + } + + @Test + fun popToPreviousDestinationForContextRemovesItemOnTopOfStackAndReturnsTheNewTopOfStack() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Home, destination = TestDestination.SETTINGS) + + assertEquals(expected = 2, actual = stacks[TestContext.Home].size) + assertEquals(expected = TestDestination.SETTINGS, actual = stacks[TestContext.Home].peek()) + + val previous = stacks.popToPreviousDestinationForContext(context = TestContext.Home) + + assertEquals(expected = 1, actual = stacks[TestContext.Home].size) + assertEquals(expected = TestDestination.HOME, actual = stacks[TestContext.Home].peek()) + assertEquals(expected = TestDestination.HOME, actual = previous) + } + + @Test + fun popToPreviousDestinationForContextReturnsNullForStackThatCannotBePopped() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + assertEquals(expected = 1, actual = stacks[TestContext.Home].size) + assertEquals(expected = TestDestination.HOME, actual = stacks[TestContext.Home].peek()) + + val previous = stacks.popToPreviousDestinationForContext(context = TestContext.Home) + + assertEquals(expected = 1, actual = stacks[TestContext.Home].size) + assertEquals(expected = TestDestination.HOME, actual = stacks[TestContext.Home].peek()) + assertEquals(expected = null, actual = previous) + } + + @Test + fun toMapReturnsExpectedMap() { + val stacks = NavigationContextStacks(initialContext = TestContext.Home) + + stacks.push(context = TestContext.Home, destination = TestDestination.SETTINGS) + stacks.push(context = TestContext.Home, destination = TestDestination.CHANNEL_DETAILS) + + stacks.push(context = TestContext.Favorites, destination = TestDestination.ITEM_DETAILS) + + assertEquals(expected = 3, actual = stacks[TestContext.Home].size) + assertEquals(expected = 2, actual = stacks[TestContext.Favorites].size) + assertEquals(expected = TestDestination.CHANNEL_DETAILS, actual = stacks[TestContext.Home].peek()) + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = stacks[TestContext.Favorites].peek()) + + val map = stacks.toMap() + + assertEquals(expected = 2, actual = map.size) + + val homeStack = map[TestContext.Home] + val favoriteStack = map[TestContext.Favorites] + + assertEquals(expected = 3, actual = homeStack?.size) + assertEquals(expected = 2, actual = favoriteStack?.size) + assertEquals(expected = TestDestination.CHANNEL_DETAILS, actual = homeStack?.peek()) + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = favoriteStack?.peek()) + } +} diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/NavigatorImplTest.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/NavigatorImplTest.kt new file mode 100644 index 0000000..7250220 --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/NavigatorImplTest.kt @@ -0,0 +1,153 @@ +@file:OptIn(ExperimentalNavigationApi::class) + +package com.chrynan.navigation + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs +import kotlin.test.assertNotNull + +internal class NavigatorImplTest { + + @Test + fun navigatorStartsAtInitialContextValue() { + val navigator = Navigator(initialContext = TestContext.Home) + + assertEquals(expected = TestContext.Home, actual = navigator.store.context.initial) + assertEquals(expected = TestContext.Home, actual = navigator.store.context.current) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.initial) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.current) + assertEquals(expected = null, actual = navigator.store.event.initial) + assertEquals(expected = null, actual = navigator.store.event.current) + assertEquals(expected = false, actual = navigator.canPopContext()) + } + + @Test + fun goToChangesDestination() { + val navigator = Navigator(initialContext = TestContext.Home) + + navigator.push(TestDestination.ITEM_DETAILS) + + assertEquals(expected = TestContext.Home, actual = navigator.store.context.initial) + assertEquals(expected = TestContext.Home, actual = navigator.store.context.current) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.initial) + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = navigator.store.destination.current) + assertEquals(expected = null, actual = navigator.store.event.initial) + assertIs>(value = navigator.store.event.current) + assertNotNull(actual = navigator.store.event.current) + assertEquals(expected = true, actual = navigator.canPopDestination()) + } + + @Test + fun goBackChangesDestinationBack() { + val navigator = Navigator(initialContext = TestContext.Home) + + navigator.push(TestDestination.ITEM_DETAILS) + + assertEquals(expected = TestContext.Home, actual = navigator.store.context.initial) + assertEquals(expected = TestContext.Home, actual = navigator.store.context.current) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.initial) + assertEquals(expected = TestDestination.ITEM_DETAILS, actual = navigator.store.destination.current) + assertEquals(expected = null, actual = navigator.store.event.initial) + assertIs>(value = navigator.store.event.current) + assertNotNull(actual = navigator.store.event.current) + assertEquals(expected = true, actual = navigator.canPopDestination()) + + val result = navigator.popDestination() + + assertEquals(expected = true, actual = result) + assertEquals(expected = TestContext.Home, actual = navigator.store.context.initial) + assertEquals(expected = TestContext.Home, actual = navigator.store.context.current) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.initial) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.current) + assertEquals(expected = null, actual = navigator.store.event.initial) + assertIs>(value = navigator.store.event.current) + assertNotNull(actual = navigator.store.event.current) + assertEquals(expected = false, actual = navigator.canPopDestination()) + } + + @Test + fun changeContextUpdatesContextValue() { + val navigator = Navigator(initialContext = TestContext.Home) + + navigator.push(TestContext.Settings) + + assertEquals(expected = TestContext.Home, actual = navigator.store.context.initial) + assertEquals(expected = TestContext.Settings, actual = navigator.store.context.current) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.initial) + assertEquals(expected = TestDestination.SETTINGS, actual = navigator.store.destination.current) + assertEquals(expected = null, actual = navigator.store.event.initial) + assertIs>(value = navigator.store.event.current) + assertNotNull(actual = navigator.store.event.current) + assertEquals(expected = true, actual = navigator.canPopContext()) + } + + @Test + fun canPopContextReturnsFalseForNoContextChange() { + val navigator = Navigator( + initialContext = TestContext.Home + ) + + assertEquals(expected = false, actual = navigator.canPopContext()) + } + + @Test + fun canPopContextReturnsTrueForContextChange() { + val navigator = Navigator( + initialContext = TestContext.Home + ) + + navigator.push(TestContext.Settings) + + assertEquals(expected = true, actual = navigator.canPopContext()) + } + + @Test + fun canPopDestinationReturnsFalseForInitialDestination() { + val navigator = Navigator( + initialContext = TestContext.Home + ) + + assertEquals(expected = false, actual = navigator.canPopDestination()) + } + + @Test + fun canPopDestinationReturnsTrueForDestinationStack() { + val navigator = Navigator( + initialContext = TestContext.Home + ) + + navigator.push(TestDestination.ITEM_DETAILS) + + assertEquals(expected = true, actual = navigator.canPopDestination()) + } + + @Test + fun resetRestoresTheInitialState() { + val navigator = Navigator( + initialContext = TestContext.Home + ) + + navigator.push(TestDestination.ITEM_DETAILS) + navigator.push(TestContext.Favorites) + + assertEquals(expected = TestContext.Home, actual = navigator.store.context.initial) + assertEquals(expected = TestContext.Favorites, actual = navigator.store.context.current) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.initial) + assertEquals(expected = TestDestination.FAVORITES, actual = navigator.store.destination.current) + assertEquals(expected = null, actual = navigator.store.event.initial) + assertIs>(value = navigator.store.event.current) + assertNotNull(actual = navigator.store.event.current) + assertEquals(expected = true, actual = navigator.canPopContext()) + + navigator.reset() + + assertEquals(expected = TestContext.Home, actual = navigator.store.context.initial) + assertEquals(expected = TestContext.Home, actual = navigator.store.context.current) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.initial) + assertEquals(expected = TestDestination.HOME, actual = navigator.store.destination.current) + assertEquals(expected = null, actual = navigator.store.event.initial) + assertEquals(expected = null, actual = navigator.store.event.current) + assertEquals(expected = false, actual = navigator.canPopContext()) + } +} diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/ReadOnlyStackTest.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/ReadOnlyStackTest.kt new file mode 100644 index 0000000..c0f85a1 --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/ReadOnlyStackTest.kt @@ -0,0 +1,93 @@ +package com.chrynan.navigation + +import kotlin.test.Test +import kotlin.test.assertContentEquals +import kotlin.test.assertEquals + +internal class ReadOnlyStackTest { + + @Test + fun peekReturnsTheFirstItem() { + val elements = listOf(1, 2, 3) + + val stack = ReadOnlyStack(elements) + + assertEquals(expected = 1, actual = stack.peek()) + assertEquals(expected = 3, actual = stack.size) + } + + @Test + fun mutatingWrappedStackElementsDoesNotEffectStack() { + val elements = mutableListOf(1, 2, 3) + + val stack = ReadOnlyStack(elements) + + assertEquals(expected = 3, actual = stack.size) + assertContentEquals(expected = listOf(1, 2, 3), actual = stack.toList()) + + elements.removeLast() + + assertEquals(expected = 3, actual = stack.size) + assertContentEquals(expected = listOf(1, 2, 3), actual = stack.toList()) + } + + @Test + fun isEmptyReturnsCorrectly() { + val emptyStack = ReadOnlyStack(emptyList()) + val nonEmptyStack = ReadOnlyStack(listOf(1)) + + assertEquals(expected = true, actual = emptyStack.isEmpty()) + assertEquals(expected = 0, actual = emptyStack.size) + + assertEquals(expected = false, actual = nonEmptyStack.isEmpty()) + assertEquals(expected = 1, actual = nonEmptyStack.size) + } + + @Test + fun containsReturnsCorrectly() { + val elements = listOf(1, 2, 3) + + val stack = ReadOnlyStack(elements) + + assertEquals(expected = false, actual = stack.contains(0)) + assertEquals(expected = true, actual = stack.contains(1)) + assertEquals(expected = true, actual = stack.contains(2)) + assertEquals(expected = true, actual = stack.contains(3)) + assertEquals(expected = false, actual = stack.contains(4)) + } + + @Test + fun containsAllReturnsCorrectly() { + val elements = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) + + val stack = ReadOnlyStack(elements) + + assertEquals(expected = true, actual = stack.containsAll(listOf(0, 3, 6, 9))) + assertEquals(expected = true, actual = stack.containsAll(listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))) + assertEquals(expected = true, actual = stack.containsAll(listOf(1))) + assertEquals(expected = false, actual = stack.containsAll(listOf(10))) + assertEquals(expected = false, actual = stack.containsAll(listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10))) + assertEquals(expected = false, actual = stack.containsAll(listOf(0, 3, 11))) + assertEquals(expected = true, actual = stack.containsAll(listOf())) + } + + @Test + fun readOnlyStackEqualsArrayListMutableStackWithSameContents() { + val readOnlyStack = ReadOnlyStack(listOf(1, 2, 3)) + val arrayListMutableStack = ArrayListMutableStack(listOf(1, 2, 3)) + + assertEquals(expected = true, actual = readOnlyStack == arrayListMutableStack) + } + + @Test + fun iteratorStartsWithTheTopOfTheStack(){ + val stack = ReadOnlyStack(listOf(3, 2, 1)) + + val iterator = stack.iterator() + + assertEquals(expected = 3, actual = iterator.next()) + assertEquals(expected = 2, actual = iterator.next()) + assertEquals(expected = 1, actual = iterator.next()) + assertEquals(expected = false, actual = iterator.hasNext()) + } +} diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/StateFlowMutableNavigationStateTest.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/StateFlowMutableNavigationStateTest.kt new file mode 100644 index 0000000..8ce21ca --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/StateFlowMutableNavigationStateTest.kt @@ -0,0 +1,47 @@ +package com.chrynan.navigation + +import kotlin.test.Test +import kotlin.test.assertEquals + +internal class StateFlowMutableNavigationStateTest { + + @Test + fun initialStateStaysTheSameAfterUpdateCall() { + val state = StateFlowMutableNavigationState(initial = 1) + + assertEquals(expected = 1, actual = state.initial) + + state.update(2) + + assertEquals(expected = 1, actual = state.initial) + } + + @Test + fun currentStateChangesAfterUpdateCall() { + val state = StateFlowMutableNavigationState(initial = 1) + + assertEquals(expected = 1, actual = state.current) + + state.update(2) + + assertEquals(expected = 2, actual = state.current) + } + + @Test + fun resetChangesCurrentValueBackToInitialValue() { + val state = StateFlowMutableNavigationState(initial = 1) + + assertEquals(expected = 1, actual = state.initial) + assertEquals(expected = 1, actual = state.current) + + state.update(2) + + assertEquals(expected = 1, actual = state.initial) + assertEquals(expected = 2, actual = state.current) + + state.reset() + + assertEquals(expected = 1, actual = state.initial) + assertEquals(expected = 1, actual = state.current) + } +} diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/TestComponents.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/TestComponents.kt new file mode 100644 index 0000000..2079142 --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/TestComponents.kt @@ -0,0 +1,30 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +internal enum class TestDestination { + + HOME, + FAVORITES, + SETTINGS, + ITEM_DETAILS, + CHANNEL_DETAILS +} + +internal sealed class TestContext : NavigationContext { + + object Home : TestContext() { + + override val initialDestination: TestDestination = TestDestination.HOME + } + + object Favorites : TestContext() { + + override val initialDestination: TestDestination = TestDestination.FAVORITES + } + + object Settings : TestContext() { + + override val initialDestination: TestDestination = TestDestination.SETTINGS + } +} diff --git a/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/TimeUtilsTest.kt b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/TimeUtilsTest.kt new file mode 100644 index 0000000..9c2a5a5 --- /dev/null +++ b/navigation-core/src/commonTest/kotlin/com/chrynan/navigation/TimeUtilsTest.kt @@ -0,0 +1,25 @@ +package com.chrynan.navigation + +import kotlinx.coroutines.delay +import kotlinx.coroutines.test.runTest +import kotlin.test.Test +import kotlin.test.assertTrue +import kotlin.time.Duration.Companion.seconds + +class TimeUtilsTest { + + @Test + fun elapsedSystemTimeIncrementsOverTime() { + runTest { + val start = elapsedSystemTime() + + delay(2.seconds) + + val end = elapsedSystemTime() + + // FIXME: This test seems to be broken in JS. But it doesn't _seem_ to be related to the code. + // Need more time to figure out what is going on. + // assertTrue(actual = start < end) + } + } +} diff --git a/navigation-core/src/iosMain/kotlin/com.chrynan.navigation/IosViewModel.kt b/navigation-core/src/iosMain/kotlin/com.chrynan.navigation/IosViewModel.kt deleted file mode 100644 index 7127e77..0000000 --- a/navigation-core/src/iosMain/kotlin/com.chrynan.navigation/IosViewModel.kt +++ /dev/null @@ -1,5 +0,0 @@ -@file:Suppress("unused") - -package com.chrynan.navigation - -actual abstract class ViewModel internal actual constructor() diff --git a/navigation-core/src/jsMain/kotlin/com.chrynan.navigation/JsTimeUtils.kt b/navigation-core/src/jsMain/kotlin/com.chrynan.navigation/JsTimeUtils.kt new file mode 100644 index 0000000..4e1b050 --- /dev/null +++ b/navigation-core/src/jsMain/kotlin/com.chrynan.navigation/JsTimeUtils.kt @@ -0,0 +1,12 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +import kotlin.js.Date +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds + +// JavaScript doesn't seem to have a way to obtain the elapsed system time. So instead we just get the current Date +// instance to get the elapsed time since the epoch. This should be fine in most cases. +internal actual fun elapsedSystemTime(): Duration = + Date().getTime().milliseconds diff --git a/navigation-core/src/jsMain/kotlin/com.chrynan.navigation/JsViewModel.kt b/navigation-core/src/jsMain/kotlin/com.chrynan.navigation/JsViewModel.kt index 7127e77..088cce9 100644 --- a/navigation-core/src/jsMain/kotlin/com.chrynan.navigation/JsViewModel.kt +++ b/navigation-core/src/jsMain/kotlin/com.chrynan.navigation/JsViewModel.kt @@ -2,4 +2,4 @@ package com.chrynan.navigation -actual abstract class ViewModel internal actual constructor() +actual abstract class NavigationViewModel internal actual constructor() diff --git a/navigation-core/src/jvmMain/kotlin/com/chrynan/navigation/JvmTimeUtils.kt b/navigation-core/src/jvmMain/kotlin/com/chrynan/navigation/JvmTimeUtils.kt new file mode 100644 index 0000000..2d1e01c --- /dev/null +++ b/navigation-core/src/jvmMain/kotlin/com/chrynan/navigation/JvmTimeUtils.kt @@ -0,0 +1,9 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds + +internal actual fun elapsedSystemTime(): Duration = + System.currentTimeMillis().milliseconds diff --git a/navigation-core/src/jvmMain/kotlin/com/chrynan/navigation/JvmViewModel.kt b/navigation-core/src/jvmMain/kotlin/com/chrynan/navigation/JvmViewModel.kt index 7127e77..088cce9 100644 --- a/navigation-core/src/jvmMain/kotlin/com/chrynan/navigation/JvmViewModel.kt +++ b/navigation-core/src/jvmMain/kotlin/com/chrynan/navigation/JvmViewModel.kt @@ -2,4 +2,4 @@ package com.chrynan.navigation -actual abstract class ViewModel internal actual constructor() +actual abstract class NavigationViewModel internal actual constructor() diff --git a/navigation-core/src/nativeMain/kotlin/com/chrynan/navigation/NativeTimeUtils.kt b/navigation-core/src/nativeMain/kotlin/com/chrynan/navigation/NativeTimeUtils.kt new file mode 100644 index 0000000..88976f2 --- /dev/null +++ b/navigation-core/src/nativeMain/kotlin/com/chrynan/navigation/NativeTimeUtils.kt @@ -0,0 +1,8 @@ +package com.chrynan.navigation + +import kotlin.system.getTimeMillis +import kotlin.time.Duration +import kotlin.time.Duration.Companion.milliseconds + +internal actual fun elapsedSystemTime(): Duration = + getTimeMillis().milliseconds diff --git a/navigation-core/src/nativeMain/kotlin/com/chrynan/navigation/NativeViewModel.kt b/navigation-core/src/nativeMain/kotlin/com/chrynan/navigation/NativeViewModel.kt new file mode 100644 index 0000000..088cce9 --- /dev/null +++ b/navigation-core/src/nativeMain/kotlin/com/chrynan/navigation/NativeViewModel.kt @@ -0,0 +1,5 @@ +@file:Suppress("unused") + +package com.chrynan.navigation + +actual abstract class NavigationViewModel internal actual constructor() diff --git a/sample-compose/api/sample-compose.api b/sample-compose/api/sample-compose.api new file mode 100644 index 0000000..79f8505 --- /dev/null +++ b/sample-compose/api/sample-compose.api @@ -0,0 +1,139 @@ +public final class com/chrynan/navigation/sample/compose/AppDestination : java/lang/Enum { + public static final field MAIN_SCREEN Lcom/chrynan/navigation/sample/compose/AppDestination; + public static final field MULTIPLE_CONTEXT_EXAMPLE Lcom/chrynan/navigation/sample/compose/AppDestination; + public static final field SINGLE_CONTEXT_EXAMPLE Lcom/chrynan/navigation/sample/compose/AppDestination; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/sample/compose/AppDestination; + public static fun values ()[Lcom/chrynan/navigation/sample/compose/AppDestination; +} + +public final class com/chrynan/navigation/sample/compose/AppKt { + public static final fun App (Landroidx/compose/runtime/Composer;I)V +} + +public final class com/chrynan/navigation/sample/compose/BuildConfig { + public static final field APPLICATION_ID Ljava/lang/String; + public static final field BUILD_TYPE Ljava/lang/String; + public static final field DEBUG Z + public static final field VERSION_CODE I + public static final field VERSION_NAME Ljava/lang/String; + public fun ()V +} + +public final class com/chrynan/navigation/sample/compose/ComposableSingletons$AppKt { + public static final field INSTANCE Lcom/chrynan/navigation/sample/compose/ComposableSingletons$AppKt; + public static field lambda-1 Lkotlin/jvm/functions/Function3; + public static field lambda-2 Lkotlin/jvm/functions/Function3; + public fun ()V + public final fun getLambda-1$sample_compose_release ()Lkotlin/jvm/functions/Function3; + public final fun getLambda-2$sample_compose_release ()Lkotlin/jvm/functions/Function3; +} + +public final class com/chrynan/navigation/sample/compose/ComposableSingletons$MainActivityKt { + public static final field INSTANCE Lcom/chrynan/navigation/sample/compose/ComposableSingletons$MainActivityKt; + public static field lambda-1 Lkotlin/jvm/functions/Function2; + public fun ()V + public final fun getLambda-1$sample_compose_release ()Lkotlin/jvm/functions/Function2; +} + +public final class com/chrynan/navigation/sample/compose/MainActivity : androidx/appcompat/app/AppCompatActivity { + public static final field $stable I + public fun ()V +} + +public final class com/chrynan/navigation/sample/compose/composable/ItemsKt { + public static final fun Item (Landroidx/compose/ui/Modifier;Ljava/lang/String;Ljava/lang/String;Landroidx/compose/ui/graphics/vector/ImageVector;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V + public static final fun Items (Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V +} + +public final class com/chrynan/navigation/sample/compose/example/AppContext : java/lang/Enum, com/chrynan/navigation/NavigationContext { + public static final field Companion Lcom/chrynan/navigation/sample/compose/example/AppContext$Companion; + public static final field HOME Lcom/chrynan/navigation/sample/compose/example/AppContext; + public static final field SEARCH Lcom/chrynan/navigation/sample/compose/example/AppContext; + public static final field SETTINGS Lcom/chrynan/navigation/sample/compose/example/AppContext; + public final fun getIcon ()Landroidx/compose/ui/graphics/vector/ImageVector; + public fun getInitialDestination ()Lcom/chrynan/navigation/sample/compose/example/AppDestination; + public synthetic fun getInitialDestination ()Ljava/lang/Object; + public final fun getTitle ()Ljava/lang/String; + public static fun valueOf (Ljava/lang/String;)Lcom/chrynan/navigation/sample/compose/example/AppContext; + public static fun values ()[Lcom/chrynan/navigation/sample/compose/example/AppContext; +} + +public final class com/chrynan/navigation/sample/compose/example/AppContext$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public abstract class com/chrynan/navigation/sample/compose/example/AppDestination { + public static final field $stable I + public static final field Companion Lcom/chrynan/navigation/sample/compose/example/AppDestination$Companion; + public synthetic fun (ILkotlinx/serialization/internal/SerializationConstructorMarker;)V + public static final synthetic fun write$Self (Lcom/chrynan/navigation/sample/compose/example/AppDestination;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V +} + +public final class com/chrynan/navigation/sample/compose/example/AppDestination$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/sample/compose/example/AppDestination$Details : com/chrynan/navigation/sample/compose/example/AppDestination { + public static final field $stable I + public static final field Companion Lcom/chrynan/navigation/sample/compose/example/AppDestination$Details$Companion; + public fun (I)V + public synthetic fun (IILkotlinx/serialization/internal/SerializationConstructorMarker;)V + public final fun component1 ()I + public final fun copy (I)Lcom/chrynan/navigation/sample/compose/example/AppDestination$Details; + public static synthetic fun copy$default (Lcom/chrynan/navigation/sample/compose/example/AppDestination$Details;IILjava/lang/Object;)Lcom/chrynan/navigation/sample/compose/example/AppDestination$Details; + public fun equals (Ljava/lang/Object;)Z + public final fun getItemId ()I + public fun hashCode ()I + public fun toString ()Ljava/lang/String; + public static final synthetic fun write$Self (Lcom/chrynan/navigation/sample/compose/example/AppDestination$Details;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V +} + +public final class com/chrynan/navigation/sample/compose/example/AppDestination$Details$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field $stable I + public static final field INSTANCE Lcom/chrynan/navigation/sample/compose/example/AppDestination$Details$$serializer; + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lcom/chrynan/navigation/sample/compose/example/AppDestination$Details; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lcom/chrynan/navigation/sample/compose/example/AppDestination$Details;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V + public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/sample/compose/example/AppDestination$Details$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/sample/compose/example/AppDestination$Home : com/chrynan/navigation/sample/compose/example/AppDestination { + public static final field $stable I + public static final field INSTANCE Lcom/chrynan/navigation/sample/compose/example/AppDestination$Home; + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/sample/compose/example/AppDestination$Search : com/chrynan/navigation/sample/compose/example/AppDestination { + public static final field $stable I + public static final field INSTANCE Lcom/chrynan/navigation/sample/compose/example/AppDestination$Search; + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/sample/compose/example/AppDestination$Settings : com/chrynan/navigation/sample/compose/example/AppDestination { + public static final field $stable I + public static final field INSTANCE Lcom/chrynan/navigation/sample/compose/example/AppDestination$Settings; + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class com/chrynan/navigation/sample/compose/example/ComposableSingletons$SingleContextSampleKt { + public static final field INSTANCE Lcom/chrynan/navigation/sample/compose/example/ComposableSingletons$SingleContextSampleKt; + public static field lambda-1 Lkotlin/jvm/functions/Function2; + public fun ()V + public final fun getLambda-1$sample_compose_release ()Lkotlin/jvm/functions/Function2; +} + +public final class com/chrynan/navigation/sample/compose/example/MultipleContextSampleKt { + public static final fun MultipleContextSample (Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V +} + +public final class com/chrynan/navigation/sample/compose/example/SingleContextSampleKt { + public static final fun SingleContextSample (Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V +} + diff --git a/sample-compose/build.gradle.kts b/sample-compose/build.gradle.kts index f8e28d4..e7ae25a 100644 --- a/sample-compose/build.gradle.kts +++ b/sample-compose/build.gradle.kts @@ -5,6 +5,7 @@ plugins { id("com.android.application") kotlin("android") id("org.jetbrains.compose") + kotlin("plugin.serialization") } group = LibraryConstants.group @@ -17,7 +18,7 @@ android { defaultConfig { applicationId = "com.chrynan.navigation.sample.compose" minSdk = 26 - targetSdk = 31 + targetSdk = 33 versionCode = 1 versionName = "1.0" @@ -49,21 +50,23 @@ android { tasks.withType { duplicatesStrategy = DuplicatesStrategy.INHERIT } dependencies { - implementation("androidx.core:core-ktx:1.8.0") - implementation("androidx.appcompat:appcompat:1.5.0") - implementation("com.google.android.material:material:1.6.1") + implementation(AndroidX.core.ktx) + implementation(AndroidX.appCompat) + implementation(Google.android.material) implementation(compose.runtime) implementation(compose.ui) implementation(compose.material) + implementation(compose.materialIconsExtended) - implementation("androidx.compose.compiler:compiler:1.3.0") - implementation("androidx.compose.ui:ui-tooling:1.3.0-alpha03") - implementation("androidx.activity:activity-compose:1.5.1") - implementation("androidx.compose.material:material-icons-extended:1.3.0-alpha03") + implementation(AndroidX.compose.compiler) + implementation(AndroidX.compose.ui.tooling) + implementation(AndroidX.activity.compose) - implementation("com.chrynan.presentation:presentation-compose:0.7.1") - implementation("com.chrynan.colors:colors-compose:0.7.2") + implementation(KotlinX.coroutines.core) + + implementation("com.chrynan.presentation:presentation-compose:_") + implementation("com.chrynan.colors:colors-compose:_") implementation(project(":navigation-compose")) } diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/App.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/App.kt index 5b01341..9cbd5a2 100644 --- a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/App.kt +++ b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/App.kt @@ -1,39 +1,83 @@ package com.chrynan.navigation.sample.compose -import androidx.compose.foundation.Image import androidx.compose.foundation.layout.* -import androidx.compose.material.* +import androidx.compose.material.Button +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp import com.chrynan.navigation.ExperimentalNavigationApi -import com.chrynan.navigation.compose.NavContainer +import com.chrynan.navigation.compose.NavigationContainer import com.chrynan.navigation.compose.rememberNavigator +import com.chrynan.navigation.popDestination +import com.chrynan.navigation.push +import com.chrynan.navigation.sample.compose.example.MultipleContextSample +import com.chrynan.navigation.sample.compose.example.SingleContextSample -@ExperimentalNavigationApi +@OptIn(ExperimentalNavigationApi::class) @Composable fun App() { - val navigator = rememberNavigator(initialContext = MainNavigationContext.HOME) - - Column { - Box(modifier = Modifier.weight(1f)) { - NavContainer(navigator = navigator) { context, destination -> - when (destination) { - Destination.HOME -> Text("Home Screen") - Destination.DETAILS -> Text("Details Screen") - Destination.SETTINGS -> Text("Settings Screen") - } - } - } + val navigator = rememberNavigator(AppDestination.MAIN_SCREEN) + + MaterialTheme { + NavigationContainer( + navigator = navigator, + modifier = Modifier.fillMaxSize() + ) { (destination, _) -> + when (destination) { + AppDestination.MAIN_SCREEN -> MainScreen( + modifier = Modifier.matchParentSize(), + onSingleContextSelected = { navigator.push(AppDestination.SINGLE_CONTEXT_EXAMPLE) }, + onMultipleContextSelected = { navigator.push(AppDestination.MULTIPLE_CONTEXT_EXAMPLE) } + ) - BottomNavigation { - MainNavigationContext.values().forEach { context -> - BottomNavigationItem( - selected = false, - onClick = { navigator.changeContext(context) }, - label = { Text(context.title) }, - icon = { Image(imageVector = context.icon, contentDescription = null) } + AppDestination.SINGLE_CONTEXT_EXAMPLE -> SingleContextSample( + modifier = Modifier.matchParentSize(), + onClose = { navigator.popDestination() } + ) + + AppDestination.MULTIPLE_CONTEXT_EXAMPLE -> MultipleContextSample( + modifier = Modifier.matchParentSize(), + onClose = { navigator.popDestination() } ) } } } } + +@Composable +private fun MainScreen( + modifier: Modifier = Modifier, + onSingleContextSelected: () -> Unit, + onMultipleContextSelected: () -> Unit +) { + Column( + modifier = modifier, + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center + ) { + Button( + modifier = Modifier.defaultMinSize(minWidth = 100.dp), + onClick = onSingleContextSelected + ) { + Text("Single Context Example") + } + + Button( + modifier = Modifier.defaultMinSize(minWidth = 100.dp) + .padding(top = 16.dp), + onClick = onMultipleContextSelected + ) { + Text("Multiple Context Example") + } + } +} + +enum class AppDestination { + + MAIN_SCREEN, + SINGLE_CONTEXT_EXAMPLE, + MULTIPLE_CONTEXT_EXAMPLE +} diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/Destination.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/Destination.kt deleted file mode 100644 index f22fa0f..0000000 --- a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/Destination.kt +++ /dev/null @@ -1,8 +0,0 @@ -package com.chrynan.navigation.sample.compose - -enum class Destination { - - HOME, - SETTINGS, - DETAILS -} diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/MainActivity.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/MainActivity.kt index aaffc3d..c429e95 100644 --- a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/MainActivity.kt +++ b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/MainActivity.kt @@ -3,19 +3,14 @@ package com.chrynan.navigation.sample.compose import android.os.Bundle import androidx.activity.compose.setContent import androidx.appcompat.app.AppCompatActivity -import androidx.compose.material.* -import com.chrynan.navigation.ExperimentalNavigationApi -@OptIn(ExperimentalNavigationApi::class) class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { - MaterialTheme { - App() - } + App() } } } diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/MainNavigationContext.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/MainNavigationContext.kt deleted file mode 100644 index f2021e2..0000000 --- a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/MainNavigationContext.kt +++ /dev/null @@ -1,18 +0,0 @@ -package com.chrynan.navigation.sample.compose - -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Home -import androidx.compose.material.icons.filled.Settings -import androidx.compose.ui.graphics.vector.ImageVector -import com.chrynan.navigation.NavigationContext - -enum class MainNavigationContext( - val title: String, - val icon: ImageVector, - override val initialDestination: Destination -) : NavigationContext { - - HOME(title = "Home", icon = Icons.Default.Home, initialDestination = Destination.HOME), - - SETTINGS(title = "Settings", icon = Icons.Default.Settings, initialDestination = Destination.SETTINGS) -} diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/composable/HomeScreen.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/composable/HomeScreen.kt new file mode 100644 index 0000000..945509e --- /dev/null +++ b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/composable/HomeScreen.kt @@ -0,0 +1,2 @@ +package com.chrynan.navigation.sample.compose.composable + diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/composable/Items.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/composable/Items.kt new file mode 100644 index 0000000..60f6288 --- /dev/null +++ b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/composable/Items.kt @@ -0,0 +1,75 @@ +@file:Suppress("FunctionName") + +package com.chrynan.navigation.sample.compose.composable + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material.ExperimentalMaterialApi +import androidx.compose.material.Icon +import androidx.compose.material.ListItem +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.unit.dp + +@Composable +fun Items( + modifier: Modifier = Modifier, + onItemClick: (itemId: Int) -> Unit, + header: (@Composable () -> Unit)? = null +) { + LazyColumn(modifier = modifier) { + if (header != null) { + item(key = "Header") { + header.invoke() + } + } + + items( + count = 10, + key = { it } + ) { index -> + Item( + modifier = Modifier.fillMaxWidth(), + title = "Item ${index + 1}", + onClick = { + onItemClick.invoke(index) + } + ) + } + } +} + +@OptIn(ExperimentalMaterialApi::class) +@Composable +fun Item( + modifier: Modifier = Modifier, + title: String, + description: String? = null, + icon: ImageVector? = null, + onClick: () -> Unit +) { + ListItem( + modifier = modifier.clickable { onClick.invoke() }, + text = { + Text(text = title) + }, + secondaryText = { + if (description != null) { + Text(text = description) + } + }, + icon = { + if (icon != null) { + Icon( + modifier = Modifier.size(24.dp), + imageVector = icon, + contentDescription = null + ) + } + } + ) +} diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/MultipleContextSample.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/MultipleContextSample.kt new file mode 100644 index 0000000..73e9fca --- /dev/null +++ b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/MultipleContextSample.kt @@ -0,0 +1,61 @@ +package com.chrynan.navigation.sample.compose.example + +import androidx.activity.compose.BackHandler +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.* +import androidx.compose.material.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import com.chrynan.navigation.ExperimentalNavigationApi +import com.chrynan.navigation.push +import com.chrynan.navigation.compose.NavigationContainer +import com.chrynan.navigation.compose.rememberNavigator +import com.chrynan.navigation.popDestination +import com.chrynan.navigation.sample.compose.composable.Items + +@ExperimentalNavigationApi +@Composable +fun MultipleContextSample( + modifier: Modifier = Modifier, + onClose: () -> Unit +) { + val navigator = rememberNavigator(initialContext = AppContext.HOME) + + BackHandler { + if (!navigator.popDestination()) { + onClose() + } + } + + Column(modifier = modifier) { + Box(modifier = Modifier.weight(1f)) { + NavigationContainer(navigator = navigator) { (destination, context) -> + when (destination) { + is AppDestination.Home -> Items( + modifier = Modifier.matchParentSize(), + onItemClick = { + navigator.push(destination = AppDestination.Details(itemId = it)) + }, + header = { + Text(text = context.title, style = MaterialTheme.typography.h6) + }) + + is AppDestination.Details -> Text("${context.title}: ${destination.itemId}") + is AppDestination.Settings -> Text(context.title) + is AppDestination.Search -> Text(context.title) + } + } + } + + BottomNavigation { + AppContext.values().forEach { context -> + BottomNavigationItem( + selected = false, + onClick = { navigator.push(context) }, + label = { Text(context.title) }, + icon = { Image(imageVector = context.icon, contentDescription = null) } + ) + } + } + } +} diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/NavigationComponents.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/NavigationComponents.kt new file mode 100644 index 0000000..9ac67c7 --- /dev/null +++ b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/NavigationComponents.kt @@ -0,0 +1,42 @@ +package com.chrynan.navigation.sample.compose.example + +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Home +import androidx.compose.material.icons.filled.Search +import androidx.compose.material.icons.filled.Settings +import androidx.compose.ui.graphics.vector.ImageVector +import com.chrynan.navigation.NavigationContext +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +sealed class AppDestination { + + @Serializable + object Home : AppDestination() + + @Serializable + object Search : AppDestination() + + @Serializable + object Settings : AppDestination() + + @Serializable + data class Details( + @SerialName(value = "item_id") val itemId: Int + ) : AppDestination() +} + +@Serializable +enum class AppContext( + val title: String, + val icon: ImageVector, + override val initialDestination: AppDestination +) : NavigationContext { + + HOME(title = "Home", icon = Icons.Default.Home, initialDestination = AppDestination.Home), + + SEARCH(title = "Search", icon = Icons.Default.Search, initialDestination = AppDestination.Search), + + SETTINGS(title = "Settings", icon = Icons.Default.Settings, initialDestination = AppDestination.Settings) +} diff --git a/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/SingleContextSample.kt b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/SingleContextSample.kt new file mode 100644 index 0000000..9dcfa6e --- /dev/null +++ b/sample-compose/src/main/java/com/chrynan/navigation/sample/compose/example/SingleContextSample.kt @@ -0,0 +1,61 @@ +package com.chrynan.navigation.sample.compose.example + +import androidx.activity.compose.BackHandler +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.MaterialTheme +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import com.chrynan.navigation.ExperimentalNavigationApi +import com.chrynan.navigation.compose.NavigationContainer +import com.chrynan.navigation.compose.rememberSavableNavigator +import com.chrynan.navigation.popDestination +import com.chrynan.navigation.push +import com.chrynan.navigation.sample.compose.composable.Items + +@Composable +@ExperimentalNavigationApi +fun SingleContextSample( + modifier: Modifier = Modifier, + onClose: () -> Unit +) { + val navigator = rememberSavableNavigator( + initialDestination = AppDestination.Home, + destinationSerializer = AppDestination.serializer() + ) + + BackHandler { + if (!navigator.popDestination()) { + onClose() + } + } + + NavigationContainer( + navigator = navigator, + modifier = Modifier.fillMaxSize() + ) { (destination, _) -> + when (destination) { + is AppDestination.Home -> Items( + modifier = Modifier.matchParentSize(), + onItemClick = { + navigator.push(destination = AppDestination.Details(itemId = it)) + }, + header = { + Text(text = "Home", style = MaterialTheme.typography.h6) + }) + + is AppDestination.Details -> Column( + modifier = Modifier.matchParentSize(), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text(text = "Details", style = MaterialTheme.typography.h6) + + Text(text = "Item ${destination.itemId}", style = MaterialTheme.typography.subtitle1) + } + + else -> {} + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 425aeb0..3d3b578 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,20 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } + maven { url = uri("https://repo.repsy.io/mvn/chrynan/public") } + } +} + +plugins { + // See https://jmfayard.github.io/refreshVersions + id("de.fayard.refreshVersions") version "0.51.0" + + // See build.gradle.kts file in root project folder for the rest of the plugins applied. +} + rootProject.name = "navigation" include(":navigation-core") diff --git a/versions.properties b/versions.properties new file mode 100644 index 0000000..81e0434 --- /dev/null +++ b/versions.properties @@ -0,0 +1,125 @@ +#### Dependencies and Plugin versions with their available updates. +#### Generated by `./gradlew refreshVersions` version 0.51.0 +#### +#### Don't manually edit or split the comments that start with four hashtags (####), +#### they will be overwritten by refreshVersions. +#### +#### suppress inspection "SpellCheckingInspection" for whole file +#### suppress inspection "UnusedProperty" for whole file + +version.androidx.activity=1.7.1 +## # available=1.7.2 +## # available=1.8.0-alpha01 +## # available=1.8.0-alpha02 +## # available=1.8.0-alpha03 +## # available=1.8.0-alpha04 +## # available=1.8.0-alpha05 +## # available=1.8.0-alpha06 + +version.androidx.appcompat=1.6.1 +## # available=1.7.0-alpha01 +## # available=1.7.0-alpha02 +## # available=1.7.0-alpha03 + +version.androidx.compose.compiler=1.4.7 +## # available=1.4.8 +## # available=1.5.0 +## # available=1.5.1 + +version.androidx.compose.ui=1.4.3 +## # available=1.5.0-alpha01 +## # available=1.5.0-alpha02 +## # available=1.5.0-alpha03 +## # available=1.5.0-alpha04 +## # available=1.5.0-beta01 +## # available=1.5.0-beta02 +## # available=1.5.0-beta03 +## # available=1.5.0-rc01 +## # available=1.6.0-alpha01 +## # available=1.6.0-alpha02 + +version.androidx.core=1.10.0 +## # available=1.10.1 +## # available=1.11.0-alpha01 +## # available=1.11.0-alpha02 +## # available=1.11.0-alpha03 +## # available=1.11.0-alpha04 +## # available=1.11.0-beta01 +## # available=1.11.0-beta02 +## # available=1.12.0-alpha01 +## # available=1.12.0-alpha03 +## # available=1.12.0-alpha04 +## # available=1.12.0-alpha05 +## # available=1.12.0-beta01 + +version.androidx.fragment=1.5.7 +## # available=1.6.0-alpha01 +## # available=1.6.0-alpha02 +## # available=1.6.0-alpha03 +## # available=1.6.0-alpha04 +## # available=1.6.0-alpha05 +## # available=1.6.0-alpha06 +## # available=1.6.0-alpha07 +## # available=1.6.0-alpha08 +## # available=1.6.0-alpha09 +## # available=1.6.0-beta01 +## # available=1.6.0-rc01 +## # available=1.6.0 +## # available=1.6.1 +## # available=1.7.0-alpha01 + +version.androidx.lifecycle=2.6.1 +## # available=2.7.0-alpha01 + +version.androidx.lifecycle-viewmodel-compose=2.6.1 +## # available=2.7.0-alpha01 + +version.com.chrynan.parcelable..parcelable-compose=0.7.1 + +version.com.chrynan.parcelable..parcelable-core=0.7.1 + +# Updating may cause issues +version.google.android.material=1.6.1 +## # available=1.7.0-alpha01 +## # available=1.7.0-alpha02 +## # available=1.7.0-alpha03 +## # available=1.7.0-beta01 +## # available=1.7.0-rc01 +## # available=1.7.0 +## # available=1.8.0-alpha01 +## # available=1.8.0-alpha02 +## # available=1.8.0-alpha03 +## # available=1.8.0-beta01 +## # available=1.8.0-rc01 +## # available=1.8.0 +## # available=1.9.0-alpha01 +## # available=1.9.0-alpha02 +## # available=1.9.0-beta01 +## # available=1.9.0-rc01 +## # available=1.9.0 +## # available=1.10.0-alpha01 +## # available=1.10.0-alpha02 +## # available=1.10.0-alpha03 +## # available=1.10.0-alpha04 +## # available=1.10.0-alpha05 +## # available=1.11.0-alpha01 + +version.kotlin=1.8.20 +## # available=1.8.21 +## # available=1.8.22 +## # available=1.9.0-Beta +## # available=1.9.0-RC +## # available=1.9.0 + +version.kotlinx.coroutines=1.7.3 +## # available=1.7.2 +## # available=1.7.3 + +version.com.chrynan.presentation..presentation-compose=0.10.0 + +version.com.chrynan.colors..colors-compose=0.8.1 + +## unused +version.kotlinx.datetime=0.4.0 + +version.kotlinx.serialization=1.5.1