Shagen Ogandzhanian
3 years ago
5 changed files with 77 additions and 66 deletions
@ -1,66 +0,0 @@
|
||||
@file:Suppress("Unused", "NOTHING_TO_INLINE") |
||||
|
||||
package org.jetbrains.compose.web.css |
||||
|
||||
fun StyleBuilder.opacity(value: Number) { |
||||
property("opacity", value) |
||||
} |
||||
|
||||
fun StyleBuilder.order(value: Int) { |
||||
property("order", value) |
||||
} |
||||
|
||||
fun StyleBuilder.flexGrow(value: Number) { |
||||
property("flex-grow", value) |
||||
} |
||||
|
||||
fun StyleBuilder.flexShrink(value: Number) { |
||||
property("flex-shrink", value) |
||||
} |
||||
|
||||
fun StyleBuilder.opacity(value: CSSSizeValue<CSSUnit.percent>) { |
||||
property("opacity", (value.value / 100)) |
||||
} |
||||
|
||||
fun StyleBuilder.color(value: String) { |
||||
property("color", value) |
||||
} |
||||
|
||||
fun StyleBuilder.color(value: CSSColorValue) { |
||||
// color hasn't Typed OM yet |
||||
property("color", value) |
||||
} |
||||
|
||||
@Suppress("EqualsOrHashCode") |
||||
class CSSBorder : CSSStyleValue { |
||||
var width: CSSNumeric? = null |
||||
var style: LineStyle? = null |
||||
var color: CSSColorValue? = null |
||||
|
||||
override fun equals(other: Any?): Boolean { |
||||
return if (other is CSSBorder) { |
||||
width == other.width && style == other.style && color == other.color |
||||
} else false |
||||
} |
||||
|
||||
override fun toString(): String { |
||||
val values = listOfNotNull(width, style, color) |
||||
return values.joinToString(" ") |
||||
} |
||||
} |
||||
|
||||
inline fun CSSBorder.width(size: CSSNumeric) { |
||||
width = size |
||||
} |
||||
|
||||
inline fun CSSBorder.style(style: LineStyle) { |
||||
this.style = style |
||||
} |
||||
|
||||
inline fun CSSBorder.color(color: CSSColorValue) { |
||||
this.color = color |
||||
} |
||||
|
||||
fun StyleBuilder.display(displayStyle: DisplayStyle) { |
||||
property("display", displayStyle.value) |
||||
} |
@ -0,0 +1,15 @@
|
||||
/* |
||||
* 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.color(value: String) { |
||||
property("color", value) |
||||
} |
||||
|
||||
fun StyleBuilder.color(value: CSSColorValue) { |
||||
// color hasn't Typed OM yet |
||||
property("color", value) |
||||
} |
@ -0,0 +1,19 @@
|
||||
/* |
||||
* 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.opacity(value: Number) { |
||||
property("opacity", value) |
||||
} |
||||
|
||||
fun StyleBuilder.opacity(value: CSSSizeValue<CSSUnit.percent>) { |
||||
property("opacity", (value.value / 100)) |
||||
} |
||||
|
||||
fun StyleBuilder.display(displayStyle: DisplayStyle) { |
||||
property("display", displayStyle.value) |
||||
} |
||||
|
Loading…
Reference in new issue