Browse Source

[web] Color is a namespace, use CSSColorValue whenever you need StylePropertyValue subtype

pull/889/head
Shagen Ogandzhanian 3 years ago
parent
commit
dc3b743f2c
  1. 4
      web/benchmark-core/src/jsMain/kotlin/com/sample/style/Stylesheet.kt
  2. 2
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/Color.kt
  3. 2
      web/integration-core/src/jsMain/kotlin/androidx/compose/web/sample/Sample.kt

4
web/benchmark-core/src/jsMain/kotlin/com/sample/style/Stylesheet.kt

@ -4,8 +4,8 @@ import org.jetbrains.compose.web.css.*
import org.jetbrains.compose.web.css.selectors.CSSSelector
object AppCSSVariables : CSSVariables {
val wtColorGreyLight by variable<Color>()
val wtColorGreyDark by variable<Color>()
val wtColorGreyLight by variable<CSSColorValue>()
val wtColorGreyDark by variable<CSSColorValue>()
val wtOffsetTopUnit by variable<CSSUnitValue>()
val wtHorizontalLayoutGutter by variable<CSSUnitValue>()

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

@ -4,7 +4,7 @@ package org.jetbrains.compose.web.css
external interface CSSColorValue: StylePropertyValue, CSSVariableValueAs<CSSColorValue>
abstract class Color : CSSStyleValue, CSSColorValue {
object Color {
data class Named(val value: String) : CSSColorValue {
override fun toString(): String = value
}

2
web/integration-core/src/jsMain/kotlin/androidx/compose/web/sample/Sample.kt

@ -39,7 +39,7 @@ val globalState = State()
val globalInt = mutableStateOf(1)
object MyCSSVariables : CSSVariables {
val myVar by variable<Color>()
val myVar by variable<CSSColorValue>()
val myVar2 by variable<StylePropertyString>()
}

Loading…
Cancel
Save