Reformat code

This commit is contained in:
2021-05-11 17:26:08 +02:00
parent 2b725f6af2
commit c5ba12032d
72 changed files with 2501 additions and 1711 deletions

View File

@@ -8,23 +8,23 @@ import nl.astraeus.css.style.Style
fun css(definition: Css) = definition fun css(definition: Css) = definition
fun style(definition: ConditionalCss): ConditionalStyle { fun style(definition: ConditionalCss): ConditionalStyle {
val css = ConditionalStyle() val css = ConditionalStyle()
definition(css) definition(css)
return css return css
} }
class CssBuilder { class CssBuilder {
var definition: Style = Style() var definition: Style = Style()
fun style(definition: Style.() -> Unit) { fun style(definition: Style.() -> Unit) {
definition(this.definition) definition(this.definition)
} }
fun getCss(minified: Boolean = false): String = definition.generateCss(minified = minified) fun getCss(minified: Boolean = false): String = definition.generateCss(minified = minified)
override fun toString(): String { override fun toString(): String {
return "CssBuilder(${definition.generateCss()})" return "CssBuilder(${definition.generateCss()})"
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class AlignContent( class AlignContent(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val stretch = AlignContent("stretch") val stretch = AlignContent("stretch")
val center = AlignContent("center") val center = AlignContent("center")
val flexStart = AlignContent("flex-start") val flexStart = AlignContent("flex-start")
val flexEnd = AlignContent("flex-end") val flexEnd = AlignContent("flex-end")
val spaceBetween = AlignContent("space-between") val spaceBetween = AlignContent("space-between")
val spaceAround = AlignContent("space-around") val spaceAround = AlignContent("space-around")
val initial = AlignContent("initial") val initial = AlignContent("initial")
val inherit = AlignContent("inherit") val inherit = AlignContent("inherit")
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class AlignItems( class AlignItems(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val stretch = AlignItems("stretch") val stretch = AlignItems("stretch")
val center = AlignItems("center") val center = AlignItems("center")
val flexStart = AlignItems("flex-start") val flexStart = AlignItems("flex-start")
val flexEnd = AlignItems("flex-end") val flexEnd = AlignItems("flex-end")
val baseline = AlignItems("baseline") val baseline = AlignItems("baseline")
val initial = AlignItems("initial") val initial = AlignItems("initial")
val inherit = AlignItems("inherit") val inherit = AlignItems("inherit")
} }
} }

View File

@@ -1,18 +1,18 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class AlignSelf( class AlignSelf(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = AlignSelf("auto") val auto = AlignSelf("auto")
val stretch = AlignSelf("stretch") val stretch = AlignSelf("stretch")
val center = AlignSelf("center") val center = AlignSelf("center")
val flexStart = AlignSelf("flex-start") val flexStart = AlignSelf("flex-start")
val flexEnd = AlignSelf("flex-end") val flexEnd = AlignSelf("flex-end")
val baseline = AlignSelf("baseline") val baseline = AlignSelf("baseline")
val initial = AlignSelf("initial") val initial = AlignSelf("initial")
val inherit = AlignSelf("inherit") val inherit = AlignSelf("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class All( class All(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val unset = All("unset") val unset = All("unset")
val revert = All("revert") val revert = All("revert")
val initial = All("initial") val initial = All("initial")
val inherit = All("inherit") val inherit = All("inherit")
} }
} }

View File

@@ -1,55 +1,55 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class AnimationDirection( class AnimationDirection(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = AnimationDirection("normal") val normal = AnimationDirection("normal")
val reverse = AnimationDirection("reverse") val reverse = AnimationDirection("reverse")
val alternate = AnimationDirection("alternate") val alternate = AnimationDirection("alternate")
val alternateReverse = AnimationDirection("alternate-reverse") val alternateReverse = AnimationDirection("alternate-reverse")
val initial = AnimationDirection("initial") val initial = AnimationDirection("initial")
val inherit = AnimationDirection("inherit") val inherit = AnimationDirection("inherit")
} }
} }
class AnimationFillMode( class AnimationFillMode(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = AnimationFillMode("none") val none = AnimationFillMode("none")
val forwards = AnimationFillMode("forwards") val forwards = AnimationFillMode("forwards")
val backwards = AnimationFillMode("backwards") val backwards = AnimationFillMode("backwards")
val both = AnimationFillMode("both") val both = AnimationFillMode("both")
val initial = AnimationFillMode("initial") val initial = AnimationFillMode("initial")
val inherit = AnimationFillMode("inherit") val inherit = AnimationFillMode("inherit")
} }
} }
class AnimationFrame( class AnimationFrame(
value: String = "" value: String = ""
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
fun name(name: String) = AnimationFrame(name) fun name(name: String) = AnimationFrame(name)
val none: AnimationFrame = AnimationFrame("none") val none: AnimationFrame = AnimationFrame("none")
val initial: AnimationFrame = AnimationFrame("initial") val initial: AnimationFrame = AnimationFrame("initial")
val inherit: AnimationFrame = AnimationFrame("inherit") val inherit: AnimationFrame = AnimationFrame("inherit")
} }
} }
class AnimationPlayState( class AnimationPlayState(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
fun name(name: String) = AnimationPlayState(name) fun name(name: String) = AnimationPlayState(name)
val paused = AnimationPlayState("paused") val paused = AnimationPlayState("paused")
val running = AnimationPlayState("running") val running = AnimationPlayState("running")
val initial = AnimationPlayState("initial") val initial = AnimationPlayState("initial")
val inherit = AnimationPlayState("inherit") val inherit = AnimationPlayState("inherit")
} }
} }

View File

@@ -1,13 +1,13 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class BackfaceVisibility( class BackfaceVisibility(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val visible = BackfaceVisibility("visible") val visible = BackfaceVisibility("visible")
val hidden = BackfaceVisibility("hidden") val hidden = BackfaceVisibility("hidden")
val initial = BackfaceVisibility("initial") val initial = BackfaceVisibility("initial")
val inherit = BackfaceVisibility("inherit") val inherit = BackfaceVisibility("inherit")
} }
} }

View File

@@ -1,79 +1,79 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class BackgroundAttachment( class BackgroundAttachment(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val scroll = BackgroundAttachment("scroll") val scroll = BackgroundAttachment("scroll")
val fixed = BackgroundAttachment("fixed") val fixed = BackgroundAttachment("fixed")
val local = BackgroundAttachment("local") val local = BackgroundAttachment("local")
val initial = BackgroundAttachment("initial") val initial = BackgroundAttachment("initial")
val inherit = BackgroundAttachment("inherit") val inherit = BackgroundAttachment("inherit")
} }
} }
class BackgroundBlendMode( class BackgroundBlendMode(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = BackgroundBlendMode("normal") val normal = BackgroundBlendMode("normal")
val multiply = BackgroundBlendMode("multiply") val multiply = BackgroundBlendMode("multiply")
val screen = BackgroundBlendMode("screen") val screen = BackgroundBlendMode("screen")
val overlay = BackgroundBlendMode("overlay") val overlay = BackgroundBlendMode("overlay")
val darken = BackgroundBlendMode("darken") val darken = BackgroundBlendMode("darken")
val lighten = BackgroundBlendMode("lighten") val lighten = BackgroundBlendMode("lighten")
val colorDodge = BackgroundBlendMode("color-dodge") val colorDodge = BackgroundBlendMode("color-dodge")
val saturation = BackgroundBlendMode("saturation") val saturation = BackgroundBlendMode("saturation")
val color = BackgroundBlendMode("color") val color = BackgroundBlendMode("color")
val luminosity = BackgroundBlendMode("luminosity") val luminosity = BackgroundBlendMode("luminosity")
} }
} }
class BackgroundPosition( class BackgroundPosition(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val left = BackgroundPosition("left") val left = BackgroundPosition("left")
val center = BackgroundPosition("center") val center = BackgroundPosition("center")
val right = BackgroundPosition("right") val right = BackgroundPosition("right")
val initial = BackgroundPosition("initial") val initial = BackgroundPosition("initial")
val inherit = BackgroundPosition("inherit") val inherit = BackgroundPosition("inherit")
} }
} }
class BackgroundRepeat( class BackgroundRepeat(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val repeat = BackgroundRepeat("repeat") val repeat = BackgroundRepeat("repeat")
val repeatX = BackgroundRepeat("repeat-x") val repeatX = BackgroundRepeat("repeat-x")
val repeatY = BackgroundRepeat("repeat-y") val repeatY = BackgroundRepeat("repeat-y")
val noRepeat = BackgroundRepeat("no-repeat") val noRepeat = BackgroundRepeat("no-repeat")
val space = BackgroundRepeat("space") val space = BackgroundRepeat("space")
val round = BackgroundRepeat("round") val round = BackgroundRepeat("round")
val initial = BackgroundRepeat("initial") val initial = BackgroundRepeat("initial")
val inherit = BackgroundRepeat("inherit") val inherit = BackgroundRepeat("inherit")
val unset = BackgroundRepeat("unset") val unset = BackgroundRepeat("unset")
} }
} }
class BackgroundSize( class BackgroundSize(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
fun px(px: Int) = BackgroundSize("${px}px") fun px(px: Int) = BackgroundSize("${px}px")
fun perc(pc: Double) = BackgroundSize("${pc}%") fun perc(pc: Double) = BackgroundSize("${pc}%")
val auto = BackgroundSize("auto") val auto = BackgroundSize("auto")
val cover = BackgroundSize("cover") val cover = BackgroundSize("cover")
val contain = BackgroundSize("contain") val contain = BackgroundSize("contain")
val initial = BackgroundSize("initial") val initial = BackgroundSize("initial")
val inherit = BackgroundSize("inherit") val inherit = BackgroundSize("inherit")
} }
} }

