From 190b3ac53e92be41d990b54fbf414b26badf2e7a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 4 Aug 2022 17:31:07 +0600 Subject: [PATCH] remove deprecations --- CHANGELOG.md | 2 + .../jsuikit/UIKitAttributeValueBuilder.kt | 18 ------ .../kotlin/dev/inmo/jsuikit/elements/List.kt | 22 -------- .../dev/inmo/jsuikit/elements/Navbar.kt | 27 --------- .../inmo/jsuikit/elements/NavbarNavBuilder.kt | 55 ------------------- .../inmo/jsuikit/elements/StandardInput.kt | 11 ---- 6 files changed, 2 insertions(+), 133 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 201160a..0f4e090 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.2.0 +**ALL DEPRECATIONS HAVE BEEN REMOVED** + * `Kotlin`: `1.7.0` * `Compose`: `1.2.0-alpha01-dev753` diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/UIKitAttributeValueBuilder.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/UIKitAttributeValueBuilder.kt index d6f23b9..965004e 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/UIKitAttributeValueBuilder.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/UIKitAttributeValueBuilder.kt @@ -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>() - - 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, diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/List.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/List.kt index 2e1f505..d9dd2af 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/List.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/List.kt @@ -43,25 +43,3 @@ fun ListWithTitle( besidesTitleAndList ?.invoke() List(data, Attrs(*ulModifiers) { ulCustomizer(this) }, elementAllocator) } - -@Deprecated("Renamed", ReplaceWith("ListWithTitle", "dev.inmo.jsuikit.elements.ListWithTitle")) -@Composable -fun List( - title: String, - data: SnapshotStateList, - vararg titleModifiers: UIKitModifier, - ulModifiers: Array = emptyArray(), - besidesTitleAndList: (@Composable () -> Unit)? = null, - titleCustomizer: AttrBuilderContext = {}, - ulCustomizer: AttrBuilderContext = {}, - elementAllocator: @Composable ElementScope.(T) -> Unit -) = ListWithTitle( - title, - data, - *titleModifiers, - ulModifiers = ulModifiers, - besidesTitleAndList = besidesTitleAndList, - titleCustomizer = titleCustomizer, - ulCustomizer = ulCustomizer, - elementAllocator = elementAllocator -) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Navbar.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Navbar.kt index ca54814..94e9ead 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Navbar.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Navbar.kt @@ -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 = {}, -) { - 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? = null, diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/NavbarNavBuilder.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/NavbarNavBuilder.kt index b919dc1..f749d62 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/NavbarNavBuilder.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/NavbarNavBuilder.kt @@ -30,58 +30,3 @@ fun NavbarNav( vararg elements: AttrsWithContentBuilder, attrs: Attrs = Attrs.empty() ) = NavbarNav(elements.toList(), attrs) - -@Deprecated("Will be removed soon. Use NavbarNavPart with AttrsWithContentBuilder instead") -interface NavbarNavElement { - fun AttrsScope.setup() {} - @Composable - fun ElementScope.fill() - - class Default( - private val setupCallback: AttrsScope.() -> Unit, - private val fillCallback: @Composable ElementScope.() -> Unit - ) : NavbarNavElement { - override fun AttrsScope.setup() { - setupCallback() - } - - @Composable - override fun ElementScope.fill() { - fillCallback() - } - } -} - -@Deprecated("Will be removed soon. Use NavbarNavPart with AttrsWithContentBuilder instead") -class NavbarNavBuilder( - private val modifiers: Array, - private val elements: List, - private val attributesCustomizer: AttrBuilderContext = {} -) { - constructor( - modifiers: Array, - vararg elements: NavbarNavElement, - attributesCustomizer: AttrBuilderContext = {} - ) : this(modifiers, elements.toList(), attributesCustomizer) - constructor( - vararg elements: NavbarNavElement, - attributesCustomizer: AttrBuilderContext = {} - ) : this(emptyArray(), elements.toList(), attributesCustomizer) - @Composable - fun draw() { - Ul( - { - include(UIKitNavbar.Nav, *modifiers) - attributesCustomizer() - } - ) { - elements.forEach { element -> - Li( - { element.apply { setup() } } - ) { - element.apply { fill() } - } - } - } - } -} diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/StandardInput.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/StandardInput.kt index 85044fa..f5d5dd4 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/StandardInput.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/StandardInput.kt @@ -41,14 +41,3 @@ fun StandardInput( attributesCustomizer() } } - -@Composable -@Deprecated("Renamed", ReplaceWith("StandardInput", "dev.inmo.jsuikit.elements.StandardInput")) -fun TextField( - type: InputType, - state: MutableState, - disabledState: State? = null, - placeholder: String? = null, - vararg modifiers: UIKitModifier, - attributesCustomizer: AttrBuilderContext = {}, -) = StandardInput(type, state, disabledState, placeholder, modifiers = modifiers, attributesCustomizer)