mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-02 06:50:09 +00:00
Compare commits
3 Commits
e227d3c88e
...
deb30957ac
Author | SHA1 | Date | |
---|---|---|---|
deb30957ac | |||
276eaddcac | |||
9b992cbda0 |
@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.2
|
||||
|
||||
* New typealias `AttrsWithContentBuilder`
|
||||
* Old `DList` and related composable functions removed (they are built-in in compose)
|
||||
|
||||
## 0.1.1
|
||||
|
||||
* `Compose`: `1.2.0-alpha01-dev686`
|
||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
||||
# Project data
|
||||
|
||||
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.include
|
||||
import dev.inmo.jsuikit.utils.*
|
||||
import org.jetbrains.compose.web.dom.ContentBuilder
|
||||
import org.jetbrains.compose.web.dom.ElementScope
|
||||
import org.jetbrains.compose.web.dom.*
|
||||
import org.w3c.dom.HTMLDListElement
|
||||
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