View File

@@ -1,96 +1,96 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class BorderRadius( class BorderRadius(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
fun px(nr: Int) = BorderRadius("${nr}px") fun px(nr: Int) = BorderRadius("${nr}px")
fun em(nr: Int) = BorderRadius("${nr}em") fun em(nr: Int) = BorderRadius("${nr}em")
fun em(nr: Double) = BorderRadius("${nr}em") fun em(nr: Double) = BorderRadius("${nr}em")
fun perc(nr: Int) = BorderRadius("${nr}%") fun perc(nr: Int) = BorderRadius("${nr}%")
fun perc(nr: Double) = BorderRadius("${nr}%") fun perc(nr: Double) = BorderRadius("${nr}%")
fun pc(nr: Int) = BorderRadius("${nr}pc") fun pc(nr: Int) = BorderRadius("${nr}pc")
fun pc(nr: Double) = BorderRadius("${nr}pc") fun pc(nr: Double) = BorderRadius("${nr}pc")
fun cm(nr: Int) = BorderRadius("${nr}cm") fun cm(nr: Int) = BorderRadius("${nr}cm")
fun cm(nr: Double) = BorderRadius("${nr}cm") fun cm(nr: Double) = BorderRadius("${nr}cm")
val initial = BorderRadius("initial") val initial = BorderRadius("initial")
val inherit = BorderRadius("inherit") val inherit = BorderRadius("inherit")
} }
} }
class BorderStyle( class BorderStyle(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = BorderStyle("none") val none = BorderStyle("none")
val hidden = BorderStyle("hidden") val hidden = BorderStyle("hidden")
val dotted = BorderStyle("dotted") val dotted = BorderStyle("dotted")
val dashed = BorderStyle("dashed") val dashed = BorderStyle("dashed")
val solid = BorderStyle("solid") val solid = BorderStyle("solid")
val double = BorderStyle("double") val double = BorderStyle("double")
val groove = BorderStyle("groove") val groove = BorderStyle("groove")
val ridge = BorderStyle("ridge") val ridge = BorderStyle("ridge")
val inset = BorderStyle("inset") val inset = BorderStyle("inset")
val outset = BorderStyle("outset") val outset = BorderStyle("outset")
val initial = BorderStyle("initial") val initial = BorderStyle("initial")
val inherit = BorderStyle("inherit") val inherit = BorderStyle("inherit")
} }
} }
class BorderWidth( class BorderWidth(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val thin = BorderWidth("thin") val thin = BorderWidth("thin")
val medium = BorderWidth("medium") val medium = BorderWidth("medium")
val thick = BorderWidth("thick") val thick = BorderWidth("thick")
val initial = BorderWidth("initial") val initial = BorderWidth("initial")
val inherit = BorderWidth("inherit") val inherit = BorderWidth("inherit")
} }
} }
class BorderCollapse( class BorderCollapse(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val separate = BorderCollapse("separate") val separate = BorderCollapse("separate")
val collapse = BorderCollapse("collapse") val collapse = BorderCollapse("collapse")
} }
} }
class BorderImageWidth ( class BorderImageWidth(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
fun px(nr: Int) = BorderImageWidth("${nr}px") fun px(nr: Int) = BorderImageWidth("${nr}px")
fun nr(nr: Int) = BorderImageWidth("$nr") fun nr(nr: Int) = BorderImageWidth("$nr")
fun perc(nr: Int) = BorderImageWidth("${nr}%") fun perc(nr: Int) = BorderImageWidth("${nr}%")
fun perc(nr: Double) = BorderImageWidth("${nr}%") fun perc(nr: Double) = BorderImageWidth("${nr}%")
val auto = BorderImageWidth("auto") val auto = BorderImageWidth("auto")
val initial = BorderImageWidth("initial") val initial = BorderImageWidth("initial")
val inherit = BorderImageWidth("inherit") val inherit = BorderImageWidth("inherit")
} }
} }
class BorderSpacing( class BorderSpacing(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
fun px(nr: Int) = BorderSpacing("${nr}px") fun px(nr: Int) = BorderSpacing("${nr}px")
fun em(nr: Int) = BorderSpacing("${nr}em") fun em(nr: Int) = BorderSpacing("${nr}em")
fun em(nr: Double) = BorderSpacing("${nr}em") fun em(nr: Double) = BorderSpacing("${nr}em")
fun perc(nr: Int) = BorderSpacing("${nr}%") fun perc(nr: Int) = BorderSpacing("${nr}%")
fun perc(nr: Double) = BorderSpacing("${nr}%") fun perc(nr: Double) = BorderSpacing("${nr}%")
fun pc(nr: Int) = BorderSpacing("${nr}pc") fun pc(nr: Int) = BorderSpacing("${nr}pc")
fun pc(nr: Double) = BorderSpacing("${nr}pc") fun pc(nr: Double) = BorderSpacing("${nr}pc")
fun cm(nr: Int) = BorderSpacing("${nr}cm") fun cm(nr: Int) = BorderSpacing("${nr}cm")
fun cm(nr: Double) = BorderSpacing("${nr}cm") fun cm(nr: Double) = BorderSpacing("${nr}cm")
val initial = BorderSpacing("initial") val initial = BorderSpacing("initial")
val inherit = BorderSpacing("inherit") val inherit = BorderSpacing("inherit")
} }
} }

View File

@@ -1,40 +1,40 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class BoxDecorationBreak( class BoxDecorationBreak(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val slice = BoxDecorationBreak("slice") val slice = BoxDecorationBreak("slice")
val clone = BoxDecorationBreak("clone") val clone = BoxDecorationBreak("clone")
val initial = BoxDecorationBreak("initial") val initial = BoxDecorationBreak("initial")
val inherit = BoxDecorationBreak("inherit") val inherit = BoxDecorationBreak("inherit")
val unset = BoxDecorationBreak("unset") val unset = BoxDecorationBreak("unset")
} }
} }
class BoxShadow( class BoxShadow(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = BoxShadow("none") val none = BoxShadow("none")
val inset = BoxShadow("inset") val inset = BoxShadow("inset")
val initial = BoxShadow("initial") val initial = BoxShadow("initial")
val inherit = BoxShadow("inherit") val inherit = BoxShadow("inherit")
fun text(txt: String) = BoxShadow(txt) fun text(txt: String) = BoxShadow(txt)
} }
} }
class BoxSizing( class BoxSizing(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val contextBox = BoxSizing("content-box") val contextBox = BoxSizing("content-box")
val borderBox = BoxSizing("border-box") val borderBox = BoxSizing("border-box")
val initial = BoxShadow("initial") val initial = BoxShadow("initial")
val inherit = BoxShadow("inherit") val inherit = BoxShadow("inherit")
} }
} }

View File

@@ -2,26 +2,26 @@ package nl.astraeus.css.properties
class Break( class Break(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = Break("auto") val auto = Break("auto")
val all = Break("all") val all = Break("all")
val always = Break("always") val always = Break("always")
val avoid = Break("avoid") val avoid = Break("avoid")
val avoidColumn = Break("avoid-column") val avoidColumn = Break("avoid-column")
val avoidPage = Break("avoid-page") val avoidPage = Break("avoid-page")
val avoidRegion = Break("avoid-region") val avoidRegion = Break("avoid-region")
val column = Break("column") val column = Break("column")
val left = Break("left") val left = Break("left")
val page = Break("page") val page = Break("page")
val recto = Break("recto") val recto = Break("recto")
val region = Break("region") val region = Break("region")
val right = Break("right") val right = Break("right")
val verso = Break("verso") val verso = Break("verso")
val initial = Break("initial") val initial = Break("initial")
val inherit = Break("inherit") val inherit = Break("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class CaptionSide( class CaptionSide(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val top = CaptionSide("top") val top = CaptionSide("top")
val bottom = CaptionSide("bottom") val bottom = CaptionSide("bottom")
val initial = CaptionSide("initial") val initial = CaptionSide("initial")
val inherit = CaptionSide("inherit") val inherit = CaptionSide("inherit")
} }
} }

