v0.11.8
Pre-release
Pre-release
The biggest feature in this new release is support for animation keyframes using Kobweb's Modifier
concept. For example, you can now do this:
val Bounce by keyframes {
from { Modifier.translateX((-50).percent) }
to { Modifier.translateX((50).percent) }
}
// Later
Box(
Modifier
.animation(Bounce.toAnimation(
duration = 2.s,
timingFunction = AnimationTimingFunction.EaseIn,
direction = AnimationDirection.Alternate,
iterationCount = AnimationIterationCount.Infinite
)
) { ... }
Silk
- Add support for defining keyframes and declaring animations via
Modifier
.- You can also declare keyframes manually using an
@InitSilk
annotated method and callingctx.stylesheet.registerKeyframes(...)
- You can also declare keyframes manually using an
- (Potentially backwards incompatible) The
Button#onClick
callback parameter now provides aSyntheticMouseEvent
argument. This lets you check if any modifier keys (e.g. ctrl/alt/shift) are being pressed.- If you get a compile error, change code like this:
onClick = ::clickHandler
to thisonClick = { clickHandler() }
- If you get a compile error, change code like this:
- Added more options for
width
andheight
modifiers via the newWidth
andHeight
css classes, e.g.Modifier.width(Width.FitContent)
- Tweaked
Popup
implementation so you can now create a popup with the mouse already over the element that triggers the popup.- For example, you can now show a tooltip in response to clicking on a button:
var showTooltip by remember { mutableStateOf(false) } Button( onClick = { handleCopy(); showTooltip = true }, Modifier.onMouseLeave { showTooltip = false } ) { Text("Copy") } if (showTooltip) { Tooltip(ElementTarget.PreviousSibling, "Copied!") }
- For example, you can now show a tooltip in response to clicking on a button:
- Refactored the location of where Silk initialization code lives, e.g. the
InitSilk
annotation. Old code should still work for now but you may get deprecation warnings suggesting you change your import locations.
Gradle
- Fixed an issue with export sometimes causing OOM events when building a Kobweb project.
- This was because dev and prod builds could happen at the same time before. After preventing this, exports take a bit longer, but it feels a lot safer to not have two related compiles happening at the same time.