Browse Source

web (breaking change): make some functions internal (#1509)

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
pull/1504/head
Oleksandr Karpovich 3 years ago committed by GitHub
parent
commit
6d0a0f4f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/BrowserAPI.kt
  2. 2
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSKeyframeRule.kt
  3. 2
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSRules.kt
  4. 4
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt
  5. 4
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleSheet.kt

8
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 import org.w3c.dom.css.CSSRuleList
external class CSSKeyframesRule: CSSRule { internal external class CSSKeyframesRule: CSSRule {
val name: String val name: String
val cssRules: CSSRuleList val cssRules: CSSRuleList
} }
inline fun CSSKeyframesRule.appendRule(cssRule: String) { internal inline fun CSSKeyframesRule.appendRule(cssRule: String) {
this.asDynamic().appendRule(cssRule) this.asDynamic().appendRule(cssRule)
} }
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun <T : Any> jsObject(): T = internal inline fun <T : Any> jsObject(): T =
js("({})") js("({})")
inline fun <T : Any> jsObject(builder: T.() -> Unit): T = internal inline fun <T : Any> jsObject(builder: T.() -> Unit): T =
jsObject<T>().apply(builder) jsObject<T>().apply(builder)

2
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 val frames = CSSKeyframesBuilder(builder).frames
return CSSKeyframesRuleDeclaration(name, frames) return CSSKeyframesRuleDeclaration(name, frames)
} }

2
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSRules.kt

@ -32,7 +32,7 @@ interface CSSGroupingRuleDeclaration: CSSRuleDeclaration {
typealias CSSRuleDeclarationList = List<CSSRuleDeclaration> typealias CSSRuleDeclarationList = List<CSSRuleDeclaration>
typealias MutableCSSRuleDeclarationList = MutableList<CSSRuleDeclaration> typealias MutableCSSRuleDeclarationList = MutableList<CSSRuleDeclaration>
fun buildCSSStyleRule(cssRule: CSSStyleRuleBuilder.() -> Unit): StyleHolder { internal fun buildCSSStyleRule(cssRule: CSSStyleRuleBuilder.() -> Unit): StyleHolder {
val builder = CSSRuleBuilderImpl() val builder = CSSRuleBuilderImpl()
builder.cssRule() builder.cssRule()
return builder return builder

4
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" } ?: ""})" "var(--$variableName${fallback?.let { ", $it" } ?: ""})"
external interface CSSVariableValueAs<out T : StylePropertyValue> external interface CSSVariableValueAs<out T : StylePropertyValue>
@ -169,7 +169,7 @@ data class StylePropertyDeclaration(
typealias StylePropertyList = List<StylePropertyDeclaration> typealias StylePropertyList = List<StylePropertyDeclaration>
typealias MutableStylePropertyList = MutableList<StylePropertyDeclaration> typealias MutableStylePropertyList = MutableList<StylePropertyDeclaration>
fun StylePropertyList.nativeEquals(properties: StylePropertyList): Boolean { internal fun StylePropertyList.nativeEquals(properties: StylePropertyList): Boolean {
if (this.size != properties.size) return false if (this.size != properties.size) return false
var index = 0 var index = 0

4
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) protected fun keyframes(cssKeyframes: CSSKeyframesBuilder.() -> Unit) = CSSKeyframesHolder(usePrefix, cssKeyframes)
companion object { companion object {
var counter = 0 private var counter = 0
} }
@Suppress("EqualsOrHashCode") @Suppress("EqualsOrHashCode")
@ -152,7 +152,7 @@ open class StyleSheet(
StyleSheet().apply(rulesBuild).cssRules StyleSheet().apply(rulesBuild).cssRules
} }
fun buildCSS( internal fun buildCSS(
thisClass: CSSSelector, thisClass: CSSSelector,
thisContext: CSSSelector, thisContext: CSSSelector,
cssRule: CSSBuilder.() -> Unit cssRule: CSSBuilder.() -> Unit

Loading…
Cancel
Save