39 Commits

Author SHA1 Message Date
9f79dfbeb2 Update kotlin monorepo to v2.2.20 (#957)
* Update kotlin monorepo to v2.2.20

* API dump

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2025-09-10 16:06:36 +00:00
5df5e316c9 Rename terminal.kt to TerminalState.kt to reflect its content (#854) 2025-04-11 02:08:16 +00:00
83a7d0c2f3 Create Terminal.Theme, and use Terminal.Size more (#815)
The ternary theme more accurately models our knowledge, and the size propagates both cell and pixel values.
2025-03-21 04:10:01 +00:00
cbcdc3487a Always go raw, but add a policy to skip TTY binding (#814) 2025-03-20 23:42:16 -04:00
52916d2f4a Rewrite POSIX Tty to actually use the TTY (#805)
And a PTY for testing. Windows still uses stdin/stdout for now.
2025-03-19 20:27:29 +00:00
545aba57bf Bring back Kitty underlines! (#806)
The difference in UnderlineStyle as opposed to Color and TextStyle was that it had a private constructor. Changing that to internal like the others avoids the compiler bug.
2025-03-18 16:49:55 +00:00
bedc15ea34 Remove pointless inline (#804) 2025-03-17 16:44:35 +00:00
e82432b11f Hide Kitty underline APIs which indirectly break native (#803)
Also disable partial linkage which hid this problem for two weeks.
2025-03-17 14:50:44 +00:00
0350c20416 Rename terminal state aggregate type to avoid conflict (#788) 2025-03-13 18:28:45 +00:00
423ba21f8c Push terminal feature detection into terminal library (#784)
This starts to provide a high-level terminal abstraction. It's not perfect, but it's good enough to start with.
2025-03-13 04:34:30 +00:00
8cee1568ae Move static to root package (#778)
It no longer depends on UI things.
2025-03-07 14:26:49 +00:00
c38c09d8bc Create new static logging system (#777)
`Static` function is now called `StaticEffect` to better indicate that it only renders its content once.

`LocalStaticLogger` composition local provides access to `StaticLogger` which allows logging plain strings at arbitrary points for inclusion in the next frame. This can be used from effects, callback, state classes, etc.
2025-03-07 00:56:46 -05:00
8957294eff Add support for Kitty underlines (#765) 2025-03-02 06:47:20 -05:00
e0510403d3 Remove renderMosaic (#762) 2025-03-01 04:27:22 +00:00
1d6a300bb8 Upgrade to Kotlin 2.1.20-RC (#734)
Use the new application plugin replacement.
2025-02-24 17:02:18 +00:00
fd2b22e562 Run startup bootstrap in the main event loop (#700) 2025-02-16 13:32:11 +00:00
93cccf14ff Add focus and theme to Terminal, make cursor and sync conditional (#696) 2025-02-15 14:50:17 -05:00
cc31d49df5 Switch to our own terminal library (#695)
* Switch to our own terminal library

This handles raw mode, VT parsing, and other system integration.

* Docs needs native libraries now

* API dump

* More test hacks

* Formatting
2025-02-14 14:44:52 -05:00
12ffc47444 Inject keys and terminal state into Mosaic (#691) 2025-02-13 16:23:23 -05:00
768abf2f13 Render Static with a subcomposition (#678)
This allows immediately disposing the subcomposition which results in removal of the entire subtree without triggering recomposition of the parent composition.
2025-02-04 23:03:57 -05:00
6046e7365b Do not trigger recomposition when static renders (#677) 2025-02-03 14:59:35 -05:00
cb67697ad0 Two quick helpers for testing statics (#634)
Not great, but better than we have.
2025-01-07 21:17:34 +00:00
5b57e618e1 Add Modifier.composed (#617) 2025-01-05 22:58:50 -05:00
069d96909a Create Mosaic.layoutId, unit tests for ParentDataModifier and fix for Modifiers (#620)
* Create `Mosaic.layoutId`, unit tests for `ParentDataModifier` and fix for `Modifier`s

- New `Mosaic.layoutId` has been created that can be used to define child elements, for example, during the measurement stage
- Add unit tests for `Mosaic.layoutId`
- Add unit tests for `ParentDataModifier`
- Fix the handling of `Modifier`s that were inherited from several key `Modifier` classes (`LayoutModifier`, `DrawModifier`, `KeyModifier`, `ParentDataModifier`) with different handling
- Remove unnecessary call site generic parameter in `RealTestMosaic` and replace `coroutineScope` with getting `CoroutineContext` by `currentCoroutineContext()` function in `runMosaicTest`.

* Update CHANGELOG.md

* Rename

---------

Co-authored-by: Jake Wharton <github@jakewharton.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2025-01-05 05:27:05 +00:00
3db278c2c1 Create internal Modifier.testTag (#619)
* Create internal `Modifier.testTag`

* Update mosaic-runtime/src/commonTest/kotlin/com/jakewharton/mosaic/stuff.kt

* Update mosaic-runtime/src/commonTest/kotlin/com/jakewharton/mosaic/stuff.kt

---------

Co-authored-by: Jake Wharton <github@jakewharton.com>
2025-01-05 04:45:58 +00:00
313db47713 Expose a public Mosaic type (#616) 2025-01-03 21:35:34 +00:00
2ffbf437d4 Add intrinsic Modifiers (#613)
- Add `IntrinsicSize`
- Add `Modifier.width`, `Modifier.height`, `Modifier.requiredWidth`, `Modifier.requiredHeight` with `IntrinsicSize` as a parameter
- Add unit tests for intrinsic Modifiers
- Update `SizeModifier` for upstream (df20b2d700)
2025-01-03 19:20:07 +00:00
efcf480ebe Create mosaic-animation (#600)
Porting animation helpers from androidx:
- https://developer.android.com/reference/kotlin/androidx/compose/animation/core/package-summary
- androidx.compose.animation](https://developer.android.com/reference/kotlin/androidx/compose/animation/package-summary (a little bit from here)

Solution for https://github.com/JakeWharton/mosaic/issues/400

Use the new code to update and add animations to the demo sample.
2025-01-02 21:19:21 -05:00
392ef676f5 More DEC mode report error cases (#543) 2024-11-22 16:39:02 +00:00
2b4cb8a69c Add rudimentary key handling (#442)
This forces all usages into raw mode, regardless of whether you are listening for keys or not.
2024-09-10 18:11:15 -04:00
b7516bc630 Stuff (#466)
- Klib API dumps
- UInt comparison
- Publishing gets Dokka automatically
2024-09-07 00:00:20 -04:00
f4370e81fc Consolidate files (#453) 2024-08-27 01:09:53 +00:00
4d053dbbd3 Change runMosaic to support effects (#284) 2024-08-16 16:58:08 -04:00
148502f815 Some code fixes (#384)
- Move `Fill` and `Stroke` inside the `DrawStyle`
- Remove `toString` from `DrawStyle.Stroke` because `@Poko` is already doing it
- In the robot sample, the use of the `offset` modifier in the robot (`Text`)
- Remove `TODO https://github.com/JakeWharton/mosaic/issues/11` in the robot sample, it seems that it is no longer relevant
- In the robot sample, add `isActive` check in the loop for keyboard input
- Fix in the `README.md` `mutableStateOf` to `mutableIntStateOf`, as is correct in newer versions
2024-05-30 07:49:11 -04:00
d542cf1587 Modify DrawScope#drawRect (#383)
- Change the `drawRect` method in `DrawScope` like the method from the Compose UI
- Add support for `DrawStyle`: `Fill` and `Stroke` in `DrawScope#drawRect`
- Add support for drawing a rectangle from text characters
- Add `Filler` with code point
- Change the robot sample to show `drawRect` with `Stroke`
2024-05-29 21:50:07 -04:00
15d9d2df30 Remove autoboxing and object creation from multiple locations (#372)
- Add `Color.Unspecified` for replace nullable `Color`
- Add some extension functions for `Color` to check on `Color.Unspecified`
- Use `TextStyle.Unspecified` instead null for `TextStyle`
- Add some extension functions for `TextStyle` to check on `TextStyle.Unspecified` and `TextStyle.Empty`
- Make `TextStyle` an inline class
- Using `Int` as codepoint (`TextPixel#codePoint`) instead of `String` in `TextPixel` (`TextPixel#value`)
- Rename `style: TextStyle` to `textStyle: TextStyle` for clearer and less confusing naming, as there are several other styles
- Add emoji to demo sample and use of 2 styles for part of the text
2024-05-27 21:15:36 -04:00
6efdb159b8 Support true color palette (#356)
Also update rrtop sample with several color palettes
2024-05-15 21:30:20 -04:00
7aa13e5e93 Remove Terminal.Size and use IntSize instead in Terminal.size for optimization purposes (#363) 2024-05-09 19:23:05 -04:00
f192af3b26 Add Binary Compatibility Validator (#298)
* Add Binary Compatibility Validator

Tracking changes to the library's public contract.

https://github.com/Kotlin/binary-compatibility-validator

* Apply suggestions from code review

---------

Co-authored-by: Jake Wharton <github@jakewharton.com>
2024-01-16 16:45:19 +00:00