Skip to content

Commit

Permalink
pre.204
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonya committed May 21, 2021
1 parent 4115486 commit a4300c2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion kotlin-react-dom/src/main/kotlin/react/dom/RDOMBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ external interface DOMProps : WithClassName {
}

@ReactDsl
interface RDOMBuilder<out T : Tag>: RBuilder {
interface RDOMBuilder<out T : Tag> : RBuilder {
fun setProp(attribute: String, value: Any?) {
val key = fixAttributeName(attribute)
domProps.asDynamic()[key] = value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
7 changes: 2 additions & 5 deletions kotlin-react-redux/src/main/kotlin/react/redux/Dsl.kt
Original file line number Diff line number Diff line change
@@ -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<ProviderProps>) =
child<ProviderProps, Provider> {
Expand Down
6 changes: 3 additions & 3 deletions kotlin-react/src/main/kotlin/react/RBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ inline fun <P : RProps, reified C : Component<P, *>> RBuilder.node(
): ReactElement =
node(C::class, props, children)

open class RBuilderImpl: RBuilder {
open class RBuilderImpl : RBuilder {
override val childList = mutableListOf<Any>()
}

open class RBuilderMultiple : RBuilderImpl()

fun <T: RBuilder> buildElements(builder: T, handler: T.() -> Unit): dynamic {
fun <T : RBuilder> buildElements(builder: T, handler: T.() -> Unit): dynamic {
val nodes = builder.apply(handler).childList
return when (nodes.size) {
0 -> null
Expand All @@ -199,7 +199,7 @@ fun buildElements(handler: RBuilder.() -> Unit): dynamic = buildElements(RBuilde

open class RBuilderSingle : RBuilderImpl()

inline fun <T: RBuilder> buildElement(rBuilder: T, handler: T.() -> Unit): ReactElement =
inline fun <T : RBuilder> buildElement(rBuilder: T, handler: T.() -> Unit): ReactElement =
rBuilder.apply(handler)
.childList.first()
.unsafeCast<ReactElement>()
Expand Down
6 changes: 3 additions & 3 deletions kotlin-styled/src/main/kotlin/styled/StyledComponents.kt
Original file line number Diff line number Diff line change
@@ -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<CommonAttributeGroupFacade>
typealias AnyBuilder = AnyTagStyledBuilder.() -> Unit
Expand Down Expand Up @@ -43,7 +43,7 @@ interface StyledBuilder<P : WithClassName> {

inline fun StyledBuilder<*>.css(handler: RuleSet) = css.handler()

interface StyledElementBuilder<P : WithClassName>: RElementBuilder<P>, StyledBuilder<P> {
interface StyledElementBuilder<P : WithClassName> : RElementBuilder<P>, StyledBuilder<P> {
fun create(): ReactElement

companion object {
Expand Down

0 comments on commit a4300c2

Please sign in to comment.