View File

@@ -2,16 +2,16 @@ package nl.astraeus.css.properties
class Clear( class Clear(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = Clear("none") val none = Clear("none")
val left = Clear("left") val left = Clear("left")
val right = Clear("right") val right = Clear("right")
val both = Clear("both") val both = Clear("both")
val initial = Clear("initial") val initial = Clear("initial")
val inherit = Clear("inherit") val inherit = Clear("inherit")
} }
} }

View File

@@ -1,57 +1,57 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Clip( class Clip(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
fun rect(top: Int, right: Int, bottom: Int, left: Int) = Clip("rect(${top}px,${right}px,${bottom}px,${left}px)") fun rect(top: Int, right: Int, bottom: Int, left: Int) = Clip("rect(${top}px,${right}px,${bottom}px,${left}px)")
val auto = Clip("auto") val auto = Clip("auto")
val initial = Clip("initial") val initial = Clip("initial")
val inherit = Clip("inherit") val inherit = Clip("inherit")
} }
} }
class ClipPath( class ClipPath(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = ClipPath("auto") val auto = ClipPath("auto")
fun circle(perc: Double) = ClipPath("circle(${perc}%)") fun circle(perc: Double) = ClipPath("circle(${perc}%)")
fun ellipse(radiusX: Double, radiusY: Double) = ClipPath("ellipse(${radiusX}%,${radiusY}%)") fun ellipse(radiusX: Double, radiusY: Double) = ClipPath("ellipse(${radiusX}%,${radiusY}%)")
fun ellipse( fun ellipse(
radiusX: Double, radiusX: Double,
radiusY: Double, radiusY: Double,
positionX: Double, positionX: Double,
positionY: Double positionY: Double
) = ClipPath("ellipse(${radiusX}%,${radiusY}% at ${positionX}%,${positionY}%)") ) = ClipPath("ellipse(${radiusX}%,${radiusY}% at ${positionX}%,${positionY}%)")
// todo: other options // todo: other options
fun other(text: String) = ClipPath(text) fun other(text: String) = ClipPath(text)
val marginBox = ClipPath("margin-box") val marginBox = ClipPath("margin-box")
val borderBox = ClipPath("border-box") val borderBox = ClipPath("border-box")
val paddingBox = ClipPath("padding-box") val paddingBox = ClipPath("padding-box")
val contentBox = ClipPath("content-box") val contentBox = ClipPath("content-box")
val fillBox = ClipPath("fill-box") val fillBox = ClipPath("fill-box")
val strokeBox = ClipPath("stroke-box") val strokeBox = ClipPath("stroke-box")
val viewBox = ClipPath("view-box") val viewBox = ClipPath("view-box")
val none = ClipPath("none") val none = ClipPath("none")
} }
} }
class ClipOrigin( class ClipOrigin(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val borderBox = ClipOrigin("border-box") val borderBox = ClipOrigin("border-box")
val paddingBox = ClipOrigin("padding-box") val paddingBox = ClipOrigin("padding-box")
val contentBox = ClipOrigin("content-box") val contentBox = ClipOrigin("content-box")
val initial = ClipOrigin("initial") val initial = ClipOrigin("initial")
val inherit = ClipOrigin("inherit") val inherit = ClipOrigin("inherit")
} }
} }

View File

@@ -1,33 +1,33 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Length( class Length(
value: String value: String
): CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
fun px(nr: Int) = Length("${nr}px") fun px(nr: Int) = Length("${nr}px")
fun em(nr: Int) = Length("${nr}em") fun em(nr: Int) = Length("${nr}em")
fun em(nr: Double) = Length("${nr}em") fun em(nr: Double) = Length("${nr}em")
fun perc(nr: Int) = Length("${nr}%") fun perc(nr: Int) = Length("${nr}%")
fun perc(nr: Double) = Length("${nr}%") fun perc(nr: Double) = Length("${nr}%")
fun pc(nr: Int) = Length("${nr}pc") fun pc(nr: Int) = Length("${nr}pc")
fun pc(nr: Double) = Length("${nr}pc") fun pc(nr: Double) = Length("${nr}pc")
fun cm(nr: Int) = Length("${nr}cm") fun cm(nr: Int) = Length("${nr}cm")
fun cm(nr: Double) = Length("${nr}cm") fun cm(nr: Double) = Length("${nr}cm")
val initial = Length("initial") val initial = Length("initial")
val inherit = Length("inherit") val inherit = Length("inherit")
} }
} }
class Fill( class Fill(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val balance = Fill("balance") val balance = Fill("balance")
val auto = Fill("auto") val auto = Fill("auto")
val initial = Fill("initial") val initial = Fill("initial")
val inherit = Fill("inherit") val inherit = Fill("inherit")
} }
} }

View File

@@ -1,23 +1,23 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Content( class Content(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = Content("normal") val normal = Content("normal")
val none = Content("none") val none = Content("none")
val counter = Content("counter") val counter = Content("counter")
val openQuote = Content("open-quote") val openQuote = Content("open-quote")
val closeQuote = Content("close-quote") val closeQuote = Content("close-quote")
val noOpenQuote = Content("no-open-quote") val noOpenQuote = Content("no-open-quote")
val noCloseQuote = Content("no-close-quote") val noCloseQuote = Content("no-close-quote")
val initial = Content("initial") val initial = Content("initial")
val inherit = Content("inherit") val inherit = Content("inherit")
fun attr(attribute: String) = Content("attr($attribute)") fun attr(attribute: String) = Content("attr($attribute)")
fun string(txt: String) = Content("\"$txt\"") fun string(txt: String) = Content("\"$txt\"")
fun url(url: String) = Content("url($url)") fun url(url: String) = Content("url($url)")
} }
} }

View File

@@ -1,15 +1,15 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Count( class Count(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto: Count = Count("auto") val auto: Count = Count("auto")
val infinite: Count = Count("infinite") val infinite: Count = Count("infinite")
val initial: Count = Count("initial") val initial: Count = Count("initial")
val inherit: Count = Count("inherit") val inherit: Count = Count("inherit")
fun count(number: Int): Count = Count("$number") fun count(number: Int): Count = Count("$number")
} }
} }

View File

@@ -1,15 +1,15 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class CssFloat( class CssFloat(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = CssFloat("none") val none = CssFloat("none")
val left = CssFloat("left") val left = CssFloat("left")
val right = CssFloat("right") val right = CssFloat("right")
val initial = CssFloat("initial") val initial = CssFloat("initial")
val inherit = CssFloat("inherit") val inherit = CssFloat("inherit")
} }
} }

View File

@@ -1,19 +1,19 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
interface CssValue { interface CssValue {
fun css(): String fun css(): String
} }
open class CssProperty( open class CssProperty(
var value: String var value: String
): CssValue { ) : CssValue {
override fun css(): String = value override fun css(): String = value
} }
fun text(value: String) = TextProperty(value) fun text(value: String) = TextProperty(value)
class TextProperty( class TextProperty(
value: String value: String
): CssProperty(value) ) : CssProperty(value)

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class DelayDuration( class DelayDuration(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val initial = DelayDuration("initial") val initial = DelayDuration("initial")
val inherit = DelayDuration("inherit") val inherit = DelayDuration("inherit")
fun seconds(seconds: Int) = DelayDuration("${seconds}s") fun seconds(seconds: Int) = DelayDuration("${seconds}s")
fun millis(milliSeconds: Int) = DelayDuration("${milliSeconds}ms") fun millis(milliSeconds: Int) = DelayDuration("${milliSeconds}ms")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Direction( class Direction(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val ltr = Direction("ltr") val ltr = Direction("ltr")
val rtl = Direction("rtl") val rtl = Direction("rtl")
val initial = Direction("initial") val initial = Direction("initial")
val inherit = Direction("inherit") val inherit = Direction("inherit")
} }
} }

View File

