v. 1.0.0
Took 1 hour 52 minutes
This commit is contained in:
@@ -1,23 +1,5 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class BorderRadius(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
companion object {
|
||||
fun px(nr: Int) = BorderRadius("${nr}px")
|
||||
fun em(nr: Int) = BorderRadius("${nr}em")
|
||||
fun em(nr: Double) = BorderRadius("${nr}em")
|
||||
fun perc(nr: Int) = BorderRadius("${nr}%")
|
||||
fun perc(nr: Double) = BorderRadius("${nr}%")
|
||||
fun pc(nr: Int) = BorderRadius("${nr}pc")
|
||||
fun pc(nr: Double) = BorderRadius("${nr}pc")
|
||||
fun cm(nr: Int) = BorderRadius("${nr}cm")
|
||||
fun cm(nr: Double) = BorderRadius("${nr}cm")
|
||||
val initial = BorderRadius("initial")
|
||||
val inherit = BorderRadius("inherit")
|
||||
}
|
||||
}
|
||||
|
||||
class BorderStyle(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
@@ -645,18 +645,10 @@ open class Style : CssGenerator() {
|
||||
props["border-bottom-left-radius"] = prp(*radius)
|
||||
}
|
||||
|
||||
fun borderBottomLeftRadius(vararg radius: BorderRadius) {
|
||||
props["border-bottom-left-radius"] = prp(*radius)
|
||||
}
|
||||
|
||||
fun borderBottomRightRadius(vararg radius: Measurement) {
|
||||
props["border-bottom-right-radius"] = prp(*radius)
|
||||
}
|
||||
|
||||
fun borderBottomRightRadius(vararg radius: BorderRadius) {
|
||||
props["border-bottom-right-radius"] = prp(*radius)
|
||||
}
|
||||
|
||||
fun borderBottomStyle(style: BorderStyle) {
|
||||
props["border-bottom-style"] = prp(style)
|
||||
}
|
||||
@@ -795,18 +787,10 @@ open class Style : CssGenerator() {
|
||||
props["border-top-left-radius"] = prp(radius)
|
||||
}
|
||||
|
||||
fun borderTopLeftRadius(radius: BorderRadius) {
|
||||
props["border-top-left-radius"] = prp(radius)
|
||||
}
|
||||
|
||||
fun borderTopRightRadius(radius: Measurement) {
|
||||
props["border-top-right-radius"] = prp(radius)
|
||||
}
|
||||
|
||||
fun borderTopRightRadius(radius: BorderRadius) {
|
||||
props["border-top-right-radius"] = prp(radius)
|
||||
}
|
||||
|
||||
fun borderTopStyle(style: BorderStyle) {
|
||||
props["border-top-style"] = prp(style)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class Examples {
|
||||
}
|
||||
}
|
||||
|
||||
println(css.generateCss())
|
||||
println(css.generateCss(minified = true))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -62,9 +62,8 @@ class Examples {
|
||||
println(css.generateCss())
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testMeasurementss() {
|
||||
fun testMeasurements() {
|
||||
val css = style {
|
||||
select("body") {
|
||||
fontSize(1.2.em)
|
||||
@@ -75,4 +74,58 @@ class Examples {
|
||||
|
||||
println(css.generateCss())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGeneration() {
|
||||
val color = hsla(0, 50, 50, 1.0)
|
||||
val backgroundColor = Color.white
|
||||
|
||||
val css = style {
|
||||
select(cls("button")) {
|
||||
padding(5.px)
|
||||
|
||||
select("a", "span") {
|
||||
color(color)
|
||||
backgroundColor(backgroundColor)
|
||||
|
||||
hover {
|
||||
color(color.lighten(10))
|
||||
backgroundColor(backgroundColor.darken(10))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println(css.generateCss(
|
||||
minified = false,
|
||||
sortProperties = true,
|
||||
combineEqualBlocks = false
|
||||
))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMediaQueries() {
|
||||
val css = style {
|
||||
media("screen and (min-width: 30em)") {
|
||||
select("html", "body") {
|
||||
backgroundColor(Color.purple)
|
||||
color(Color.blue)
|
||||
}
|
||||
}
|
||||
|
||||
media("print") {
|
||||
select("html", "body") {
|
||||
backgroundColor(Color.white)
|
||||
color(Color.darkGrey)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
println(css.generateCss(
|
||||
minified = false,
|
||||
sortProperties = true,
|
||||
combineEqualBlocks = true
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user