Code Monkey home page Code Monkey logo

Comments (19)

raquo avatar raquo commented on June 3, 2024 3

Released: Laminar 15.0.0-M7, Airstream 15.0.0-M5, Waypoint 6.0.0-M5, and Scala DOM Types 17.0.0-M7

Various small fixes. Notable changes:

  • Html tags / attrs / etc. are plain val-s now, not lazy val-s. I checked that the latest Scala.js dead-code-eliminates them in fullOptJS. A bit less overhead when building all the DOM trees. I couldn't get this to work with style props and svg attrs so far because those classes apparently aren't pure enough for DCE to kick in.
  • Fixed type signature of EventBus.emit(bus1 -> v1, bus2 -> v2) to be able to accept event buses of different types.
  • Renamed Fetch back to FetchStream

Also updated a bunch of documentation. Still need to write more docs, mostly on the new Airstream semantics, then we can release 15.0.0.

from laminar.

raquo avatar raquo commented on June 3, 2024 2

Released: Laminar 15.0.0-M4, Airstream 15.0.0-M3, Scala DOM Types 17.0.0-M4, and Waypoint 6.0.0-M3

  • All issues mentioned above are fixed.

  • API: DerivedVar zoomOut parameter now provides the parent Var's current value as the first param.

    • Migration: update existing usages of parentVar.zoom(in)(out) method to parentVar.zoom(in)((parentValue, derivedValue) => out(derivedValue)), or better yet, make use of parentValue instead of calling parentVar.now() in your out function.
  • API: Renamed the new operators: distinctBy(isSameFn) is now distinctByFn(isSameFn), distinctByKey(_.key) is now distinctBy(_.key). If you already started using them, you'll need to address this.

  • New: setValue("...") and setChecked(true) event processor helpers for cases when you want to e.g. clear the input field's value before performing the main side effect.

  • Additional 15.x upgrade note: you should completely remove "com.raquo" %%% "domtypes" from your dependencies if you have it in your build.sbt, because SDT is no longer a runtime dependency of Laminar, SDT is now used as a code generator at Laminar compile time (not your project's compile time, and not your project's runtime).

from laminar.

raquo avatar raquo commented on June 3, 2024 1

Found a data bug in Scala DOM Types 17.0.0-x – SVG xmlns attribute should have a namespace, but it doesn't. Can't build SVGs with that attribute. Will fix soon. cc FYI @armanbilge.

from laminar.

raquo avatar raquo commented on June 3, 2024 1

Released: Laminar 15.0.0-M6

M5 had an issue with implicit resolution for child nodes and text nodes in certain use cases, this release should fix that.

from laminar.

raquo avatar raquo commented on June 3, 2024 1

from laminar.

raquo avatar raquo commented on June 3, 2024 1

@yurique Waypoint tests are passing with 0.4.0-RC1, I think it's good to release it as the final version.

from laminar.

yurique avatar yurique commented on June 3, 2024 1

0.4.0 is out

from laminar.

raquo avatar raquo commented on June 3, 2024

As reported in Discord, a few color-related aliases went missing, such as color.aqua.
As a workaround, replace with them with color("aqua") for now.
I will add them back in M2.

from laminar.

raquo avatar raquo commented on June 3, 2024

In 15.0.0-M1 I added a def apply[A]: EventBus[A] = new EventBus[A] method, but it should have had parens. Because of this, EventBus[A]() syntax that previously worked in Scala 3 does not work currently. As a workaround, use EventBus[A] or new EventBus[A] for now, and I will fix the apply method in M2.

from laminar.

raquo avatar raquo commented on June 3, 2024

As discussed in Discord, I will take a more conservative approach to the new :=> Unit arrow methods, requiring an implicit import to enable this, and using implicitNotFound to provide a compiler error informing the user about the Scala 3 if-caveat.

Just to say it once – all fixes and changes are scheduled for the next milestone release, unless noted otherwise.

from laminar.

raquo avatar raquo commented on June 3, 2024

I plan to release M2 tomorrow night with the fixes above, and maybe also raquo/Airstream#104

If there is anything else you want in M2, please let me know soon.

from laminar.

raquo avatar raquo commented on June 3, 2024

customSvgAttr deprecation message has a typo in it, incorrectly referring to customSvgTag instead. Fixed in master.

from laminar.

raquo avatar raquo commented on June 3, 2024

Released: Laminar 15.0.0-M5, Airstream 15.0.0-M4, Waypoint 6.0.0-M4, and Scala DOM Types 17.0.0-M6

If everything goes well, this Laminar release will be cut as 15.0.0.

Please try migrating your Laminar app to this version. If any issues crop up with your Laminar usage patterns, they would be a lot easier for me to address now than after 15.0.0 is released. I don't expect any issues at this point, but this release has some very significant changes.

The draft migration guide is complete, short of very minor new features.

I will now focus on updating the documentation and website, and once that's done, I'll release Laminar 15.0.0.

