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