API 概要
PulseDesktop の API は小さく、焦点が絞られています。アーティファクトとパッケージは 1 対 1 です。コアの mvi は jp.kaleidot725.pulse.mvi、任意の navigation と architecture はそれぞれ jp.kaleidot725.pulse.navigation と jp.kaleidot725.pulse.architecture にあります。後者 2 つは 拡張 にまとめています。
クラス
| クラス | 説明 |
|---|---|
PulseViewModel | UI 状態を管理する抽象基底クラス |
PulseContainer | 複数の ViewModel を調整する |
Composable
| Composable | 説明 |
|---|---|
PulseHost | Container をサブツリーにスコープし、Refresh と Broadcast のコールバックを提供する |
PulseContent | ViewModel を観測し、状態と Action のディスパッチャを提供する |
マーカーインターフェース
| インターフェース | 説明 |
|---|---|
PulseState | クラスを ViewModel の UI 状態として印付ける |
PulseAction | クラスをユーザーの Action として印付ける |
PulseEvent | クラスを一度きりの副作用として印付ける |
PulseBroadcast | クラスを Container の Broadcast メッセージとして印付ける |
PulseUnicast | クラスを子から親への Unicast メッセージとして印付ける |
拡張
Navigation 3
| Composable | 説明 |
|---|---|
rememberPulseViewModel | ViewModelStoreOwner にスコープされた ViewModel |
rememberPulseContainer | ViewModelStoreOwner にスコープされた Container |
rememberPulseNavEntryDecorators | ViewModel をバックスタックエントリにスコープする NavDisplay のデコレータ |
アーキテクチャ検査
| アサート | 説明 |
|---|---|
assertPulseMviConventions | 続く 12 の検査を順に実行する |
assertStatesAreDataTypes | PulseState は data class または data object |
assertMessagesAreSealedOrDataTypes | メッセージは data class / data object のケースを持つ sealed class、または単独の data class / data object |
assertStatesAndMessagesLiveInContracts | State とメッセージは ViewModel か Container の隣の …Contracts.kt に置く |
assertViewModelsAndContainersAreNamedAfterTheirBase | …ViewModel と …Container |
assertViewModelsHoldTheirDataInTheirState | ViewModel と Container は var プロパティを持たない |
assertViewModelsLiveInContents | ViewModel は content の下に置く |
assertContainersLiveAtTheFeatureRoot | Container は feature のルートに置く |
assertHostsComposeContents | Host は …Host という名前で、ViewModel を束ねず Content を並べる |
assertFeaturePackagesHaveARole | feature の中のファイルは、ルートか content・section・component の下にある |
assertContentsBindAViewModel | Content は PulseContent で ViewModel を束ねる |
assertSectionsAndComponentsArePure | Section と Component はデータとコールバックだけを受け取る |
assertSectionsAndComponentsHavePreviews | すべての Section と Component に <Name>_Preview がある |
assertPulseDomainConventions | Repository は Flow を公開し、ワンショットの取得は Result<V, E> で返す。UseCase は usecase に置き、1 行にしない |
assertPulseModuleConventions | モジュール間の依存が Clean Architecture の向きに従い、domain・data・designsystem がパッケージで分かれている |
assertPulseKoinConventions | Koin モジュールは app モジュールで定義する |
assertPulseResourceConventions | domain は文言を持たず、Composable は文言を文字列リソースから読む |
PulseModuleLayout | どのモジュール名がどの層に当たるか |