From 6d0a0f4f1dfd561d7bb084e269a72fd064e3c43d Mon Sep 17 00:00:00 2001 From: Oleksandr Karpovich Date: Tue, 30 Nov 2021 11:33:55 +0100 Subject: [PATCH] web (breaking change): make some functions internal (#1509) Co-authored-by: Oleksandr Karpovich --- .../kotlin/org/jetbrains/compose/web/css/BrowserAPI.kt | 8 ++++---- .../org/jetbrains/compose/web/css/CSSKeyframeRule.kt | 2 +- .../kotlin/org/jetbrains/compose/web/css/CSSRules.kt | 2 +- .../kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt | 4 ++-- .../kotlin/org/jetbrains/compose/web/css/StyleSheet.kt | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/BrowserAPI.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/BrowserAPI.kt index 7b1e44dc16..3c55709bf3 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/BrowserAPI.kt +++ b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/BrowserAPI.kt @@ -10,18 +10,18 @@ import org.w3c.dom.css.CSSRule import org.w3c.dom.css.CSSRuleList -external class CSSKeyframesRule: CSSRule { +internal external class CSSKeyframesRule: CSSRule { val name: String val cssRules: CSSRuleList } -inline fun CSSKeyframesRule.appendRule(cssRule: String) { +internal inline fun CSSKeyframesRule.appendRule(cssRule: String) { this.asDynamic().appendRule(cssRule) } @Suppress("NOTHING_TO_INLINE") -inline fun jsObject(): T = +internal inline fun jsObject(): T = js("({})") -inline fun jsObject(builder: T.() -> Unit): T = +internal inline fun jsObject(builder: T.() -> Unit): T = jsObject().apply(builder) diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSKeyframeRule.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSKeyframeRule.kt index 37ef76fcef..cac9a7f9ac 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSKeyframeRule.kt +++ b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSKeyframeRule.kt @@ -67,7 +67,7 @@ class CSSKeyframesBuilder() { } } -fun buildKeyframes(name: String, builder: CSSKeyframesBuilder.() -> Unit): CSSKeyframesRuleDeclaration { +internal fun buildKeyframes(name: String, builder: CSSKeyframesBuilder.() -> Unit): CSSKeyframesRuleDeclaration { val frames = CSSKeyframesBuilder(builder).frames return CSSKeyframesRuleDeclaration(name, frames) } diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSRules.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSRules.kt index e389e3a66c..0e3d2717a1 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSRules.kt +++ b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSRules.kt @@ -32,7 +32,7 @@ interface CSSGroupingRuleDeclaration: CSSRuleDeclaration { typealias CSSRuleDeclarationList = List typealias MutableCSSRuleDeclarationList = MutableList -fun buildCSSStyleRule(cssRule: CSSStyleRuleBuilder.() -> Unit): StyleHolder { +internal fun buildCSSStyleRule(cssRule: CSSStyleRuleBuilder.() -> Unit): StyleHolder { val builder = CSSRuleBuilderImpl() builder.cssRule() return builder diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt index 595b078474..4bc8a20907 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt +++ b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt @@ -57,7 +57,7 @@ interface StyleBuilder { } } -inline fun variableValue(variableName: String, fallback: StylePropertyValue? = null) = +internal inline fun variableValue(variableName: String, fallback: StylePropertyValue? = null) = "var(--$variableName${fallback?.let { ", $it" } ?: ""})" external interface CSSVariableValueAs @@ -169,7 +169,7 @@ data class StylePropertyDeclaration( typealias StylePropertyList = List typealias MutableStylePropertyList = MutableList -fun StylePropertyList.nativeEquals(properties: StylePropertyList): Boolean { +internal fun StylePropertyList.nativeEquals(properties: StylePropertyList): Boolean { if (this.size != properties.size) return false var index = 0 diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleSheet.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleSheet.kt index 6ac77237cd..5a2b94c180 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleSheet.kt +++ b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleSheet.kt @@ -75,7 +75,7 @@ open class StyleSheet( protected fun keyframes(cssKeyframes: CSSKeyframesBuilder.() -> Unit) = CSSKeyframesHolder(usePrefix, cssKeyframes) companion object { - var counter = 0 + private var counter = 0 } @Suppress("EqualsOrHashCode") @@ -152,7 +152,7 @@ open class StyleSheet( StyleSheet().apply(rulesBuild).cssRules } -fun buildCSS( +internal fun buildCSS( thisClass: CSSSelector, thisContext: CSSSelector, cssRule: CSSBuilder.() -> Unit