Browse Source

BREAKING: CSSUnitValue working in Chrome

pull/761/head
Shagen Ogandzhanian 4 years ago
parent
commit
a6fbe1ff94
  1. 2
      web/core/build.gradle.kts
  2. 8
      web/core/src/jsMain/kotlin/androidx/compose/web/css/CSS.kt
  3. 76
      web/core/src/jsMain/kotlin/androidx/compose/web/css/CSSUnits.kt

2
web/core/build.gradle.kts

@ -13,7 +13,7 @@ kotlin {
testLogging.showStandardStreams = true testLogging.showStandardStreams = true
useKarma { useKarma {
useChromeHeadless() useChromeHeadless()
useFirefox() // useFirefox()
} }
} }
} }

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

@ -142,15 +142,9 @@ external interface CSSNumericValue : CSSStyleValue {
} }
} }
external interface CSSUnitValue : CSSNumericValue, StylePropertyValue { open external class CSSUnitValue(value: Number, unit: String) : CSSNumericValue, StylePropertyValue {
val value: Number val value: Number
val unit: String val unit: String
}
@JsName("CSSUnitValue")
external class CSSUnitValueJS(value: Number, unit: String) : CSSNumericValue, CSSUnitValue {
override val value: Number
override val unit: String
override fun add(vararg values: CSSNumberish): CSSNumericValue = definedExternally override fun add(vararg values: CSSNumberish): CSSNumericValue = definedExternally
override fun sub(vararg values: CSSNumberish): CSSNumericValue = definedExternally override fun sub(vararg values: CSSNumberish): CSSNumericValue = definedExternally
override fun mul(vararg values: CSSNumberish): CSSNumericValue = definedExternally override fun mul(vararg values: CSSNumberish): CSSNumericValue = definedExternally

76
web/core/src/jsMain/kotlin/androidx/compose/web/css/CSSUnits.kt

@ -8,44 +8,44 @@ interface CSSFrequencyValue
interface CSSResolutionValue interface CSSResolutionValue
interface CSSFlexValue interface CSSFlexValue
interface CSSpercentValue : CSSUnitValue, CSSRelValue class CSSpercentValue(value: Number) : CSSUnitValue(value, "percent"), CSSRelValue
interface CSSemValue : CSSUnitValue, CSSRelValue class CSSemValue(value: Number) : CSSUnitValue(value, "em"), CSSRelValue
interface CSSexValue : CSSUnitValue, CSSRelValue class CSSexValue(value: Number) : CSSUnitValue(value, "ex"), CSSRelValue
interface CSSchValue : CSSUnitValue, CSSRelValue class CSSchValue(value: Number) : CSSUnitValue(value, "ch"), CSSRelValue
interface CSSicValue : CSSUnitValue, CSSRelValue class CSSicValue(value: Number) : CSSUnitValue(value, "ic"), CSSRelValue
interface CSSremValue : CSSUnitValue, CSSRelValue class CSSremValue(value: Number) : CSSUnitValue(value, "rem"), CSSRelValue
interface CSSlhValue : CSSUnitValue, CSSRelValue class CSSlhValue(value: Number) : CSSUnitValue(value, "lh"), CSSRelValue
interface CSSrlhValue : CSSUnitValue, CSSRelValue class CSSrlhValue(value: Number) : CSSUnitValue(value, "rlh"), CSSRelValue
interface CSSvwValue : CSSUnitValue, CSSRelValue class CSSvwValue(value: Number) : CSSUnitValue(value, "vw"), CSSRelValue
interface CSSvhValue : CSSUnitValue, CSSRelValue class CSSvhValue(value: Number) : CSSUnitValue(value, "vh"), CSSRelValue
interface CSSviValue : CSSUnitValue, CSSRelValue class CSSviValue(value: Number) : CSSUnitValue(value, "vi"), CSSRelValue
interface CSSvbValue : CSSUnitValue, CSSRelValue class CSSvbValue(value: Number) : CSSUnitValue(value, "vb"), CSSRelValue
interface CSSvminValue : CSSUnitValue, CSSRelValue class CSSvminValue(value: Number) : CSSUnitValue(value, "vmin"), CSSRelValue
interface CSSvmaxValue : CSSUnitValue, CSSRelValue class CSSvmaxValue(value: Number) : CSSUnitValue(value, "vmax"), CSSRelValue
interface CSScmValue : CSSUnitValue, CSSRelValue class CSScmValue(value: Number) : CSSUnitValue(value, "cm"), CSSRelValue
interface CSSmmValue : CSSUnitValue, CSSRelValue class CSSmmValue(value: Number) : CSSUnitValue(value, "mm"), CSSRelValue
interface CSSQValue : CSSUnitValue, CSSRelValue class CSSQValue(value: Number) : CSSUnitValue(value, "q"), CSSRelValue
interface CSSptValue : CSSUnitValue, CSSAbsValue class CSSptValue(value: Number) : CSSUnitValue(value, "pt"), CSSAbsValue
interface CSSpcValue : CSSUnitValue, CSSAbsValue class CSSpcValue(value: Number) : CSSUnitValue(value, "pc"), CSSAbsValue
interface CSSpxValue : CSSUnitValue, CSSAbsValue class CSSpxValue(value: Number) : CSSUnitValue(value, "px"), CSSAbsValue
interface CSSdegValue : CSSUnitValue, CSSAngleValue class CSSdegValue(value: Number) : CSSUnitValue(value, "deg"), CSSAngleValue
interface CSSgradValue : CSSUnitValue, CSSAngleValue class CSSgradValue(value: Number) : CSSUnitValue(value, "grad"), CSSAngleValue
interface CSSradValue : CSSUnitValue, CSSAngleValue class CSSradValue(value: Number) : CSSUnitValue(value, "rad"), CSSAngleValue
interface CSSturnValue : CSSUnitValue, CSSAngleValue class CSSturnValue(value: Number) : CSSUnitValue(value, "turn"), CSSAngleValue
interface CSSsValue : CSSUnitValue, CSSTimeValue class CSSsValue(value: Number) : CSSUnitValue(value, "s"), CSSTimeValue
interface CSSmsValue : CSSUnitValue, CSSTimeValue class CSSmsValue(value: Number) : CSSUnitValue(value, "ms"), CSSTimeValue
interface CSSHzValue : CSSUnitValue, CSSFrequencyValue class CSSHzValue(value: Number) : CSSUnitValue(value, "hz"), CSSFrequencyValue
interface CSSkHzValue : CSSUnitValue, CSSFrequencyValue class CSSkHzValue(value: Number) : CSSUnitValue(value, "khz"), CSSFrequencyValue
interface CSSdpiValue : CSSUnitValue, CSSResolutionValue class CSSdpiValue(value: Number) : CSSUnitValue(value, "dpi"), CSSResolutionValue
interface CSSdpcmValue : CSSUnitValue, CSSResolutionValue class CSSdpcmValue(value: Number) : CSSUnitValue(value, "dpcm"), CSSResolutionValue
interface CSSdppxValue : CSSUnitValue, CSSResolutionValue class CSSdppxValue(value: Number) : CSSUnitValue(value, "dppx"), CSSResolutionValue
interface CSSfrValue : CSSUnitValue, CSSFlexValue class CSSfrValue(value: Number) : CSSUnitValue(value, "fr"), CSSFlexValue
val Number.number val Number.number
get(): CSSUnitValue = CSS.number(this) get(): CSSUnitValue = CSS.number(this)

Loading…
Cancel
Save