BREAKING CHANGE
- React
useContext
moved tokotlin-react-legacy
- Modern replacement -
use
- Modern replacement -
BREAKING CHANGE
- Browser. Immutable JSO interfaces
BREAKING CHANGE
- Deprecated event types removed
BREAKING CHANGE
wrappers
group removed from version catalog aliases.
Details: #2497.
// Before
dependencies {
jsMainImplementation(kotlinWrappers.wrappers.react)
jsMainImplementation(kotlinWrappers.wrappers.reactDom)
}
// After
dependencies {
jsMainImplementation(kotlinWrappers.react)
jsMainImplementation(kotlinWrappers.reactDom)
}
BREAKING CHANGE
- Event type constants instead of type functions
// legacy
val event = MouseEvent(MouseEvent.click())
// modern
val event = MouseEvent(MouseEvent.CLICK)
BREAKING CHANGE
Version catalog updated according to best practices
// Before
dependencies {
jsMainImplementation(libs.wrappers.react)
jsMainImplementation(libs.wrappers.react.dom)
jsMainImplementation(libs.wrappers.react.router.dom)
jsMainImplementation(libs.wrappers.tanstack.react.query)
jsMainImplementation(libs.wrappers.tanstack.react.table)
}
// After
dependencies {
jsMainImplementation(libs.wrappers.react)
jsMainImplementation(libs.wrappers.reactDom)
jsMainImplementation(libs.wrappers.reactRouterDom)
jsMainImplementation(libs.wrappers.tanstack.reactQuery)
jsMainImplementation(libs.wrappers.tanstack.reactTable)
}
BREAKING CHANGE
- Events.
EventType
current target type parameter removed as redundant
BREAKING CHANGE
- Popper Core
- Fix subproject name
- Gradle version catalog
org.jetbrains.kotlin-wrappers:kotlin-wrappers-catalog
kotlin-redux
andkotlin-react-redux
removed as outdated
- React. Move raw declarations in a separate package
react.rawUseMemo
->react.raw.useMemoRaw
react.rawUseCallback
->react.raw.useCallbackRaw
- ...
- React. Fix
useLayoutEffect
implementation
BREAKING CHANGE
- React. New context of effect lambdas -
CoroutineScope
(instead ofEffectBuilder
)
BREAKING CHANGE
- React. Suspend lambdas for effects
- Instead of
EffectBuilder.cleanup
please use suspend functions with "auto-cleanup" like: - If you need old-style cleanup registration, please use the following hooks:
useEffectWithCleanup
useEffectOnceWithCleanup
useLayoutEffectWithCleanup
useLayoutEffectOnceWithCleanup
- ...
- Instead of
BREAKING CHANGE
- Tanstack Query
skipToken
support fixed- To construct
QueryFunction
please use factory functionQueryFunction
- To construct
- Kotlin
2.0.0
- Real
@JsPlainObject
- With factory methods
- With
copy
method
JsContextFunction
- function withthis
access
- Auto cancellation support for suspend adapters (marked with
@JsAsync
)
import web.abort.Abortable
// ORIGINAL
external class Loader {
@JsAsync
suspend fun load(
options: Abortable /* or child interface */ = definedExternally,
) T
fun loadAsync(
options: Abortable /* or child interface */ = definedExternally,
): Promise<T>
}
// GENERATED
external class Loader {
@JsAsync
suspend fun load(
options: Abortable /* or child interface */ = definedExternally,
) T
{
/* GENERATED CODE START */
val controller = AbortController()
val abortOptions = jso {
signal = anyOf(options?.signal, controller.signal)
}
val newOptions = Object.assign(jso(), options, abortOptions)
invokeOnCancellation {
controller.abort()
}
return loadAsync(newOptions).await()
/* GENERATED CODE END */
}
fun loadAsync(
options: Abortable /* or child interface */ = definedExternally,
): Promise<T>
}
BREAKING CHANGE
- Browser. Suspend adapters for async functions (marked with
@JsAsync
)- The original Promise-based functions are available with the
Async
suffix
- The original Promise-based functions are available with the
BREAKING CHANGE
- React. Align
ForwardRef
andFC
signatures- Preparing to remove
ForwardRef
(redundant in React 19)
- Preparing to remove
- Preact Signals declarations
Temporal
. Initial implementation
BREAKING CHANGE
- Legacy
kotlin-styled
removed
BREAKING CHANGE
- Type parameter for
currentTarget
is removed from*Event
classes EventHandler
is an interface that allows to handle events with a strictcurrentTarget
BREAKING CHANGE
EventTarget.addEventHandler
andEventTarget.removeEventHandler
are extension functions now rather than members
BREAKING CHANGE
EventTarget.addEventHandler
is an extension function now rather than a member
BREAKING CHANGE
- Type parameter for
currentTarget
in*Event
classes
BREAKING CHANGE
Transferable
package changedjs.core
->js.transferable
structuredClone
package changedjs.core
->web.serialization
BREAKING CHANGE
fetch
throws the original error instead of an artificialFetchException
wrapper exceptionBlob
package changedweb.buffer
->web.blob
BREAKING CHANGE
- Split
js.core
packagejs.array
ReadonlyArray
,ArrayLike
,JsTuple
, …
js.objects
Object
,Record
,jso
, …
BREAKING CHANGE
- Split
js.core
packagejs.symbol
Symbol
js.memory
FinalizationRegistry
WeakRef
web.time
DOMHighResTimeStamp
EpochTimeStamp
BREAKING CHANGE
- Form-related types moved to
web.form
package
BREAKING CHANGE
- Root
web
packagewebassembly
->web.assembly
webgl
->web.gl
webrtc
->web.rtc
websockets
->web.sockets
webvtt
->web.vtt
BREAKING CHANGE
- Changed packages for top-level functions:
web.animations
requestAnimationFrame
web.scheduling
queueMicrotask
requestIdleCallback
BREAKING CHANGE
- CommonJS module kind by default
- Preparing for migration to ES module kind
BREAKING CHANGE
- MUI subproject names changed
kotlin-mui
->kotlin-mui-material
kotlin-icons
->kotlin-icons-material
- React Select
- Union names in lower case (like in original)
BREAKING CHANGE
- React Router
- Legacy API removed (
Router
,Route
components)
- Legacy API removed (
BREAKING CHANGE
Event type constants moved into event companions.
// Before
import web.uievents.CLICK // OLD IMPORT
import web.uievents.MouseEvent
element.addEventHandler(MouseEvent.CLICK) { }
// After
import web.uievents.MouseEvent
element.addEventHandler(MouseEvent.CLICK) { }
- Kotlin
1.9.0
support
BREAKING CHANGE
Although it is unlikely that someone was using this signature directly (the implementation
in kotlin-styled
/ kotlin-styled-next
is normally used instead) it is technically still a breaking
change.
css {
// Before
animation("animation", 1.s, Timing.easeIn, 0.5.s)
// After
animation += Animation("animation", 1.s, Timing.easeIn, 0.5.s)
}
BREAKING CHANGE
kotlin-css
now has a different syntax for setting boxShadow
and transition
properties.
css {
// Before
boxShadow(Color.black, 1.px, 2.px, 3.px, 4.px)
transition("all", 0.15.s, Timing.linear, 0.5.s)
// After
boxShadow += BoxShadow(Color.black, 1.px, 2.px, 3.px, 4.px)
transition += Transition("background-color", 0.15.s, Timing.linear, 0.5.s)
}
BREAKING CHANGE
kotlin-css
now has a different syntax for setting the flex
property.
css {
// Before
flex(Flex.GROW)
flex(1, 0, LinearDimension.auto)
// After
flex = Flex.GROW
flex = Flex(1, 0, LinearDimension.auto)
}
BREAKING CHANGE
Removed a hack Promise<Promise<T>>.then
method. Replace the usages as follows to migrate:
Promise.then(Promise)
->Promise.flatThen(Promise)
Promise.catch(Promise)
->Promise.flatCatch(Promise)
BREAKING CHANGE
Modern Promise
introduced
Replace the imports as follows to migrate:
kotlin.js.Promise
->js.promise.Promise
kotlinx.coroutines.await
->js.promise.await
kotlinx.coroutines.asDeferred
->js.promise.asDeferred
BREAKING CHANGE
kotlin-css
now has a different syntax for setting backgroundPosition
, border
, inset
, margin
, padding
,
and textDecoration
properties.
css {
// Before
margin(0.px)
// After
margin = Margin(0.px)
}
BREAKING CHANGE
Core CSSOM types moved from the csstype
package to web.cssom
- Kotlin
1.8.20
support
BREAKING CHANGE
Kotlin/JS Legacy compiler support removed
BREAKING CHANGE
- Union declarations changed
- Values moved into companion object
- Before:
import node.process.Platform.win32
- After:
import node.process.Platform.Companion.win32
BREAKING CHANGE
Strict createContext
signature (aligned with TS version)
BREAKING CHANGE
fun StyledElement.grow(grow: Grow)
renamed to fun StyledElement.flex(flex: Flex)
. Please update your code
accordingly if you're using kotlin-css
.
BREAKING CHANGE
kotlin-browser
package structure changed:
canvas
->web.canvas
dom.geometry
->web.geometry
dom.html
->web.html
dom.svg
->web.svg
dom
->web.dom
media
->web.media
BREAKING CHANGE
Core JS declarations from the kotlinx.js
package were moved to the following packages:
js.buffer
js.collections
js.core
js.errors
js.import
js.intl
(ex-web.intl
)js.promise
js.reflect
js.typedarrays
Some factory functions were supported in kotlin-csstype
. Declarations in kotlin-csstype
were updated.
BREAKING CHANGE auto
and none
values were generalized for the whole DSL, duplicates of these declarations
were removed.
BigInt
declaration was added to kotlin-extensions
.
kotlin-browser
declarations were introduced. These are browser APIs missing from the standard library.
Refactoring of kotlin-extensions
has begun. Migration from kotlinext
to kotlinx
package is the main goal.
kotlin-node
declarations were introduced.
kotlin-webrtc
declarations were introduced.
kotlin-typescript
declarations were updated.
kotlin-typescript
declarations were introduced. They are compiler API declarations that can be used for code
transformation or infrastructural tasks.
kotlin-mui
declarations were updated.
kotlin-mui
declarations were updated, some utility hooks were supported.
Examples were updated.
kotlin-mui
declarations were updated.
Symbol
declaration was added to kotlin-extensions
.
Low-level API was added to emotion-css
.
kotlin-react
only supports the new DSL for React elements (ChildrenBuilder
, aka "no attrs"),
while kotlin-react-legacy
provides the familiar RBuilder
DSL.
If you are migrating from an earlier version and are not interested in migrating to the new API, you should replace
the kotlin-react
dependency with kotlin-react-legacy
in your project.
If you are migrating from an earlier version and would like to gradually migrate to the new API, you should add
the kotlin-react-legacy
dependency to your project.
If you are migrating from an earlier version and would like to migrate to the new API at once, resolve all the compilation errors you encounter. Good luck :)
If you are a new user of kotlin-react
, just start using the new API and don't worry about the old one.
Technically, there is a third component called kotlin-react-core
which contains most of the React API, but you don't
need to add it as a direct dependency.
kotlin-react-dom
was also split into two parts – you guessed it right — kotlin-react-dom
and kotlin-react-dom-legacy
kotlin-react-dom
does not depend on kotlinx.html
, the HTML typings it provides are generated from TypeScript types
directly. They are therefore more complete and up-to-date.
kotlin-react-dom-legacy
depends on kolinx.html
and its HTML typings are maintained manually.
To choose the migration path, apply the same reasoning as the one described above for kotlin-react
: you could either
ignore the new APIs and keep using the old ones, perform a gradual migration, or migrate "cold turkey" style.
Please do note that kotlin-styled
and kotlin-styled-next
are only compatible with the legacy API. If you're
migrating
to the new API, you are going to need to switch to kotlin-emotion
.
- New DSL for React elements was implemented.
attrs
block is no longer required.
Before:
val App = fc<Props> {
Button {
attrs {
title = "Submit form"
disabled = true
onClick = { event -> }
}
+"Submit form"
}
}
After:
val App = FC<Props> {
Button {
title = "Submit form"
disabled = true
onClick = { event -> }
+"Submit form"
}
}
- Maven Central group ID was changed to
org.jetbrains.kotlin-wrappers
- Interfaces were renamed:
RProps
->Props
RState
->State
ElementType
andComponentType
interfaces were introduced to describe the type hierarchy in React- React Hooks were added
- Intrinsic types in
kotlin-react-dom
were implemented withoutkotlinx-html
- New DSL for CSS was introduced in
kotlin-csstype
- React Router v6 was supported in
kotlin-react-router-dom
- New wrappers:
kotlin-react-table
kotlin-react-query
kotlin-react-virtual
kotlin-react-popper
- Design systems:
kotlin-mui
kotlin-ring-ui
- Initial implementation is published under
org.jetbrains
group ID to kotlin.jetbrains.space.