More properties, cleanup
This commit is contained in:
@@ -3,6 +3,16 @@ package nl.astraeus.css.properties
|
||||
class BorderRadius(
|
||||
value: String
|
||||
): CssProperty(value) {
|
||||
constructor(topLeft: Int, topRight: Int, bottomRight: Int, bottomLeft: Int): this(
|
||||
"${topLeft}px ${topRight}px ${bottomRight}px ${bottomLeft}px"
|
||||
)
|
||||
constructor(topLeft: Int, topRightBottomLeft: Int, bottomRight: Int): this(
|
||||
"${topLeft}px ${topRightBottomLeft}px ${bottomRight}px"
|
||||
)
|
||||
constructor(topLeftBottomRight: Int, topRightBottomLeft: Int): this(
|
||||
"${topLeftBottomRight}px ${topRightBottomLeft}px"
|
||||
)
|
||||
constructor(radius: Int): this("${radius}px")
|
||||
|
||||
companion object {
|
||||
fun px(nr: Int) = BorderRadius("${nr}px")
|
||||
@@ -19,23 +29,23 @@ class BorderRadius(
|
||||
}
|
||||
}
|
||||
|
||||
class BorderStyle(
|
||||
class RuleBorderStyle(
|
||||
value: String
|
||||
): CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun none() = BorderStyle("none")
|
||||
fun hidden() = BorderStyle("hidden")
|
||||
fun dotted() = BorderStyle("dotted")
|
||||
fun dashed() = BorderStyle("dashed")
|
||||
fun solid() = BorderStyle("solid")
|
||||
fun double() = BorderStyle("double")
|
||||
fun groove() = BorderStyle("groove")
|
||||
fun ridge() = BorderStyle("ridge")
|
||||
fun inset() = BorderStyle("inset")
|
||||
fun outset() = BorderStyle("outset")
|
||||
fun initial() = BorderStyle("initial")
|
||||
fun inherit() = BorderStyle("inherit")
|
||||
fun none() = RuleBorderStyle("none")
|
||||
fun hidden() = RuleBorderStyle("hidden")
|
||||
fun dotted() = RuleBorderStyle("dotted")
|
||||
fun dashed() = RuleBorderStyle("dashed")
|
||||
fun solid() = RuleBorderStyle("solid")
|
||||
fun double() = RuleBorderStyle("double")
|
||||
fun groove() = RuleBorderStyle("groove")
|
||||
fun ridge() = RuleBorderStyle("ridge")
|
||||
fun inset() = RuleBorderStyle("inset")
|
||||
fun outset() = RuleBorderStyle("outset")
|
||||
fun initial() = RuleBorderStyle("initial")
|
||||
fun inherit() = RuleBorderStyle("inherit")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,15 +58,15 @@ class BorderWidth(
|
||||
fun medium() = BorderWidth("medium")
|
||||
fun thick() = BorderWidth("thick")
|
||||
|
||||
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")
|
||||
fun px(nr: Int) = BorderWidth("${nr}px")
|
||||
fun em(nr: Int) = BorderWidth("${nr}em")
|
||||
fun em(nr: Double) = BorderWidth("${nr}em")
|
||||
fun perc(nr: Int) = BorderWidth("${nr}%")
|
||||
fun perc(nr: Double) = BorderWidth("${nr}%")
|
||||
fun pc(nr: Int) = BorderWidth("${nr}pc")
|
||||
fun pc(nr: Double) = BorderWidth("${nr}pc")
|
||||
fun cm(nr: Int) = BorderWidth("${nr}cm")
|
||||
fun cm(nr: Double) = BorderWidth("${nr}cm")
|
||||
|
||||
fun initial() = BorderWidth("initial")
|
||||
fun inherit() = BorderWidth("inherit")
|
||||
|
||||
17
src/commonMain/kotlin/nl/astraeus/css/properties/Clear.kt
Normal file
17
src/commonMain/kotlin/nl/astraeus/css/properties/Clear.kt
Normal file
@@ -0,0 +1,17 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
|
||||
class Clear(
|
||||
value: String
|
||||
): CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun none() = Clear("none")
|
||||
fun left() = Clear("left")
|
||||
fun right() = Clear("right")
|
||||
fun both() = Clear("both")
|
||||
fun initial() = Clear("initial")
|
||||
fun inherit() = Clear("inherit")
|
||||
}
|
||||
|
||||
}
|
||||
54
src/commonMain/kotlin/nl/astraeus/css/properties/Clip.kt
Normal file
54
src/commonMain/kotlin/nl/astraeus/css/properties/Clip.kt
Normal file
@@ -0,0 +1,54 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class Clip(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun auto() = Clip("auto")
|
||||
fun rect(top: Int, right: Int, bottom: Int, left: Int) = Clip("rect(${top}px,${right}px,${bottom}px,${left}px)")
|
||||
fun initial() = Clip("initial")
|
||||
fun inherit() = Clip("inherit")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class ClipPath(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun auto() = ClipPath("auto")
|
||||
fun circle(perc: Double) = ClipPath("circle(${perc}%)")
|
||||
fun ellipse(radiusX: Double, radiusY: Double) = ClipPath("ellipse(${radiusX}%,${radiusY}%)")
|
||||
fun ellipse(
|
||||
radiusX: Double,
|
||||
radiusY: Double,
|
||||
positionX: Double,
|
||||
positionY: Double
|
||||
) = ClipPath("ellipse(${radiusX}%,${radiusY}% at ${positionX}%,${positionY}%)")
|
||||
// todo: other options
|
||||
fun marginBox() = ClipPath("margin-box")
|
||||
fun borderBox() = ClipPath("border-box")
|
||||
fun paddingBox() = ClipPath("padding-box")
|
||||
fun contentBox() = ClipPath("content-box")
|
||||
fun fillBox() = ClipPath("fill-box")
|
||||
fun strokeBox() = ClipPath("stroke-box")
|
||||
fun viewBox() = ClipPath("view-box")
|
||||
fun none() = ClipPath("none")
|
||||
}
|
||||
}
|
||||
|
||||
class ClipOrigin(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun borderBox() = ClipOrigin("border-box")
|
||||
fun paddingBox() = ClipOrigin("padding-box")
|
||||
fun contentBox() = ClipOrigin("content-box")
|
||||
fun initial() = ClipOrigin("initial")
|
||||
fun inherit() = ClipOrigin("inherit")
|
||||
|
||||
}
|
||||
}
|
||||
@@ -20,17 +20,14 @@ class Length(
|
||||
|
||||
}
|
||||
|
||||
class ClipOrigin(
|
||||
class Fill(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun borderBox() = ClipOrigin("border-box")
|
||||
fun paddingBox() = ClipOrigin("padding-box")
|
||||
fun contentBox() = ClipOrigin("content-box")
|
||||
fun initial() = ClipOrigin("initial")
|
||||
fun inherit() = ClipOrigin("inherit")
|
||||
|
||||
fun balance() = Fill("balance")
|
||||
fun auto() = Fill("auto")
|
||||
fun initial() = Fill("initial")
|
||||
fun inherit() = Fill("inherit")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
22
src/commonMain/kotlin/nl/astraeus/css/properties/Content.kt
Normal file
22
src/commonMain/kotlin/nl/astraeus/css/properties/Content.kt
Normal file
@@ -0,0 +1,22 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class Content(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun normal() = Content("normal")
|
||||
fun none() = Content("none")
|
||||
fun counter() = Content("counter")
|
||||
fun attr(attribute: String) = Content("attr($attribute)")
|
||||
fun string(txt: String) = Content("\"$txt\"")
|
||||
fun openQuote() = Content("open-quote")
|
||||
fun closeQuote() = Content("close-quote")
|
||||
fun noOpenQuote() = Content("no-open-quote")
|
||||
fun noCloseQuote() = Content("no-close-quote")
|
||||
fun url(url: String) = Content("url($url)")
|
||||
fun initial() = Content("initial")
|
||||
fun inherit() = Content("inherit")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,8 @@ class Count(
|
||||
companion object {
|
||||
fun count(number: Int): Count =
|
||||
Count("$number")
|
||||
fun auto(): Count =
|
||||
Count("auto")
|
||||
fun infinite(): Count =
|
||||
Count("infinite")
|
||||
fun initial(): Count =
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class Direction(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun ltr() = Direction("ltr")
|
||||
fun rtl() = Direction("rtl")
|
||||
fun initial() = Direction("initial")
|
||||
fun inherit() = Direction("inherit")
|
||||
}
|
||||
|
||||
}
|
||||
33
src/commonMain/kotlin/nl/astraeus/css/properties/Display.kt
Normal file
33
src/commonMain/kotlin/nl/astraeus/css/properties/Display.kt
Normal file
@@ -0,0 +1,33 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class Display(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun inline() = Display("inline")
|
||||
fun block() = Display("block")
|
||||
fun contents() = Display("contents")
|
||||
fun flex() = Display("flex")
|
||||
fun grid() = Display("grid")
|
||||
fun inlineBlock() = Display("inline-block")
|
||||
fun inlineFlex() = Display("inline-flex")
|
||||
fun inlineGrid() = Display("inline-grid")
|
||||
fun inlineTable() = Display("inline-table")
|
||||
fun listItem() = Display("list-item")
|
||||
fun runIn() = Display("run-in")
|
||||
fun table() = Display("table")
|
||||
fun tableCaption() = Display("table-caption")
|
||||
fun tableColumnGroup() = Display("table-column-group")
|
||||
fun tableHeaderGroup() = Display("table-header-group")
|
||||
fun tableFooterGroup() = Display("table-footer-group")
|
||||
fun tableRowGroup() = Display("table-row-group")
|
||||
fun tableCell() = Display("table-cell")
|
||||
fun tableColumn() = Display("table-column")
|
||||
fun tableRow() = Display("table-row")
|
||||
fun none() = Display("none")
|
||||
fun initial() = Display("initial")
|
||||
fun inherit() = Display("inherit")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class EmptyCells(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun show() = EmptyCells("show")
|
||||
fun hide() = EmptyCells("hide")
|
||||
fun initial() = EmptyCells("initial")
|
||||
fun inherit() = EmptyCells("inherit")
|
||||
}
|
||||
|
||||
}
|
||||
15
src/commonMain/kotlin/nl/astraeus/css/properties/Float.kt
Normal file
15
src/commonMain/kotlin/nl/astraeus/css/properties/Float.kt
Normal file
@@ -0,0 +1,15 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class Float(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun none() = Float("none")
|
||||
fun left() = Float("left")
|
||||
fun right() = Float("right")
|
||||
fun initial() = Float("initial")
|
||||
fun inherit() = Float("inherit")
|
||||
}
|
||||
|
||||
}
|
||||
80
src/commonMain/kotlin/nl/astraeus/css/properties/Font.kt
Normal file
80
src/commonMain/kotlin/nl/astraeus/css/properties/Font.kt
Normal file
@@ -0,0 +1,80 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class FontSize(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun xxSmall() = FontSize("xx-small")
|
||||
fun xSmall() = FontSize("x-small")
|
||||
fun small() = FontSize("small")
|
||||
fun medium() = FontSize("medium")
|
||||
fun large() = FontSize("large")
|
||||
fun xLarge() = FontSize("x-large")
|
||||
fun xxLarge() = FontSize("xx-large")
|
||||
fun smaller() = FontSize("smaller")
|
||||
fun larger() = FontSize("larger")
|
||||
fun initial() = FontSize("initial")
|
||||
fun inherit() = FontSize("inherit")
|
||||
fun px(nr: Int) = FontSize("${nr}px")
|
||||
fun em(nr: Int) = FontSize("${nr}em")
|
||||
fun em(nr: Double) = FontSize("${nr}em")
|
||||
fun perc(nr: Int) = FontSize("${nr}%")
|
||||
fun perc(nr: Double) = FontSize("${nr}%")
|
||||
fun pc(nr: Int) = FontSize("${nr}pc")
|
||||
fun pc(nr: Double) = FontSize("${nr}pc")
|
||||
fun cm(nr: Int) = FontSize("${nr}cm")
|
||||
fun cm(nr: Double) = FontSize("${nr}cm")
|
||||
}
|
||||
}
|
||||
|
||||
class FontStretch(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun normal() = FontStretch("normal")
|
||||
fun condensed() = FontStretch("condensed")
|
||||
fun ultraCondensed() = FontStretch("ultra-condensed")
|
||||
fun extraCondensed() = FontStretch("extra-condensed")
|
||||
fun semiCondensed() = FontStretch("semi-condensed")
|
||||
fun expanded() = FontStretch("expanded")
|
||||
fun semiExpanded() = FontStretch("semi-expanded")
|
||||
fun extraExpanded() = FontStretch("extra-expanded")
|
||||
fun ultraExpanded() = FontStretch("ultra-expanded")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class FontStyle(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun normal() = FontStyle("normal")
|
||||
fun italic() = FontStyle("italic")
|
||||
fun oblique() = FontStyle("oblique")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class FontWeight(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun normal() = FontWeight("normal")
|
||||
fun bold() = FontWeight("bold")
|
||||
fun _100() = FontWeight("100")
|
||||
fun _200() = FontWeight("200")
|
||||
fun _300() = FontWeight("300")
|
||||
fun _400() = FontWeight("400")
|
||||
fun _500() = FontWeight("500")
|
||||
fun _600() = FontWeight("600")
|
||||
fun _700() = FontWeight("700")
|
||||
fun _800() = FontWeight("800")
|
||||
fun _900() = FontWeight("900")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ open class Measurement(
|
||||
fun auto() = Measurement("auto")
|
||||
fun initial() = Measurement("initial")
|
||||
fun inherit() = Measurement("inherit")
|
||||
fun normal() = Measurement("normal")
|
||||
fun px(nr: Int) = Measurement("${nr}px")
|
||||
fun em(nr: Int) = Measurement("${nr}em")
|
||||
fun em(nr: Double) = Measurement("${nr}em")
|
||||
@@ -19,31 +20,3 @@ open class Measurement(
|
||||
fun cm(nr: Double) = Measurement("${nr}cm")
|
||||
}
|
||||
}
|
||||
|
||||
class FontSize(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun xxSmall() = FontSize("xx-small")
|
||||
fun xSmall() = FontSize("x-small")
|
||||
fun small() = FontSize("small")
|
||||
fun medium() = FontSize("medium")
|
||||
fun large() = FontSize("large")
|
||||
fun xLarge() = FontSize("x-large")
|
||||
fun xxLarge() = FontSize("xx-large")
|
||||
fun smaller() = FontSize("smaller")
|
||||
fun larger() = FontSize("larger")
|
||||
fun initial() = FontSize("initial")
|
||||
fun inherit() = FontSize("inherit")
|
||||
fun px(nr: Int) = FontSize("${nr}px")
|
||||
fun em(nr: Int) = FontSize("${nr}em")
|
||||
fun em(nr: Double) = FontSize("${nr}em")
|
||||
fun perc(nr: Int) = FontSize("${nr}%")
|
||||
fun perc(nr: Double) = FontSize("${nr}%")
|
||||
fun pc(nr: Int) = FontSize("${nr}pc")
|
||||
fun pc(nr: Double) = FontSize("${nr}pc")
|
||||
fun cm(nr: Int) = FontSize("${nr}cm")
|
||||
fun cm(nr: Double) = FontSize("${nr}cm")
|
||||
}
|
||||
}
|
||||
|
||||
14
src/commonMain/kotlin/nl/astraeus/css/properties/Span.kt
Normal file
14
src/commonMain/kotlin/nl/astraeus/css/properties/Span.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package nl.astraeus.css.properties
|
||||
|
||||
class Span(
|
||||
value: String
|
||||
) : CssProperty(value) {
|
||||
|
||||
companion object {
|
||||
fun none() = Clip("none")
|
||||
fun all() = Clip("all")
|
||||
fun initial() = Clip("initial")
|
||||
fun inherit() = Clip("inherit")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user