Changes vs Laminar 15.0.0-M4

  • Removed automatic == deduplication checks from DOM updaters like attr <-- stream and child <-- signal – that was causing undesirable behavior in certain cases. Long story short, to do this properly at the library level, I need to read the current state of the DOM on every event, and that is actually somehow more expensive than writing to the DOM, so it does not make sense as a performance optimization.

    • In your own code you're free to use .distinct as appropriate though. I've added some comments on performance tradeoffs to the draft release blog post, the TLDR is – if you have observables that emit a lot of consecutive duplicate events that end up updating the DOM, consider puting .distinct on some of those observables to reduce the number of DOM updates, but otherwise, it's fine.
  • I spent a few days profiling Laminar and Airstream, and implemented a bunch of small performance optimizations.

  • New: Ability to render custom components as if they were regular laminar elements, by using implicit instances of RenderableNode typeclass. I had to rearrange all the modifier-related implicits for this, so if some Modifier-related code that used to compile does not anymore, please ping me. I believe the changes should be largely if not entirely source-compatible with M4, unless you called any of the implicits explicitly.

  • Naming: Renderable -> RenderableText

  • Naming: Undo EventStream.withCallback -> fromCallback change; rename withCallbackUnit to withUnitCallback

  • API: Remove Modifier.Any type alias add Modifier.Base

  • Naming: CompositeProp -> CompositeHtmlProp

  • API: Changed href and a couple other keys from being represented as html props to being represented as html attrs. This does not affect you unless you used DomApi to read (not just write, as usual) those keys. If you did, see raquo/scala-dom-types#95

  • Naming: Renamed name to nameAttr

  • Some internal changes to Airstream transactions that should make it more robust when re-mounting elements.

  • Build: Better setup for local development: if you check out and publishLocal any of my projects, it will be published with a reasonable snapshot vesion, e.g. if the current version is 15.0.0-M5, it will publishLocal with version 15.0.0-M6-SNAPSHOT.

    • I borrowed this setup from Play Framework. I don't have the time to publish it as an sbt plugin (nor enough understanding of sbt to be a good maintainer), so I just copy-paste this for every project.

from laminar.

raquo avatar raquo commented on June 3, 2024

Next release will be final, I think. No more milestones.

Changes between M7 and final release:

  • Revert the lazy val -> val change in M7 above. Turns out you need GCC for this optimization to work, and if you use ES modules (e.g. Vite), you don't have GCC.
  • Eliminate intermediate trait AsIsCodec: replace AsIsCodec.apply constructor function with def AsIsCodec, and an (immediately deprecated) AsIsCodec type alias. If you aren't doing isInstanceOf checks on this trait, your code should not break aside from getting a deprecation warning. Migration – replace all AsIsCodec[A] types with Codec[A, A].

from laminar.

yurique avatar yurique commented on June 3, 2024

@raquo should we take this opportunity to update the tuplez?

Recap: there was going to be v0.4.x, with a different encoding.

old: https://github.com/tulz-app/tuplez/blob/main/modules/full-light/src/main/scala/app/tulz/tuplez/TupleComposition.scala

    val compose: (A, B) => Tuple2[A, B] = (l, r) =>
      Tuple2(l, r)

new: https://github.com/tulz-app/tuplez/blob/feature/0.4.0/modules/full-light/src/main/scala/app/tulz/tuplez/TupleComposition.scala

    def compose(l: A, r: B): Tuple2[A, B] =
      Tuple2(l, r)

In the .js output, the old way looks like this:

function $c_Lapp_tulz_tuplez_Composition\uff3fPri10$$anon$66(outer) {
  this.Lapp_tulz_tuplez_Composition\uff3fPri10$$anon$66__f_compose = null;
  this.Lapp_tulz_tuplez_Composition\uff3fPri10$$anon$66__f_compose = new $c_sjsr_AnonFunction2((function(l$2, r$2) {
    $as_jl_Void(r$2);
    return l$2
  }))
}

(I don't like the unnecessary new $c_sjsr_AnonFunction2 here)

I don't think it will have a huge impact on bundle sizes/performance, but the new one is a better encoding :)

from laminar.

raquo avatar raquo commented on June 3, 2024

@yurique Ah, yes, let's do that! Forgot about it tbh. The 0.4.x branch has the decompose method that we needed for URL-DSL, right? We need to bump the tuplez version in both Airstream and in URL-DSL. What exact version number should we use?

from laminar.

yurique avatar yurique commented on June 3, 2024

@raquo yes, decompose is in there.

As for the version, there's RC-1 currently: Maven

I don't remember if we already tested Airstream with it, but if everything works I can release 0.4.0 final any time.

from laminar.

raquo avatar raquo commented on June 3, 2024

Found and fixed a very old bug in MergeStream that had it emit all events in the same transaction in cases where one of its parents depends on the other, and they both emit an event in the same transaction. This deviates from what the documentation promised for this operator, and violates the one-event-per-transaction observables contract. The bug would cause an FRP glitch, specifically a swallowed event, if you then combineWith the merged stream with some other stream.

I think it's fairly unlikely that you have production code implicitly relying on this bug, seeing how the observed behaviour is significantly undesirable, and nobody complained in five years (whereas I had a few bug reports about similar issues elsewhere). So, I won't be cutting another milestone release for this.

from laminar.

raquo avatar raquo commented on June 3, 2024

We did it. It is done. https://laminar.dev/blog/2023/03/22/laminar-v15.0.0

from laminar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.