Browse Source

Remove CSSKeywordValue from API completely

And subsequently simplify auto invocation
pull/743/head
Shagen Ogandzhanian 3 years ago
parent
commit
15a6b5601e
  1. 13
      web/core/src/jsMain/kotlin/androidx/compose/web/css/CSS.kt
  2. 7
      web/core/src/jsMain/kotlin/androidx/compose/web/css/CSSHelpers.kt

13
web/core/src/jsMain/kotlin/androidx/compose/web/css/CSS.kt

@ -36,9 +36,7 @@ fun StyleSheet.insertRule(cssRule: String, index: Int? = null): Int {
val ElementCSSInlineStyle.attributeStyleMap
get() = this.asDynamic().attributeStyleMap.unsafeCast<StylePropertyMap>()
external interface CSSStyleValue {
// toString() : string
}
external interface CSSStyleValue
@JsName("CSSStyleValue")
open external class CSSStyleValueJS : CSSStyleValue {
@ -79,15 +77,6 @@ external class CSSUnparsedValue(members: Array<CSSUnparsedSegment>) : CSSStyleVa
operator fun set(index: Int, value: CSSUnparsedSegment)
}
external interface CSSKeywordValue : CSSStyleValue {
val value: String
}
@JsName("CSSKeywordValue")
external class CSSKeywordValueJS(value: String) : CSSKeywordValue {
override val value: String
}
// type CSSNumberish = number | CSSNumericValue
interface CSSNumberish {
companion object {

7
web/core/src/jsMain/kotlin/androidx/compose/web/css/CSSHelpers.kt

@ -1,11 +1,9 @@
@file:Suppress("UNUSED")
package org.jetbrains.compose.web.css
interface CSSAutoValue : CSSKeywordValue
interface CSSAutoValue : CSSStyleValue
val auto = CSSKeywordValueJS("auto").unsafeCast<CSSAutoValue>()
fun asCSSAutoValue(value: dynamic) = (value as? CSSKeywordValueJS).unsafeCast<CSSAutoValue>()
val auto = StylePropertyValue("auto").unsafeCast<CSSAutoValue>()
// type CSSSizeOrAutoValue = CSSSizeValue | CSSAutoValue
interface CSSSizeOrAutoValue : CSSStyleValue, StylePropertyValue {
@ -16,7 +14,6 @@ interface CSSSizeOrAutoValue : CSSStyleValue, StylePropertyValue {
}
fun CSSSizeOrAutoValue.asCSSSizeValue() = this.asDynamic() as? CSSUnitValueJS
fun CSSSizeOrAutoValue.asCSSAutoValue(): CSSAutoValue = asCSSAutoValue(this.asDynamic())
enum class Direction {
rtl,

Loading…
Cancel
Save