mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-30 05:58:45 +00:00
add several builders for AttrsWithContentBuilder
This commit is contained in:
parent
3afe6c2815
commit
d78acce3c5
@ -10,7 +10,7 @@ import org.w3c.dom.HTMLDivElement
|
||||
@Composable
|
||||
fun DropArea(
|
||||
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
|
||||
inputAttrs: InputAttrs<String> = Attrs.empty(),
|
||||
inputAttrs: InputAttrs<String> = InputAttrs.empty(),
|
||||
contentBuilder: ContentBuilder<HTMLDivElement> = {}
|
||||
) = Div(
|
||||
{
|
||||
|
@ -1,10 +1,32 @@
|
||||
package dev.inmo.jsuikit.utils
|
||||
|
||||
import dev.inmo.jsuikit.modifiers.UIKitModifier
|
||||
import org.jetbrains.compose.web.attributes.AttrsScope
|
||||
import org.jetbrains.compose.web.dom.ContentBuilder
|
||||
import org.w3c.dom.Element
|
||||
|
||||
typealias AttrsWithContentBuilder<T> = Pair<Attrs<T>, ContentBuilder<T>>
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun <T : Element> AttrsWithContentBuilder(noinline builder: ContentBuilder<T>) = AttrsWithContentBuilder(
|
||||
Attrs.empty(),
|
||||
builder
|
||||
)
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun <T : Element> AttrsWithContentBuilder(attrs: Attrs<T>) = AttrsWithContentBuilder(
|
||||
attrs
|
||||
) {}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun <T : Element> AttrsWithContentBuilder(
|
||||
modifier: UIKitModifier?,
|
||||
vararg modifiers: UIKitModifier?,
|
||||
noinline attrs: AttrsScope<T>.() -> Unit = {}
|
||||
) = AttrsWithContentBuilder(
|
||||
Attrs(modifier, *modifiers, attrs = attrs)
|
||||
)
|
||||
|
||||
inline val <T : Element> AttrsWithContentBuilder<T>.attrs
|
||||
get() = first
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user