Comments (19)
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, notlazy 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 toFetchStream
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.
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 toparentVar.zoom(in)((parentValue, derivedValue) => out(derivedValue))
, or better yet, make use ofparentValue
instead of callingparentVar.now()
in yourout
function.
- Migration: update existing usages of
-
API: Renamed the new operators:
distinctBy(isSameFn)
is nowdistinctByFn(isSameFn)
,distinctByKey(_.key)
is nowdistinctBy(_.key)
. If you already started using them, you'll need to address this. -
New:
setValue("...")
andsetChecked(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.
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.
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.
from laminar.
@yurique Waypoint tests are passing with 0.4.0-RC1, I think it's good to release it as the final version.
from laminar.
0.4.0
is out
from laminar.
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.
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.
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.
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.
customSvgAttr
deprecation message has a typo in it, incorrectly referring to customSvgTag
instead. Fixed in master.
from laminar.
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 likeattr <-- stream
andchild <-- 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.
- In your own code you're free to use
-
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 usedDomApi
to read (not just write, as usual) those keys. If you did, see raquo/scala-dom-types#95 -
Naming: Renamed
name
tonameAttr
-
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.
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
: replaceAsIsCodec.apply
constructor function withdef AsIsCodec
, and an (immediately deprecated)AsIsCodec
type alias. If you aren't doingisInstanceOf
checks on this trait, your code should not break aside from getting a deprecation warning. Migration – replace allAsIsCodec[A]
types withCodec[A, A]
.
from laminar.
@raquo should we take this opportunity to update the tuplez?
Recap: there was going to be v0.4.x
, with a different encoding.
val compose: (A, B) => Tuple2[A, B] = (l, r) =>
Tuple2(l, r)
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.
@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.
@raquo yes, decompose
is in there.
As for the version, there's RC-1 currently:
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.
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.
We did it. It is done. https://laminar.dev/blog/2023/03/22/laminar-v15.0.0
from laminar.
Related Issues (20)
- Possible O(n^2) instead of O(n) cost ? HOT 13
- Airstream semantics update – RFC
- Safari cursor jumps to the end when an input value is set HOT 2
- Errors in recursive graphs can cause stack overflow HOT 1
- Docs: Conditional rendering
- Moving elements from one `children` list to another HOT 4
- Laminar is a Scala.js reactive library [SEO] HOT 1
- Virtual dom link in quick start docs is broken HOT 2
- Give `$` back to Scala compiler
- RFC: Alternative server-side rendering (SSR) architecture HOT 3
- RFC: signal.peekNow() HOT 6
- Docs: Algolia search
- RFC: Drop Scala 2.12 support HOT 2
- Animation features
- [Question] - jQuery bind and oninput event HOT 2
- [DOM] Using certain reserved values for the `name` attribute breaks Scala types HOT 1
- onParentChange callbacks HOT 3
- Laminar Native for building mobile and desktop apps HOT 2
- ZIO / FS2 / etc. integration examples HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laminar.