diff --git a/build.sbt b/build.sbt index 3865174..aba7dec 100644 --- a/build.sbt +++ b/build.sbt @@ -145,11 +145,7 @@ lazy val laminar = project.in(file(".")) useYarn := true, - scalaJSUseMainModuleInitializer := true, - - (Compile / fastOptJS / scalaJSLinkerConfig) ~= { - _.withSourceMap(false) - } + scalaJSUseMainModuleInitializer := true ) .settings( name := "Laminar", diff --git a/project/Versions.scala b/project/Versions.scala index 4461d3f..51211bf 100644 --- a/project/Versions.scala +++ b/project/Versions.scala @@ -6,7 +6,7 @@ object Versions { // -- Dependencies -- - val Airstream = "17.0.0-M3-SNAPSHOT" + val Airstream = "17.0.0-M8" val Ew = "0.2.0" diff --git a/src/test/scala/com/raquo/laminar/tests/SyntaxSpec.scala b/src/test/scala/com/raquo/laminar/tests/SyntaxSpec.scala index b1ddea4..50d3168 100644 --- a/src/test/scala/com/raquo/laminar/tests/SyntaxSpec.scala +++ b/src/test/scala/com/raquo/laminar/tests/SyntaxSpec.scala @@ -280,7 +280,7 @@ class SyntaxSpec extends UnitSpec { ) el.amend( - onMountBind(_ => observable --> ((num: Int) => noop(num * 5))), // #nc + onMountBind(_ => observable --> ((num: Int) => noop(num * 5))), onMountBind(_ => signal --> ((num: Int) => noop(num * 5))), onMountBind(_ => stream --> ((num: Int) => noop(num * 5))) ) diff --git a/website/blog/2023-12-04-laminar-v17.0.0.md b/website/blog/2023-12-04-laminar-v17.0.0.md index 6d1e135..abb71cb 100644 --- a/website/blog/2023-12-04-laminar-v17.0.0.md +++ b/website/blog/2023-12-04-laminar-v17.0.0.md @@ -66,6 +66,21 @@ Technical notes * TODO: document in Laminar +### Render JS and Mutable Collections + +Previously, Laminar's `children <-- streamOfChildren` syntax required an Observable of an `immutable.Seq` of elements (roughly speaking). Now you can provide observables of any `collection.Seq`, `scala.Array`, `js.Array`, `ew.JsArray` and [`ew.JsVector`](https://github.com/raquo/ew). You may want to use JS collections or mutable collections for efficiency, when rendering very large and/or very frequently updated lists of items. + +At the moment this mechanism isn't extensible to custom collection types. If you need that, please let me know. + +TODO: Document using mutable collections with observables + +As part of this change, I simplified Laminar implicits to use the new `RenderableSeq` typeclass. I believe that these changes are a net benefit, and they should also improve compiler error messages a bit (less of "None of the overloaded alternatives of method ... match arguments"). + +**Migration:** All Laminar syntax tests pass with the new implicits, however it's possible that some obscure use cases no longer compile if the compiler's ability to resolve new implicits does not exactly match the previous ones. + +* If legitimate-looking Laminar code no longer compiles, please let me know. Things like: conversions of strings / numbers / etc. to text nodes, conversions of components (with `RenderableNode` to elements), all of the above but with collections, etc. + + ## Significant Airstream Improvements @@ -181,6 +196,8 @@ See [Airstream#115](https://github.com/raquo/Airstream/issues/115) and [Laminar# ## Smaller Airstream Improvements +* New: `EventStream.fromPublisher` creates an Airstream `EventStream` from Java's `Flow.Publisher` (thanks, [@armanbilge](https://github.com/armanbilge)!). + * This lets you consume FS2, Monix, or some other libraries' streams in Laminar * New: [tapEach](https://github.com/raquo/Airstream/#tapEach) operator * Naming: `eventBus.stream` alias to `eventBus.events`, for consistency with Var's `signal`. * Naming: `signal.changes(op)` alias to `signal.composeChanges(op)`. `signal.changes` (with no parens) remains the same. @@ -188,6 +205,9 @@ See [Airstream#115](https://github.com/raquo/Airstream/issues/115) and [Laminar# * Shorten default displayName-s (`com.raquo.airstream.eventbus.EventBus@` -> `EventBus@` etc.) for all `Named` types, including observables, event buses, vars, etc. * Use pretty default names for var signals and eventbus streams (e.g. `Var@.signal`) (this also affects toString) * **Migration:** your tests might break if they rely on previous default displayName-s +* Fix: The per-item signals provided by the split operator now re-sync their values to the parent signal when restarted – this makes their behaviour consistent with other signals since v15. + * **Migration:** You are unlikely to be relying on the current behaviour, since it is quite undesirable. See [Airstream#120](https://github.com/raquo/Airstream/issues/120) for an example. +* Fix: `split` operator's memoization works for `LazyList` now * Fix: More robust error reporting * Handle exceptions that happen while printing exceptions * Yes, that can happen, and yes, that happened. @@ -210,6 +230,8 @@ See [Airstream#115](https://github.com/raquo/Airstream/issues/115) and [Laminar# **Migration** should be obvious where not specified. +* Creating a custom `RenderableNode` only requires a single parameter now: + * e.g. `RenderableNode(_.node)` instead of `RenderableNode(_.node, _.map(_.node), ...)` * Drop support for Scala 2.12 * [The RFC](https://github.com/raquo/Laminar/issues/132) has been up for more than a year, and nobody has spoken in favor of keeping support. * Internal structure refactor: @@ -218,6 +240,8 @@ See [Airstream#115](https://github.com/raquo/Airstream/issues/115) and [Laminar# * Extract some code from `Laminar` trait into `MountHooks` and `StyleUnitsApi` * Move all the inserters, `InsertContext` and `CollectionCommand` to new `inserters` package * Eliminate `FocusBinder` object - use `focus` directly + * Remove unused `extraNodes` field from `InsertContext` + * Some children realted internal types now accept `laminar.Seq` instead of `immutable.Seq` * Naming: `ValueController` -> `InputController`