|
|
|
@ -68,8 +68,7 @@ fun <TValue: StylePropertyValue> CSSStyleVariable<TValue>.value(fallback: TValue
|
|
|
|
|
|
|
|
|
|
fun <TValue> CSSStyleVariable<TValue>.value(fallback: TValue? = null) |
|
|
|
|
where TValue : CSSVariableValueAs<TValue>, |
|
|
|
|
TValue: StylePropertyValue |
|
|
|
|
= |
|
|
|
|
TValue : StylePropertyValue = |
|
|
|
|
CSSVariableValue<TValue>( |
|
|
|
|
variableValue( |
|
|
|
|
name, |
|
|
|
@ -77,6 +76,25 @@ fun <TValue> CSSStyleVariable<TValue>.value(fallback: TValue? = null)
|
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Introduces CSS variable that can be later referred anywhere in [StyleSheet] |
|
|
|
|
* |
|
|
|
|
* Example: |
|
|
|
|
* ``` |
|
|
|
|
* object AppCSSVariables { |
|
|
|
|
* val width by variable<CSSUnitValue>() |
|
|
|
|
* val stringHeight by variable<StylePropertyString>() |
|
|
|
|
* val order by variable<StylePropertyNumber>() |
|
|
|
|
* } |
|
|
|
|
* |
|
|
|
|
* object AppStylesheet : StyleSheet() { |
|
|
|
|
* val classWithProperties by style { |
|
|
|
|
* AppCSSVariables.width(100.px) |
|
|
|
|
* property("width", AppCSSVariables.width.value()) |
|
|
|
|
* } |
|
|
|
|
*``` |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
fun <TValue : StylePropertyValue> variable() = |
|
|
|
|
ReadOnlyProperty<Any?, CSSStyleVariable<TValue>> { _, property -> |
|
|
|
|
CSSStyleVariable(property.name) |
|
|
|
|