Package-level declarations

Functions

Link copied to clipboard
actual fun PlatformFile.asChunkedFlow(chunkSize: Int): Flow<ByteArray>
expect fun PlatformFile.asChunkedFlow(chunkSize: Int = 64 * 1024): Flow<ByteArray>

Streams this PlatformFile's content as a Flow of chunkSize-byte chunks, without loading the whole file into memory at once — the mechanism behind GetFile's flowOfBytes() output type, meant for large files where arrayOfBytes() would be wasteful. Actual reading is platform-specific (expect/actual), since each platform's own file APIs differ.

actual fun PlatformFile.asChunkedFlow(chunkSize: Int): Flow<ByteArray>
actual fun PlatformFile.asChunkedFlow(chunkSize: Int): Flow<ByteArray>
actual fun PlatformFile.asChunkedFlow(chunkSize: Int): Flow<ByteArray>
Link copied to clipboard

Returns a callback firing trigger, or null when events declares no event wired to it — so a tile is only made interactive when something is actually listening.

Link copied to clipboard
fun <T> SharedFlow<T>.consume(key: Any?, action: suspend (value: T) -> Unit)

Collects this SharedFlow inside a LaunchedEffect keyed on key, running action for each emitted value via collectLatest — a still-running action from a previous emission is cancelled when a new one arrives, rather than queued. The shared low-level primitive behind observeScreenTileBroadcastChannel and observeSystemBroadcastChannel below.

Link copied to clipboard

Discards this Result's success value, collapsing it to Result<Unit> — preserves the original exception on failure. Used when a use case's caller only cares whether the operation succeeded, not what it produced.

Link copied to clipboard

Converts epoch millis (as produced by Compose M3's DatePickerState) to the ISO yyyy-MM-dd string DatePicker's schema stores/produces (selectedDate).

Link copied to clipboard
fun MutableMap<String, Any?>.extractAndPutIfPresent(key: String, data: Map<String, Any?>, ifPresent: (Any) -> Any = { it })

Copies the value at key from data into this mutable map under the same key, applying ifPresent to it first — but only when key is present in data and non-null. A no-op otherwise, leaving this map's own entry (if any) untouched.

Link copied to clipboard
fun MutableMap<String, Any?>.extractAndPutIfPresentOrNull(key: String, data: Map<String, Any?>, ifPresent: (Any?) -> Any? = { it })

Same as extractAndPutIfPresent, but also copies an explicit null value from data (applying ifPresent to it too) — only skips the copy when key is entirely absent from data.

Link copied to clipboard
fun ImmutableList<TileSchema>.filteredBy(term: String?): ImmutableList<TileSchema>

Filters the children a container tile should render according to its filterChildrenByTerm.

Link copied to clipboard
inline fun Map<String, Any?>.getIfPresent(key: String, ifPresent: (Any) -> Unit)

Runs ifPresent with this map's value at key, only when key is present and its value is non-null — the common pattern for decoding an optional field out of a raw Map<String, Any?> (a builder's updateData, incomingData treated as a map, etc.) while distinguishing "absent" from "present but null".

Link copied to clipboard
inline fun Map<String, Any?>.getOrNullIfPresent(key: String, ifPresent: (Any?) -> Unit)

Same as getIfPresent, but also runs ifPresent (with null) when key is present with an explicit null value — only skips it when key is absent entirely.

Link copied to clipboard

Whether this DatePicker's state is ERROR — used by its renderer to switch the underlying Material field into error styling.

Whether this DropdownList's state is ERROR — used by its renderer to switch the underlying Material field into error styling.

Whether this TextField's state is ERROR — used by its renderer to switch the underlying Material field into error styling.

Whether this TimePicker's state is ERROR — used by its renderer to switch the underlying Material field into error styling.

Link copied to clipboard
fun hourMinuteToIsoTime(hour: Int, minute: Int): String

Formats an hour/minute pair as the zero-padded ISO HH:mm string TimePicker's schema stores/produces (selectedTime).

Link copied to clipboard
fun IconSchema?.iconButtonOrNull(onClick: () -> Unit): @Composable () -> Unit?

Wraps this optional IconSchema into a clickable @Composable lambda — an IconButton wrapping Icon and firing onClick. Used by tiles like TextField, where clickableLeadingIcon/ clickableTrailingIcon decides whether the optional icon should be wrapped this way or rendered plainly via iconOrNull instead.

Link copied to clipboard

Wraps this optional IconSchema into a plain, non-clickable @Composable lambda rendering it via Icon — the usual way a tile with an optional icon field (e.g. AssistChip.leadingIcon) conditionally renders it without an explicit if (icon != null) at every call site.

Link copied to clipboard