@@ -1,33 +1,33 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Display( class Display(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val inline = Display("inline") val inline = Display("inline")
val block = Display("block") val block = Display("block")
val contents = Display("contents") val contents = Display("contents")
val flex = Display("flex") val flex = Display("flex")
val grid = Display("grid") val grid = Display("grid")
val inlineBlock = Display("inline-block") val inlineBlock = Display("inline-block")
val inlineFlex = Display("inline-flex") val inlineFlex = Display("inline-flex")
val inlineGrid = Display("inline-grid") val inlineGrid = Display("inline-grid")
val inlineTable = Display("inline-table") val inlineTable = Display("inline-table")
val listItem = Display("list-item") val listItem = Display("list-item")
val runIn = Display("run-in") val runIn = Display("run-in")
val table = Display("table") val table = Display("table")
val tableCaption = Display("table-caption") val tableCaption = Display("table-caption")
val tableColumnGroup = Display("table-column-group") val tableColumnGroup = Display("table-column-group")
val tableHeaderGroup = Display("table-header-group") val tableHeaderGroup = Display("table-header-group")
val tableFooterGroup = Display("table-footer-group") val tableFooterGroup = Display("table-footer-group")
val tableRowGroup = Display("table-row-group") val tableRowGroup = Display("table-row-group")
val tableCell = Display("table-cell") val tableCell = Display("table-cell")
val tableColumn = Display("table-column") val tableColumn = Display("table-column")
val tableRow = Display("table-row") val tableRow = Display("table-row")
val none = Display("none") val none = Display("none")
val initial = Display("initial") val initial = Display("initial")
val inherit = Display("inherit") val inherit = Display("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class EmptyCells( class EmptyCells(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val show = EmptyCells("show") val show = EmptyCells("show")
val hide = EmptyCells("hide") val hide = EmptyCells("hide")
val initial = EmptyCells("initial") val initial = EmptyCells("initial")
val inherit = EmptyCells("inherit") val inherit = EmptyCells("inherit")
} }
} }

View File

@@ -1,43 +1,43 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class FlexDirection( class FlexDirection(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val row = FlexDirection("row") val row = FlexDirection("row")
val rowReverse = FlexDirection("row-reverse") val rowReverse = FlexDirection("row-reverse")
val column = FlexDirection("column") val column = FlexDirection("column")
val columnReverse = FlexDirection("column-reverse") val columnReverse = FlexDirection("column-reverse")
val initial = FlexDirection("initial") val initial = FlexDirection("initial")
val inherit = FlexDirection("inherit") val inherit = FlexDirection("inherit")
} }
} }
class FlexGrowShrink( class FlexGrowShrink(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val initial = FlexGrowShrink("initial") val initial = FlexGrowShrink("initial")
val inherit = FlexGrowShrink("inherit") val inherit = FlexGrowShrink("inherit")
fun number(number: Int) = FlexGrowShrink("$number") fun number(number: Int) = FlexGrowShrink("$number")
} }
} }
class FlexWrap( class FlexWrap(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val nowrap = FlexWrap("nowrap") val nowrap = FlexWrap("nowrap")
val wrap = FlexWrap("wrap") val wrap = FlexWrap("wrap")
val wrapReverse = FlexWrap("wrap-reverse") val wrapReverse = FlexWrap("wrap-reverse")
val initial = FlexWrap("initial") val initial = FlexWrap("initial")
val inherit = FlexWrap("inherit") val inherit = FlexWrap("inherit")
} }
} }

View File

@@ -1,142 +1,142 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class FontSize( class FontSize(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val xxSmall = FontSize("xx-small") val xxSmall = FontSize("xx-small")
val xSmall = FontSize("x-small") val xSmall = FontSize("x-small")
val small = FontSize("small") val small = FontSize("small")
val medium = FontSize("medium") val medium = FontSize("medium")
val large = FontSize("large") val large = FontSize("large")
val xLarge = FontSize("x-large") val xLarge = FontSize("x-large")
val xxLarge = FontSize("xx-large") val xxLarge = FontSize("xx-large")
val smaller = FontSize("smaller") val smaller = FontSize("smaller")
val larger = FontSize("larger") val larger = FontSize("larger")
val initial = FontSize("initial") val initial = FontSize("initial")
val inherit = FontSize("inherit") val inherit = FontSize("inherit")
fun px(nr: Int) = FontSize("${nr}px") fun px(nr: Int) = FontSize("${nr}px")
fun em(nr: Int) = FontSize("${nr}em") fun em(nr: Int) = FontSize("${nr}em")
fun em(nr: Double) = FontSize("${nr}em") fun em(nr: Double) = FontSize("${nr}em")
fun perc(nr: Int) = FontSize("${nr}%") fun perc(nr: Int) = FontSize("${nr}%")
fun perc(nr: Double) = FontSize("${nr}%") fun perc(nr: Double) = FontSize("${nr}%")
fun pc(nr: Int) = FontSize("${nr}pc") fun pc(nr: Int) = FontSize("${nr}pc")
fun pc(nr: Double) = FontSize("${nr}pc") fun pc(nr: Double) = FontSize("${nr}pc")
fun cm(nr: Int) = FontSize("${nr}cm") fun cm(nr: Int) = FontSize("${nr}cm")
fun cm(nr: Double) = FontSize("${nr}cm") fun cm(nr: Double) = FontSize("${nr}cm")
} }
} }
class FontStretch( class FontStretch(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = FontStretch("normal") val normal = FontStretch("normal")
val condensed = FontStretch("condensed") val condensed = FontStretch("condensed")
val ultraCondensed = FontStretch("ultra-condensed") val ultraCondensed = FontStretch("ultra-condensed")
val extraCondensed = FontStretch("extra-condensed") val extraCondensed = FontStretch("extra-condensed")
val semiCondensed = FontStretch("semi-condensed") val semiCondensed = FontStretch("semi-condensed")
val expanded = FontStretch("expanded") val expanded = FontStretch("expanded")
val semiExpanded = FontStretch("semi-expanded") val semiExpanded = FontStretch("semi-expanded")
val extraExpanded = FontStretch("extra-expanded") val extraExpanded = FontStretch("extra-expanded")
val ultraExpanded = FontStretch("ultra-expanded") val ultraExpanded = FontStretch("ultra-expanded")
val initial = FontWeight("initial") val initial = FontWeight("initial")
val inherit = FontWeight("inherit") val inherit = FontWeight("inherit")
} }
} }
class FontStyle( class FontStyle(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = FontStyle("normal") val normal = FontStyle("normal")
val italic = FontStyle("italic") val italic = FontStyle("italic")
val oblique = FontStyle("oblique") val oblique = FontStyle("oblique")
val initial = FontStyle("initial") val initial = FontStyle("initial")
val inherit = FontStyle("inherit") val inherit = FontStyle("inherit")
} }
} }
class FontWeight( class FontWeight(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = FontWeight("normal") val normal = FontWeight("normal")
val bold = FontWeight("bold") val bold = FontWeight("bold")
val _100 = FontWeight("100") val _100 = FontWeight("100")
val _200 = FontWeight("200") val _200 = FontWeight("200")
val _300 = FontWeight("300") val _300 = FontWeight("300")
val _400 = FontWeight("400") val _400 = FontWeight("400")
val _500 = FontWeight("500") val _500 = FontWeight("500")
val _600 = FontWeight("600") val _600 = FontWeight("600")
val _700 = FontWeight("700") val _700 = FontWeight("700")
val _800 = FontWeight("800") val _800 = FontWeight("800")
val _900 = FontWeight("900") val _900 = FontWeight("900")
val initial = FontWeight("initial") val initial = FontWeight("initial")
val inherit = FontWeight("inherit") val inherit = FontWeight("inherit")
} }
} }
class FontKerning( class FontKerning(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = FontKerning("auto") val auto = FontKerning("auto")
val normal = FontKerning("normal") val normal = FontKerning("normal")
val none = FontKerning("none") val none = FontKerning("none")
} }
} }
class FontSizeAdjust( class FontSizeAdjust(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = FontSizeAdjust("none") val none = FontSizeAdjust("none")
val initial = FontSizeAdjust("initial") val initial = FontSizeAdjust("initial")
val inherit = FontSizeAdjust("inherit") val inherit = FontSizeAdjust("inherit")
} }
} }
class FontVariant( class FontVariant(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = FontVariant("normal") val normal = FontVariant("normal")
val smallCaps = FontVariant("small-caps") val smallCaps = FontVariant("small-caps")
val initial = FontVariant("initial") val initial = FontVariant("initial")
val inherit = FontVariant("inherit") val inherit = FontVariant("inherit")
} }
} }
class FontVariantCaps( class FontVariantCaps(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = FontVariantCaps("normal") val normal = FontVariantCaps("normal")
val smallCaps = FontVariantCaps("small-caps") val smallCaps = FontVariantCaps("small-caps")
val allSmallCaps = FontVariantCaps("all-small-caps") val allSmallCaps = FontVariantCaps("all-small-caps")
val petiteCaps = FontVariantCaps("petite-caps") val petiteCaps = FontVariantCaps("petite-caps")
val allPetiteCaps = FontVariantCaps("all-petite-caps") val allPetiteCaps = FontVariantCaps("all-petite-caps")
val unicase = FontVariantCaps("unicase") val unicase = FontVariantCaps("unicase")
val initial = FontVariantCaps("initial") val initial = FontVariantCaps("initial")
val inherit = FontVariantCaps("inherit") val inherit = FontVariantCaps("inherit")
val unset = FontVariantCaps("unset") val unset = FontVariantCaps("unset")
} }
} }

View File

