From 6fbdae9e8335cc7266fc42123c80060b69e9a3b9 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Wed, 14 Jul 2021 23:26:11 +0200 Subject: [PATCH] CSSVariable is a class --- .../jetbrains/compose/web/css/StyleBuilder.kt | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) 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 a0214fb3cc..9a783dce81 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 @@ -14,15 +14,15 @@ interface StyleBuilder { fun property(propertyName: String, value: StylePropertyValue) fun variable(variableName: String, value: StylePropertyValue) - operator fun CSSStyleVariable.invoke(value: TValue) { + operator fun CSSVariable.invoke(value: TValue) { variable(name, value.toString()) } - operator fun CSSStyleVariable.invoke(value: String) { + operator fun CSSVariable.invoke(value: String) { variable(name, value) } - operator fun CSSStyleVariable.invoke(value: Number) { + operator fun CSSVariable.invoke(value: Number) { variable(name, value) } } @@ -57,13 +57,9 @@ fun StyleBuilder.add( interface CSSVariables -interface CSSVariable { - val name: String -} - -class CSSStyleVariable(override val name: String) : CSSVariable +class CSSVariable(val name: String) -fun CSSStyleVariable.value(fallback: TValue? = null) = +fun CSSVariable.value(fallback: TValue? = null) = CSSVariableValue( variableValue( name, @@ -71,7 +67,7 @@ fun CSSStyleVariable.value(fallback: TValue ) ) -fun > CSSStyleVariable.value(fallback: TValue? = null) = +fun > CSSVariable.value(fallback: TValue? = null) = CSSVariableValue( variableValue( name, @@ -80,8 +76,8 @@ fun > CSSStyleVariable.value(fallback ) fun CSSVariables.variable() = - ReadOnlyProperty> { _, property -> - CSSStyleVariable(property.name) + ReadOnlyProperty> { _, property -> + CSSVariable(property.name) } interface StyleHolder {