Merge pull request #66 from InsanusMokrassar/0.2.0

0.2.0
This commit is contained in:
InsanusMokrassar 2022-08-04 17:33:45 +06:00 committed by GitHub
commit 0648ceed18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 143 deletions

View File

@ -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

View File

@ -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

View File

@ -9,4 +9,4 @@ android.enableJetifier=true
# Project data
group=dev.inmo
version=0.1.10
version=0.2.0

View File

@ -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]

View File

@ -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,

View File

@ -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
)

View File

@ -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,

View File

@ -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() }
}
}
}
}
}

View File

@ -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)