@@ -2,71 +2,71 @@ package nl.astraeus.css.properties
class Grid( class Grid(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = Grid("none") val none = Grid("none")
val initial = Grid("initial") val initial = Grid("initial")
val inherit = Grid("inherit") val inherit = Grid("inherit")
} }
} }
class GridAuto( class GridAuto(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = GridAuto("auto") val auto = GridAuto("auto")
val maxContent = GridAuto("max-content") val maxContent = GridAuto("max-content")
val minContent = GridAuto("min-content") val minContent = GridAuto("min-content")
} }
} }
class GridFlow( class GridFlow(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val row = GridFlow("row") val row = GridFlow("row")
val column = GridFlow("column") val column = GridFlow("column")
val dense = GridFlow("dense") val dense = GridFlow("dense")
val rowDense = GridFlow("row dense") val rowDense = GridFlow("row dense")
val columnDense = GridFlow("column dense") val columnDense = GridFlow("column dense")
} }
} }
class GridValue( class GridValue(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = GridValue("auto") val auto = GridValue("auto")
fun span(column: Int) = GridValue("span $column") fun span(column: Int) = GridValue("span $column")
fun column(line: Int) = GridValue("$line") fun column(line: Int) = GridValue("$line")
fun row(line: Int) = GridValue("$line") fun row(line: Int) = GridValue("$line")
} }
} }
class TemplateRowColumn( class TemplateRowColumn(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = GridValue("none") val none = GridValue("none")
val auto = GridValue("auto") val auto = GridValue("auto")
val maxContent = GridValue("max-content") val maxContent = GridValue("max-content")
val minContent = GridValue("min-content") val minContent = GridValue("min-content")
val initial = GridValue("initial") val initial = GridValue("initial")
val inherit = GridValue("inherit") val inherit = GridValue("inherit")
fun length(length: Measurement) = GridValue(length.value) fun length(length: Measurement) = GridValue(length.value)
} }
} }

View File

@@ -1,15 +1,15 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Hyphens( class Hyphens(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = Hyphens("none") val none = Hyphens("none")
val manual = Hyphens("manual") val manual = Hyphens("manual")
val auto = Hyphens("auto") val auto = Hyphens("auto")
val initial = Hyphens("initial") val initial = Hyphens("initial")
val inherit = Hyphens("inherit") val inherit = Hyphens("inherit")
} }
} }

View File

@@ -1,62 +1,62 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Image( class Image(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = Image("none") val none = Image("none")
val initial = Image("initial") val initial = Image("initial")
val inherit = Image("inherit") val inherit = Image("inherit")
fun url(url: String) = Image("url($url)") fun url(url: String) = Image("url($url)")
} }
} }
class ImageRepeat( class ImageRepeat(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val repeat = ImageRepeat("repeat") val repeat = ImageRepeat("repeat")
val round = ImageRepeat("round") val round = ImageRepeat("round")
val initial = ImageRepeat("initial") val initial = ImageRepeat("initial")
val inherit = ImageRepeat("inherit") val inherit = ImageRepeat("inherit")
fun stretch(url: String) = ImageRepeat("stretch") fun stretch(url: String) = ImageRepeat("stretch")
} }
} }
class ImageSlice( class ImageSlice(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val repeat = ImageSlice("repeat") val repeat = ImageSlice("repeat")
val fill = ImageSlice("fill") val fill = ImageSlice("fill")
val initial = ImageSlice("initial") val initial = ImageSlice("initial")
val inherit = ImageSlice("inherit") val inherit = ImageSlice("inherit")
fun nr(nr: Int) = ImageSlice("$nr") fun nr(nr: Int) = ImageSlice("$nr")
fun perc(perc: Int) = ImageSlice("$perc%") fun perc(perc: Int) = ImageSlice("$perc%")
fun perc(perc: Double) = ImageSlice("$perc%") fun perc(perc: Double) = ImageSlice("$perc%")
fun stretch(url: String) = ImageSlice("stretch") fun stretch(url: String) = ImageSlice("stretch")
} }
} }
class ImageSource( class ImageSource(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = ImageSource("none") val none = ImageSource("none")
val initial = ImageSource("initial") val initial = ImageSource("initial")
val inherit = ImageSource("inherit") val inherit = ImageSource("inherit")
fun text(txt: String) = ImageSource(txt) fun text(txt: String) = ImageSource(txt)
fun image(url: String) = ImageSource("'$url'") fun image(url: String) = ImageSource("'$url'")
} }
} }

View File

@@ -1,12 +1,12 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class InitialInherit( class InitialInherit(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val initial = InitialInherit("initial") val initial = InitialInherit("initial")
val inherit = InitialInherit("inherit") val inherit = InitialInherit("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Isolation( class Isolation(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = Isolation("auto") val auto = Isolation("auto")
val isolate = Isolation("isolate") val isolate = Isolation("isolate")
val initial = Isolation("initial") val initial = Isolation("initial")
val inherit = Isolation("inherit") val inherit = Isolation("inherit")
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class JustifyContent( class JustifyContent(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val flexStart = JustifyContent("flex-start") val flexStart = JustifyContent("flex-start")
val flexEnd = JustifyContent("flex-end") val flexEnd = JustifyContent("flex-end")
val center = JustifyContent("center") val center = JustifyContent("center")
val spaceBetween = JustifyContent("space-between") val spaceBetween = JustifyContent("space-between")
val spaceAround = JustifyContent("space-around") val spaceAround = JustifyContent("space-around")
val initial = JustifyContent("initial") val initial = JustifyContent("initial")
val inherit = JustifyContent("inherit") val inherit = JustifyContent("inherit")
} }
} }

View File

@@ -1,13 +1,13 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class LetterSpacing( class LetterSpacing(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = LetterSpacing("normal") val normal = LetterSpacing("normal")
val initial = LetterSpacing("initial") val initial = LetterSpacing("initial")
val inherit = LetterSpacing("inherit") val inherit = LetterSpacing("inherit")
} }
} }

View File

@@ -2,47 +2,47 @@ package nl.astraeus.css.properties
class ListStylePosition( class ListStylePosition(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val inside = ListStylePosition("inside") val inside = ListStylePosition("inside")
val outside = ListStylePosition("outside") val outside = ListStylePosition("outside")
val initial = ListStylePosition("initial") val initial = ListStylePosition("initial")
val inherit = ListStylePosition("inherit") val inherit = ListStylePosition("inherit")
} }
} }
class ListStyleType( class ListStyleType(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val disc = ListStyleType("disc") val disc = ListStyleType("disc")
val armenian = ListStyleType("armenian") val armenian = ListStyleType("armenian")
val circle = ListStyleType("circle") val circle = ListStyleType("circle")
val cjkIdeographic = ListStyleType("cjk-ideographic") val cjkIdeographic = ListStyleType("cjk-ideographic")
val decimal = ListStyleType("decimal") val decimal = ListStyleType("decimal")
val decimalLeadingZero = ListStyleType("decimal-leading-zero") val decimalLeadingZero = ListStyleType("decimal-leading-zero")
val georgian = ListStyleType("georgian") val georgian = ListStyleType("georgian")
val hebrew = ListStyleType("hebrew") val hebrew = ListStyleType("hebrew")
val hiragana = ListStyleType("hiragana") val hiragana = ListStyleType("hiragana")
val hiraganaIroha = ListStyleType("hiragana-iroha") val hiraganaIroha = ListStyleType("hiragana-iroha")
val katakana = ListStyleType("katakana") val katakana = ListStyleType("katakana")
val katakanaIroha = ListStyleType("katakana-iroha") val katakanaIroha = ListStyleType("katakana-iroha")
val lowerAlpha = ListStyleType("lower-alpha") val lowerAlpha = ListStyleType("lower-alpha")
val lowerGreek = ListStyleType("lower-greek") val lowerGreek = ListStyleType("lower-greek")
val lowerLatin = ListStyleType("lower-latin") val lowerLatin = ListStyleType("lower-latin")
val lowerRoman = ListStyleType("lower-roman") val lowerRoman = ListStyleType("lower-roman")
val none = ListStyleType("none") val none = ListStyleType("none")
val square = ListStyleType("square") val square = ListStyleType("square")
val upperAlpha = ListStyleType("upper-alpha") val upperAlpha = ListStyleType("upper-alpha")
val upperGreek = ListStyleType("upper-greek") val upperGreek = ListStyleType("upper-greek")
val upperLatin = ListStyleType("upper-latin") val upperLatin = ListStyleType("upper-latin")
val upperRoman = ListStyleType("upper-roman") val upperRoman = ListStyleType("upper-roman")
val initial = ListStyleType("initial") val initial = ListStyleType("initial")
val inherit = ListStyleType("inherit") val inherit = ListStyleType("inherit")
} }
} }

View File

