This release features some significant behind the scenes refactorings. There are a handful of new features, but even if you don't need them, it might be worth updating now to help us make sure everything is still working for you sooner than later!
Warning
You may get some deprecation warnings or even compile errors with these release, due to Silk refactorings. If this happens to you, read below for more information. Resolving the warnings and/or errors should be very easy.
This release also introduces some initial work providing type-safe APIs for SVG elements.
Rect {
fill(SVGFillType.None)
stroke(Colors.Red)
strokeDashArray(5, 5)
rx(15) // rounded corners
width(100)
height(100)
}Type safe APIs are provided for Circle, Ellipse, Line, Path, Polygon, Polyline, Rect, and Text, with more work planned in following releases.
Frontend
- Kobweb now provides type-safe SVG APIs when creating shapes (like circles, polygons, text, etc.)
- Work in this area is ongoing, so if you give this a try, please don't hesitate to share any feedback.
Markdown
- You can now set route overrides for your markdown pages, using either the front matter
routeOverrideentry or by setting akobweb.markdown.routeOverridecallback in your build script to set an algorithm that is used globally.- This allows you to create URL names that were previously impossible, like something with a hyphen in it.
- See the README for more information.
Gradle / KSP
- A bunch of code that used to live inside the Kobweb Gradle plugin has been extracted into a KSP (Kotlin Symbol Processing) processor.
- Using KSP has always been a goal for Kobweb, but we had to hack around it at the time since JS support was not ready when Kobweb was first being written.
- See Why KSP for more information about the approach.
- Remote debugging Kobweb servers is now supported.
- If you are working on a fullstack application, you can now configure Kobweb so you can put breakpoints in your server code.
- See the README for more information.
Silk
- Silk's core foundational layer has been extracted out into its own module.
- This means you can now use
ComponentStyle,Keyframes, color mode theming, anddeferRenderwithout having to pay the cost of bringing in any of the Silk widgets if you're not using them. - A good use-case for this is if you want to use a different UI library (like Bootstrap bindings or shadcn) but still enjoy using Silk's styling support in your own code.
- To do this in your own codebase, stop using the
com.varaybte.kobweb:kobweb-silkdependency and usecom.varabyte.kobweb:silk-foundationinstead. - If you notice any palette-related warnings or errors, this may require some minimal migration effort. See the Notes section below for more information.
- This means you can now use
- Some Silk dependencies have been renamed, to emphasize that much of Silk can be used without Kobweb (which wasn't originally the case)
com.varabyte.kobweb:kobweb-silk-widgets->com.varabyte.kobweb:silk-widgetscom.varabyte.kobweb:kobweb-silk-icons-fa->com.varabyte.kobwebx:silk-icons-facom.varabyte.kobweb:kobweb-silk-icons-mdi->com.varabyte.kobwebx:silk-icons-mdi- ☝Please note the new
kobwebxgroup for icons. - You may see a warning about this, and if so, you can run the newly added task
./gradlew :kobwebMigrateDepsto automatically fix up yourlibs.versions.tomlfile. See the Notes section below for more information.
Notes
Silk palette deprecation warning / errors
You may get a warning about colorMode.toSilkPalette() being deprecated. Moving forward, you should use colorMode.toPalette(), as Palette is a more general, extensible palette system that replaces SilkPalette. Unfortunately, after the migration, you will likely get a red import error.
This is because the new system uses extension properties instead of hardcoded ones. What this means is you'll have to additionally import that property as well.
It's easy to do but hard to explain, so here, we created a video to walk you through the necessary steps:
to-silk-palette-deprecation.mp4
Important
Some projects may get an unclear compile error that looks like Function invocation 'color(...)' expected. This is a sign that you're using SilkTheme.palette directly (as in SilkTheme.palette.color for this particular error). You can resolve this by right-clicking on the problematic palette property and directing the IDE to import it.
Management apologies for the inconvenience!
Relocated dependencies
The task ./gradlew :kobwebMigrateDeps has been added to the root project help users automatically migrate some Kobweb dependencies whose names have changed.
However, you may want to consider manually editing your libs.versions.toml file instead, as the automatic task is designed to minimize disruption but does not produce the best code.
Here is the official recommendation:
# before
kobweb-silk-core = { module = "com.varabyte.kobweb:kobweb-silk", version.ref = "kobweb" }
kobweb-silk-icons-fa = { module = "com.varabyte.kobweb:kobweb-silk-icons-fa", version.ref = "kobweb" }
kobweb-silk-icons-mdi = { module = "com.varabyte.kobweb:kobweb-silk-icons-mdi", version.ref = "kobweb" }
# after
kobweb-silk = { module = "com.varabyte.kobweb:kobweb-silk", version.ref = "kobweb" }
silk-icons-fa = { module = "com.varabyte.kobwebx:silk-icons-fa", version.ref = "kobweb" }
silk-icons-mdi = { module = "com.varabyte.kobwebx:silk-icons-mdi", version.ref = "kobweb" }Making the above changes will likely result in Gradle sync errors, which you can fix fairly easy by updating your build scripts:
// site/build.gradle.kts
kotlin {
sourceSets {
val jsMain by getting {
dependencies {
// before
implementation(libs.kobweb.silk.core)
implementation(libs.kobweb.silk.icons.fa)
// after
implementation(libs.kobweb.silk)
implementation(libs.silk.icons.fa)
}
}
}
}Thanks!
Huge thanks to first-time contributor @binayshaw7777 for his work improving the SVG APIs, and to @DennisTsar for the incredible effort in investigating and migrating Gradle code to KSP.
Full Changelog: v0.14.0...v0.14.1
