mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-04 23:43:58 +00:00
commit
0648ceed18
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
@ -5,15 +5,11 @@ on: [push]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
- name: Fix android 31.0.0 dx
|
||||
continue-on-error: true
|
||||
run: cd /usr/local/lib/android/sdk/build-tools/31.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
|
||||
java-version: 11
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 0.2.0
|
||||
|
||||
**ALL DEPRECATIONS HAVE BEEN REMOVED**
|
||||
|
||||
* `Kotlin`: `1.7.0`
|
||||
* `Compose`: `1.2.0-alpha01-dev753`
|
||||
|
||||
## 0.1.10
|
||||
|
||||
* `Grid` support improvements
|
||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.1.10
|
||||
version=0.2.0
|
||||
|
@ -1,8 +1,8 @@
|
||||
[versions]
|
||||
|
||||
kt = "1.6.21"
|
||||
jb-compose = "1.2.0-alpha01-dev731"
|
||||
jb-dokka = "1.6.21"
|
||||
kt = "1.7.0"
|
||||
jb-compose = "1.2.0-alpha01-dev753"
|
||||
jb-dokka = "1.7.0"
|
||||
gh-release = "2.4.1"
|
||||
|
||||
[libraries]
|
||||
|
@ -1,26 +1,8 @@
|
||||
package dev.inmo.jsuikit
|
||||
|
||||
import dev.inmo.jsuikit.modifiers.AttributeValue
|
||||
import dev.inmo.jsuikit.utils.*
|
||||
import org.jetbrains.compose.web.attributes.AttrsScope
|
||||
|
||||
@Deprecated("Will be removed soon")
|
||||
class UIKitAttributeValueBuilder {
|
||||
private val attrs = mutableListOf<Pair<String, String>>()
|
||||
|
||||
infix fun String.to(other: String?) {
|
||||
other ?.let {
|
||||
attrs.add(Pair(this, other))
|
||||
}
|
||||
}
|
||||
|
||||
infix fun String.to(other: AttributeValue?) {
|
||||
this to other ?.name
|
||||
}
|
||||
|
||||
fun build(): String = attrs.joinToString(";") { (k, v) -> "$k: $v" }
|
||||
}
|
||||
|
||||
fun AttrsScope<*>.buildAndAddAttribute(
|
||||
attributeName: String,
|
||||
skipNullValues: Boolean = true,
|
||||
|
@ -43,25 +43,3 @@ fun <T> ListWithTitle(
|
||||
besidesTitleAndList ?.invoke()
|
||||
List(data, Attrs(*ulModifiers) { ulCustomizer(this) }, elementAllocator)
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("ListWithTitle", "dev.inmo.jsuikit.elements.ListWithTitle"))
|
||||
@Composable
|
||||
fun <T> List(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
vararg titleModifiers: UIKitModifier,
|
||||
ulModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
besidesTitleAndList: (@Composable () -> Unit)? = null,
|
||||
titleCustomizer: AttrBuilderContext<HTMLHeadingElement> = {},
|
||||
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
|
||||
) = ListWithTitle(
|
||||
title,
|
||||
data,
|
||||
*titleModifiers,
|
||||
ulModifiers = ulModifiers,
|
||||
besidesTitleAndList = besidesTitleAndList,
|
||||
titleCustomizer = titleCustomizer,
|
||||
ulCustomizer = ulCustomizer,
|
||||
elementAllocator = elementAllocator
|
||||
)
|
||||
|
@ -22,33 +22,6 @@ fun Navbar(
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Will be removed soon. Use the variant with AttrsWithContentBuilders")
|
||||
@Composable
|
||||
fun Navbar(
|
||||
leftBuilder: NavbarNavBuilder?,
|
||||
centerBuilder: NavbarNavBuilder? = null,
|
||||
rightBuilder: NavbarNavBuilder? = null,
|
||||
vararg navModifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLElement> = {},
|
||||
) {
|
||||
Navbar(
|
||||
{
|
||||
include(*navModifiers)
|
||||
attributesCustomizer()
|
||||
}
|
||||
) {
|
||||
leftBuilder ?.let {
|
||||
Div({ include(UIKitNavbar.Alignment.Left) }) { it.draw() }
|
||||
}
|
||||
centerBuilder ?.let {
|
||||
Div({ include(UIKitNavbar.Alignment.Center) }) { it.draw() }
|
||||
}
|
||||
rightBuilder ?.let {
|
||||
Div({ include(UIKitNavbar.Alignment.Right) }) { it.draw() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Navbar(
|
||||
leftBuilder: AttrsWithContentBuilder<HTMLDivElement>? = null,
|
||||
|
@ -30,58 +30,3 @@ fun NavbarNav(
|
||||
vararg elements: AttrsWithContentBuilder<HTMLLIElement>,
|
||||
attrs: Attrs<HTMLUListElement> = Attrs.empty()
|
||||
) = NavbarNav(elements.toList(), attrs)
|
||||
|
||||
@Deprecated("Will be removed soon. Use NavbarNavPart with AttrsWithContentBuilder instead")
|
||||
interface NavbarNavElement {
|
||||
fun AttrsScope<HTMLLIElement>.setup() {}
|
||||
@Composable
|
||||
fun ElementScope<HTMLLIElement>.fill()
|
||||
|
||||
class Default(
|
||||
private val setupCallback: AttrsScope<HTMLLIElement>.() -> Unit,
|
||||
private val fillCallback: @Composable ElementScope<HTMLLIElement>.() -> Unit
|
||||
) : NavbarNavElement {
|
||||
override fun AttrsScope<HTMLLIElement>.setup() {
|
||||
setupCallback()
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun ElementScope<HTMLLIElement>.fill() {
|
||||
fillCallback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Will be removed soon. Use NavbarNavPart with AttrsWithContentBuilder instead")
|
||||
class NavbarNavBuilder(
|
||||
private val modifiers: Array<UIKitModifier>,
|
||||
private val elements: List<NavbarNavElement>,
|
||||
private val attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {}
|
||||
) {
|
||||
constructor(
|
||||
modifiers: Array<UIKitModifier>,
|
||||
vararg elements: NavbarNavElement,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {}
|
||||
) : this(modifiers, elements.toList(), attributesCustomizer)
|
||||
constructor(
|
||||
vararg elements: NavbarNavElement,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {}
|
||||
) : this(emptyArray(), elements.toList(), attributesCustomizer)
|
||||
@Composable
|
||||
fun draw() {
|
||||
Ul(
|
||||
{
|
||||
include(UIKitNavbar.Nav, *modifiers)
|
||||
attributesCustomizer()
|
||||
}
|
||||
) {
|
||||
elements.forEach { element ->
|
||||
Li(
|
||||
{ element.apply { setup() } }
|
||||
) {
|
||||
element.apply { fill() }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,14 +41,3 @@ fun <T> StandardInput(
|
||||
attributesCustomizer()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Deprecated("Renamed", ReplaceWith("StandardInput", "dev.inmo.jsuikit.elements.StandardInput"))
|
||||
fun <T> TextField(
|
||||
type: InputType<T>,
|
||||
state: MutableState<T>,
|
||||
disabledState: State<Boolean>? = null,
|
||||
placeholder: String? = null,
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
|
||||
) = StandardInput(type, state, disabledState, placeholder, modifiers = modifiers, attributesCustomizer)
|
||||
|
Loading…
Reference in New Issue
Block a user