Browse Source

CSSVariableValueAs does not inherit from StylePropertyValue

CSS_CASTS
Shagen Ogandzhanian 3 years ago
parent
commit
414ae1056a
  1. 8
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/StyleBuilder.kt

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

@ -36,7 +36,7 @@ fun StyleBuilder.variable(variableName: String, value: String)
fun StyleBuilder.variable(variableName: String, value: Number) fun StyleBuilder.variable(variableName: String, value: Number)
= variable(variableName, value.unsafeCast<StylePropertyValue>()) = variable(variableName, value.unsafeCast<StylePropertyValue>())
external interface CSSVariableValueAs<out T: StylePropertyValue>: StylePropertyValue external interface CSSVariableValueAs<out T: StylePropertyValue>
// after adding `variable` word `add` became ambiguous // after adding `variable` word `add` became ambiguous
@Deprecated( @Deprecated(
@ -55,13 +55,15 @@ class CSSVariable<out TValue: StylePropertyValue>(val name: String)
private inline fun <TValue : StylePropertyValue?> variableValue(variableName: String, fallback: TValue? = null) = private inline fun <TValue : StylePropertyValue?> variableValue(variableName: String, fallback: TValue? = null) =
"var(--$variableName${fallback?.let { ", $it" } ?: ""})".unsafeCast<TValue>() "var(--$variableName${fallback?.let { ", $it" } ?: ""})".unsafeCast<TValue>()
fun <TValue: StylePropertyValue> CSSVariable<TValue>.value(fallback: TValue? = null) = fun <TValue: StylePropertyValue> CSSVariable<TValue>.value(fallback: TValue? = null): TValue =
variableValue( variableValue(
name, name,
fallback fallback
) )
fun <TValue: CSSVariableValueAs<TValue>> CSSVariable<TValue>.value(fallback: TValue? = null) = fun <TValue> CSSVariable<TValue>.value(fallback: TValue? = null): TValue
where TValue: CSSVariableValueAs<TValue>, TValue: StylePropertyValue
=
variableValue( variableValue(
name, name,
fallback fallback

Loading…
Cancel
Save