mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-22 16:47:24 +00:00
updates and attributes buildings and fixes
This commit is contained in:
parent
a856545471
commit
ca8f927304
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## 0.0.33
|
## 0.0.33
|
||||||
|
|
||||||
|
* Fixes in attributes building and related things
|
||||||
|
|
||||||
## 0.0.32
|
## 0.0.32
|
||||||
|
|
||||||
* Support of `UIKitHeight`
|
* Support of `UIKitHeight`
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package dev.inmo.jsuikit
|
package dev.inmo.jsuikit
|
||||||
|
|
||||||
import dev.inmo.jsuikit.modifiers.AttributeValue
|
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
|
import org.jetbrains.compose.web.attributes.AttrsBuilder
|
||||||
|
|
||||||
|
@Deprecated("Will be removed soon")
|
||||||
class UIKitAttributeValueBuilder {
|
class UIKitAttributeValueBuilder {
|
||||||
private val attrs = mutableListOf<Pair<String, String>>()
|
private val attrs = mutableListOf<Pair<String, String>>()
|
||||||
|
|
||||||
@ -21,7 +24,9 @@ class UIKitAttributeValueBuilder {
|
|||||||
|
|
||||||
fun AttrsBuilder<*>.buildAndAddAttribute(
|
fun AttrsBuilder<*>.buildAndAddAttribute(
|
||||||
attributeName: String,
|
attributeName: String,
|
||||||
block: UIKitAttributeValueBuilder.() -> Unit
|
block: AttributeBuilder.() -> Unit
|
||||||
) {
|
) {
|
||||||
attr(attributeName, UIKitAttributeValueBuilder().apply(block).build())
|
buildAttribute(attributeName, block).let {
|
||||||
|
attr(it.first, it.second)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import dev.inmo.jsuikit.buildAndAddAttribute
|
import dev.inmo.jsuikit.buildAndAddAttribute
|
||||||
import dev.inmo.jsuikit.modifiers.*
|
import dev.inmo.jsuikit.modifiers.*
|
||||||
import dev.inmo.jsuikit.utils.Milliseconds
|
import dev.inmo.jsuikit.utils.Milliseconds
|
||||||
|
import dev.inmo.jsuikit.utils.buildAttribute
|
||||||
import org.jetbrains.compose.web.dom.*
|
import org.jetbrains.compose.web.dom.*
|
||||||
import org.w3c.dom.HTMLDivElement
|
import org.w3c.dom.HTMLDivElement
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ class AttributeBuilder (
|
|||||||
private val parametersPreset: MutableMap<String, String?> = mutableMapOf()
|
private val parametersPreset: MutableMap<String, String?> = mutableMapOf()
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun add(k: String, v: String? = null) = parametersPreset.set(k, v)
|
fun add(k: String, v: Any? = null) = parametersPreset.set(k, v ?.toString())
|
||||||
infix fun String.to(value: String?) = add(this, value)
|
infix fun String.to(value: Any?) = add(this, value)
|
||||||
operator fun String.unaryPlus() = add(this, null)
|
operator fun String.unaryPlus() = add(this, null)
|
||||||
|
|
||||||
fun build(): Pair<String, String> = Pair(
|
fun build(): Pair<String, String> = Pair(
|
||||||
|
Loading…
Reference in New Issue
Block a user