StylishContentState

sealed interface StylishContentState<out T>

The shared state machine for data-backed Stylish components.

Components should model loading, empty, error, and content as explicit states instead of scattering nullable values and booleans across their APIs. The model is UI-framework agnostic, so a Flow, SwiftUI observable object, or web state store can own it and map it into the same rendering contract.

Inheritors

Types

Link copied to clipboard
data class Content<T>(val value: T) : StylishContentState<T>

The request completed successfully with a value.

Link copied to clipboard
data class Empty(val message: String? = null) : StylishContentState<Nothing>

The request completed successfully but contains no items.

Link copied to clipboard
data class Error(val message: String, val retryLabel: String? = null) : StylishContentState<Nothing>

The request failed and may optionally expose a retry action to the host.

Link copied to clipboard

A request is in progress and content is not yet available.

Functions

Link copied to clipboard
inline fun <T, R> StylishContentState<T>.mapContent(transform: (T) -> R): StylishContentState<R>

Maps only the content branch while preserving the state contract.