Skip to content

Commit

Permalink
Release version 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ajalt committed Sep 8, 2024
1 parent 3ca2acd commit 008f9d0
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 14 deletions.
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## Unreleased

## 3.0.0
## Added
- New `TerminalDetection` object that can be used to detect terminal capabilities without creating a terminal instance.
- Added new optional methods to `TerminalInterface` to control raw mode: `getTerminalSize`, `readInputEvent`, `enterRawMode`, and `shouldAutoUpdateSize`.
Expand All @@ -16,11 +18,11 @@
- **Breaking Change** Moved `Terminal.info.width` and `height` to `Terminal.size.width` and `height`.
- **Breaking Change** `TerminalInterface.info` is now a method with parameters instead of a property.
- **Breaking Change** Moved `Markdown` widget to separate `mordant-markdown` module, which is not included by default. If you use markdown rendering, you need to add that module to you dependencies.
- **Breaking Change** Combined all `ColumnWidth` subclasses into a single class with factory methods. If you were using `ColumnWidth.Custom`, you should now use the `ColumnWidth` constructor.
- **Breaking Change** The following `Terminal` methods are now extensions: `prompt()`, `info()`, `danger()`, `warning()`, `success()`, `muted()`
- **Breaking Change** Renamed `TerminalInfo.crClearsLine` to `supportsAnsiCursor`
- In raw mode on POSIX systems, pressing the escape key once will now immediately return an `Escape` event. [(#193)](https://github.com/ajalt/mordant/issues/193)
- Renamed `TerminalInfo.crClearsLine` to `supportsAnsiCursor`
- Combined all `ColumnWidth` subclasses into a single class with factory methods. If you were using `ColumnWidth.Custom`, you should now use the `ColumnWidth` constructor.
- The following `Terminal` methods are now extensions: `prompt()`, `info()`, `danger()`, `warning()`, `success()`, `muted()`
- Renamed `Terminal.info` property to `Terminal.terminalInfo`
- Renamed `Terminal.info` property to `Terminal.terminalInfo`. The old name is deprecated.

### Removed
- Removed constructor overloads for `Terminal`. There is now one constructor with all default parameters.
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ Mordant is distributed through Maven Central.

```groovy
dependencies {
implementation("com.github.ajalt.mordant:mordant:2.7.2")
implementation("com.github.ajalt.mordant:mordant:3.0.0")
// optional extensions for running animations with coroutines
implementation("com.github.ajalt.mordant:mordant-coroutines:2.7.2")
implementation("com.github.ajalt.mordant:mordant-coroutines:3.0.0")
// optional widget for rendering Markdown
implementation("com.github.ajalt.mordant:mordant-markdown:3.0.0")
}
```

On JVM, there are more granular dependencies available.
[See the docs for details](https://ajalt.github.io/mordant/guide/).

###### If you're using Maven instead of Gradle, use `<artifactId>mordant-jvm</artifactId>`

#### Snapshots
Expand Down
5 changes: 3 additions & 2 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ there are several modules that implement `TerminalInterface` using different dep

=== "Individual JVM gradle dependencies"
```kotlin
// This modules doesn't include any JVM interface modules, so you'll need one or more if you're
// targeting JVM
// The `:mordant-core` module doesn't include any JVM interface modules, so you'll need one or
// more if you're targeting JVM. If you don't include any, features like raw mode and size
// detection won't work, but colors and styles still will.
implementation("com.github.ajalt.mordant:mordant-core:$mordantVersion")

// This module uses the Java Foreign Function and Memory API. It requires JDK 22+, and you must
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=2.7.2
VERSION_NAME=3.0.0

kotlin.mpp.stability.nowarn=true

Expand Down
1 change: 1 addition & 0 deletions mordant/api/mordant.api
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ public final class com/github/ajalt/mordant/terminal/Terminal {
public fun <init> (Lcom/github/ajalt/mordant/rendering/AnsiLevel;Lcom/github/ajalt/mordant/rendering/Theme;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;ILjava/lang/Boolean;Lcom/github/ajalt/mordant/terminal/TerminalInterface;)V
public synthetic fun <init> (Lcom/github/ajalt/mordant/rendering/AnsiLevel;Lcom/github/ajalt/mordant/rendering/Theme;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;ILjava/lang/Boolean;Lcom/github/ajalt/mordant/terminal/TerminalInterface;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getCursor ()Lcom/github/ajalt/mordant/terminal/TerminalCursor;
public final fun getInfo ()Lcom/github/ajalt/mordant/terminal/TerminalInfo;
public final fun getSize ()Lcom/github/ajalt/mordant/rendering/Size;
public final fun getTabWidth ()I
public final fun getTerminalInfo ()Lcom/github/ajalt/mordant/terminal/TerminalInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ interface CellStyleBuilder : CellStyleBuilderBase {
* Configuration for how a column should be sized in a table.
*/
data class ColumnWidth(
// TODO(3.0): add a `minimumWidth?` field and use it for progress cells like timeRemaining
/**
* The priority of the column when allocating available width.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class Terminal private constructor(
)
)

@Deprecated("This property was renamed to terminalInfo", ReplaceWith("terminalInfo"))
val info: TerminalInfo get() = terminalInfo

/**
* The current size of the terminal.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ data class TerminalInfo(
*/
val inputInteractive: Boolean,
/**
* If true, `\r` will clear the entire line it's printed on in the current terminal, if false,
* `\r` will only move the cursor
* If false using ANSI cursor movement codes may not work.
*/
val supportsAnsiCursor: Boolean,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ If you're using only `:mordant-jvm-ffm`, make sure you're running with JVM 22+,
"""

private object DumbTerminalInterface : StandardTerminalInterface() {
override fun stdoutInteractive(): Boolean = true
override fun stdinInteractive(): Boolean = true
override fun shouldAutoUpdateSize(): Boolean = false
override fun getTerminalSize(): Size? = null
override fun enterRawMode(mouseTracking: MouseTracking): AutoCloseable {
throw UnsupportedOperationException(DUMB_RAW_MODE_ERROR)
Expand Down
8 changes: 8 additions & 0 deletions samples/tour/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
plugins {
id("mordant-mpp-sample-conventions")
}

kotlin {
sourceSets {
commonMain.dependencies {
implementation(project(":mordant-markdown"))
}
}
}

0 comments on commit 008f9d0

Please sign in to comment.