28 Commits

Author SHA1 Message Date
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
4f5977231b Run samples in CI (#792) 2025-03-17 03:47:30 +00:00
f71c42d2d0 Make all samples multiplatform (#786) 2025-03-13 13:23:43 -04: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
6046e7365b Do not trigger recomposition when static renders (#677) 2025-02-03 14:59:35 -05:00
e308b86351 Hide and show the cursor automatically during rendering (#452) 2024-08-26 16:30:32 +00:00
4d053dbbd3 Change runMosaic to support effects (#284) 2024-08-16 16:58:08 -04:00
5ca7ff1a15 Update dependency com.pinterest.ktlint:ktlint-cli to v1.3.0 (#392)
* Update dependency com.pinterest.ktlint:ktlint-cli to v1.3.0

* Format

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2024-06-07 03:39:41 +00:00
a5ec60767d Update to Kotlin 2.0
* Update Kotlin and Compose to v2

* Kotlin 2.0 updates

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2024-05-28 16:55:50 -04:00
6efdb159b8 Support true color palette (#356)
Also update rrtop sample with several color palettes
2024-05-15 21:30:20 -04:00
36fc6a8e3b Update dependency io.nlopez.compose.rules:ktlint to v0.3.15 (#345)
* Update dependency io.nlopez.compose.rules:ktlint to v0.3.15

* Use mutableIntStateOf

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2024-04-14 01:34:12 +00:00
e58ceb1dd0 Update dependency com.pinterest.ktlint:ktlint-cli to v1.2.0 (#320)
* Update dependency com.pinterest.ktlint:ktlint-cli to v1.2.0

* Appease ktlint

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2024-02-29 02:17:03 +00:00
12fc6fc245 Introduce Compose ktlint rules (#267) 2023-12-01 22:03:15 -05:00
e67cb363c7 Fix Gradle warnings (#248)
* Fix deprecation warning coming from buildconfig plugin.

> Configure project :build-logic:mosaic-gradle-plugin
The Project.getConvention() method has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.4/userguide/upgrading_version_8.html#deprecated_access_to_conventions
        at build_76rlsb2vs9qh6z5gt0vmnl0ip.run(P:\projects\contrib\github-mosaic\mosaic-gradle-plugin\build.gradle:3)

* Fix application plugin related deprecations. `mainClassName` is a convention property, even when it's inside the `application` block.
We cant to set https://docs.gradle.org/8.4/dsl/org.gradle.api.plugins.JavaApplication.html#org.gradle.api.plugins.JavaApplication:mainClass instead.

> Configure project :samples:counter
Build file 'P:\projects\contrib\github-mosaic\samples\counter\build.gradle': line 11
The org.gradle.api.plugins.ApplicationPluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.4/userguide/upgrading_version_8.html#application_convention_deprecation
        at build_dw2puawl5bmiuhlfercnbnay0$_run_closure1.doCall$original(P:\projects\contrib\github-mosaic\samples\counter\build.gradle:11)
        at build_dw2puawl5bmiuhlfercnbnay0.run(P:\projects\contrib\github-mosaic\samples\counter\build.gradle:10)

		Build file 'P:\projects\contrib\github-mosaic\samples\counter\build.gradle': line 11
The org.gradle.api.plugins.Convention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.4/userguide/upgrading_version_8.html#deprecated_access_to_conventions
        at build_dw2puawl5bmiuhlfercnbnay0$_run_closure1.doCall$original(P:\projects\contrib\github-mosaic\samples\counter\build.gradle:11)
        at build_dw2puawl5bmiuhlfercnbnay0.run(P:\projects\contrib\github-mosaic\samples\counter\build.gradle:10)

> Configure project :samples:jest | :samples:robot | :samples:demo
Build file 'P:\projects\contrib\github-mosaic\samples\jest\build.gradle': line 5
The org.gradle.api.plugins.ApplicationPluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.4/userguide/upgrading_version_8.html#application_convention_deprecation
        at build_3tv3yi15cjhed4vkpewcfismx.run(P:\projects\contrib\github-mosaic\samples\jest\build.gradle:5)

Build file 'P:\projects\contrib\github-mosaic\samples\jest\build.gradle': line 5
The org.gradle.api.plugins.Convention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.4/userguide/upgrading_version_8.html#deprecated_access_to_conventions
        at build_3tv3yi15cjhed4vkpewcfismx.run(P:\projects\contrib\github-mosaic\samples\jest\build.gradle:5)

* Ignore warning about Kotlin/Native, there's no way to build mac binaries on Linux and Windows, so no need to nag about it.

> Configure project :mosaic-runtime
w: The following Kotlin/Native targets cannot be built on this machine and are disabled:
macosArm64, macosX64
To hide this message, add 'kotlin.native.ignoreDisabledTargets=true' to the Gradle properties.

> Configure project :samples:counter
w: The following Kotlin/Native targets cannot be built on this machine and are disabled:
macosArm64, macosX64
To hide this message, add 'kotlin.native.ignoreDisabledTargets=true' to the Gradle properties.
2023-11-13 22:37:15 +00:00
9358bd8ad5 Add new demo app for messing around (#246) 2023-11-13 21:16:08 +00:00
ec6c09eca2 Enable Spotless/ktlint formatting (#243) 2023-11-13 19:01:40 +00:00
8123702fa9 Add AnnotatedString with SpanStyle for text customization (#227)
* Add AnnotatedString with SpanStyle for text customization

This is a simplified version of AnnotatedString and SpanStyle from Jetpack Compose. There is no ParagraphStyle support. SpanStyle contains fewer properties.

The tests are also taken from Jetpack Compose, but simplified.

The API has been saved for using AnnotatedString and creating and styling it, for quick understanding if you know Jetpack Compose.

The code has two Compose Text functions, two DrawScope.DrawText methods, two TextLayout inheritors, in which the difference is only in the accepted value - either String or AnnotatedString. This is done for optimization, but in theory it may be unnecessary.

Update the jest example using AnnotatedString.

* Add MosaicComposable to Text function with AnnotatedString parameter

* Change TextLayout access modifier to internal
2023-11-13 13:21:00 -05:00
f18e140e7e Add background modifier, fix multimodifier positioning (#180) 2023-05-17 03:38:59 +00:00
a82597b931 Avoid initial empty rendering of Jest sample (#155)
Ensure our worker coroutines are started eagerly and move the initial rendering to occur after their tests have been put into the working set.
2023-03-14 03:36:25 +00:00
e40752e991 Break layout and components into packages, individual files 2023-03-12 00:10:22 -05:00
af0139a679 Switch Static to render using a list (#150) 2023-03-12 04:19:02 +00:00
2ae0256004 Change entrypoint to a suspend function
...and add support for running in JS!
2023-01-25 23:01:14 -05:00
f8eb590dac Remove extra newline at the end of the GIFs 2023-01-18 16:41:20 -05:00
73a62c7129 Use agg to render gifs 2023-01-17 23:55:47 -05:00
c512de1383 Add Static component for rendering permanent output 2022-09-06 15:12:38 -04:00
8ea89df52f Fix Jest sample
This isn't great. You don't have to do this with normal Compose UI. Must fix.
2022-08-11 23:24:40 -04:00
11d276f2d9 Restructure project to a nested build
This allows the samples (formerly examples) to configure themselves like a regular consumer would (using the Gradle plugin).
2021-05-05 12:37:19 -04:00