198 Commits

Author SHA1 Message Date
6cb4880d29 Test and document Static effect and recomposition behavior (#679) 2025-02-05 00:33:14 -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
44ef3f4706 Centralize most opt-in usage (#655) 2025-01-23 15:16:40 -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
321290f5c1 Create mosaic-testing module (#528) 2025-01-03 21:55:32 +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
6da5f635e4 Change generic assertFails to assertFailure with specific exception (#614) 2025-01-03 18:57:45 +00:00
707fa0b835 Revamp test infrastructure (#615)
This now supports testing in all kinds of ways through a single mechanism and pluggable API. We no longer carry bespoke setups solely for testing but instead always use the test harness which is very close to the production behavior.
2025-01-03 18:30:13 +00:00
fb3980cc7a Start creation of the Mosaic type (#612)
This will eventually be a public type which represents a running Mosaic composition.
2025-01-03 15:05:18 +00:00
51033d0667 Move Terminal state to be owned by Mosaic (#610) 2025-01-03 00:58:25 -05:00
a095f0e16a Move key events to be owned by Mosaic (#609) 2025-01-03 04:46:55 +00:00
1ed803671d Time is stable (#607)
— Einstein, probably
2025-01-03 03:45:39 +00:00
b0cd493c4f Drop TextCanvas interface (#606)
We don't need it right now.
2025-01-03 03:23:34 +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
f2dc454e1e ANSI level is a property of rendering, not painting (#602) 2025-01-02 22:20:32 +00:00
fc85a79e53 Do not use Rendering for test harness (#601)
Rendering is for sending multiple frames to a VT-aware display, and its use only complicates the test harness. Our internal tests are the only ones which should ever need to test VT sequences.
2025-01-02 14:54:36 -05:00
187d618a5f Start frame listener undispatched (#599)
We want to reach the suspension point synchronously.
2025-01-02 16:52:38 +00:00
5e213493e6 Drive clock externally (#597)
This helps simplify testing where the clock is driven manually.
2025-01-02 15:55:36 +00:00
c9b459fdb1 Use a single test snapshot codepath (#596) 2025-01-02 05:53:09 +00:00
6b25c26474 Build Mosaic from a context, not a scope (#595) 2025-01-02 05:27:36 +00:00
034ceb7032 Do not send a frame or layout/draw on unhandled Ctrl+C (#594) 2025-01-02 04:54:07 +00:00
7c3fe41ce3 Use bound references instead of lambdas (#593) 2025-01-02 04:47:46 +00:00
e2fd7727f0 Remove extra lambda allocation (#592) 2025-01-01 04:56:52 +00:00
a2e163c04e Render as fast as possible (#578)
Do not delay to space out frames. Instead, send frames as fast as possible and only render when something changes. This ensures we reflect changes as soon as possible rather than after an artificial delay.
2024-12-19 12:14:55 -05:00
392ef676f5 More DEC mode report error cases (#543) 2024-11-22 16:39:02 +00:00
5c2ea724cc Only store the next layer once (#492)
Or in the case of the bottom layer, not at all.
2024-10-14 17:52:48 -04:00
687974c0bc Collapse surface arrays into a single contiguous chunk (#485)
Better locality in memory.
2024-09-25 23:45:02 -04:00
e2f598859e Use more efficient collections where possible (#483)
These avoid boxing, virtual calls, or both. Not all usages have been updated, just the easy targets.
2024-09-25 09:20:56 -04:00
aa9a9bb768 Fix nano calculation (#482) 2024-09-23 14:04:50 +00:00
7379bdd323 Send real frame times into Compose (#479) 2024-09-17 00:54:01 -04:00
4e2ca3d4a3 Launch different phases separately depending on need (#451)
* Launch different phases separately depending on need

A simple implementation that remembers the readings of the states when calling the layout, drawing blocks separately, and then with the help of a global observer checks which states have changed, if those that were read during layout or drawing have changed and composition is not going on now, then we run the layout or drawing phase separately.

Since composition does not occur in case of some changes, therefore, when completed in the `MosaicComposition#awaitComplete` method, we additionally expect one frame to be rendered, if necessary.

* Review fixes

* Back out AndroidX collections

---------

Co-authored-by: Jake Wharton <github@jakewharton.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2024-09-17 03:56:27 +00:00
6b5f3e30af Migrate from deprecated Mordant property (#470) 2024-09-11 02:03:11 +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
83e079deba Migrate to finalization hook library (#460) 2024-08-31 00:06:50 -04:00
0e1266fd72 Delete old intermediate source sets (#461) 2024-08-31 04:05:02 +00:00
f4370e81fc Consolidate files (#453) 2024-08-27 01:09:53 +00:00
e308b86351 Hide and show the cursor automatically during rendering (#452) 2024-08-26 16:30:32 +00:00
15b0f94967 Optimize atomics (#450)
Use platform-native types directly rather than wrapper classes.
2024-08-24 03:38:52 +00:00
83474b8724 Remove JS support (#447)
Demand for this is low, probably 0. If someone wants for it they can file an issue and we can discuss support further.

Downgrade to Gradle 8.9 because of KT-70700.
2024-08-23 09:59:23 -04:00
49cfda265e Eliminate subtyping (#441)
Still room for some cleanup, but the lack of subtypes should make it easier to add features around the composition.
2024-08-20 13:40:54 -04:00
abae5828b4 Change test composition to encapsulate a real composition (#440)
On the path to eliminating subtyping for the main composition.
2024-08-20 16:39:37 +00:00
12fc6df0af Give applier ownership of the root node (#438) 2024-08-20 15:49:58 +00:00
fec6366e16 Use runMosaicTest for all unit tests (#435)
- Rename `BaseMosaicComposition` to `MosaicComposition`, and `MosaicComposition` to `RenderingMosaicComposition` (with some changes)
- Use `RenderingMosaicComposition` in `renderMosaic` instead of `mosaicNodes`
- Use `runMosaicTest` in unit tests instead of `mosaicNodes`
- Remove `mosaicNodes`
- Create an `internal` `TestMosaicComposition` interface with the implementation of `RealTestMosaicComposition`
- Add unit tests for synchronous `renderMosaic`
2024-08-20 02:20:18 +00:00
c53d03badf Flatten MosaicNodeLayer hierarchy (#436) 2024-08-19 20:54:21 +00:00