Skip to content

Commit

Permalink
Prepare version 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWharton committed Oct 7, 2024
1 parent 7fa4b5e commit 9619ebe
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 84 deletions.
57 changes: 33 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
# Change log

## [Unreleased]
[Unreleased]: https://github.com/JakeWharton/mosaic/compare/0.14.0...HEAD

New:
- Support synchronized terminal update for rendering.
- The terminal cursor is now automatically hidden during rendering and restored afterwards.
- Use `Modifier.onKeyEvent` or `Modifier.onPreKeyEvent` to listen to keyboard events.
- Send real frame times into Compose which can be used for things like animations.
- Nothing yet!

Changed:
- Сhange `DrawScope#drawRect` API with the ability to draw with text characters and specify `DrawStyle` (`Fill` or `Stroke`).
- Drop support for JS target. If you were using this, please file an issue so we can discuss support.
- Nothing yet!

Fixed:
- Nothing yet!


## [0.14.0] - 2024-10-07
[0.14.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.14.0

New:
- Support synchronized terminal update for rendering. This should eliminate tearing when rendering updates for terminals that support this feature.
- The terminal cursor is now automatically hidden during rendering and restored afterward.
- Added `Modifier.onKeyEvent` or `Modifier.onPreKeyEvent` to listen to keyboard events.
- Send real frame times into Compose which can be used for things like animations.

Changed:
- The entrypoints (`runMosaic` and `runMosaicBlocking`) have been changed to directly accept a composable lambda. Asynchronous work should not be performed inside Compose's effect system (e.g., `LaunchEffect`), and rendering will complete when all effects have completed. Check out our samples for more information about how to do this.
- Сhange `DrawScope#drawRect` API with the ability to draw with text characters and specify `DrawStyle` (`Fill` or `Stroke`).
- Drop support for JS target. If you were using this, please file an issue so we can discuss support.


## [0.13.0] - 2024-05-28
[0.13.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.13.0

New:
- Support Kotlin 2.0.0!
Expand Down Expand Up @@ -88,6 +101,7 @@ mosaic {


## [0.12.0] - 2024-05-28
[0.12.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.12.0

New:
- Add `linuxArm64` target.
Expand All @@ -105,6 +119,7 @@ Fixed:


## [0.11.0] - 2024-02-27
[0.11.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.11.0

New:
- Support Kotlin 1.9.22 via JetBrains Compose compiler 1.5.10.
Expand All @@ -128,6 +143,7 @@ This version works with Kotlin 1.9.22 by default.


## [0.10.0] - 2023-11-13
[0.10.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.10.0

New:
- Support Kotlin 1.9.20 via JetBrains Compose compiler 1.5.3.
Expand Down Expand Up @@ -179,6 +195,7 @@ This version works with Kotlin 1.9.20 by default.


## [0.9.1] - 2023-09-14
[0.9.1]: https://github.com/JakeWharton/mosaic/releases/tag/0.9.1

New:
- Support Kotlin 1.9.10 via JetBrains Compose compiler 1.5.2.
Expand All @@ -187,6 +204,7 @@ This version works with Kotlin 1.9.10 by default.


## [0.9.0] - 2023-08-09
[0.9.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.9.0

New:
- Support for specifying custom Compose compiler versions. This will allow you to use the latest
Expand All @@ -196,18 +214,21 @@ New:


## [0.8.0] - 2023-07-20
[0.8.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.8.0

New:
- Support Kotlin 1.9.0 via JetBrains Compose compiler 1.5.0.


## [0.7.1] - 2023-06-30
[0.7.1]: https://github.com/JakeWharton/mosaic/releases/tag/0.7.1

New:
- Support Kotlin 1.8.22 via JetBrains Compose compiler 1.4.8.


## [0.7.0] - 2023-06-26
[0.7.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.7.0

New:
- Support Kotlin 1.8.21 via JetBrains Compose compiler 1.4.7.
Expand All @@ -221,6 +242,7 @@ Changed:


## [0.6.0] - 2023-04-17
[0.6.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.6.0

New:
- Support Kotlin 1.8.20 via JetBrains Compose compiler 1.4.5.
Expand All @@ -238,6 +260,7 @@ Breaking:


## [0.5.0] - 2023-03-09
[0.5.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.5.0

- Support Kotlin 1.8.10 via JetBrains Compose compiler 1.4.2.
- New: `renderMosaic` function returns a single string of the composition for tools that require only static output.
Expand All @@ -247,6 +270,7 @@ Breaking:


## [0.4.0] - 2023-02-19
[0.4.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.4.0

- Mosaic is now multiplatform!

Expand All @@ -264,36 +288,21 @@ Breaking:


## [0.3.0] - 2023-01-17
[0.3.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.3.0

- Support Kotlin 1.8.0 via Compose compiler 1.4.0.
- New: `Static` composable for rendering permanent output.
- Fix: Correct line calculation to prevent output from drifting downward over time when its height changes.


## [0.2.0] - 2022-08-12
[0.2.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.2.0

- Support Kotlin 1.7.10 via Compose compiler 1.3.0.
- Migrate from custom build of Compose compiler and Compose runtime to Google's Compose compiler and JetBrains' multiplatform Compose runtime. Note that this will require you have the Google Maven repositories in your Gradle repositories (`google()`).


## [0.1.0] - 2021-06-25
[0.1.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.1.0

Initial release!


[Unreleased]: https://github.com/JakeWharton/mosaic/compare/0.13.0...HEAD
[0.13.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.13.0
[0.12.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.12.0
[0.11.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.11.0
[0.10.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.10.0
[0.9.1]: https://github.com/JakeWharton/mosaic/releases/tag/0.9.1
[0.9.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.9.0
[0.8.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.8.0
[0.7.1]: https://github.com/JakeWharton/mosaic/releases/tag/0.7.1
[0.7.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.7.0
[0.6.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.6.0
[0.5.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.5.0
[0.4.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.4.0
[0.3.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.3.0
[0.2.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.2.0
[0.1.0]: https://github.com/JakeWharton/mosaic/releases/tag/0.1.0
69 changes: 10 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ Jump to:
The entrypoint to Mosaic is the `runMosaic` function.
The lambda passed to this function is responsible for both output and performing work.

Output (for now) happens through the `setContent` function.
You can call `setContent` multiple times, but as you'll see you probably won't need to.

```kotlin
suspend fun main() = runMosaic {
setContent {
Text("The count is: 0")
}
Text("The count is: 0")
}
```

Expand All @@ -34,40 +29,15 @@ Let's update our counter to actually count to 20.

```kotlin
suspend fun main() = runMosaic {
var count = 0

setContent {
Text("The count is: $count")
}

for (i in 1..20) {
delay(250)
count = i
}
}
```

**This will not work!** Our count stays at 0 for 5 seconds instead of incrementing until 20.
Instead, we have to use Compose's `State` objects to hold state.

```diff
-var count = 0
+var count by mutableIntStateOf(0)
```

Now, when the `count` value is updated, Compose will know that it needs to re-render the string.

```kotlin
suspend fun main() = runMosaic {
var count by mutableIntStateOf(0)
var count by remember { mutableIntStateOf(0) }

setContent {
Text("The count is: $count")
}
Text("The count is: $count")

for (i in 1..20) {
delay(250)
count = i
LaunchedEffect(Unit) {
for (i in 1..20) {
delay(250)
count = i
}
}
}
```
Expand Down Expand Up @@ -95,7 +65,7 @@ Mosaic itself can then be added like any other dependency:

```groovy
dependencies {
implementation("com.jakewharton.mosaic:mosaic-runtime:0.13.0")
implementation("com.jakewharton.mosaic:mosaic-runtime:0.14.0")
}
```

Expand All @@ -113,7 +83,7 @@ repository {
}
}
dependencies {
implementation("com.jakewharton.mosaic:mosaic-runtime:0.14.0-SNAPSHOT")
implementation("com.jakewharton.mosaic:mosaic-runtime:0.15.0-SNAPSHOT")
}
```

Expand Down Expand Up @@ -172,25 +142,6 @@ successive lines instead.
In the future Mosaic will detect this case and do... something. For now, we unconditionally emit
ANSI control characters. Run your programs directly in a terminal emulator–no IDE and no Gradle.

### Why doesn't work take place in a `LaunchedEffect`?

This is the goal. It is currently blocked by [issuetracker.google.com/178904648](https://issuetracker.google.com/178904648).

When that change lands, and Mosaic is updated, the counter sample will look like this:
```kotlin
suspend fun main() = runMosaic {
var count by remember { mutableIntStateOf(0) }

Text("The count is: $count")

LaunchedEffect(Unit) {
for (i in 1..20) {
delay(250)
count = i
}
}
}
```

# License

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.jakewharton.mosaic
VERSION_NAME=0.14.0-SNAPSHOT
VERSION_NAME=0.14.0

SONATYPE_HOST=DEFAULT
SONATYPE_AUTOMATIC_RELEASE=true
Expand Down

0 comments on commit 9619ebe

Please sign in to comment.