Browse Source

Hide StylePropertyString, StylePropertyNumber casts by making them private

CSS_CASTS
Shagen Ogandzhanian 3 years ago
parent
commit
d03155bafd
  1. 10
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt
  2. 3
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StylePropertyValue.kt

10
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt

@ -9,6 +9,9 @@ package org.jetbrains.compose.web.css
import kotlin.properties.ReadOnlyProperty import kotlin.properties.ReadOnlyProperty
private fun StylePropertyValue(value: String): StylePropertyString = value.unsafeCast<StylePropertyString>()
private fun StylePropertyValue(value: Number): StylePropertyNumber = value.unsafeCast<StylePropertyNumber>()
interface StyleBuilder { interface StyleBuilder {
fun property(propertyName: String, value: StylePropertyValue) fun property(propertyName: String, value: StylePropertyValue)
fun variable(variableName: String, value: StylePropertyValue) fun variable(variableName: String, value: StylePropertyValue)
@ -36,11 +39,8 @@ inline fun variableValue(variableName: String, fallback: StylePropertyValue? = n
external interface CSSVariableValueAs<out T: StylePropertyValue>: StylePropertyValue external interface CSSVariableValueAs<out T: StylePropertyValue>: StylePropertyValue
inline fun <TValue> CSSVariableValue(value: StylePropertyValue) = inline fun <TValue> CSSVariableValue(value: StylePropertyValue) = value.unsafeCast<TValue>()
value.unsafeCast<TValue>() inline fun <TValue> CSSVariableValue(value: String) = value.unsafeCast<TValue>()
inline fun <TValue> CSSVariableValue(value: String) =
CSSVariableValue<TValue>(StylePropertyValue(value))
// after adding `variable` word `add` became ambiguous // after adding `variable` word `add` became ambiguous
@Deprecated( @Deprecated(

3
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StylePropertyValue.kt

@ -11,9 +11,6 @@ external interface StylePropertyValue
external interface StylePropertyNumber: StylePropertyValue external interface StylePropertyNumber: StylePropertyValue
external interface StylePropertyString: StylePropertyValue external interface StylePropertyString: StylePropertyValue
inline fun StylePropertyValue(value: String): StylePropertyString = value.unsafeCast<StylePropertyString>()
inline fun StylePropertyValue(value: Number): StylePropertyNumber = value.unsafeCast<StylePropertyNumber>()
external interface CSSStyleValue: StylePropertyValue { external interface CSSStyleValue: StylePropertyValue {
override fun toString(): String override fun toString(): String
} }
Loading…
Cancel
Save