mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-02 06:50:09 +00:00
Compare commits
No commits in common. "deb30957ac1134ab2c787bb582828affbd9f03cd" and "e227d3c88e54ba49a2a4b593543ac0ea6e1c14ff" have entirely different histories.
deb30957ac
...
e227d3c88e
@ -1,10 +1,5 @@
|
|||||||
# 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.2
|
version=0.1.1
|
||||||
|
@ -4,7 +4,8 @@ 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.*
|
import org.jetbrains.compose.web.dom.ContentBuilder
|
||||||
|
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
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
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
|
|
55
src/jsMain/kotlin/dev/inmo/jsuikit/utils/Dlist.kt
Normal file
55
src/jsMain/kotlin/dev/inmo/jsuikit/utils/Dlist.kt
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
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