github JakeWharton/mosaic 0.10.0

latest releases: 0.18.0, 0.17.0, 0.16.0...
22 months ago

New:

  • Support Kotlin 1.9.20 via JetBrains Compose compiler 1.5.3.

  • @MosaicComposable annotation restricts composable function usage to those meant for Mosaic
    (e.g., our Text) or general-purpose (e.g., Compose's remember). In most cases the Compose
    compiler can infer this automatically, but it's available for explicit use if needed.

  • LocalTerminal composition local provides the size of the terminal if it can be detected.
    If the size changes, your function will automatically be recomposed with the new values.

    val size = LocalTerminal.current.size
    Text("Terminal(w=${size.width}, h=${size.height})")
  • Row, Column, and Box now support horizontal and vertical alignment of their children.

    Column {
      Text("This is very long")
      Text(
        "On the right",
        modifier = Modifier.align(End),
      )
    }
  • Add AnnotatedString with SpanStyle for string customization. Instead of writing a series of
    Text functions in a Row, emit a single Text with formatting changes within the string.

    Text(buildAnnotatedString {
      append("Plain! ")
      withStyle(SpanStyle(color = BrightGreen)) {
        append("Green! ")
      }
      withStyle(SpanStyle(color = BrightBlue)) {
        append("Blue!")
      }
    })
  • Spacer node for occupying space within layouts.

  • Constraints and intrinsics are now available in the layout system.

This version works with Kotlin 1.9.20 by default.

Don't miss a new mosaic release

NewReleases is sending notifications on new releases.