Move relevant properties from CSSProperties to box.kt, position.kt and flex.kt

This commit is contained in:
Shagen Ogandzhanian
2021-07-08 23:18:31 +02:00
parent d0a2664e62
commit c1fd4bd259
4 changed files with 121 additions and 99 deletions

View File

@@ -2,8 +2,6 @@
package org.jetbrains.compose.web.css
import org.jetbrains.compose.web.css.keywords.CSSAutoKeyword
fun StyleBuilder.opacity(value: Number) {
property("opacity", value)
}
@@ -65,101 +63,4 @@ inline fun CSSBorder.color(color: CSSColorValue) {
fun StyleBuilder.display(displayStyle: DisplayStyle) {
property("display", displayStyle.value)
}
fun StyleBuilder.flexDirection(flexDirection: FlexDirection) {
property("flex-direction", flexDirection.value)
}
fun StyleBuilder.flexWrap(flexWrap: FlexWrap) {
property("flex-wrap", flexWrap.value)
}
fun StyleBuilder.flexFlow(flexDirection: FlexDirection, flexWrap: FlexWrap) {
property(
"flex-flow",
"${flexDirection.value} ${flexWrap.value}"
)
}
fun StyleBuilder.justifyContent(justifyContent: JustifyContent) {
property(
"justify-content",
justifyContent.value
)
}
fun StyleBuilder.alignSelf(alignSelf: AlignSelf) {
property(
"align-self",
alignSelf.value
)
}
fun StyleBuilder.alignItems(alignItems: AlignItems) {
property(
"align-items",
alignItems.value
)
}
fun StyleBuilder.alignContent(alignContent: AlignContent) {
property(
"align-content",
alignContent.value
)
}
fun StyleBuilder.position(position: Position) {
property(
"position",
position.value
)
}
fun StyleBuilder.width(value: CSSNumeric) {
property("width", value)
}
fun StyleBuilder.width(value: CSSAutoKeyword) {
property("width", value)
}
fun StyleBuilder.height(value: CSSNumeric) {
property("height", value)
}
fun StyleBuilder.height(value: CSSAutoKeyword) {
property("height", value)
}
fun StyleBuilder.top(value: CSSLengthOrPercentageValue) {
property("top", value)
}
fun StyleBuilder.top(value: CSSAutoKeyword) {
property("top", value)
}
fun StyleBuilder.bottom(value: CSSLengthOrPercentageValue) {
property("bottom", value)
}
fun StyleBuilder.bottom(value: CSSAutoKeyword) {
property("bottom", value)
}
fun StyleBuilder.left(value: CSSLengthOrPercentageValue) {
property("left", value)
}
fun StyleBuilder.left(value: CSSAutoKeyword) {
property("left", value)
}
fun StyleBuilder.right(value: CSSLengthOrPercentageValue) {
property("right", value)
}
fun StyleBuilder.right(value: CSSAutoKeyword) {
property("right", value)
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.web.css
import org.jetbrains.compose.web.css.keywords.CSSAutoKeyword
fun StyleBuilder.width(value: CSSNumeric) {
property("width", value)
}
fun StyleBuilder.width(value: CSSAutoKeyword) {
property("width", value)
}
fun StyleBuilder.height(value: CSSNumeric) {
property("height", value)
}
fun StyleBuilder.height(value: CSSAutoKeyword) {
property("height", value)
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.web.css
fun StyleBuilder.flexDirection(flexDirection: FlexDirection) {
property("flex-direction", flexDirection.value)
}
fun StyleBuilder.flexWrap(flexWrap: FlexWrap) {
property("flex-wrap", flexWrap.value)
}
fun StyleBuilder.flexFlow(flexDirection: FlexDirection, flexWrap: FlexWrap) {
property(
"flex-flow",
"${flexDirection.value} ${flexWrap.value}"
)
}
fun StyleBuilder.justifyContent(justifyContent: JustifyContent) {
property(
"justify-content",
justifyContent.value
)
}
fun StyleBuilder.alignSelf(alignSelf: AlignSelf) {
property(
"align-self",
alignSelf.value
)
}
fun StyleBuilder.alignItems(alignItems: AlignItems) {
property(
"align-items",
alignItems.value
)
}
fun StyleBuilder.alignContent(alignContent: AlignContent) {
property(
"align-content",
alignContent.value
)
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.web.css
import org.jetbrains.compose.web.css.keywords.CSSAutoKeyword
fun StyleBuilder.position(position: Position) {
property(
"position",
position.value
)
}
fun StyleBuilder.top(value: CSSLengthOrPercentageValue) {
property("top", value)
}
fun StyleBuilder.top(value: CSSAutoKeyword) {
property("top", value)
}
fun StyleBuilder.bottom(value: CSSLengthOrPercentageValue) {
property("bottom", value)
}
fun StyleBuilder.bottom(value: CSSAutoKeyword) {
property("bottom", value)
}
fun StyleBuilder.left(value: CSSLengthOrPercentageValue) {
property("left", value)
}
fun StyleBuilder.left(value: CSSAutoKeyword) {
property("left", value)
}
fun StyleBuilder.right(value: CSSLengthOrPercentageValue) {
property("right", value)
}
fun StyleBuilder.right(value: CSSAutoKeyword) {
property("right", value)
}