@@ -1,60 +1,91 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
open class Measurement( open class Measurement(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = Measurement("auto") val auto = Measurement("auto")
val initial = Measurement("initial") val initial = Measurement("initial")
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) {
fun px(nr: Double) = nr.px Measurement("0")
fun em(nr: Int) = nr.em } else {
fun em(nr: Double) = nr.em Measurement("${nr}px")
fun prc(nr: Int) = nr.prc
fun prc(nr: Double) = nr.prc
fun pc(nr: Int) = nr.pc
fun pc(nr: Double) = nr.pc
fun cm(nr: Int) = nr.cm
fun cm(nr: Double) = nr.cm
} }
fun px(nr: Double) = nr.px
fun em(nr: Int) = nr.em
fun em(nr: Double) = nr.em
fun prc(nr: Int) = nr.prc
fun prc(nr: Double) = nr.prc
fun pc(nr: Int) = nr.pc
fun pc(nr: Double) = nr.pc
fun cm(nr: Int) = nr.cm
fun cm(nr: Double) = nr.cm
}
} }
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
get() = Measurement("${this}px") get() = Measurement("${this}px")
val Double.em: Measurement val Double.em: Measurement
get() = Measurement("${this}em") get() = Measurement("${this}em")
val Double.rem: Measurement val Double.rem: Measurement
get() = Measurement("${this}rem") get() = Measurement("${this}rem")
val Double.prc: Measurement val Double.prc: Measurement
get() = Measurement("${this}%") get() = Measurement("${this}%")
val Double.pc: Measurement 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) {
companion object { companion object {
val normal = LineHeight("normal") val normal = LineHeight("normal")
val initial = LineHeight("initial") val initial = LineHeight("initial")
val inherit = LineHeight("inherit") val inherit = LineHeight("inherit")
} }
} }

View File

@@ -2,24 +2,24 @@ package nl.astraeus.css.properties
class MixBlendMode( class MixBlendMode(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = MixBlendMode("normal") val normal = MixBlendMode("normal")
val multiply = MixBlendMode("multiply") val multiply = MixBlendMode("multiply")
val screen = MixBlendMode("screen") val screen = MixBlendMode("screen")
val overlay = MixBlendMode("overlay") val overlay = MixBlendMode("overlay")
val darken = MixBlendMode("darken") val darken = MixBlendMode("darken")
val lighten = MixBlendMode("lighten") val lighten = MixBlendMode("lighten")
val colorDodge = MixBlendMode("color-dodge") val colorDodge = MixBlendMode("color-dodge")
val colorBurn = MixBlendMode("color-burn") val colorBurn = MixBlendMode("color-burn")
val difference = MixBlendMode("difference") val difference = MixBlendMode("difference")
val exclusion = MixBlendMode("exclusion") val exclusion = MixBlendMode("exclusion")
val hue = MixBlendMode("hue") val hue = MixBlendMode("hue")
val saturation = MixBlendMode("saturation") val saturation = MixBlendMode("saturation")
val color = MixBlendMode("color") val color = MixBlendMode("color")
val luminosity = MixBlendMode("luminosity") val luminosity = MixBlendMode("luminosity")
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class ObjectFit( class ObjectFit(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val fill = ObjectFit("fill") val fill = ObjectFit("fill")
val contain = ObjectFit("contain") val contain = ObjectFit("contain")
val cover = ObjectFit("cover") val cover = ObjectFit("cover")
val scaleDown = ObjectFit("scale-down") val scaleDown = ObjectFit("scale-down")
val none = ObjectFit("none") val none = ObjectFit("none")
val initial = ObjectFit("initial") val initial = ObjectFit("initial")
val inherit = ObjectFit("inherit") val inherit = ObjectFit("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class OutlineWidth( class OutlineWidth(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val thin = OutlineWidth("thin") val thin = OutlineWidth("thin")
val medium = OutlineWidth("medium") val medium = OutlineWidth("medium")
val thick = OutlineWidth("thick") val thick = OutlineWidth("thick")
val initial = BorderWidth("initial") val initial = BorderWidth("initial")
val inherit = BorderWidth("inherit") val inherit = BorderWidth("inherit")
} }
} }

View File

@@ -1,15 +1,15 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Overflow( class Overflow(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val visible = Overflow("visible") val visible = Overflow("visible")
val hidden = Overflow("hidden") val hidden = Overflow("hidden")
val scroll = Overflow("scroll") val scroll = Overflow("scroll")
val auto = Overflow("auto") val auto = Overflow("auto")
val initial = BorderWidth("initial") val initial = BorderWidth("initial")
val inherit = BorderWidth("inherit") val inherit = BorderWidth("inherit")
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class PageBreak( class PageBreak(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = PageBreak("auto") val auto = PageBreak("auto")
val always = PageBreak("always") val always = PageBreak("always")
val avoid = PageBreak("avoid") val avoid = PageBreak("avoid")
val left = PageBreak("left") val left = PageBreak("left")
val right = PageBreak("right") val right = PageBreak("right")
val initial = PageBreak("initial") val initial = PageBreak("initial")
val inherit = PageBreak("inherit") val inherit = PageBreak("inherit")
} }
} }

View File

@@ -1,13 +1,13 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Perspective( class Perspective(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = Perspective("none") val none = Perspective("none")
val initial = Perspective("initial") val initial = Perspective("initial")
val inherit = Perspective("inherit") val inherit = Perspective("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class PointerEvents( class PointerEvents(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = PointerEvents("auto") val auto = PointerEvents("auto")
val none = PointerEvents("none") val none = PointerEvents("none")
val initial = PointerEvents("initial") val initial = PointerEvents("initial")
val inherit = PointerEvents("inherit") val inherit = PointerEvents("inherit")
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Position( class Position(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val static = Position("static") val static = Position("static")
val absolute = Position("absolute") val absolute = Position("absolute")
val fixed = Position("fixed") val fixed = Position("fixed")
val relative = Position("relative") val relative = Position("relative")
val sticky = Position("sticky") val sticky = Position("sticky")
val initial = Position("initial") val initial = Position("initial")
val inherit = Position("inherit") val inherit = Position("inherit")
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class HangingPunctuation( class HangingPunctuation(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = HangingPunctuation("none") val none = HangingPunctuation("none")
val first = HangingPunctuation("first") val first = HangingPunctuation("first")
val last = HangingPunctuation("last") val last = HangingPunctuation("last")
val allowEnd = HangingPunctuation("allow-end") val allowEnd = HangingPunctuation("allow-end")
val forceEnd = HangingPunctuation("force-end") val forceEnd = HangingPunctuation("force-end")
val initial = HangingPunctuation("initial") val initial = HangingPunctuation("initial")
val inherit = HangingPunctuation("inherit") val inherit = HangingPunctuation("inherit")
} }
} }

View File

@@ -1,16 +1,16 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Resize( class Resize(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = Resize("none") val none = Resize("none")
val both = Resize("both") val both = Resize("both")
val horizontal = Resize("horizontal") val horizontal = Resize("horizontal")
val vertical = Resize("vertical") val vertical = Resize("vertical")
val initial = Resize("initial") val initial = Resize("initial")
val inherit = Resize("inherit") val inherit = Resize("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class ScrollBehavior( class ScrollBehavior(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = ScrollBehavior("auto") val auto = ScrollBehavior("auto")
val smooth = ScrollBehavior("smooth") val smooth = ScrollBehavior("smooth")
val initial = ScrollBehavior("initial") val initial = ScrollBehavior("initial")
val inherit = ScrollBehavior("inherit") val inherit = ScrollBehavior("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Span( class Span(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = Clip("none") val none = Clip("none")
val all = Clip("all") val all = Clip("all")
val initial = Clip("initial") val initial = Clip("initial")
val inherit = Clip("inherit") val inherit = Clip("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TableLayout( class TableLayout(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = TableLayout("auto") val auto = TableLayout("auto")
val fixed = TableLayout("fixed") val fixed = TableLayout("fixed")
val initial = TableLayout("initial") val initial = TableLayout("initial")
val inherit = TableLayout("auto") val inherit = TableLayout("auto")
} }
} }

View File

@@ -1,16 +1,16 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TextAlign( class TextAlign(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val left = TextAlign("left") val left = TextAlign("left")
val right = TextAlign("right") val right = TextAlign("right")
val center = TextAlign("center") val center = TextAlign("center")
val justify = TextAlign("justify") val justify = TextAlign("justify")
val initial = TextAlign("initial") val initial = TextAlign("initial")
val inherit = TextAlign("inherit") val inherit = TextAlign("inherit")
} }
} }

View File

@@ -1,19 +1,19 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TextAlignLast( class TextAlignLast(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = TextAlignLast("auto") val auto = TextAlignLast("auto")
val left = TextAlignLast("left") val left = TextAlignLast("left")
val right = TextAlignLast("right") val right = TextAlignLast("right")
val center = TextAlignLast("center") val center = TextAlignLast("center")
val justify = TextAlignLast("justify") val justify = TextAlignLast("justify")
val start = TextAlignLast("start") val start = TextAlignLast("start")
val end = TextAlignLast("end") val end = TextAlignLast("end")
val initial = TextAlignLast("initial") val initial = TextAlignLast("initial")
val inherit = TextAlignLast("inherit") val inherit = TextAlignLast("inherit")
} }
} }

View File

@@ -1,16 +1,16 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TextDecorationLine( class TextDecorationLine(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = TextDecorationLine("none") val none = TextDecorationLine("none")
val underline = TextDecorationLine("underline") val underline = TextDecorationLine("underline")
val overline = TextDecorationLine("overline") val overline = TextDecorationLine("overline")
val lineThrough = TextDecorationLine("line-through") val lineThrough = TextDecorationLine("line-through")
val initial = TextDecorationLine("initial") val initial = TextDecorationLine("initial")
val inherit = TextDecorationLine("inherit") val inherit = TextDecorationLine("inherit")
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TextDecorationStyle( class TextDecorationStyle(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val solid = TextDecorationStyle("solid") val solid = TextDecorationStyle("solid")
val double = TextDecorationStyle("double") val double = TextDecorationStyle("double")
val dotted = TextDecorationStyle("dotted") val dotted = TextDecorationStyle("dotted")
val dashed = TextDecorationStyle("dashed") val dashed = TextDecorationStyle("dashed")
val wavy = TextDecorationStyle("wavy") val wavy = TextDecorationStyle("wavy")
val initial = TextDecorationStyle("initial") val initial = TextDecorationStyle("initial")
val inherit = TextDecorationStyle("inherit") val inherit = TextDecorationStyle("inherit")
} }
} }

View File

@@ -1,16 +1,16 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TextJustify( class TextJustify(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = TextJustify("auto") val auto = TextJustify("auto")
val interWord = TextJustify("inter-word") val interWord = TextJustify("inter-word")
val interCharacter = TextJustify("inter-character") val interCharacter = TextJustify("inter-character")
val none = TextJustify("none") val none = TextJustify("none")
val initial = TextJustify("initial") val initial = TextJustify("initial")
val inherit = TextJustify("inherit") val inherit = TextJustify("inherit")
} }
} }

