Reformat code
This commit is contained in:
@@ -10,7 +10,12 @@ open class Measurement(
|
||||
val inherit = Measurement("inherit")
|
||||
val normal = Measurement("normal")
|
||||
|
||||
fun px(nr: Int) = if (nr == 0) { Measurement("0") } else { Measurement("${nr}px") }
|
||||
fun px(nr: Int) = if (nr == 0) {
|
||||
Measurement("0")
|
||||
} else {
|
||||
Measurement("${nr}px")
|
||||
}
|
||||
|
||||
fun px(nr: Double) = nr.px
|
||||
fun em(nr: Int) = nr.em
|
||||
fun em(nr: Double) = nr.em
|
||||
@@ -24,17 +29,42 @@ open class Measurement(
|
||||
}
|
||||
|
||||
val Int.px: Measurement
|
||||
get() = Measurement("${this}${if (this == 0) { "" } else { "px"}}")
|
||||
get() = Measurement(
|
||||
"${this}${
|
||||
if (this == 0) {
|
||||
""
|
||||
} else {
|
||||
"px"
|
||||
}
|
||||
}"
|
||||
)
|
||||
val Int.em: Measurement
|
||||
get() = Measurement("${this}${if (this == 0) { "" } else { "em"}}")
|
||||
get() = Measurement(
|
||||
"${this}${
|
||||
if (this == 0) {
|
||||
""
|
||||
} else {
|
||||
"em"
|
||||
}
|
||||
}"
|
||||
)
|
||||
val Int.rem: Measurement
|
||||
get() = Measurement("${this}${if (this == 0) { "" } else { "rem"}}")
|
||||
get() = Measurement(
|
||||
"${this}${
|
||||
if (this == 0) {
|
||||
""
|
||||
} else {
|
||||
"rem"
|
||||
}
|
||||
}"
|
||||
)
|
||||
val Int.prc: Measurement
|
||||
get() = Measurement("${this}%")
|
||||
val Int.pc: Measurement
|
||||
get() = Measurement("${this}pc")
|
||||
val Int.cm: Measurement
|
||||
get() = Measurement("${this}cm")
|
||||
|
||||
fun Int.px(): Measurement = Measurement.px(this)
|
||||
|
||||
val Double.px: Measurement
|
||||
@@ -49,6 +79,7 @@ val Double.pc: Measurement
|
||||
get() = Measurement("${this}pc")
|
||||
val Double.cm: Measurement
|
||||
get() = Measurement("${this}cm")
|
||||
|
||||
fun Double.px(): Measurement = Measurement.px(this)
|
||||
|
||||
open class LineHeight(value: String) : CssProperty(value) {
|
||||
|
||||
@@ -15,7 +15,16 @@ class TimingFunction(
|
||||
val initial = TimingFunction("initial")
|
||||
val inherit = TimingFunction("inherit")
|
||||
|
||||
fun steps(steps: Int, start: Boolean) = TimingFunction("steps($steps, ${if (start) { "start" } else { "end" }}")
|
||||
fun steps(steps: Int, start: Boolean) = TimingFunction(
|
||||
"steps($steps, ${
|
||||
if (start) {
|
||||
"start"
|
||||
} else {
|
||||
"end"
|
||||
}
|
||||
}"
|
||||
)
|
||||
|
||||
fun cubicBezier(n1: Double, n2: Double, n3: Double, n4: Double) = TimingFunction("cubic-bezier($n1, $n2, $n3, $n4)")
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class Transform(
|
||||
n5: Double,
|
||||
n6: Double
|
||||
) = Transform("matrix($n1, $n2, $n3, $n4, $n5, $n6)")
|
||||
|
||||
fun matrix3d(
|
||||
n01: Double, n02: Double, n03: Double, n04: Double,
|
||||
n05: Double, n06: Double, n07: Double, n08: Double,
|
||||
@@ -25,6 +26,7 @@ class Transform(
|
||||
) = Transform(
|
||||
"matrix3d($n01, $n02, $n03, $n04, $n05, $n06, $n07, $n08, $n09, $n10, $n11, $n12, $n13, $n14, $n15, $n16)"
|
||||
)
|
||||
|
||||
fun translate(x: Double, y: Double) = Transform("translate($x, $y)")
|
||||
fun translate3d(x: Double, y: Double, z: Double) = Transform("translate3d($x, $y, $z)")
|
||||
fun translateX(x: Double) = Transform("translateX($x)")
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package nl.astraeus.css.style
|
||||
|
||||
import nl.astraeus.css.properties.*
|
||||
import nl.astraeus.css.properties.CssProperty
|
||||
import nl.astraeus.css.properties.FontSize
|
||||
import nl.astraeus.css.properties.FontStretch
|
||||
import nl.astraeus.css.properties.FontStyle
|
||||
import nl.astraeus.css.properties.FontWeight
|
||||
|
||||
@CssTagMarker
|
||||
open class FontFace : CssGenerator() {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,10 @@
|
||||
package nl.astraeus.css
|
||||
|
||||
import nl.astraeus.css.properties.*
|
||||
import nl.astraeus.css.properties.AlignContent
|
||||
import nl.astraeus.css.properties.DelayDuration
|
||||
import nl.astraeus.css.properties.TimingFunction
|
||||
import nl.astraeus.css.properties.hex
|
||||
|
||||
fun main() {
|
||||
val sd = style {
|
||||
select("#pipo") {
|
||||
|
||||
Reference in New Issue
Block a user