mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-04 15:33:49 +00:00
commit
deb30957ac
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.1.2
|
||||||
|
|
||||||
|
* New typealias `AttrsWithContentBuilder`
|
||||||
|
* Old `DList` and related composable functions removed (they are built-in in compose)
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
||||||
* `Compose`: `1.2.0-alpha01-dev686`
|
* `Compose`: `1.2.0-alpha01-dev686`
|
||||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.1.1
|
version=0.1.2
|
||||||
|
@ -4,8 +4,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import dev.inmo.jsuikit.modifiers.UIKitDescriptionList
|
import dev.inmo.jsuikit.modifiers.UIKitDescriptionList
|
||||||
import dev.inmo.jsuikit.modifiers.include
|
import dev.inmo.jsuikit.modifiers.include
|
||||||
import dev.inmo.jsuikit.utils.*
|
import dev.inmo.jsuikit.utils.*
|
||||||
import org.jetbrains.compose.web.dom.ContentBuilder
|
import org.jetbrains.compose.web.dom.*
|
||||||
import org.jetbrains.compose.web.dom.ElementScope
|
|
||||||
import org.w3c.dom.HTMLDListElement
|
import org.w3c.dom.HTMLDListElement
|
||||||
import org.w3c.dom.HTMLElement
|
import org.w3c.dom.HTMLElement
|
||||||
|
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package dev.inmo.jsuikit.utils
|
||||||
|
|
||||||
|
import org.jetbrains.compose.web.dom.ContentBuilder
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
typealias AttrsWithContentBuilder<T> = Pair<Attrs<T>, ContentBuilder<T>>
|
||||||
|
|
||||||
|
inline val <T : Element> AttrsWithContentBuilder<T>.attrs
|
||||||
|
get() = first
|
||||||
|
|
||||||
|
inline val <T : Element> AttrsWithContentBuilder<T>.attributesBuilderContext
|
||||||
|
get() = attrs.builder
|
||||||
|
|
||||||
|
inline val <T : Element> AttrsWithContentBuilder<T>.builder
|
||||||
|
get() = second
|
@ -1,55 +0,0 @@
|
|||||||
package dev.inmo.jsuikit.utils
|
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import kotlinx.browser.document
|
|
||||||
import org.jetbrains.compose.web.dom.*
|
|
||||||
import org.w3c.dom.*
|
|
||||||
|
|
||||||
private object DListElementBuilder : ElementBuilder<HTMLDListElement> {
|
|
||||||
private val el: Element by lazy { document.createElement("dl") }
|
|
||||||
override fun create(): HTMLDListElement = el.cloneNode() as HTMLDListElement
|
|
||||||
}
|
|
||||||
|
|
||||||
private object DTermElementBuilder : ElementBuilder<HTMLElement> {
|
|
||||||
private val el: Element by lazy { document.createElement("dt") }
|
|
||||||
override fun create(): HTMLElement = el.cloneNode() as HTMLElement
|
|
||||||
}
|
|
||||||
|
|
||||||
private object DDescriptionElementBuilder : ElementBuilder<HTMLElement> {
|
|
||||||
private val el: Element by lazy { document.createElement("dd") }
|
|
||||||
override fun create(): HTMLElement = el.cloneNode() as HTMLElement
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun DList(
|
|
||||||
attrs: AttrBuilderContext<HTMLDListElement>? = null,
|
|
||||||
content: ContentBuilder<HTMLDListElement>? = null
|
|
||||||
) {
|
|
||||||
TagElement(
|
|
||||||
DListElementBuilder,
|
|
||||||
attrs,
|
|
||||||
content
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@Composable
|
|
||||||
fun DTerm(
|
|
||||||
attrs: AttrBuilderContext<HTMLElement>? = null,
|
|
||||||
content: ContentBuilder<HTMLElement>? = null
|
|
||||||
) {
|
|
||||||
TagElement(
|
|
||||||
DTermElementBuilder,
|
|
||||||
attrs,
|
|
||||||
content
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@Composable
|
|
||||||
fun DDescription(
|
|
||||||
attrs: AttrBuilderContext<HTMLElement>? = null,
|
|
||||||
content: ContentBuilder<HTMLElement>? = null
|
|
||||||
) {
|
|
||||||
TagElement(
|
|
||||||
DDescriptionElementBuilder,
|
|
||||||
attrs,
|
|
||||||
content
|
|
||||||
)
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user