From a4300c249d9dc1c281a9eaaa278208da03aaeb40 Mon Sep 17 00:00:00 2001 From: Leonid Khachaturov Date: Fri, 21 May 2021 22:59:48 +0200 Subject: [PATCH] pre.204 --- gradle.properties | 2 +- kotlin-react-dom/src/main/kotlin/react/dom/RDOMBuilder.kt | 2 +- .../src/main/kotlin/react/dom/ReactDOMAttributes.kt | 2 +- kotlin-react-redux/src/main/kotlin/react/redux/Dsl.kt | 7 ++----- kotlin-react/src/main/kotlin/react/RBuilder.kt | 6 +++--- kotlin-styled/src/main/kotlin/styled/StyledComponents.kt | 6 +++--- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6686f50bda3da..80a55ffe07a02 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ group=org.jetbrains.kotlin-wrappers version=1.0-SNAPSHOT - version.build=pre.203 +version.build=pre.204 kotlin.code.style=official kotlin.js.compiler=both diff --git a/kotlin-react-dom/src/main/kotlin/react/dom/RDOMBuilder.kt b/kotlin-react-dom/src/main/kotlin/react/dom/RDOMBuilder.kt index c40278549c06a..5d14b8df58e8f 100644 --- a/kotlin-react-dom/src/main/kotlin/react/dom/RDOMBuilder.kt +++ b/kotlin-react-dom/src/main/kotlin/react/dom/RDOMBuilder.kt @@ -18,7 +18,7 @@ external interface DOMProps : WithClassName { } @ReactDsl -interface RDOMBuilder: RBuilder { +interface RDOMBuilder : RBuilder { fun setProp(attribute: String, value: Any?) { val key = fixAttributeName(attribute) domProps.asDynamic()[key] = value diff --git a/kotlin-react-dom/src/main/kotlin/react/dom/ReactDOMAttributes.kt b/kotlin-react-dom/src/main/kotlin/react/dom/ReactDOMAttributes.kt index 6870a8cb5887d..2951147bb3fa7 100644 --- a/kotlin-react-dom/src/main/kotlin/react/dom/ReactDOMAttributes.kt +++ b/kotlin-react-dom/src/main/kotlin/react/dom/ReactDOMAttributes.kt @@ -201,7 +201,7 @@ private val events = listOf( "wrap" ) -private val attrsMap = events.map { it.lowercase() to it }.toMap().toMutableMap().apply { +private val attrsMap = events.associateBy { it.lowercase() }.toMutableMap().apply { put("class", "className") put("ondblclick", "onDoubleClick") } diff --git a/kotlin-react-redux/src/main/kotlin/react/redux/Dsl.kt b/kotlin-react-redux/src/main/kotlin/react/redux/Dsl.kt index a8667272c29dc..c633f951dd080 100644 --- a/kotlin-react-redux/src/main/kotlin/react/redux/Dsl.kt +++ b/kotlin-react-redux/src/main/kotlin/react/redux/Dsl.kt @@ -1,10 +1,7 @@ package react.redux -import react.child -import react.RBuilder -import react.RContext -import react.RHandler -import redux.Store +import react.* +import redux.* fun RBuilder.provider(store: Store<*, *, *>, context: RContext<*>? = null, handler: RHandler) = child { diff --git a/kotlin-react/src/main/kotlin/react/RBuilder.kt b/kotlin-react/src/main/kotlin/react/RBuilder.kt index 2e72ddbeb10f1..270d2c40e8582 100644 --- a/kotlin-react/src/main/kotlin/react/RBuilder.kt +++ b/kotlin-react/src/main/kotlin/react/RBuilder.kt @@ -180,13 +180,13 @@ inline fun

> RBuilder.node( ): ReactElement = node(C::class, props, children) -open class RBuilderImpl: RBuilder { +open class RBuilderImpl : RBuilder { override val childList = mutableListOf() } open class RBuilderMultiple : RBuilderImpl() -fun buildElements(builder: T, handler: T.() -> Unit): dynamic { +fun buildElements(builder: T, handler: T.() -> Unit): dynamic { val nodes = builder.apply(handler).childList return when (nodes.size) { 0 -> null @@ -199,7 +199,7 @@ fun buildElements(handler: RBuilder.() -> Unit): dynamic = buildElements(RBuilde open class RBuilderSingle : RBuilderImpl() -inline fun buildElement(rBuilder: T, handler: T.() -> Unit): ReactElement = +inline fun buildElement(rBuilder: T, handler: T.() -> Unit): ReactElement = rBuilder.apply(handler) .childList.first() .unsafeCast() diff --git a/kotlin-styled/src/main/kotlin/styled/StyledComponents.kt b/kotlin-styled/src/main/kotlin/styled/StyledComponents.kt index 9a137705df9e2..ebf87289b2755 100644 --- a/kotlin-styled/src/main/kotlin/styled/StyledComponents.kt +++ b/kotlin-styled/src/main/kotlin/styled/StyledComponents.kt @@ -1,13 +1,13 @@ package styled import kotlinext.js.* -import kotlinx.browser.window +import kotlinx.browser.* import kotlinx.css.* import kotlinx.html.* import org.w3c.dom.* import react.* import react.dom.* -import kotlin.js.* +import kotlin.js.Promise typealias AnyTagStyledBuilder = StyledDOMBuilder typealias AnyBuilder = AnyTagStyledBuilder.() -> Unit @@ -43,7 +43,7 @@ interface StyledBuilder

{ inline fun StyledBuilder<*>.css(handler: RuleSet) = css.handler() -interface StyledElementBuilder

: RElementBuilder

, StyledBuilder

{ +interface StyledElementBuilder

: RElementBuilder

, StyledBuilder

{ fun create(): ReactElement companion object {