Skip to content

API 概要 ​

PulseDesktop の API は小さく、焦点が絞られています。アーティファクトとパッケージは 1 対 1 です。コアの mvi は jp.kaleidot725.pulse.mvi、任意の navigation と architecture はそれぞれ jp.kaleidot725.pulse.navigation と jp.kaleidot725.pulse.architecture にあります。後者 2 つは 拡張 にまとめています。

クラス ​

クラス説明
PulseViewModelUI 状態を管理する抽象基底クラス
PulseContainer複数の ViewModel を調整する

Composable ​

Composable説明
PulseHostContainer をサブツリーにスコープし、Refresh と Broadcast のコールバックを提供する
PulseContentViewModel を観測し、状態と Action のディスパッチャを提供する

マーカーインターフェース ​

インターフェース説明
PulseStateクラスを ViewModel の UI 状態として印付ける
PulseActionクラスをユーザーの Action として印付ける
PulseEventクラスを一度きりの副作用として印付ける
PulseBroadcastクラスを Container の Broadcast メッセージとして印付ける
PulseUnicastクラスを子から親への Unicast メッセージとして印付ける

拡張 ​

Composable説明
rememberPulseViewModelViewModelStoreOwner にスコープされた ViewModel
rememberPulseContainerViewModelStoreOwner にスコープされた Container
rememberPulseNavEntryDecoratorsViewModel をバックスタックエントリにスコープする NavDisplay のデコレータ

アーキテクチャ検査 ​

アサート説明
assertPulseMviConventions続く 12 の検査を順に実行する
assertStatesAreDataTypesPulseState は data class または data object
assertMessagesAreSealedOrDataTypesメッセージは data class / data object のケースを持つ sealed class、または単独の data class / data object
assertStatesAndMessagesLiveInContractsState とメッセージは ViewModel か Container の隣の …Contracts.kt に置く
assertViewModelsAndContainersAreNamedAfterTheirBase…ViewModel と …Container
assertViewModelsHoldTheirDataInTheirStateViewModel と Container は var プロパティを持たない
assertViewModelsLiveInContentsViewModel は content の下に置く
assertContainersLiveAtTheFeatureRootContainer は feature のルートに置く
assertHostsComposeContentsHost は …Host という名前で、ViewModel を束ねず Content を並べる
assertFeaturePackagesHaveARolefeature の中のファイルは、ルートか content・section・component の下にある
assertContentsBindAViewModelContent は PulseContent で ViewModel を束ねる
assertSectionsAndComponentsArePureSection と Component はデータとコールバックだけを受け取る
assertSectionsAndComponentsHavePreviewsすべての Section と Component に <Name>_Preview がある
assertPulseDomainConventionsRepository は Flow を公開し、ワンショットの取得は Result<V, E> で返す。UseCase は usecase に置き、1 行にしない
assertPulseModuleConventionsモジュール間の依存が Clean Architecture の向きに従い、domain・data・designsystem がパッケージで分かれている
assertPulseKoinConventionsKoin モジュールは app モジュールで定義する
assertPulseResourceConventionsdomain は文言を持たず、Composable は文言を文字列リソースから読む
PulseModuleLayoutどのモジュール名がどの層に当たるか

Apache 2.0 License の下で公開されています。