mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2025-12-04 21:35:40 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a2830e5e85 | |||
| 484564e323 | |||
| b5e93bc829 | |||
| 4282165d79 | |||
| 1e452c78d1 | |||
| 5fa388c169 | |||
| 763e1fa5ac | |||
| 150efa1719 | |||
| 20bf43b8a1 |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,5 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## 0.0.12
|
||||
|
||||
* Add `rowAttributes` to table fun
|
||||
|
||||
## 0.0.11
|
||||
|
||||
* Upfill `Nav` and `UIKitNav`
|
||||
|
||||
## 0.0.10
|
||||
|
||||
* Filling of `UIKitUtility`
|
||||
|
||||
## 0.0.9
|
||||
|
||||
* Improving of `Nav` support
|
||||
|
||||
@@ -9,4 +9,4 @@ android.enableJetifier=true
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.0.9
|
||||
version=0.0.12
|
||||
|
||||
@@ -27,8 +27,7 @@ fun Nav(
|
||||
"animation" to animation
|
||||
"duration" to duration ?.toString()
|
||||
}
|
||||
classes("uk-nav")
|
||||
include(*modifiers)
|
||||
include(*modifiers, UIKitNav)
|
||||
attributesCustomizer()
|
||||
}
|
||||
) {
|
||||
@@ -36,6 +35,63 @@ fun Nav(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DefaultNav(
|
||||
vararg modifiers: UIKitModifier,
|
||||
multiple: Boolean? = null,
|
||||
collapsible: Boolean? = null,
|
||||
animation: UIKitAnimation? = null,
|
||||
duration: Milliseconds? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
dataAllocator: ContentBuilder<HTMLUListElement>
|
||||
) = Nav(
|
||||
modifiers = modifiers + UIKitNav.Default,
|
||||
multiple,
|
||||
collapsible,
|
||||
animation,
|
||||
duration,
|
||||
attributesCustomizer,
|
||||
dataAllocator
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun PrimaryNav(
|
||||
vararg modifiers: UIKitModifier,
|
||||
multiple: Boolean? = null,
|
||||
collapsible: Boolean? = null,
|
||||
animation: UIKitAnimation? = null,
|
||||
duration: Milliseconds? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
dataAllocator: ContentBuilder<HTMLUListElement>
|
||||
) = Nav(
|
||||
modifiers = modifiers + UIKitNav.Primary,
|
||||
multiple,
|
||||
collapsible,
|
||||
animation,
|
||||
duration,
|
||||
attributesCustomizer,
|
||||
dataAllocator
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun SubNav(
|
||||
vararg modifiers: UIKitModifier,
|
||||
multiple: Boolean? = null,
|
||||
collapsible: Boolean? = null,
|
||||
animation: UIKitAnimation? = null,
|
||||
duration: Milliseconds? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
dataAllocator: ContentBuilder<HTMLUListElement>
|
||||
) = Nav(
|
||||
modifiers = modifiers + UIKitNav.SubNav,
|
||||
multiple,
|
||||
collapsible,
|
||||
animation,
|
||||
duration,
|
||||
attributesCustomizer,
|
||||
dataAllocator
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun <T> Nav(
|
||||
title: String,
|
||||
@@ -59,8 +115,7 @@ fun <T> Nav(
|
||||
"animation" to animation
|
||||
"duration" to duration ?.toString()
|
||||
}
|
||||
classes("uk-nav")
|
||||
include(*ulModifiers)
|
||||
include(*ulModifiers, UIKitNav)
|
||||
ulCustomizer()
|
||||
}
|
||||
) {
|
||||
@@ -76,6 +131,93 @@ fun <T> Nav(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun <T> DefaultNav(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
vararg ulModifiers: UIKitModifier,
|
||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
multiple: Boolean? = null,
|
||||
collapsible: Boolean? = null,
|
||||
animation: UIKitAnimation? = null,
|
||||
duration: Milliseconds? = null,
|
||||
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
|
||||
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
|
||||
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
|
||||
) = Nav(
|
||||
title,
|
||||
data,
|
||||
ulModifiers = ulModifiers + UIKitNav.Default,
|
||||
titleModifiers,
|
||||
multiple,
|
||||
collapsible,
|
||||
animation,
|
||||
duration,
|
||||
besidesTitleAndList,
|
||||
titleCustomizer,
|
||||
ulCustomizer,
|
||||
elementAllocator
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun <T> PrimaryNav(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
vararg ulModifiers: UIKitModifier,
|
||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
multiple: Boolean? = null,
|
||||
collapsible: Boolean? = null,
|
||||
animation: UIKitAnimation? = null,
|
||||
duration: Milliseconds? = null,
|
||||
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
|
||||
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
|
||||
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
|
||||
) = Nav(
|
||||
title,
|
||||
data,
|
||||
ulModifiers = ulModifiers + UIKitNav.Primary,
|
||||
titleModifiers,
|
||||
multiple,
|
||||
collapsible,
|
||||
animation,
|
||||
duration,
|
||||
besidesTitleAndList,
|
||||
titleCustomizer,
|
||||
ulCustomizer,
|
||||
elementAllocator
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun <T> SubNav(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
vararg ulModifiers: UIKitModifier,
|
||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
multiple: Boolean? = null,
|
||||
collapsible: Boolean? = null,
|
||||
animation: UIKitAnimation? = null,
|
||||
duration: Milliseconds? = null,
|
||||
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
|
||||
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
|
||||
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
|
||||
) = Nav(
|
||||
title,
|
||||
data,
|
||||
ulModifiers = ulModifiers + UIKitNav.SubNav,
|
||||
titleModifiers,
|
||||
multiple,
|
||||
collapsible,
|
||||
animation,
|
||||
duration,
|
||||
besidesTitleAndList,
|
||||
titleCustomizer,
|
||||
ulCustomizer,
|
||||
elementAllocator
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun NavHeader(
|
||||
text: String,
|
||||
@@ -92,6 +234,24 @@ fun NavHeader(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NavItemElement(
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
|
||||
contentAllocator: ContentBuilder<HTMLAnchorElement>
|
||||
) {
|
||||
Li(
|
||||
{
|
||||
include(*modifiers)
|
||||
attributesCustomizer()
|
||||
}
|
||||
) {
|
||||
A("#") {
|
||||
contentAllocator()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NavElement(
|
||||
vararg modifiers: UIKitModifier,
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.inmo.jsuikit.elements
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||
import dev.inmo.jsuikit.modifiers.*
|
||||
import org.jetbrains.compose.web.attributes.AttrsBuilder
|
||||
import org.jetbrains.compose.web.dom.*
|
||||
import org.jetbrains.compose.web.dom.Text
|
||||
import org.w3c.dom.*
|
||||
@@ -14,6 +15,7 @@ fun <T> DefaultTable(
|
||||
vararg tableModifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
|
||||
headingCustomizer: AttrBuilderContext<HTMLTableCellElement> = {},
|
||||
rowAttributes: AttrsBuilder<HTMLTableRowElement>.(t: T) -> Unit = {},
|
||||
cellFiller: @Composable (i: Int, t: T) -> Unit
|
||||
) {
|
||||
val headingIndexes = heading.indices
|
||||
@@ -39,7 +41,11 @@ fun <T> DefaultTable(
|
||||
}
|
||||
Tbody {
|
||||
dataList.forEach {
|
||||
Tr {
|
||||
Tr(
|
||||
{
|
||||
rowAttributes(it)
|
||||
}
|
||||
) {
|
||||
headingIndexes.forEach { i ->
|
||||
Td {
|
||||
cellFiller(i, it)
|
||||
|
||||
@@ -3,8 +3,8 @@ package dev.inmo.jsuikit.modifiers
|
||||
sealed class UIKitNav(classname: String) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf(classname)
|
||||
|
||||
object Accordion : UIKitNav("uk-nav-parent-icon")
|
||||
object Subnav : UIKitNav("uk-nav-sub")
|
||||
object ParentIcon : UIKitNav("uk-nav-parent-icon")
|
||||
object SubNav : UIKitNav("uk-nav-sub")
|
||||
|
||||
object Header : UIKitNav("uk-nav-header")
|
||||
object Divider : UIKitNav("uk-nav-divider")
|
||||
@@ -14,4 +14,6 @@ sealed class UIKitNav(classname: String) : UIKitModifier {
|
||||
object Primary : UIKitNav("uk-nav-primary")
|
||||
|
||||
object Center : UIKitNav("uk-nav-center")
|
||||
|
||||
companion object : UIKitNav("uk-nav")
|
||||
}
|
||||
|
||||
@@ -3,10 +3,110 @@ package dev.inmo.jsuikit.modifiers
|
||||
sealed class UIKitUtility(classname: String) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf(classname)
|
||||
|
||||
object Panel : UIKitUtility("uk-panel")
|
||||
|
||||
sealed class Float(suffix: String) : UIKitUtility("uk-float-$suffix") {
|
||||
object Left : Float("left")
|
||||
object Right : Float("right")
|
||||
}
|
||||
object Clearfix : Float("clearfix")
|
||||
|
||||
sealed class Overflow(suffix: String) : UIKitUtility("uk-overflow-$suffix") {
|
||||
object Hidden : Overflow("hidden")
|
||||
object Auto : Overflow("auto")
|
||||
}
|
||||
|
||||
sealed class Resize(suffix: String?) : UIKitUtility("uk-resize${suffix ?.let { "-$it" } ?: ""}") {
|
||||
object Vertical : Resize("vertical")
|
||||
companion object : Resize(null)
|
||||
}
|
||||
|
||||
sealed class Display(suffix: String) : UIKitUtility("uk-display-$suffix") {
|
||||
object Block : Display("block")
|
||||
sealed class Inline(suffix: String?) : Display("inline${suffix ?.let { "-$it" } ?: ""}") {
|
||||
object Block : Inline("block")
|
||||
companion object : Inline(null)
|
||||
}
|
||||
}
|
||||
|
||||
sealed class Inline(suffix: String?) : UIKitUtility("uk-inline${suffix ?.let { "-$it" } ?: ""}") {
|
||||
object Clip : Inline("clip")
|
||||
companion object : Inline(null)
|
||||
}
|
||||
|
||||
sealed class Responsive(suffix: String) : UIKitUtility("uk-responsive-$suffix") {
|
||||
object Width : Responsive("width")
|
||||
object Height : Responsive("height")
|
||||
}
|
||||
object PreserveWidth : UIKitUtility("uk-preserve-width")
|
||||
|
||||
sealed class Border(suffix: String) : UIKitUtility("uk-border-$suffix") {
|
||||
object Rounded : Border("rounded")
|
||||
object Circle : Border("circle")
|
||||
object Pill : Border("pill")
|
||||
}
|
||||
|
||||
sealed class BoxShadow(suffix: String) : UIKitUtility("uk-box-shadow-$suffix") {
|
||||
object Small : BoxShadow("small")
|
||||
object Medium : BoxShadow("medium")
|
||||
object Large : BoxShadow("large")
|
||||
object XLarge : BoxShadow("xlarge")
|
||||
|
||||
object Bottom : BoxShadow("bottom")
|
||||
|
||||
sealed class Hover(suffix: String) : BoxShadow("hover-$suffix") {
|
||||
object Small : Hover("small")
|
||||
object Medium : Hover("medium")
|
||||
object Large : Hover("large")
|
||||
object XLarge : Hover("xlarge")
|
||||
}
|
||||
}
|
||||
|
||||
object DropCap : UIKitUtility("uk-dropcap")
|
||||
|
||||
object Logo : UIKitUtility("uk-logo")
|
||||
|
||||
sealed class Blend(suffix: String) : UIKitUtility("uk-blend-$suffix") {
|
||||
object Multiply : Blend("multiply")
|
||||
object Screen : Blend("screen")
|
||||
object Overlay : Blend("overlay")
|
||||
object Darken : Blend("darken")
|
||||
object Lighten : Blend("lighten")
|
||||
sealed class Color(suffix: String?) : Blend("color${suffix ?.let { "-$it" } ?: ""}") {
|
||||
object Dodge : Color("dodge")
|
||||
object Burn : Color("burn")
|
||||
companion object : Color(null)
|
||||
}
|
||||
object HardLight : Blend("hard-light")
|
||||
object SoftLight : Blend("soft-light")
|
||||
object Difference : Blend("difference")
|
||||
object Exclusion : Blend("exclusion")
|
||||
object Hue : Blend("hue")
|
||||
object Saturation : Blend("saturation")
|
||||
object Luminosity : Blend("luminosity")
|
||||
}
|
||||
|
||||
sealed class Transform(suffix: String) : UIKitUtility("uk-transform-$suffix") {
|
||||
object Center : Transform("center")
|
||||
sealed class Origin(suffix: String) : Transform("origin-$suffix") {
|
||||
sealed class Top(suffix: String) : Origin("top-$suffix") {
|
||||
object Left : Top("left")
|
||||
object Center : Top("center")
|
||||
object Right : Top("right")
|
||||
}
|
||||
sealed class Center(suffix: String) : Origin("center-$suffix") {
|
||||
object Left : Center("left")
|
||||
object Right : Center("right")
|
||||
}
|
||||
sealed class Bottom(suffix: String) : Origin("bottom-$suffix") {
|
||||
object Left : Bottom("left")
|
||||
object Center : Bottom("center")
|
||||
object Right : Bottom("right")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Disabled : UIKitUtility("uk-disabled")
|
||||
object Drag : UIKitUtility("uk-drag")
|
||||
object Active : UIKitUtility("uk-active")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user