v0.19.3 #620
bitspittle
announced in
Announcements
v0.19.3
#620
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Some fun miscellaneous items in this one, including breakpoint ranges, Kotlinx serialization support for HTTP verbs, and support for small/large/dynamic viewport units.
Important
Planning to upgrade? Review instructions in the README.
Changes
Frontend
(Breakpoint.SM until Breakpoint.LG) { ... }
targets tablet and desktop screens (but no wider).Modifier.attr
andModifier.dataAttr
attribute modifiers.Modifier.attr("key", "value")
is a slightly simpler substittute forModifier.attrsModifier { attr("key", "value") }
Modifier.dataAttr("key", "value")
is short forModifier.attrsModifier { attr("data-key", "value") }
AppGlobals
inInitSilk
andInitKobweb
methods would crash.routePrefix
has been renamed tobasePath
conf.yaml
file.autoPrefix
parameters.basePath
value in yourconf.yaml
file, you should just expect that Kobweb will automatically add it every time.Backend
start.bat
server script.kobweb export --layout fullstack
andkobweb export --layout static
generate slightly different scripts.Build
Notes
HTTP verb + serialization
The HTTP standard provides a core set of verbs (GET, POST, PUT, etc.) which Kobweb provides Kotlin bindings for. For example:
With this latest release, if your site depends on kotlinx serialization (setup instructions here) and a kobweb serialization artifact (discussed shortly), you can leverage it to get a fully parsed type.
First, you should add a dependency on the artifact that provides the utility methods:
And that point, your project should have access to kotlinx-serialization-aware methods:
You can also pass in rich types for the body parameter, if you have one:
Repainting canvases manually
Canvases (specifically,
Canvas2d
andCanvasGl
widgets) were designed to repaint continuously, which was honestly inspired by my background in gamedev. However, it is absolutely valid to have a canvas that only paints once and then stops until the user interacts with the canvas, or at least, whose repaint is infrequent and controlled by the developer.To this end, we introduced the new
CanvasRepainter
class, which you can optionally pass into a canvas and use it to control when that canvas rerenders:Here is an example which refills the canvas with a random color every click:
If you don't care about repainting at all and just want a canvas that renders something unique once and then never again, you can pass in the
REPAINT_CANVAS_MANUALLY
value to theminDeltaMs
parameter and then just never request a repaint:A note on
tryRoutingTo
/navigateTo
and base pathsIf you have
RoutePrefix.prepend
code anywhere in your project (which is probably very few of you all):it is no longer necessary to auto-prepend anything yourself. In this release,
tryRoutingTo
andnavigateTo
have been updated to prepend these values for you automatically.In other words, you can find those calls and simplify your code to:
ctx.router.tryRoutingTo("/")
and it will just work.
Old code will continue to work for now, but if you look at your dev console output, you'll find warnings asking the developer to search your code and fix this issue.
If you have code where you still need to keep the
RoutePrefix.prepend
call in (because, say, you're interacting with a Compose HTML widget that is not aware of Kobweb base paths), the name has been deprecated and you should change it toBasePath.prepend
instead.Thanks!
Thanks to new contributor @ChrisGNZ for reporting and helping us fix the issue with our
start.bat
script (which broke if the user's Java path had at least one space in it...)Thanks to @dead8309 for their spooky Hacktoberfest contribution, fixing Add kotlinx serialization extension methods for HttpFetcher #602 and giving us serialization APIs for HTTP verbs.
Thanks to @TheDome0 for their help extending CSS units.
And to @DennisTsar for so much of his work, as usual, but with a special callout for the ktor 3.0.0 migration, removing unnecessary trace markers (resulting in smaller sites for everyone), and some work he has done in preparation for Kotlin 2.1.0 (to be supported in a future release)
Full Changelog: v0.19.2...v0.19.3
This discussion was created from the release v0.19.3.
Beta Was this translation helpful? Give feedback.
All reactions