View File

@@ -1,16 +1,16 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TextTransform( class TextTransform(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = TextTransform("none") val none = TextTransform("none")
val capitalize = TextTransform("capitalize") val capitalize = TextTransform("capitalize")
val uppercase = TextTransform("uppercase") val uppercase = TextTransform("uppercase")
val lowercase = TextTransform("lowercase") val lowercase = TextTransform("lowercase")
val initial = TextTransform("initial") val initial = TextTransform("initial")
val inherit = TextTransform("inherit") val inherit = TextTransform("inherit")
} }
} }

View File

@@ -1,22 +1,31 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TimingFunction( class TimingFunction(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val linear = TimingFunction("linear") val linear = TimingFunction("linear")
val ease = TimingFunction("ease") val ease = TimingFunction("ease")
val easeIn = TimingFunction("ease-in") val easeIn = TimingFunction("ease-in")
val easeOut = TimingFunction("ease-out") val easeOut = TimingFunction("ease-out")
val easeInOut = TimingFunction("ease-in-out") val easeInOut = TimingFunction("ease-in-out")
val stepStart = TimingFunction("step-start") val stepStart = TimingFunction("step-start")
val stepEnd = TimingFunction("step-end") val stepEnd = TimingFunction("step-end")
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(
fun cubicBezier(n1: Double, n2: Double, n3: Double, n4: Double) = TimingFunction("cubic-bezier($n1, $n2, $n3, $n4)") "steps($steps, ${
} if (start) {
"start"
} else {
"end"
}
}"
)
fun cubicBezier(n1: Double, n2: Double, n3: Double, n4: Double) = TimingFunction("cubic-bezier($n1, $n2, $n3, $n4)")
}
} }

View File

@@ -1,49 +1,51 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Transform( class Transform(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val none = Transform("none") val none = Transform("none")
val initial = Transform("initial") val initial = Transform("initial")
val inherit = Transform("inherit") val inherit = Transform("inherit")
fun matrix( fun matrix(
n1: Double, n1: Double,
n2: Double, n2: Double,
n3: Double, n3: Double,
n4: Double, n4: Double,
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(
n01: Double, n02: Double, n03: Double, n04: Double, fun matrix3d(
n05: Double, n06: Double, n07: Double, n08: Double, n01: Double, n02: Double, n03: Double, n04: Double,
n09: Double, n10: Double, n11: Double, n12: Double, n05: Double, n06: Double, n07: Double, n08: Double,
n13: Double, n14: Double, n15: Double, n16: Double n09: Double, n10: Double, n11: Double, n12: Double,
) = Transform( n13: Double, n14: Double, n15: Double, n16: Double
"matrix3d($n01, $n02, $n03, $n04, $n05, $n06, $n07, $n08, $n09, $n10, $n11, $n12, $n13, $n14, $n15, $n16)" ) = 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)") fun translate(x: Double, y: Double) = Transform("translate($x, $y)")
fun translateY(y: Double) = Transform("translateY($y)") fun translate3d(x: Double, y: Double, z: Double) = Transform("translate3d($x, $y, $z)")
fun translateZ(z: Double) = Transform("translateZ($z)") fun translateX(x: Double) = Transform("translateX($x)")
fun scale(x: Double, y: Double) = Transform("scale($x, $y)") fun translateY(y: Double) = Transform("translateY($y)")
fun scale3d(x: Double, y: Double, z: Double) = Transform("scale3d($x, $y, $z)") fun translateZ(z: Double) = Transform("translateZ($z)")
fun scaleX(x: Double) = Transform("scaleX($x)") fun scale(x: Double, y: Double) = Transform("scale($x, $y)")
fun scaleY(y: Double) = Transform("scaleY($y)") fun scale3d(x: Double, y: Double, z: Double) = Transform("scale3d($x, $y, $z)")
fun scaleZ(z: Double) = Transform("scaleZ($z)") fun scaleX(x: Double) = Transform("scaleX($x)")
fun rotate(angle: Double) = Transform("rotate($angle)") fun scaleY(y: Double) = Transform("scaleY($y)")
fun rotate3d(x: Double, y: Double, z: Double, angle: Double) = Transform("scale3d($x, $y, $z, $angle") fun scaleZ(z: Double) = Transform("scaleZ($z)")
fun rotateX(x: Double) = Transform("rotateX($x)") fun rotate(angle: Double) = Transform("rotate($angle)")
fun rotateY(y: Double) = Transform("rotateY($y)") fun rotate3d(x: Double, y: Double, z: Double, angle: Double) = Transform("scale3d($x, $y, $z, $angle")
fun rotateZ(z: Double) = Transform("rotateZ($z)") fun rotateX(x: Double) = Transform("rotateX($x)")
fun skew(x: Double, y: Double) = Transform("skew($x, $y)") fun rotateY(y: Double) = Transform("rotateY($y)")
fun skewX(x: Double) = Transform("skew($x)") fun rotateZ(z: Double) = Transform("rotateZ($z)")
fun skewY(y: Double) = Transform("skew($y)") fun skew(x: Double, y: Double) = Transform("skew($x, $y)")
fun perspective(length: Measurement) = Transform("perspective(${length.css()})") fun skewX(x: Double) = Transform("skew($x)")
} fun skewY(y: Double) = Transform("skew($y)")
fun perspective(length: Measurement) = Transform("perspective(${length.css()})")
}
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class TransformStyle( class TransformStyle(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val flat = TransformStyle("flat") val flat = TransformStyle("flat")
val preserve3d = TransformStyle("preserve-3d") val preserve3d = TransformStyle("preserve-3d")
val initial = TransformStyle("initial") val initial = TransformStyle("initial")
val inherit = TransformStyle("inherit") val inherit = TransformStyle("inherit")
} }
} }

View File

@@ -1,15 +1,15 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class UnicodeBidi( class UnicodeBidi(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = UnicodeBidi("normal") val normal = UnicodeBidi("normal")
val embed = UnicodeBidi("embed") val embed = UnicodeBidi("embed")
val bidiOverride = UnicodeBidi("bidi-override") val bidiOverride = UnicodeBidi("bidi-override")
val initial = UnicodeBidi("initial") val initial = UnicodeBidi("initial")
val inherit = UnicodeBidi("inherit") val inherit = UnicodeBidi("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class UserSelect( class UserSelect(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = UserSelect("auto") val auto = UserSelect("auto")
val none = UserSelect("none") val none = UserSelect("none")
val text = UserSelect("text") val text = UserSelect("text")
val all = UserSelect("all") val all = UserSelect("all")
} }
} }

View File