Converts an ISO yyyy-MM-dd string (DatePicker.selectedDate) to epoch millis, for feeding Compose M3's DatePickerState — the inverse of epochMillisToIsoDate.

Link copied to clipboard

Parses an ISO HH:mm string (TimePicker.selectedTime) back into an hour/minute pair — the inverse of hourMinuteToIsoTime.

Link copied to clipboard

Converts this TextField's own nested keyboardOptions schema into a Compose KeyboardOptionsshowKeyboardOnFocus (schema field name; the DSL builder's own parameter for it is howKeyboardOnFocus, a typo in the framework's own keyboardOptions() builder function, not in this schema) maps directly to Compose's own showKeyboardOnFocus.

Link copied to clipboard
fun <R> MutableStateFlow<*>.like(): R

Unchecked-casts this type-erased MutableStateFlow<*>'s current value to R — the read-only counterpart of updateAs, for a call site that only needs the current value narrowed, not to update it.

Link copied to clipboard

Applies block to this Result's exception, replacing it with the returned Throwable — a no-op on a successful Result. Used to translate a lower-level exception (e.g. a raw NetworkResponseException) into a more specific one before it reaches an EventRunner's onFailure handling.

Link copied to clipboard
inline fun <T : ScreenTilesBroadcastData> TileSchema.observeScreenTileBroadcastChannel(filterByTileId: Boolean = true, crossinline action: suspend (value: T) -> Unit)

Subscribes this tile to its screen's own broadcast channel (reached via LocalScreenTilesBroadcastChannel), running action for every emitted ScreenTilesBroadcastData of type T — the composable-side counterpart of EventRunningScope.broadcastData, and the mechanism a tile's own renderer uses to react to a screen-scoped command addressed to it (scroll commands, overlay open/close, etc.).

Link copied to clipboard
fun ScrollState.ObserveScrollDirection(onScrollForward: () -> Unit, onScrollBackward: () -> Unit)

Same as the LazyListState overload above, for a plain (non-lazy) ScrollState — the mechanism behind Column/Row's own OnScrolled trigger when scrollable = true. Direction is derived by comparing the current scroll offset (ScrollState.value) against the previous one.

fun LazyListState.ObserveScrollDirection(onScrollForward: () -> Unit, onScrollBackward: () -> Unit)

Observes this LazyListState's scroll position and calls onScrollForward/onScrollBackward every time the scroll direction actually changes (not on every scroll delta) — the real mechanism behind LazyColumn/LazyRow's OnScrolled trigger (ScrollDirection.Bottom/End maps to onScrollForward, ScrollDirection.Top/Start to onScrollBackward).

Link copied to clipboard
fun observeSystemBroadcastChannel(key: Any?, action: suspend (value: SystemBroadcastData) -> Unit)

Subscribes to the app-wide SystemBroadcastChannel (resolved via Koin), running action for every published SystemBroadcastData — the composable-side counterpart of BroadcastToSystem, and the mechanism behind SystemBroadcastListener's OnSystemBroadcast(broadcastId) trigger, reaching across screens rather than being scoped to one.

Link copied to clipboard

callbackFor specialized for EventTriggers.onClick() — the standard way a tile renderer wires up Modifier.styledWith's onClick/a composable's own onClick parameter, only when the tile actually declares an OnClick event.

Link copied to clipboard

Fires EventTriggers.onDisplay() once, the first time this composable enters composition — the standard way every built-in container/interactive tile implements its own OnDisplay trigger. Keyed on tileId, so it re-fires only if the tile identity itself changes (a new instance with a different id), not on every recomposition.

Link copied to clipboard

callbackFor specialized for EventTriggers.onLongPress() — same pattern as onClick, for Modifier.styledWith's onLongClick.

Link copied to clipboard
fun OffsetType.resolve(fullSize: Int): Int

Resolves an OffsetType to a concrete pixel offset given the axis' fullSize — a slide transition's initialOffset/targetOffset is one of these, since Compose's own slideInHorizontally/slideInVertically only learn the real container size at draw time.

Link copied to clipboard
suspend fun safeNetworkCall(riskyBlock: suspend () -> HttpResponse): Result<HttpResponse>

