Merge pull request #33 from InsanusMokrassar/0.0.33

0.0.33
This commit is contained in:
InsanusMokrassar 2022-02-09 01:19:14 +06:00 committed by GitHub
commit 94698a0468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 5 deletions

View File

@ -1,5 +1,9 @@
# Changelog
## 0.0.33
* Fixes in attributes building and related things
## 0.0.32
* Support of `UIKitHeight`

View File

@ -9,4 +9,4 @@ android.enableJetifier=true
# Project data
group=dev.inmo
version=0.0.32
version=0.0.33

View File

@ -1,8 +1,11 @@
package dev.inmo.jsuikit
import dev.inmo.jsuikit.modifiers.AttributeValue
import dev.inmo.jsuikit.utils.AttributeBuilder
import dev.inmo.jsuikit.utils.buildAttribute
import org.jetbrains.compose.web.attributes.AttrsBuilder
@Deprecated("Will be removed soon")
class UIKitAttributeValueBuilder {
private val attrs = mutableListOf<Pair<String, String>>()
@ -21,7 +24,9 @@ class UIKitAttributeValueBuilder {
fun AttrsBuilder<*>.buildAndAddAttribute(
attributeName: String,
block: UIKitAttributeValueBuilder.() -> Unit
block: AttributeBuilder.() -> Unit
) {
attr(attributeName, UIKitAttributeValueBuilder().apply(block).build())
buildAttribute(attributeName, block).let {
attr(it.first, it.second)
}
}

View File

@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
import dev.inmo.jsuikit.buildAndAddAttribute
import dev.inmo.jsuikit.modifiers.*
import dev.inmo.jsuikit.utils.Milliseconds
import dev.inmo.jsuikit.utils.buildAttribute
import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLDivElement

View File

@ -5,8 +5,8 @@ class AttributeBuilder (
private val parametersPreset: MutableMap<String, String?> = mutableMapOf()
) {
fun add(k: String, v: String? = null) = parametersPreset.set(k, v)
infix fun String.to(value: String?) = add(this, value)
fun add(k: String, v: Any? = null) = parametersPreset.set(k, v ?.toString())
infix fun String.to(value: Any?) = add(this, value)
operator fun String.unaryPlus() = add(this, null)
fun build(): Pair<String, String> = Pair(