@@ -1,20 +1,20 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class VerticalAlign( class VerticalAlign(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val baseline = VerticalAlign("baseline") val baseline = VerticalAlign("baseline")
val sub = VerticalAlign("sub") val sub = VerticalAlign("sub")
val _super = VerticalAlign("super") val _super = VerticalAlign("super")
val top = VerticalAlign("top") val top = VerticalAlign("top")
val textTop = VerticalAlign("text-top") val textTop = VerticalAlign("text-top")
val middle = VerticalAlign("middle") val middle = VerticalAlign("middle")
val bottom = VerticalAlign("bottom") val bottom = VerticalAlign("bottom")
val textBottom = VerticalAlign("text-bottom") val textBottom = VerticalAlign("text-bottom")
val initial = VerticalAlign("initial") val initial = VerticalAlign("initial")
val inherit = VerticalAlign("inherit") val inherit = VerticalAlign("inherit")
} }
} }

View File

@@ -1,15 +1,15 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class Visibility( class Visibility(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val visible = Visibility("visible") val visible = Visibility("visible")
val hidden = Visibility("hidden") val hidden = Visibility("hidden")
val collapse = Visibility("collapse") val collapse = Visibility("collapse")
val initial = Visibility("initial") val initial = Visibility("initial")
val inherit = Visibility("inherit") val inherit = Visibility("inherit")
} }
} }

View File

@@ -1,17 +1,17 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class WhiteSpace( class WhiteSpace(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = WhiteSpace("normal") val normal = WhiteSpace("normal")
val nowrap = WhiteSpace("nowrap") val nowrap = WhiteSpace("nowrap")
val pre = WhiteSpace("pre") val pre = WhiteSpace("pre")
val preLine = WhiteSpace("pre-line") val preLine = WhiteSpace("pre-line")
val preWrap = WhiteSpace("pre-wrap") val preWrap = WhiteSpace("pre-wrap")
val initial = WhiteSpace("initial") val initial = WhiteSpace("initial")
val inherit = WhiteSpace("inherit") val inherit = WhiteSpace("inherit")
} }
} }

View File

@@ -1,16 +1,16 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class WordBreak( class WordBreak(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = WordBreak("normal") val normal = WordBreak("normal")
val breakAll = WordBreak("break-all") val breakAll = WordBreak("break-all")
val keepAll = WordBreak("keep-all") val keepAll = WordBreak("keep-all")
val breakWord = WordBreak("break-word") val breakWord = WordBreak("break-word")
val initial = WordBreak("initial") val initial = WordBreak("initial")
val inherit = WordBreak("inherit") val inherit = WordBreak("inherit")
} }
} }

View File

@@ -1,13 +1,13 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class WordSpacing( class WordSpacing(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = WordSpacing("normal") val normal = WordSpacing("normal")
val initial = WordSpacing("initial") val initial = WordSpacing("initial")
val inherit = WordSpacing("inherit") val inherit = WordSpacing("inherit")
} }
} }

View File

@@ -1,14 +1,14 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class WordWrap( class WordWrap(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val normal = WordWrap("normal") val normal = WordWrap("normal")
val breakWord = WordWrap("break-word") val breakWord = WordWrap("break-word")
val initial = WordWrap("initial") val initial = WordWrap("initial")
val inherit = WordWrap("inherit") val inherit = WordWrap("inherit")
} }
} }

View File

@@ -1,13 +1,13 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class WritingMode( class WritingMode(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val horizontalTb = WritingMode("horizontal-tb") val horizontalTb = WritingMode("horizontal-tb")
val verticalRl = WritingMode("vertical-rl") val verticalRl = WritingMode("vertical-rl")
val verticalLr = WritingMode("vertical-lr") val verticalLr = WritingMode("vertical-lr")
} }
} }

View File

@@ -1,13 +1,13 @@
package nl.astraeus.css.properties package nl.astraeus.css.properties
class ZIndex( class ZIndex(
value: String value: String
) : CssProperty(value) { ) : CssProperty(value) {
companion object { companion object {
val auto = ZIndex("auto") val auto = ZIndex("auto")
val initial = ZIndex("initial") val initial = ZIndex("initial")
val inherit = ZIndex("inherit") val inherit = ZIndex("inherit")
} }
} }

View File

@@ -4,8 +4,8 @@ import nl.astraeus.css.properties.Color
object CssFunctions { object CssFunctions {
fun darken(color: Color, percentage: Int): Color { fun darken(color: Color, percentage: Int): Color {
return color return color
} }
} }

View File

@@ -1,38 +1,42 @@
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() {
override fun getValidator(name: String) = null override fun getValidator(name: String) = null
fun fontFamily(font: String) { fun fontFamily(font: String) {
props["font-family"] = listOf(CssProperty(font)) props["font-family"] = listOf(CssProperty(font))
} }
fun fontSize(size: FontSize) { fun fontSize(size: FontSize) {
props["font-size"] = listOf(size) props["font-size"] = listOf(size)
} }
fun src(src: String) { fun src(src: String) {
props["src"] = listOf(CssProperty(src)) props["src"] = listOf(CssProperty(src))
} }
fun fontStretch(stretch: FontStretch) { fun fontStretch(stretch: FontStretch) {
props["font-stretch"] = listOf(stretch) props["font-stretch"] = listOf(stretch)
} }
fun fontStyle(style: FontStyle) { fun fontStyle(style: FontStyle) {
props["font-style"] = listOf(style) props["font-style"] = listOf(style)
} }
fun fontWeight(weight: FontWeight) { fun fontWeight(weight: FontWeight) {
props["font-weight"] = listOf(weight) props["font-weight"] = listOf(weight)
} }
fun unicodeRange(unicodeRange: String) { fun unicodeRange(unicodeRange: String) {
props["unicode-range"] = listOf(CssProperty(unicodeRange)) props["unicode-range"] = listOf(CssProperty(unicodeRange))
} }
} }

View File

@@ -2,15 +2,15 @@ package nl.astraeus.css.style
@CssTagMarker @CssTagMarker
open class KeyFrames : CssGenerator() { open class KeyFrames : CssGenerator() {
val frames: MutableMap<Int, Css> = mutableMapOf() val frames: MutableMap<Int, Css> = mutableMapOf()
override fun getValidator(name: String): List<Validator>? = listOf() override fun getValidator(name: String): List<Validator>? = listOf()
fun percentage(percentage: Int, style: Css) { fun percentage(percentage: Int, style: Css) {
val css = Style() val css = Style()
style(css) style(css)
frames[percentage] = style frames[percentage] = style
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -4,34 +4,34 @@ import nl.astraeus.css.properties.CssProperty
abstract class Validator { abstract class Validator {
open fun validate(properties: List<CssProperty>): Boolean = true open fun validate(properties: List<CssProperty>): Boolean = true
open fun getMessage(name: String): String = "'$name' validation message not defined for $this" open fun getMessage(name: String): String = "'$name' validation message not defined for $this"
} }
class MaxCountValidator( class MaxCountValidator(
val number: Int val number: Int
): Validator() { ) : Validator() {
override fun validate(property: List<CssProperty>): Boolean = property.size <= number override fun validate(property: List<CssProperty>): Boolean = property.size <= number
override fun getMessage(name: String): String = "'$name' should not have more than 4 entries" override fun getMessage(name: String): String = "'$name' should not have more than 4 entries"
} }
class InitialInheritSingleValue: Validator() { class InitialInheritSingleValue : Validator() {
override fun validate(properties: List<CssProperty>): Boolean { override fun validate(properties: List<CssProperty>): Boolean {
for (prop in properties) { for (prop in properties) {
if (prop.css() == "initial" || prop.css() == "inherit") { if (prop.css() == "initial" || prop.css() == "inherit") {
return properties.size == 1 return properties.size == 1
} }
}
return true
} }
override fun getMessage(name: String): String = "'$name' can only have single value when 'initial' or 'inherit'" return true
}
override fun getMessage(name: String): String = "'$name' can only have single value when 'initial' or 'inherit'"
} }

View File

@@ -1,24 +1,28 @@
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") {
backgroundColor(hex(0xeeeeee)) backgroundColor(hex(0xeeeeee))
fontFamily("Arial, Courier") fontFamily("Arial, Courier")
animationDelay(DelayDuration.initial) animationDelay(DelayDuration.initial)
select("div") { select("div") {
color(hex(0x1b1b1b1)) color(hex(0x1b1b1b1))
alignContent(AlignContent.flexStart) alignContent(AlignContent.flexStart)
animationName("animname") animationName("animname")
animationTimingFunction( animationTimingFunction(
TimingFunction.cubicBezier(0.1, 0.2, 0.3, 0.4), TimingFunction.cubicBezier(0.1, 0.2, 0.3, 0.4),
TimingFunction.easeInOut TimingFunction.easeInOut
) )
} }
}
} }
}
println(sd.generateCss()) println(sd.generateCss())
} }