Runs riskyBlock (an HTTP call) via safeResult, additionally treating a non-2xx response as a failure — turning it into a failed Result carrying a NetworkResponseException (with the response's status and body text) rather than a successful Result wrapping an error response.

Link copied to clipboard
suspend fun <T> safeResult(riskyBlock: suspend () -> T): Result<T>

Runs riskyBlock, wrapping any thrown Throwable into a failed Result instead of letting it propagate — the standard way a use case in mosaic-client/.../domain turns a throwing call into a Result-returning one.

Link copied to clipboard

Sniffs the mime type of raw image bytes from their magic-byte signature.

Link copied to clipboard
fun String?.textOrNull(centered: Boolean = false): @Composable () -> Unit?

Wraps this optional String into a plain @Composable lambda rendering it via a Material 3 Text — the usual way a tile with an optional text field (e.g. TextField.label/placeholder/ supportingText) conditionally renders it without an explicit if (value != null) at every call site.

Link copied to clipboard
fun Int.ThresholdReachedEffect(lazyListState: LazyListState, considerLoadingItemAtEnd: Boolean = true, onThresholdReached: () -> Unit)

Fires onThresholdReached when the last visible item of lazyListState comes within this many items of the end of the list — the infinite-scroll pagination guard behind LazyColumn/LazyRow's scrollThreshold and their OnScrollThresholdReached trigger. Public and reusable outside the built-in lazy tiles for a custom lazy-list-style tile that wants the same pagination behavior.

Link copied to clipboard

Converts the wire-format AlignmentSchema.Horizontal into its Compose Alignment.Horizontal counterpart — used by any renderer applying alignHorizontallyToX().

Converts the wire-format AlignmentSchema.TwoDimensional into its Compose Alignment counterpart — used by Box/AsyncImage/Popup and any other tile taking a 2D alignment.

Converts the wire-format AlignmentSchema.Vertical into its Compose Alignment.Vertical counterpart — used by any renderer applying alignVerticallyToX().

Link copied to clipboard

Converts a horizontal ArrangementSchema — including the axis-agnostic ArrangementSchema.HorizontalOrVertical cases — into its Compose Arrangement.Horizontal counterpart. Used by Row/LazyRow/FlowRow's arrangement.

Converts the axis-agnostic ArrangementSchema.HorizontalOrVertical cases (Center, SpaceAround, SpaceBetween, SpaceEvenly) into their Compose counterpart, valid on either axis.

Converts a vertical ArrangementSchema — including the axis-agnostic ArrangementSchema.HorizontalOrVertical cases — into its Compose Arrangement.Vertical counterpart. Used by Column/LazyColumn's arrangement.

Link copied to clipboard

Converts a BackgroundSchema into the Compose Brush that renders it.

Link copied to clipboard

Parses this string as a hex color — color(String)'s underlying implementation. Accepts both a 6-digit RRGGBB string (opaque, alpha forced to FF) and an 8-digit AARRGGBB string as-is; a leading # is stripped if present.

Link copied to clipboard

Combines every entry into a single Compose EnterTransition via repeated + composition — an empty list resolves to EnterTransition.None.

Link copied to clipboard

Combines every entry into a single Compose ExitTransition via repeated + composition — an empty list resolves to ExitTransition.None.

Link copied to clipboard

Converts a ColorSchema into its Compose Color counterpart — ColorSchema.Hex and ColorSchema.Rgba resolve directly, while ColorSchema.Theme reads the matching role off MaterialTheme.colorScheme, which is why this is @Composable at all (and, in turn, why it always reflects the app's current theme, including a live SetTheme swap).

Link copied to clipboard

Converts the wire-format EasingType into its Compose Easing counterpart, used inside AnimationSpecSchema.toTweenOrSpring to build a tween's curve.

Link copied to clipboard

Converts the wire-format WindowInsetsSchema into its Compose WindowInsets counterpart — used by Modifier.styledWith to apply style.windowInsets, the first modifier in the fixed style application order.

Link copied to clipboard
fun CompressionScheme.toCompressionConfig(): CompressionConfig

Converts a CompressionScheme (TakePicture/GetImageFromGallery's compression) into the cmpimgcompress library's own CompressionConfig.

Link copied to clipboard

Converts AsyncImage's own nested ContentScale enum into its Compose ContentScale counterpart. A distinct type from ImageContentScaleSchema.toContentScale below despite the identical set of cases — AsyncImage and Image each declare their own ContentScale type on the wire, so their DSL helpers (cropContentScale() vs imageCropContentScale(), etc.) aren't interchangeable either.

Converts Image's own nested ContentScale enum into its Compose ContentScale counterpart — see AsyncContentScaleSchema.toContentScale above for why this is a separate function rather than a shared one.

Link copied to clipboard

Converts a ContentTransitionSchema (a screen/entry's declared transition/popTransition/ predictivePopTransition) into the Compose ContentTransform NavDisplay's transitionSpec expects — the mechanism behind MosaicApplication's screen transition wiring.

Link copied to clipboard
Link copied to clipboard

Converts an ExitTransitionSchema into its Compose ExitTransition counterpart. ExitTransitionSchema.KeepUntilTransitionsFinished currently resolves to ExitTransition.None as a placeholder, pending Compose's own ExitTransition.KeepUntilTransitionsFinished becoming public API.

Link copied to clipboard

Converts OpenFilePicker's pickMode into the filekit library's own FileKitMode. Only Single exists on the schema today, matching filekit's own FileKitMode.Single.

Link copied to clipboard

Converts OpenFilePicker's fileType into the filekit library's own FileKitType, which OpenFilePickerEventRunner passes to the platform's native file picker dialog.

Link copied to clipboard

Converts the wire-format FontFamilySchema into its Compose FontFamily counterpart — used wherever SimpleText/TextField and similar text-bearing tiles resolve fontFamily.

Link copied to clipboard

Converts the wire-format FontStyleSchema into its Compose FontStyle counterpart — used wherever SimpleText/TextField resolve fontStyle.

Link copied to clipboard

Converts the wire-format FontWeightSchema into its Compose FontWeight counterpart — used wherever SimpleText/TextField resolve fontWeight.

Link copied to clipboard
fun HttpMethod.toKtorHttpMethod(): HttpMethod

Converts the wire-format HttpMethod into Ktor's own HttpMethod — every networking event (SendNetworkRequest, UploadFile, the download events, GetScreen/RefreshScreen) resolves its method through this before issuing the real request.

Link copied to clipboard

Converts the wire-format IconSchema.Style into the MaterialSymbolStyle the Icon composable expects.

Link copied to clipboard

Converts a MarginSchema into a Compose PaddingValues — used by Modifier.styledWith to apply style.margin. style.padding is a distinct dev.catbit.mosaic.core.data.schemas.tile.style.PaddingSchema with its own PaddingSchema.toPaddingValues extension, despite the identical field shape.

Converts a PaddingSchema into a Compose PaddingValues — used by Modifier.styledWith to apply style.padding. style.margin is a distinct dev.catbit.mosaic.core.data.schemas.tile.style.MarginSchema with its own MarginSchema.toPaddingValues extension, despite the identical field shape.

Link copied to clipboard
fun ImageResizeOptions.toResizeOptions(): ResizeOptions

Converts an ImageResizeOptions (TakePicture/GetImageFromGallery's resize) into the cmpimgcompress library's own ResizeOptions. Only takes effect when paired with a non-null CompressionScheme — resizing is applied as part of the same re-encode pass.

Link copied to clipboard

Converts a RadiusSchema into a Compose RoundedCornerShape — used for style.border's own corner radius, and (via ShapeSchema.toShape) for style.clip's RoundedCornerRectangle variant.

Converts a ShapeSchema into its Compose Shape counterpart — used by Modifier.styledWith to apply style.clip.

Link copied to clipboard

Converts the wire-format TextAlignSchema into its Compose TextAlign counterpart — used by SimpleText's textAlign.

Link copied to clipboard

Converts an AutoSizeSchema into its Compose TextAutoSize counterpart — used by SimpleText's autoSize to shrink/grow the font to fit the available space.

Link copied to clipboard

Converts the wire-format TextDecorationSchema into its Compose TextDecoration counterpart — used by SimpleText's textDecoration.

Link copied to clipboard

Converts the wire-format TextOverflowSchema into its Compose TextOverflow counterpart — used by SimpleText's overflow.

Link copied to clipboard

Converts the wire-format TypographySchema into the matching TextStyle off MaterialTheme.typography — used by SimpleText's typography to resolve the base text style, which every other styling field on SimpleText then overrides one property of.

Link copied to clipboard
inline fun <R> MutableStateFlow<*>.updateAs(block: R.() -> R)

Applies block to a MutableStateFlow<*>'s current value as if it were statically typed MutableStateFlow<R> — for call sites holding a type-erased state flow (e.g. a sealed UI-state flow narrowed to one specific subtype at a given point) that still want a type-safe update {}. A no-op if the flow's current value isn't actually non-null (via withNotNull) — this doesn't itself verify the value is really an instance of R; an unchecked cast that doesn't hold throws inside block.

Link copied to clipboard
inline fun <T> Map<String, Any?>.valueIfPresent(key: String, ifPresent: (T) -> Unit)

Runs ifPresent with this map's value at key cast to T, only when key is present and its value is actually an instance of T — a value present under the wrong type is silently skipped rather than throwing a ClassCastException.

Link copied to clipboard
inline fun <T> Map<String, Any?>.valueOrNullIfPresent(key: String, ifPresent: (T?) -> Unit)

Same as valueIfPresent, but runs ifPresent even when the value isn't an instance of T — passing null in that case (via as?) instead of skipping the call. Only skips entirely when key is absent.

Link copied to clipboard

Converts this TextField's visualTransformation into a Compose VisualTransformationPassword maps to Compose's own dot-masking transform, Custom(mask) to CustomVisualTransformation below, anything else (including null) to VisualTransformation.None.