diff --git a/src/commonMain/kotlin/nl/astraeus/css/CssBuilder.kt b/src/commonMain/kotlin/nl/astraeus/css/CssBuilder.kt index a405a58..c2e0422 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/CssBuilder.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/CssBuilder.kt @@ -8,23 +8,23 @@ import nl.astraeus.css.style.Style fun css(definition: Css) = definition fun style(definition: ConditionalCss): ConditionalStyle { - val css = ConditionalStyle() + val css = ConditionalStyle() - definition(css) + definition(css) - return css + return css } class CssBuilder { - var definition: Style = Style() + var definition: Style = Style() - fun style(definition: Style.() -> Unit) { - definition(this.definition) - } + fun style(definition: Style.() -> Unit) { + 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 { - return "CssBuilder(${definition.generateCss()})" - } + override fun toString(): String { + return "CssBuilder(${definition.generateCss()})" + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/AlignContent.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/AlignContent.kt index b2ef789..deeeb8f 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/AlignContent.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/AlignContent.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class AlignContent( - value: String + value: String ) : CssProperty(value) { - companion object { - val stretch = AlignContent("stretch") - val center = AlignContent("center") - val flexStart = AlignContent("flex-start") - val flexEnd = AlignContent("flex-end") - val spaceBetween = AlignContent("space-between") - val spaceAround = AlignContent("space-around") - val initial = AlignContent("initial") - val inherit = AlignContent("inherit") - } + companion object { + val stretch = AlignContent("stretch") + val center = AlignContent("center") + val flexStart = AlignContent("flex-start") + val flexEnd = AlignContent("flex-end") + val spaceBetween = AlignContent("space-between") + val spaceAround = AlignContent("space-around") + val initial = AlignContent("initial") + val inherit = AlignContent("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/AlignItems.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/AlignItems.kt index d9b2e49..99c8da1 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/AlignItems.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/AlignItems.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class AlignItems( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val stretch = AlignItems("stretch") - val center = AlignItems("center") - val flexStart = AlignItems("flex-start") - val flexEnd = AlignItems("flex-end") - val baseline = AlignItems("baseline") - val initial = AlignItems("initial") - val inherit = AlignItems("inherit") - } + companion object { + val stretch = AlignItems("stretch") + val center = AlignItems("center") + val flexStart = AlignItems("flex-start") + val flexEnd = AlignItems("flex-end") + val baseline = AlignItems("baseline") + val initial = AlignItems("initial") + val inherit = AlignItems("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/AlignSelf.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/AlignSelf.kt index 61bfa10..b721a88 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/AlignSelf.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/AlignSelf.kt @@ -1,18 +1,18 @@ package nl.astraeus.css.properties class AlignSelf( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val auto = AlignSelf("auto") - val stretch = AlignSelf("stretch") - val center = AlignSelf("center") - val flexStart = AlignSelf("flex-start") - val flexEnd = AlignSelf("flex-end") - val baseline = AlignSelf("baseline") - val initial = AlignSelf("initial") - val inherit = AlignSelf("inherit") - } + companion object { + val auto = AlignSelf("auto") + val stretch = AlignSelf("stretch") + val center = AlignSelf("center") + val flexStart = AlignSelf("flex-start") + val flexEnd = AlignSelf("flex-end") + val baseline = AlignSelf("baseline") + val initial = AlignSelf("initial") + val inherit = AlignSelf("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/All.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/All.kt index 76c901e..d9bcb41 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/All.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/All.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class All( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val unset = All("unset") - val revert = All("revert") - val initial = All("initial") - val inherit = All("inherit") - } + companion object { + val unset = All("unset") + val revert = All("revert") + val initial = All("initial") + val inherit = All("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Animation.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Animation.kt index 4697a83..6483c89 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Animation.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Animation.kt @@ -1,55 +1,55 @@ package nl.astraeus.css.properties class AnimationDirection( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = AnimationDirection("normal") - val reverse = AnimationDirection("reverse") - val alternate = AnimationDirection("alternate") - val alternateReverse = AnimationDirection("alternate-reverse") - val initial = AnimationDirection("initial") - val inherit = AnimationDirection("inherit") - } + companion object { + val normal = AnimationDirection("normal") + val reverse = AnimationDirection("reverse") + val alternate = AnimationDirection("alternate") + val alternateReverse = AnimationDirection("alternate-reverse") + val initial = AnimationDirection("initial") + val inherit = AnimationDirection("inherit") + } } class AnimationFillMode( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = AnimationFillMode("none") - val forwards = AnimationFillMode("forwards") - val backwards = AnimationFillMode("backwards") - val both = AnimationFillMode("both") - val initial = AnimationFillMode("initial") - val inherit = AnimationFillMode("inherit") - } + companion object { + val none = AnimationFillMode("none") + val forwards = AnimationFillMode("forwards") + val backwards = AnimationFillMode("backwards") + val both = AnimationFillMode("both") + val initial = AnimationFillMode("initial") + val inherit = AnimationFillMode("inherit") + } } class AnimationFrame( - value: String = "" -): CssProperty(value) { + value: String = "" +) : CssProperty(value) { - companion object { - fun name(name: String) = AnimationFrame(name) - val none: AnimationFrame = AnimationFrame("none") - val initial: AnimationFrame = AnimationFrame("initial") - val inherit: AnimationFrame = AnimationFrame("inherit") - } + companion object { + fun name(name: String) = AnimationFrame(name) + val none: AnimationFrame = AnimationFrame("none") + val initial: AnimationFrame = AnimationFrame("initial") + val inherit: AnimationFrame = AnimationFrame("inherit") + } } class AnimationPlayState( - value: String + value: String ) : CssProperty(value) { - companion object { - fun name(name: String) = AnimationPlayState(name) - val paused = AnimationPlayState("paused") - val running = AnimationPlayState("running") - val initial = AnimationPlayState("initial") - val inherit = AnimationPlayState("inherit") - } + companion object { + fun name(name: String) = AnimationPlayState(name) + val paused = AnimationPlayState("paused") + val running = AnimationPlayState("running") + val initial = AnimationPlayState("initial") + val inherit = AnimationPlayState("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/BackfaceVisibility.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/BackfaceVisibility.kt index 05a2cc1..698379a 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/BackfaceVisibility.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/BackfaceVisibility.kt @@ -1,13 +1,13 @@ package nl.astraeus.css.properties class BackfaceVisibility( - value: String + value: String ) : CssProperty(value) { - companion object { - val visible = BackfaceVisibility("visible") - val hidden = BackfaceVisibility("hidden") - val initial = BackfaceVisibility("initial") - val inherit = BackfaceVisibility("inherit") - } + companion object { + val visible = BackfaceVisibility("visible") + val hidden = BackfaceVisibility("hidden") + val initial = BackfaceVisibility("initial") + val inherit = BackfaceVisibility("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Background.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Background.kt index b181ee7..46554b4 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Background.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Background.kt @@ -1,79 +1,79 @@ package nl.astraeus.css.properties class BackgroundAttachment( - value: String + value: String ) : CssProperty(value) { - companion object { - val scroll = BackgroundAttachment("scroll") - val fixed = BackgroundAttachment("fixed") - val local = BackgroundAttachment("local") - val initial = BackgroundAttachment("initial") - val inherit = BackgroundAttachment("inherit") - } + companion object { + val scroll = BackgroundAttachment("scroll") + val fixed = BackgroundAttachment("fixed") + val local = BackgroundAttachment("local") + val initial = BackgroundAttachment("initial") + val inherit = BackgroundAttachment("inherit") + } } class BackgroundBlendMode( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = BackgroundBlendMode("normal") - val multiply = BackgroundBlendMode("multiply") - val screen = BackgroundBlendMode("screen") - val overlay = BackgroundBlendMode("overlay") - val darken = BackgroundBlendMode("darken") - val lighten = BackgroundBlendMode("lighten") - val colorDodge = BackgroundBlendMode("color-dodge") - val saturation = BackgroundBlendMode("saturation") - val color = BackgroundBlendMode("color") - val luminosity = BackgroundBlendMode("luminosity") - } + companion object { + val normal = BackgroundBlendMode("normal") + val multiply = BackgroundBlendMode("multiply") + val screen = BackgroundBlendMode("screen") + val overlay = BackgroundBlendMode("overlay") + val darken = BackgroundBlendMode("darken") + val lighten = BackgroundBlendMode("lighten") + val colorDodge = BackgroundBlendMode("color-dodge") + val saturation = BackgroundBlendMode("saturation") + val color = BackgroundBlendMode("color") + val luminosity = BackgroundBlendMode("luminosity") + } } class BackgroundPosition( - value: String + value: String ) : CssProperty(value) { - companion object { - val left = BackgroundPosition("left") - val center = BackgroundPosition("center") - val right = BackgroundPosition("right") - val initial = BackgroundPosition("initial") - val inherit = BackgroundPosition("inherit") - } + companion object { + val left = BackgroundPosition("left") + val center = BackgroundPosition("center") + val right = BackgroundPosition("right") + val initial = BackgroundPosition("initial") + val inherit = BackgroundPosition("inherit") + } } class BackgroundRepeat( - value: String + value: String ) : CssProperty(value) { - companion object { - val repeat = BackgroundRepeat("repeat") - val repeatX = BackgroundRepeat("repeat-x") - val repeatY = BackgroundRepeat("repeat-y") - val noRepeat = BackgroundRepeat("no-repeat") - val space = BackgroundRepeat("space") - val round = BackgroundRepeat("round") - val initial = BackgroundRepeat("initial") - val inherit = BackgroundRepeat("inherit") - val unset = BackgroundRepeat("unset") - } + companion object { + val repeat = BackgroundRepeat("repeat") + val repeatX = BackgroundRepeat("repeat-x") + val repeatY = BackgroundRepeat("repeat-y") + val noRepeat = BackgroundRepeat("no-repeat") + val space = BackgroundRepeat("space") + val round = BackgroundRepeat("round") + val initial = BackgroundRepeat("initial") + val inherit = BackgroundRepeat("inherit") + val unset = BackgroundRepeat("unset") + } } class BackgroundSize( - value: String + value: String ) : CssProperty(value) { - companion object { - fun px(px: Int) = BackgroundSize("${px}px") - fun perc(pc: Double) = BackgroundSize("${pc}%") + companion object { + fun px(px: Int) = BackgroundSize("${px}px") + fun perc(pc: Double) = BackgroundSize("${pc}%") - val auto = BackgroundSize("auto") - val cover = BackgroundSize("cover") - val contain = BackgroundSize("contain") - val initial = BackgroundSize("initial") - val inherit = BackgroundSize("inherit") - } + val auto = BackgroundSize("auto") + val cover = BackgroundSize("cover") + val contain = BackgroundSize("contain") + val initial = BackgroundSize("initial") + val inherit = BackgroundSize("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Border.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Border.kt index e83a5bb..549d3ff 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Border.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Border.kt @@ -1,96 +1,96 @@ package nl.astraeus.css.properties class BorderRadius( - value: String -): CssProperty(value) { - companion object { - fun px(nr: Int) = BorderRadius("${nr}px") - fun em(nr: Int) = BorderRadius("${nr}em") - fun em(nr: Double) = BorderRadius("${nr}em") - fun perc(nr: Int) = BorderRadius("${nr}%") - fun perc(nr: Double) = BorderRadius("${nr}%") - fun pc(nr: Int) = BorderRadius("${nr}pc") - fun pc(nr: Double) = BorderRadius("${nr}pc") - fun cm(nr: Int) = BorderRadius("${nr}cm") - fun cm(nr: Double) = BorderRadius("${nr}cm") - val initial = BorderRadius("initial") - val inherit = BorderRadius("inherit") - } + value: String +) : CssProperty(value) { + companion object { + fun px(nr: Int) = BorderRadius("${nr}px") + fun em(nr: Int) = BorderRadius("${nr}em") + fun em(nr: Double) = BorderRadius("${nr}em") + fun perc(nr: Int) = BorderRadius("${nr}%") + fun perc(nr: Double) = BorderRadius("${nr}%") + fun pc(nr: Int) = BorderRadius("${nr}pc") + fun pc(nr: Double) = BorderRadius("${nr}pc") + fun cm(nr: Int) = BorderRadius("${nr}cm") + fun cm(nr: Double) = BorderRadius("${nr}cm") + val initial = BorderRadius("initial") + val inherit = BorderRadius("inherit") + } } class BorderStyle( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val none = BorderStyle("none") - val hidden = BorderStyle("hidden") - val dotted = BorderStyle("dotted") - val dashed = BorderStyle("dashed") - val solid = BorderStyle("solid") - val double = BorderStyle("double") - val groove = BorderStyle("groove") - val ridge = BorderStyle("ridge") - val inset = BorderStyle("inset") - val outset = BorderStyle("outset") - val initial = BorderStyle("initial") - val inherit = BorderStyle("inherit") - } + companion object { + val none = BorderStyle("none") + val hidden = BorderStyle("hidden") + val dotted = BorderStyle("dotted") + val dashed = BorderStyle("dashed") + val solid = BorderStyle("solid") + val double = BorderStyle("double") + val groove = BorderStyle("groove") + val ridge = BorderStyle("ridge") + val inset = BorderStyle("inset") + val outset = BorderStyle("outset") + val initial = BorderStyle("initial") + val inherit = BorderStyle("inherit") + } } class BorderWidth( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val thin = BorderWidth("thin") - val medium = BorderWidth("medium") - val thick = BorderWidth("thick") - val initial = BorderWidth("initial") - val inherit = BorderWidth("inherit") - } + companion object { + val thin = BorderWidth("thin") + val medium = BorderWidth("medium") + val thick = BorderWidth("thick") + val initial = BorderWidth("initial") + val inherit = BorderWidth("inherit") + } } class BorderCollapse( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val separate = BorderCollapse("separate") - val collapse = BorderCollapse("collapse") - } + companion object { + val separate = BorderCollapse("separate") + val collapse = BorderCollapse("collapse") + } } -class BorderImageWidth ( - value: String -): CssProperty(value) { +class BorderImageWidth( + value: String +) : CssProperty(value) { - companion object { - fun px(nr: Int) = BorderImageWidth("${nr}px") - fun nr(nr: Int) = BorderImageWidth("$nr") - fun perc(nr: Int) = BorderImageWidth("${nr}%") - fun perc(nr: Double) = BorderImageWidth("${nr}%") - val auto = BorderImageWidth("auto") - val initial = BorderImageWidth("initial") - val inherit = BorderImageWidth("inherit") - } + companion object { + fun px(nr: Int) = BorderImageWidth("${nr}px") + fun nr(nr: Int) = BorderImageWidth("$nr") + fun perc(nr: Int) = BorderImageWidth("${nr}%") + fun perc(nr: Double) = BorderImageWidth("${nr}%") + val auto = BorderImageWidth("auto") + val initial = BorderImageWidth("initial") + val inherit = BorderImageWidth("inherit") + } } class BorderSpacing( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - fun px(nr: Int) = BorderSpacing("${nr}px") - fun em(nr: Int) = BorderSpacing("${nr}em") - fun em(nr: Double) = BorderSpacing("${nr}em") - fun perc(nr: Int) = BorderSpacing("${nr}%") - fun perc(nr: Double) = BorderSpacing("${nr}%") - fun pc(nr: Int) = BorderSpacing("${nr}pc") - fun pc(nr: Double) = BorderSpacing("${nr}pc") - fun cm(nr: Int) = BorderSpacing("${nr}cm") - fun cm(nr: Double) = BorderSpacing("${nr}cm") - val initial = BorderSpacing("initial") - val inherit = BorderSpacing("inherit") - } + companion object { + fun px(nr: Int) = BorderSpacing("${nr}px") + fun em(nr: Int) = BorderSpacing("${nr}em") + fun em(nr: Double) = BorderSpacing("${nr}em") + fun perc(nr: Int) = BorderSpacing("${nr}%") + fun perc(nr: Double) = BorderSpacing("${nr}%") + fun pc(nr: Int) = BorderSpacing("${nr}pc") + fun pc(nr: Double) = BorderSpacing("${nr}pc") + fun cm(nr: Int) = BorderSpacing("${nr}cm") + fun cm(nr: Double) = BorderSpacing("${nr}cm") + val initial = BorderSpacing("initial") + val inherit = BorderSpacing("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Box.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Box.kt index c44dee9..930c10c 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Box.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Box.kt @@ -1,40 +1,40 @@ package nl.astraeus.css.properties class BoxDecorationBreak( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val slice = BoxDecorationBreak("slice") - val clone = BoxDecorationBreak("clone") - val initial = BoxDecorationBreak("initial") - val inherit = BoxDecorationBreak("inherit") - val unset = BoxDecorationBreak("unset") - } + companion object { + val slice = BoxDecorationBreak("slice") + val clone = BoxDecorationBreak("clone") + val initial = BoxDecorationBreak("initial") + val inherit = BoxDecorationBreak("inherit") + val unset = BoxDecorationBreak("unset") + } } class BoxShadow( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val none = BoxShadow("none") - val inset = BoxShadow("inset") - val initial = BoxShadow("initial") - val inherit = BoxShadow("inherit") + companion object { + val none = BoxShadow("none") + val inset = BoxShadow("inset") + val initial = BoxShadow("initial") + val inherit = BoxShadow("inherit") - fun text(txt: String) = BoxShadow(txt) - } + fun text(txt: String) = BoxShadow(txt) + } } class BoxSizing( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val contextBox = BoxSizing("content-box") - val borderBox = BoxSizing("border-box") - val initial = BoxShadow("initial") - val inherit = BoxShadow("inherit") - } + companion object { + val contextBox = BoxSizing("content-box") + val borderBox = BoxSizing("border-box") + val initial = BoxShadow("initial") + val inherit = BoxShadow("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Break.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Break.kt index 4856659..017b0c5 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Break.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Break.kt @@ -2,26 +2,26 @@ package nl.astraeus.css.properties class Break( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val auto = Break("auto") - val all = Break("all") - val always = Break("always") - val avoid = Break("avoid") - val avoidColumn = Break("avoid-column") - val avoidPage = Break("avoid-page") - val avoidRegion = Break("avoid-region") - val column = Break("column") - val left = Break("left") - val page = Break("page") - val recto = Break("recto") - val region = Break("region") - val right = Break("right") - val verso = Break("verso") - val initial = Break("initial") - val inherit = Break("inherit") - } + companion object { + val auto = Break("auto") + val all = Break("all") + val always = Break("always") + val avoid = Break("avoid") + val avoidColumn = Break("avoid-column") + val avoidPage = Break("avoid-page") + val avoidRegion = Break("avoid-region") + val column = Break("column") + val left = Break("left") + val page = Break("page") + val recto = Break("recto") + val region = Break("region") + val right = Break("right") + val verso = Break("verso") + val initial = Break("initial") + val inherit = Break("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Caption.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Caption.kt index e0c9ec7..a595b8b 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Caption.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Caption.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class CaptionSide( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val top = CaptionSide("top") - val bottom = CaptionSide("bottom") - val initial = CaptionSide("initial") - val inherit = CaptionSide("inherit") - } + companion object { + val top = CaptionSide("top") + val bottom = CaptionSide("bottom") + val initial = CaptionSide("initial") + val inherit = CaptionSide("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Clear.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Clear.kt index 4803fb4..8c52912 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Clear.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Clear.kt @@ -2,16 +2,16 @@ package nl.astraeus.css.properties class Clear( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - val none = Clear("none") - val left = Clear("left") - val right = Clear("right") - val both = Clear("both") - val initial = Clear("initial") - val inherit = Clear("inherit") - } + companion object { + val none = Clear("none") + val left = Clear("left") + val right = Clear("right") + val both = Clear("both") + val initial = Clear("initial") + val inherit = Clear("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Clip.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Clip.kt index eb49e9d..da885a2 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Clip.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Clip.kt @@ -1,57 +1,57 @@ package nl.astraeus.css.properties class Clip( - value: String + value: String ) : CssProperty(value) { - companion object { - 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 initial = Clip("initial") - val inherit = Clip("inherit") + companion object { + 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 initial = Clip("initial") + val inherit = Clip("inherit") - } + } } class ClipPath( - value: String + value: String ) : CssProperty(value) { - companion object { - val 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}%)") + companion object { + val 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 other(text: String) = ClipPath(text) + // todo: other options + fun other(text: String) = ClipPath(text) - val marginBox = ClipPath("margin-box") - val borderBox = ClipPath("border-box") - val paddingBox = ClipPath("padding-box") - val contentBox = ClipPath("content-box") - val fillBox = ClipPath("fill-box") - val strokeBox = ClipPath("stroke-box") - val viewBox = ClipPath("view-box") - val none = ClipPath("none") - } + val marginBox = ClipPath("margin-box") + val borderBox = ClipPath("border-box") + val paddingBox = ClipPath("padding-box") + val contentBox = ClipPath("content-box") + val fillBox = ClipPath("fill-box") + val strokeBox = ClipPath("stroke-box") + val viewBox = ClipPath("view-box") + val none = ClipPath("none") + } } class ClipOrigin( - value: String + value: String ) : CssProperty(value) { - companion object { - val borderBox = ClipOrigin("border-box") - val paddingBox = ClipOrigin("padding-box") - val contentBox = ClipOrigin("content-box") - val initial = ClipOrigin("initial") - val inherit = ClipOrigin("inherit") + companion object { + val borderBox = ClipOrigin("border-box") + val paddingBox = ClipOrigin("padding-box") + val contentBox = ClipOrigin("content-box") + val initial = ClipOrigin("initial") + val inherit = ClipOrigin("inherit") - } + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Common.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Common.kt index 79d9e1b..c5d6377 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Common.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Common.kt @@ -1,33 +1,33 @@ package nl.astraeus.css.properties class Length( - value: String -): CssProperty(value) { + value: String +) : CssProperty(value) { - companion object { - fun px(nr: Int) = Length("${nr}px") - fun em(nr: Int) = Length("${nr}em") - fun em(nr: Double) = Length("${nr}em") - fun perc(nr: Int) = Length("${nr}%") - fun perc(nr: Double) = Length("${nr}%") - fun pc(nr: Int) = Length("${nr}pc") - fun pc(nr: Double) = Length("${nr}pc") - fun cm(nr: Int) = Length("${nr}cm") - fun cm(nr: Double) = Length("${nr}cm") - val initial = Length("initial") - val inherit = Length("inherit") - } + companion object { + fun px(nr: Int) = Length("${nr}px") + fun em(nr: Int) = Length("${nr}em") + fun em(nr: Double) = Length("${nr}em") + fun perc(nr: Int) = Length("${nr}%") + fun perc(nr: Double) = Length("${nr}%") + fun pc(nr: Int) = Length("${nr}pc") + fun pc(nr: Double) = Length("${nr}pc") + fun cm(nr: Int) = Length("${nr}cm") + fun cm(nr: Double) = Length("${nr}cm") + val initial = Length("initial") + val inherit = Length("inherit") + } } class Fill( - value: String + value: String ) : CssProperty(value) { - companion object { - val balance = Fill("balance") - val auto = Fill("auto") - val initial = Fill("initial") - val inherit = Fill("inherit") - } + companion object { + val balance = Fill("balance") + val auto = Fill("auto") + val initial = Fill("initial") + val inherit = Fill("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Content.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Content.kt index 475937f..5370272 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Content.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Content.kt @@ -1,23 +1,23 @@ package nl.astraeus.css.properties class Content( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = Content("normal") - val none = Content("none") - val counter = Content("counter") - val openQuote = Content("open-quote") - val closeQuote = Content("close-quote") - val noOpenQuote = Content("no-open-quote") - val noCloseQuote = Content("no-close-quote") - val initial = Content("initial") - val inherit = Content("inherit") + companion object { + val normal = Content("normal") + val none = Content("none") + val counter = Content("counter") + val openQuote = Content("open-quote") + val closeQuote = Content("close-quote") + val noOpenQuote = Content("no-open-quote") + val noCloseQuote = Content("no-close-quote") + val initial = Content("initial") + val inherit = Content("inherit") - fun attr(attribute: String) = Content("attr($attribute)") - fun string(txt: String) = Content("\"$txt\"") - fun url(url: String) = Content("url($url)") - } + fun attr(attribute: String) = Content("attr($attribute)") + fun string(txt: String) = Content("\"$txt\"") + fun url(url: String) = Content("url($url)") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Count.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Count.kt index 8f376f5..2cb6f7c 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Count.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Count.kt @@ -1,15 +1,15 @@ package nl.astraeus.css.properties -class Count( - value: String +class Count( + value: String ) : CssProperty(value) { - companion object { - val auto: Count = Count("auto") - val infinite: Count = Count("infinite") - val initial: Count = Count("initial") - val inherit: Count = Count("inherit") + companion object { + val auto: Count = Count("auto") + val infinite: Count = Count("infinite") + val initial: Count = Count("initial") + val inherit: Count = Count("inherit") - fun count(number: Int): Count = Count("$number") - } + fun count(number: Int): Count = Count("$number") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/CssFloat.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/CssFloat.kt index 7fc89fc..4113f3e 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/CssFloat.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/CssFloat.kt @@ -1,15 +1,15 @@ package nl.astraeus.css.properties class CssFloat( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = CssFloat("none") - val left = CssFloat("left") - val right = CssFloat("right") - val initial = CssFloat("initial") - val inherit = CssFloat("inherit") - } + companion object { + val none = CssFloat("none") + val left = CssFloat("left") + val right = CssFloat("right") + val initial = CssFloat("initial") + val inherit = CssFloat("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/CssProperty.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/CssProperty.kt index eed8318..fa3f58a 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/CssProperty.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/CssProperty.kt @@ -1,19 +1,19 @@ package nl.astraeus.css.properties interface CssValue { - fun css(): String + fun css(): String } open class CssProperty( - var value: String -): CssValue { + var value: String +) : CssValue { - override fun css(): String = value + override fun css(): String = value } fun text(value: String) = TextProperty(value) class TextProperty( - value: String -): CssProperty(value) + value: String +) : CssProperty(value) diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/DelayDuration.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/DelayDuration.kt index df2787c..16533ca 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/DelayDuration.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/DelayDuration.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class DelayDuration( - value: String + value: String ) : CssProperty(value) { - companion object { - val initial = DelayDuration("initial") - val inherit = DelayDuration("inherit") + companion object { + val initial = DelayDuration("initial") + val inherit = DelayDuration("inherit") - fun seconds(seconds: Int) = DelayDuration("${seconds}s") - fun millis(milliSeconds: Int) = DelayDuration("${milliSeconds}ms") - } + fun seconds(seconds: Int) = DelayDuration("${seconds}s") + fun millis(milliSeconds: Int) = DelayDuration("${milliSeconds}ms") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Direction.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Direction.kt index f430c90..14cdf47 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Direction.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Direction.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class Direction( - value: String + value: String ) : CssProperty(value) { - companion object { - val ltr = Direction("ltr") - val rtl = Direction("rtl") - val initial = Direction("initial") - val inherit = Direction("inherit") - } + companion object { + val ltr = Direction("ltr") + val rtl = Direction("rtl") + val initial = Direction("initial") + val inherit = Direction("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Display.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Display.kt index e622919..242305a 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Display.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Display.kt @@ -1,33 +1,33 @@ package nl.astraeus.css.properties class Display( - value: String + value: String ) : CssProperty(value) { - companion object { - val inline = Display("inline") - val block = Display("block") - val contents = Display("contents") - val flex = Display("flex") - val grid = Display("grid") - val inlineBlock = Display("inline-block") - val inlineFlex = Display("inline-flex") - val inlineGrid = Display("inline-grid") - val inlineTable = Display("inline-table") - val listItem = Display("list-item") - val runIn = Display("run-in") - val table = Display("table") - val tableCaption = Display("table-caption") - val tableColumnGroup = Display("table-column-group") - val tableHeaderGroup = Display("table-header-group") - val tableFooterGroup = Display("table-footer-group") - val tableRowGroup = Display("table-row-group") - val tableCell = Display("table-cell") - val tableColumn = Display("table-column") - val tableRow = Display("table-row") - val none = Display("none") - val initial = Display("initial") - val inherit = Display("inherit") - } + companion object { + val inline = Display("inline") + val block = Display("block") + val contents = Display("contents") + val flex = Display("flex") + val grid = Display("grid") + val inlineBlock = Display("inline-block") + val inlineFlex = Display("inline-flex") + val inlineGrid = Display("inline-grid") + val inlineTable = Display("inline-table") + val listItem = Display("list-item") + val runIn = Display("run-in") + val table = Display("table") + val tableCaption = Display("table-caption") + val tableColumnGroup = Display("table-column-group") + val tableHeaderGroup = Display("table-header-group") + val tableFooterGroup = Display("table-footer-group") + val tableRowGroup = Display("table-row-group") + val tableCell = Display("table-cell") + val tableColumn = Display("table-column") + val tableRow = Display("table-row") + val none = Display("none") + val initial = Display("initial") + val inherit = Display("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/EmptyCells.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/EmptyCells.kt index 2112b60..9d43fac 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/EmptyCells.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/EmptyCells.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class EmptyCells( - value: String + value: String ) : CssProperty(value) { - companion object { - val show = EmptyCells("show") - val hide = EmptyCells("hide") - val initial = EmptyCells("initial") - val inherit = EmptyCells("inherit") - } + companion object { + val show = EmptyCells("show") + val hide = EmptyCells("hide") + val initial = EmptyCells("initial") + val inherit = EmptyCells("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Flex.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Flex.kt index 4ecfb76..4e4a936 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Flex.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Flex.kt @@ -1,43 +1,43 @@ package nl.astraeus.css.properties class FlexDirection( - value: String + value: String ) : CssProperty(value) { - companion object { - val row = FlexDirection("row") - val rowReverse = FlexDirection("row-reverse") - val column = FlexDirection("column") - val columnReverse = FlexDirection("column-reverse") - val initial = FlexDirection("initial") - val inherit = FlexDirection("inherit") - } + companion object { + val row = FlexDirection("row") + val rowReverse = FlexDirection("row-reverse") + val column = FlexDirection("column") + val columnReverse = FlexDirection("column-reverse") + val initial = FlexDirection("initial") + val inherit = FlexDirection("inherit") + } } class FlexGrowShrink( - value: String + value: String ) : CssProperty(value) { - companion object { - val initial = FlexGrowShrink("initial") - val inherit = FlexGrowShrink("inherit") + companion object { + val initial = FlexGrowShrink("initial") + val inherit = FlexGrowShrink("inherit") - fun number(number: Int) = FlexGrowShrink("$number") - } + fun number(number: Int) = FlexGrowShrink("$number") + } } class FlexWrap( - value: String + value: String ) : CssProperty(value) { - companion object { - val nowrap = FlexWrap("nowrap") - val wrap = FlexWrap("wrap") - val wrapReverse = FlexWrap("wrap-reverse") - val initial = FlexWrap("initial") - val inherit = FlexWrap("inherit") - } + companion object { + val nowrap = FlexWrap("nowrap") + val wrap = FlexWrap("wrap") + val wrapReverse = FlexWrap("wrap-reverse") + val initial = FlexWrap("initial") + val inherit = FlexWrap("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Font.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Font.kt index dc801d6..2000c6e 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Font.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Font.kt @@ -1,142 +1,142 @@ package nl.astraeus.css.properties class FontSize( - value: String + value: String ) : CssProperty(value) { - companion object { - val xxSmall = FontSize("xx-small") - val xSmall = FontSize("x-small") - val small = FontSize("small") - val medium = FontSize("medium") - val large = FontSize("large") - val xLarge = FontSize("x-large") - val xxLarge = FontSize("xx-large") - val smaller = FontSize("smaller") - val larger = FontSize("larger") - val initial = FontSize("initial") - val inherit = FontSize("inherit") + companion object { + val xxSmall = FontSize("xx-small") + val xSmall = FontSize("x-small") + val small = FontSize("small") + val medium = FontSize("medium") + val large = FontSize("large") + val xLarge = FontSize("x-large") + val xxLarge = FontSize("xx-large") + val smaller = FontSize("smaller") + val larger = FontSize("larger") + val initial = FontSize("initial") + val 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") - } + 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 + value: String ) : CssProperty(value) { - companion object { - val normal = FontStretch("normal") - val condensed = FontStretch("condensed") - val ultraCondensed = FontStretch("ultra-condensed") - val extraCondensed = FontStretch("extra-condensed") - val semiCondensed = FontStretch("semi-condensed") - val expanded = FontStretch("expanded") - val semiExpanded = FontStretch("semi-expanded") - val extraExpanded = FontStretch("extra-expanded") - val ultraExpanded = FontStretch("ultra-expanded") - val initial = FontWeight("initial") - val inherit = FontWeight("inherit") - } + companion object { + val normal = FontStretch("normal") + val condensed = FontStretch("condensed") + val ultraCondensed = FontStretch("ultra-condensed") + val extraCondensed = FontStretch("extra-condensed") + val semiCondensed = FontStretch("semi-condensed") + val expanded = FontStretch("expanded") + val semiExpanded = FontStretch("semi-expanded") + val extraExpanded = FontStretch("extra-expanded") + val ultraExpanded = FontStretch("ultra-expanded") + val initial = FontWeight("initial") + val inherit = FontWeight("inherit") + } } class FontStyle( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = FontStyle("normal") - val italic = FontStyle("italic") - val oblique = FontStyle("oblique") - val initial = FontStyle("initial") - val inherit = FontStyle("inherit") - } + companion object { + val normal = FontStyle("normal") + val italic = FontStyle("italic") + val oblique = FontStyle("oblique") + val initial = FontStyle("initial") + val inherit = FontStyle("inherit") + } } class FontWeight( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = FontWeight("normal") - val bold = FontWeight("bold") - val _100 = FontWeight("100") - val _200 = FontWeight("200") - val _300 = FontWeight("300") - val _400 = FontWeight("400") - val _500 = FontWeight("500") - val _600 = FontWeight("600") - val _700 = FontWeight("700") - val _800 = FontWeight("800") - val _900 = FontWeight("900") - val initial = FontWeight("initial") - val inherit = FontWeight("inherit") - } + companion object { + val normal = FontWeight("normal") + val bold = FontWeight("bold") + val _100 = FontWeight("100") + val _200 = FontWeight("200") + val _300 = FontWeight("300") + val _400 = FontWeight("400") + val _500 = FontWeight("500") + val _600 = FontWeight("600") + val _700 = FontWeight("700") + val _800 = FontWeight("800") + val _900 = FontWeight("900") + val initial = FontWeight("initial") + val inherit = FontWeight("inherit") + } } class FontKerning( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = FontKerning("auto") - val normal = FontKerning("normal") - val none = FontKerning("none") - } + companion object { + val auto = FontKerning("auto") + val normal = FontKerning("normal") + val none = FontKerning("none") + } } class FontSizeAdjust( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = FontSizeAdjust("none") - val initial = FontSizeAdjust("initial") - val inherit = FontSizeAdjust("inherit") - } + companion object { + val none = FontSizeAdjust("none") + val initial = FontSizeAdjust("initial") + val inherit = FontSizeAdjust("inherit") + } } class FontVariant( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = FontVariant("normal") - val smallCaps = FontVariant("small-caps") - val initial = FontVariant("initial") - val inherit = FontVariant("inherit") - } + companion object { + val normal = FontVariant("normal") + val smallCaps = FontVariant("small-caps") + val initial = FontVariant("initial") + val inherit = FontVariant("inherit") + } } class FontVariantCaps( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = FontVariantCaps("normal") - val smallCaps = FontVariantCaps("small-caps") - val allSmallCaps = FontVariantCaps("all-small-caps") - val petiteCaps = FontVariantCaps("petite-caps") - val allPetiteCaps = FontVariantCaps("all-petite-caps") - val unicase = FontVariantCaps("unicase") - val initial = FontVariantCaps("initial") - val inherit = FontVariantCaps("inherit") - val unset = FontVariantCaps("unset") - } + companion object { + val normal = FontVariantCaps("normal") + val smallCaps = FontVariantCaps("small-caps") + val allSmallCaps = FontVariantCaps("all-small-caps") + val petiteCaps = FontVariantCaps("petite-caps") + val allPetiteCaps = FontVariantCaps("all-petite-caps") + val unicase = FontVariantCaps("unicase") + val initial = FontVariantCaps("initial") + val inherit = FontVariantCaps("inherit") + val unset = FontVariantCaps("unset") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Grid.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Grid.kt index 1d41f5b..67880ab 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Grid.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Grid.kt @@ -2,71 +2,71 @@ package nl.astraeus.css.properties class Grid( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = Grid("none") - val initial = Grid("initial") - val inherit = Grid("inherit") - } + companion object { + val none = Grid("none") + val initial = Grid("initial") + val inherit = Grid("inherit") + } } class GridAuto( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = GridAuto("auto") - val maxContent = GridAuto("max-content") - val minContent = GridAuto("min-content") - } + companion object { + val auto = GridAuto("auto") + val maxContent = GridAuto("max-content") + val minContent = GridAuto("min-content") + } } class GridFlow( - value: String + value: String ) : CssProperty(value) { - companion object { - val row = GridFlow("row") - val column = GridFlow("column") - val dense = GridFlow("dense") - val rowDense = GridFlow("row dense") - val columnDense = GridFlow("column dense") - } + companion object { + val row = GridFlow("row") + val column = GridFlow("column") + val dense = GridFlow("dense") + val rowDense = GridFlow("row dense") + val columnDense = GridFlow("column dense") + } } class GridValue( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = GridValue("auto") + companion object { + val auto = GridValue("auto") - fun span(column: Int) = GridValue("span $column") - fun column(line: Int) = GridValue("$line") - fun row(line: Int) = GridValue("$line") - } + fun span(column: Int) = GridValue("span $column") + fun column(line: Int) = GridValue("$line") + fun row(line: Int) = GridValue("$line") + } } class TemplateRowColumn( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = GridValue("none") - val auto = GridValue("auto") - val maxContent = GridValue("max-content") - val minContent = GridValue("min-content") - val initial = GridValue("initial") - val inherit = GridValue("inherit") + companion object { + val none = GridValue("none") + val auto = GridValue("auto") + val maxContent = GridValue("max-content") + val minContent = GridValue("min-content") + val initial = GridValue("initial") + val inherit = GridValue("inherit") - fun length(length: Measurement) = GridValue(length.value) - } + fun length(length: Measurement) = GridValue(length.value) + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Hyphens.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Hyphens.kt index 0094c51..2ee01c9 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Hyphens.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Hyphens.kt @@ -1,15 +1,15 @@ package nl.astraeus.css.properties class Hyphens( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = Hyphens("none") - val manual = Hyphens("manual") - val auto = Hyphens("auto") - val initial = Hyphens("initial") - val inherit = Hyphens("inherit") - } + companion object { + val none = Hyphens("none") + val manual = Hyphens("manual") + val auto = Hyphens("auto") + val initial = Hyphens("initial") + val inherit = Hyphens("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Image.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Image.kt index 7e36cdf..6fe9544 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Image.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Image.kt @@ -1,62 +1,62 @@ package nl.astraeus.css.properties class Image( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = Image("none") - val initial = Image("initial") - val inherit = Image("inherit") + companion object { + val none = Image("none") + val initial = Image("initial") + val inherit = Image("inherit") - fun url(url: String) = Image("url($url)") - } + fun url(url: String) = Image("url($url)") + } } class ImageRepeat( - value: String + value: String ) : CssProperty(value) { - companion object { - val repeat = ImageRepeat("repeat") - val round = ImageRepeat("round") - val initial = ImageRepeat("initial") - val inherit = ImageRepeat("inherit") + companion object { + val repeat = ImageRepeat("repeat") + val round = ImageRepeat("round") + val initial = ImageRepeat("initial") + val inherit = ImageRepeat("inherit") - fun stretch(url: String) = ImageRepeat("stretch") - } + fun stretch(url: String) = ImageRepeat("stretch") + } } class ImageSlice( - value: String + value: String ) : CssProperty(value) { - companion object { - val repeat = ImageSlice("repeat") - val fill = ImageSlice("fill") - val initial = ImageSlice("initial") - val inherit = ImageSlice("inherit") + companion object { + val repeat = ImageSlice("repeat") + val fill = ImageSlice("fill") + val initial = ImageSlice("initial") + val inherit = ImageSlice("inherit") - fun nr(nr: Int) = ImageSlice("$nr") - fun perc(perc: Int) = ImageSlice("$perc%") - fun perc(perc: Double) = ImageSlice("$perc%") - fun stretch(url: String) = ImageSlice("stretch") - } + fun nr(nr: Int) = ImageSlice("$nr") + fun perc(perc: Int) = ImageSlice("$perc%") + fun perc(perc: Double) = ImageSlice("$perc%") + fun stretch(url: String) = ImageSlice("stretch") + } } class ImageSource( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = ImageSource("none") - val initial = ImageSource("initial") - val inherit = ImageSource("inherit") + companion object { + val none = ImageSource("none") + val initial = ImageSource("initial") + val inherit = ImageSource("inherit") - fun text(txt: String) = ImageSource(txt) - fun image(url: String) = ImageSource("'$url'") - } + fun text(txt: String) = ImageSource(txt) + fun image(url: String) = ImageSource("'$url'") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/InitialInherit.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/InitialInherit.kt index 1de892e..4fd3e23 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/InitialInherit.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/InitialInherit.kt @@ -1,12 +1,12 @@ package nl.astraeus.css.properties class InitialInherit( - value: String + value: String ) : CssProperty(value) { - companion object { - val initial = InitialInherit("initial") - val inherit = InitialInherit("inherit") - } + companion object { + val initial = InitialInherit("initial") + val inherit = InitialInherit("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Isolation.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Isolation.kt index e4db74a..52e767f 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Isolation.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Isolation.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class Isolation( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = Isolation("auto") - val isolate = Isolation("isolate") - val initial = Isolation("initial") - val inherit = Isolation("inherit") - } + companion object { + val auto = Isolation("auto") + val isolate = Isolation("isolate") + val initial = Isolation("initial") + val inherit = Isolation("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/JustifyContent.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/JustifyContent.kt index 7b6b0da..5e2d79e 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/JustifyContent.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/JustifyContent.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class JustifyContent( - value: String + value: String ) : CssProperty(value) { - companion object { - val flexStart = JustifyContent("flex-start") - val flexEnd = JustifyContent("flex-end") - val center = JustifyContent("center") - val spaceBetween = JustifyContent("space-between") - val spaceAround = JustifyContent("space-around") - val initial = JustifyContent("initial") - val inherit = JustifyContent("inherit") - } + companion object { + val flexStart = JustifyContent("flex-start") + val flexEnd = JustifyContent("flex-end") + val center = JustifyContent("center") + val spaceBetween = JustifyContent("space-between") + val spaceAround = JustifyContent("space-around") + val initial = JustifyContent("initial") + val inherit = JustifyContent("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/LetterSpacing.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/LetterSpacing.kt index 1bccc20..2ada69e 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/LetterSpacing.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/LetterSpacing.kt @@ -1,13 +1,13 @@ package nl.astraeus.css.properties class LetterSpacing( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = LetterSpacing("normal") - val initial = LetterSpacing("initial") - val inherit = LetterSpacing("inherit") - } + companion object { + val normal = LetterSpacing("normal") + val initial = LetterSpacing("initial") + val inherit = LetterSpacing("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/ListStyle.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/ListStyle.kt index 6d5f538..91b7b7a 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/ListStyle.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/ListStyle.kt @@ -2,47 +2,47 @@ package nl.astraeus.css.properties class ListStylePosition( - value: String + value: String ) : CssProperty(value) { - companion object { - val inside = ListStylePosition("inside") - val outside = ListStylePosition("outside") - val initial = ListStylePosition("initial") - val inherit = ListStylePosition("inherit") - } + companion object { + val inside = ListStylePosition("inside") + val outside = ListStylePosition("outside") + val initial = ListStylePosition("initial") + val inherit = ListStylePosition("inherit") + } } class ListStyleType( - value: String + value: String ) : CssProperty(value) { - companion object { - val disc = ListStyleType("disc") - val armenian = ListStyleType("armenian") - val circle = ListStyleType("circle") - val cjkIdeographic = ListStyleType("cjk-ideographic") - val decimal = ListStyleType("decimal") - val decimalLeadingZero = ListStyleType("decimal-leading-zero") - val georgian = ListStyleType("georgian") - val hebrew = ListStyleType("hebrew") - val hiragana = ListStyleType("hiragana") - val hiraganaIroha = ListStyleType("hiragana-iroha") - val katakana = ListStyleType("katakana") - val katakanaIroha = ListStyleType("katakana-iroha") - val lowerAlpha = ListStyleType("lower-alpha") - val lowerGreek = ListStyleType("lower-greek") - val lowerLatin = ListStyleType("lower-latin") - val lowerRoman = ListStyleType("lower-roman") - val none = ListStyleType("none") - val square = ListStyleType("square") - val upperAlpha = ListStyleType("upper-alpha") - val upperGreek = ListStyleType("upper-greek") - val upperLatin = ListStyleType("upper-latin") - val upperRoman = ListStyleType("upper-roman") - val initial = ListStyleType("initial") - val inherit = ListStyleType("inherit") - } + companion object { + val disc = ListStyleType("disc") + val armenian = ListStyleType("armenian") + val circle = ListStyleType("circle") + val cjkIdeographic = ListStyleType("cjk-ideographic") + val decimal = ListStyleType("decimal") + val decimalLeadingZero = ListStyleType("decimal-leading-zero") + val georgian = ListStyleType("georgian") + val hebrew = ListStyleType("hebrew") + val hiragana = ListStyleType("hiragana") + val hiraganaIroha = ListStyleType("hiragana-iroha") + val katakana = ListStyleType("katakana") + val katakanaIroha = ListStyleType("katakana-iroha") + val lowerAlpha = ListStyleType("lower-alpha") + val lowerGreek = ListStyleType("lower-greek") + val lowerLatin = ListStyleType("lower-latin") + val lowerRoman = ListStyleType("lower-roman") + val none = ListStyleType("none") + val square = ListStyleType("square") + val upperAlpha = ListStyleType("upper-alpha") + val upperGreek = ListStyleType("upper-greek") + val upperLatin = ListStyleType("upper-latin") + val upperRoman = ListStyleType("upper-roman") + val initial = ListStyleType("initial") + val inherit = ListStyleType("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Measurement.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Measurement.kt index 4b789a3..126658d 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Measurement.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Measurement.kt @@ -1,60 +1,91 @@ package nl.astraeus.css.properties open class Measurement( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = Measurement("auto") - val initial = Measurement("initial") - val inherit = Measurement("inherit") - val normal = Measurement("normal") + companion object { + val auto = Measurement("auto") + val initial = Measurement("initial") + val inherit = Measurement("inherit") + val normal = Measurement("normal") - fun px(nr: Int) = if (nr == 0) { Measurement("0") } else { Measurement("${nr}px") } - fun px(nr: Double) = nr.px - fun em(nr: Int) = nr.em - fun em(nr: Double) = nr.em - 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: Int) = if (nr == 0) { + Measurement("0") + } else { + Measurement("${nr}px") } + + fun px(nr: Double) = nr.px + fun em(nr: Int) = nr.em + fun em(nr: Double) = nr.em + 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 - get() = Measurement("${this}${if (this == 0) { "" } else { "px"}}") + get() = Measurement( + "${this}${ + if (this == 0) { + "" + } else { + "px" + } + }" + ) val Int.em: Measurement - get() = Measurement("${this}${if (this == 0) { "" } else { "em"}}") + get() = Measurement( + "${this}${ + if (this == 0) { + "" + } else { + "em" + } + }" + ) val Int.rem: Measurement - get() = Measurement("${this}${if (this == 0) { "" } else { "rem"}}") + get() = Measurement( + "${this}${ + if (this == 0) { + "" + } else { + "rem" + } + }" + ) val Int.prc: Measurement - get() = Measurement("${this}%") + get() = Measurement("${this}%") val Int.pc: Measurement - get() = Measurement("${this}pc") + get() = Measurement("${this}pc") val Int.cm: Measurement - get() = Measurement("${this}cm") + get() = Measurement("${this}cm") + fun Int.px(): Measurement = Measurement.px(this) val Double.px: Measurement - get() = Measurement("${this}px") + get() = Measurement("${this}px") val Double.em: Measurement - get() = Measurement("${this}em") + get() = Measurement("${this}em") val Double.rem: Measurement - get() = Measurement("${this}rem") + get() = Measurement("${this}rem") val Double.prc: Measurement - get() = Measurement("${this}%") + get() = Measurement("${this}%") val Double.pc: Measurement - get() = Measurement("${this}pc") + get() = Measurement("${this}pc") val Double.cm: Measurement - get() = Measurement("${this}cm") + get() = Measurement("${this}cm") + fun Double.px(): Measurement = Measurement.px(this) open class LineHeight(value: String) : CssProperty(value) { - companion object { - val normal = LineHeight("normal") - val initial = LineHeight("initial") - val inherit = LineHeight("inherit") - } + companion object { + val normal = LineHeight("normal") + val initial = LineHeight("initial") + val inherit = LineHeight("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/MixBlendMode.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/MixBlendMode.kt index e22a4da..002d9af 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/MixBlendMode.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/MixBlendMode.kt @@ -2,24 +2,24 @@ package nl.astraeus.css.properties class MixBlendMode( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = MixBlendMode("normal") - val multiply = MixBlendMode("multiply") - val screen = MixBlendMode("screen") - val overlay = MixBlendMode("overlay") - val darken = MixBlendMode("darken") - val lighten = MixBlendMode("lighten") - val colorDodge = MixBlendMode("color-dodge") - val colorBurn = MixBlendMode("color-burn") - val difference = MixBlendMode("difference") - val exclusion = MixBlendMode("exclusion") - val hue = MixBlendMode("hue") - val saturation = MixBlendMode("saturation") - val color = MixBlendMode("color") - val luminosity = MixBlendMode("luminosity") - } + companion object { + val normal = MixBlendMode("normal") + val multiply = MixBlendMode("multiply") + val screen = MixBlendMode("screen") + val overlay = MixBlendMode("overlay") + val darken = MixBlendMode("darken") + val lighten = MixBlendMode("lighten") + val colorDodge = MixBlendMode("color-dodge") + val colorBurn = MixBlendMode("color-burn") + val difference = MixBlendMode("difference") + val exclusion = MixBlendMode("exclusion") + val hue = MixBlendMode("hue") + val saturation = MixBlendMode("saturation") + val color = MixBlendMode("color") + val luminosity = MixBlendMode("luminosity") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/ObjectFit.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/ObjectFit.kt index 78beab4..ea0d4bb 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/ObjectFit.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/ObjectFit.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class ObjectFit( - value: String + value: String ) : CssProperty(value) { - companion object { - val fill = ObjectFit("fill") - val contain = ObjectFit("contain") - val cover = ObjectFit("cover") - val scaleDown = ObjectFit("scale-down") - val none = ObjectFit("none") - val initial = ObjectFit("initial") - val inherit = ObjectFit("inherit") - } + companion object { + val fill = ObjectFit("fill") + val contain = ObjectFit("contain") + val cover = ObjectFit("cover") + val scaleDown = ObjectFit("scale-down") + val none = ObjectFit("none") + val initial = ObjectFit("initial") + val inherit = ObjectFit("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/OutlineWidth.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/OutlineWidth.kt index 04ce5e5..51ca6e1 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/OutlineWidth.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/OutlineWidth.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class OutlineWidth( - value: String + value: String ) : CssProperty(value) { - companion object { - val thin = OutlineWidth("thin") - val medium = OutlineWidth("medium") - val thick = OutlineWidth("thick") - val initial = BorderWidth("initial") - val inherit = BorderWidth("inherit") - } + companion object { + val thin = OutlineWidth("thin") + val medium = OutlineWidth("medium") + val thick = OutlineWidth("thick") + val initial = BorderWidth("initial") + val inherit = BorderWidth("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Overflow.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Overflow.kt index c205297..b17f2ae 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Overflow.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Overflow.kt @@ -1,15 +1,15 @@ package nl.astraeus.css.properties class Overflow( - value: String + value: String ) : CssProperty(value) { - companion object { - val visible = Overflow("visible") - val hidden = Overflow("hidden") - val scroll = Overflow("scroll") - val auto = Overflow("auto") - val initial = BorderWidth("initial") - val inherit = BorderWidth("inherit") - } + companion object { + val visible = Overflow("visible") + val hidden = Overflow("hidden") + val scroll = Overflow("scroll") + val auto = Overflow("auto") + val initial = BorderWidth("initial") + val inherit = BorderWidth("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/PageBreak.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/PageBreak.kt index 89b2130..3344e38 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/PageBreak.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/PageBreak.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class PageBreak( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = PageBreak("auto") - val always = PageBreak("always") - val avoid = PageBreak("avoid") - val left = PageBreak("left") - val right = PageBreak("right") - val initial = PageBreak("initial") - val inherit = PageBreak("inherit") - } + companion object { + val auto = PageBreak("auto") + val always = PageBreak("always") + val avoid = PageBreak("avoid") + val left = PageBreak("left") + val right = PageBreak("right") + val initial = PageBreak("initial") + val inherit = PageBreak("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Perspective.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Perspective.kt index 1579e2a..2dab621 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Perspective.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Perspective.kt @@ -1,13 +1,13 @@ package nl.astraeus.css.properties class Perspective( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = Perspective("none") - val initial = Perspective("initial") - val inherit = Perspective("inherit") - } + companion object { + val none = Perspective("none") + val initial = Perspective("initial") + val inherit = Perspective("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/PointerEvents.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/PointerEvents.kt index 013b0f4..92083cc 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/PointerEvents.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/PointerEvents.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class PointerEvents( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = PointerEvents("auto") - val none = PointerEvents("none") - val initial = PointerEvents("initial") - val inherit = PointerEvents("inherit") - } + companion object { + val auto = PointerEvents("auto") + val none = PointerEvents("none") + val initial = PointerEvents("initial") + val inherit = PointerEvents("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Position.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Position.kt index 7be6159..0750059 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Position.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Position.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class Position( - value: String + value: String ) : CssProperty(value) { - companion object { - val static = Position("static") - val absolute = Position("absolute") - val fixed = Position("fixed") - val relative = Position("relative") - val sticky = Position("sticky") - val initial = Position("initial") - val inherit = Position("inherit") - } + companion object { + val static = Position("static") + val absolute = Position("absolute") + val fixed = Position("fixed") + val relative = Position("relative") + val sticky = Position("sticky") + val initial = Position("initial") + val inherit = Position("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Punctuation.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Punctuation.kt index dc935c7..a368305 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Punctuation.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Punctuation.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class HangingPunctuation( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = HangingPunctuation("none") - val first = HangingPunctuation("first") - val last = HangingPunctuation("last") - val allowEnd = HangingPunctuation("allow-end") - val forceEnd = HangingPunctuation("force-end") - val initial = HangingPunctuation("initial") - val inherit = HangingPunctuation("inherit") - } + companion object { + val none = HangingPunctuation("none") + val first = HangingPunctuation("first") + val last = HangingPunctuation("last") + val allowEnd = HangingPunctuation("allow-end") + val forceEnd = HangingPunctuation("force-end") + val initial = HangingPunctuation("initial") + val inherit = HangingPunctuation("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Resize.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Resize.kt index a0d97b5..01cc12c 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Resize.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Resize.kt @@ -1,16 +1,16 @@ package nl.astraeus.css.properties class Resize( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = Resize("none") - val both = Resize("both") - val horizontal = Resize("horizontal") - val vertical = Resize("vertical") - val initial = Resize("initial") - val inherit = Resize("inherit") - } + companion object { + val none = Resize("none") + val both = Resize("both") + val horizontal = Resize("horizontal") + val vertical = Resize("vertical") + val initial = Resize("initial") + val inherit = Resize("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/ScrollBehavior.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/ScrollBehavior.kt index cc97f98..c129633 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/ScrollBehavior.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/ScrollBehavior.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class ScrollBehavior( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = ScrollBehavior("auto") - val smooth = ScrollBehavior("smooth") - val initial = ScrollBehavior("initial") - val inherit = ScrollBehavior("inherit") - } + companion object { + val auto = ScrollBehavior("auto") + val smooth = ScrollBehavior("smooth") + val initial = ScrollBehavior("initial") + val inherit = ScrollBehavior("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Span.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Span.kt index 019691d..0aa860e 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Span.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Span.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class Span( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = Clip("none") - val all = Clip("all") - val initial = Clip("initial") - val inherit = Clip("inherit") - } + companion object { + val none = Clip("none") + val all = Clip("all") + val initial = Clip("initial") + val inherit = Clip("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TableLayout.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TableLayout.kt index 65c5574..a7a77cc 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TableLayout.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TableLayout.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class TableLayout( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = TableLayout("auto") - val fixed = TableLayout("fixed") - val initial = TableLayout("initial") - val inherit = TableLayout("auto") - } + companion object { + val auto = TableLayout("auto") + val fixed = TableLayout("fixed") + val initial = TableLayout("initial") + val inherit = TableLayout("auto") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TextAlign.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TextAlign.kt index b5ccf5d..03b7b2e 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TextAlign.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TextAlign.kt @@ -1,16 +1,16 @@ package nl.astraeus.css.properties class TextAlign( - value: String + value: String ) : CssProperty(value) { - companion object { - val left = TextAlign("left") - val right = TextAlign("right") - val center = TextAlign("center") - val justify = TextAlign("justify") - val initial = TextAlign("initial") - val inherit = TextAlign("inherit") - } + companion object { + val left = TextAlign("left") + val right = TextAlign("right") + val center = TextAlign("center") + val justify = TextAlign("justify") + val initial = TextAlign("initial") + val inherit = TextAlign("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TextAlignLast.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TextAlignLast.kt index afbd0b1..99de0cf 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TextAlignLast.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TextAlignLast.kt @@ -1,19 +1,19 @@ package nl.astraeus.css.properties class TextAlignLast( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = TextAlignLast("auto") - val left = TextAlignLast("left") - val right = TextAlignLast("right") - val center = TextAlignLast("center") - val justify = TextAlignLast("justify") - val start = TextAlignLast("start") - val end = TextAlignLast("end") - val initial = TextAlignLast("initial") - val inherit = TextAlignLast("inherit") - } + companion object { + val auto = TextAlignLast("auto") + val left = TextAlignLast("left") + val right = TextAlignLast("right") + val center = TextAlignLast("center") + val justify = TextAlignLast("justify") + val start = TextAlignLast("start") + val end = TextAlignLast("end") + val initial = TextAlignLast("initial") + val inherit = TextAlignLast("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TextDecorationLine.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TextDecorationLine.kt index a9d9d60..5306aff 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TextDecorationLine.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TextDecorationLine.kt @@ -1,16 +1,16 @@ package nl.astraeus.css.properties class TextDecorationLine( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = TextDecorationLine("none") - val underline = TextDecorationLine("underline") - val overline = TextDecorationLine("overline") - val lineThrough = TextDecorationLine("line-through") - val initial = TextDecorationLine("initial") - val inherit = TextDecorationLine("inherit") - } + companion object { + val none = TextDecorationLine("none") + val underline = TextDecorationLine("underline") + val overline = TextDecorationLine("overline") + val lineThrough = TextDecorationLine("line-through") + val initial = TextDecorationLine("initial") + val inherit = TextDecorationLine("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TextDecorationStyle.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TextDecorationStyle.kt index 5661d44..ac70b85 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TextDecorationStyle.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TextDecorationStyle.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class TextDecorationStyle( - value: String + value: String ) : CssProperty(value) { - companion object { - val solid = TextDecorationStyle("solid") - val double = TextDecorationStyle("double") - val dotted = TextDecorationStyle("dotted") - val dashed = TextDecorationStyle("dashed") - val wavy = TextDecorationStyle("wavy") - val initial = TextDecorationStyle("initial") - val inherit = TextDecorationStyle("inherit") - } + companion object { + val solid = TextDecorationStyle("solid") + val double = TextDecorationStyle("double") + val dotted = TextDecorationStyle("dotted") + val dashed = TextDecorationStyle("dashed") + val wavy = TextDecorationStyle("wavy") + val initial = TextDecorationStyle("initial") + val inherit = TextDecorationStyle("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TextJustify.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TextJustify.kt index 59db82b..6634807 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TextJustify.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TextJustify.kt @@ -1,16 +1,16 @@ package nl.astraeus.css.properties class TextJustify( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = TextJustify("auto") - val interWord = TextJustify("inter-word") - val interCharacter = TextJustify("inter-character") - val none = TextJustify("none") - val initial = TextJustify("initial") - val inherit = TextJustify("inherit") - } + companion object { + val auto = TextJustify("auto") + val interWord = TextJustify("inter-word") + val interCharacter = TextJustify("inter-character") + val none = TextJustify("none") + val initial = TextJustify("initial") + val inherit = TextJustify("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TextTransform.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TextTransform.kt index 7902372..de33735 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TextTransform.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TextTransform.kt @@ -1,16 +1,16 @@ package nl.astraeus.css.properties class TextTransform( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = TextTransform("none") - val capitalize = TextTransform("capitalize") - val uppercase = TextTransform("uppercase") - val lowercase = TextTransform("lowercase") - val initial = TextTransform("initial") - val inherit = TextTransform("inherit") - } + companion object { + val none = TextTransform("none") + val capitalize = TextTransform("capitalize") + val uppercase = TextTransform("uppercase") + val lowercase = TextTransform("lowercase") + val initial = TextTransform("initial") + val inherit = TextTransform("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TimingFunction.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TimingFunction.kt index 3ab0d1f..ec636b6 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TimingFunction.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TimingFunction.kt @@ -1,22 +1,31 @@ package nl.astraeus.css.properties class TimingFunction( - value: String + value: String ) : CssProperty(value) { - companion object { - val linear = TimingFunction("linear") - val ease = TimingFunction("ease") - val easeIn = TimingFunction("ease-in") - val easeOut = TimingFunction("ease-out") - val easeInOut = TimingFunction("ease-in-out") - val stepStart = TimingFunction("step-start") - val stepEnd = TimingFunction("step-end") - val initial = TimingFunction("initial") - val inherit = TimingFunction("inherit") + companion object { + val linear = TimingFunction("linear") + val ease = TimingFunction("ease") + val easeIn = TimingFunction("ease-in") + val easeOut = TimingFunction("ease-out") + val easeInOut = TimingFunction("ease-in-out") + val stepStart = TimingFunction("step-start") + val stepEnd = TimingFunction("step-end") + val initial = TimingFunction("initial") + val inherit = TimingFunction("inherit") - fun steps(steps: Int, start: Boolean) = TimingFunction("steps($steps, ${if (start) { "start" } else { "end" }}") - fun cubicBezier(n1: Double, n2: Double, n3: Double, n4: Double) = TimingFunction("cubic-bezier($n1, $n2, $n3, $n4)") - } + fun steps(steps: Int, start: Boolean) = TimingFunction( + "steps($steps, ${ + if (start) { + "start" + } else { + "end" + } + }" + ) + + fun cubicBezier(n1: Double, n2: Double, n3: Double, n4: Double) = TimingFunction("cubic-bezier($n1, $n2, $n3, $n4)") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Transform.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Transform.kt index ed29c86..55f8f69 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Transform.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Transform.kt @@ -1,49 +1,51 @@ package nl.astraeus.css.properties class Transform( - value: String + value: String ) : CssProperty(value) { - companion object { - val none = Transform("none") - val initial = Transform("initial") - val inherit = Transform("inherit") + companion object { + val none = Transform("none") + val initial = Transform("initial") + val inherit = Transform("inherit") - fun matrix( - n1: Double, - n2: Double, - n3: Double, - n4: Double, - n5: Double, - n6: Double - ) = Transform("matrix($n1, $n2, $n3, $n4, $n5, $n6)") - fun matrix3d( - n01: Double, n02: Double, n03: Double, n04: Double, - n05: Double, n06: Double, n07: Double, n08: Double, - n09: Double, n10: Double, n11: Double, n12: Double, - n13: Double, n14: Double, n15: Double, n16: Double - ) = 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 translateY(y: Double) = Transform("translateY($y)") - fun translateZ(z: Double) = Transform("translateZ($z)") - fun scale(x: Double, y: Double) = Transform("scale($x, $y)") - fun scale3d(x: Double, y: Double, z: Double) = Transform("scale3d($x, $y, $z)") - fun scaleX(x: Double) = Transform("scaleX($x)") - fun scaleY(y: Double) = Transform("scaleY($y)") - fun scaleZ(z: Double) = Transform("scaleZ($z)") - fun rotate(angle: Double) = Transform("rotate($angle)") - fun rotate3d(x: Double, y: Double, z: Double, angle: Double) = Transform("scale3d($x, $y, $z, $angle") - fun rotateX(x: Double) = Transform("rotateX($x)") - fun rotateY(y: Double) = Transform("rotateY($y)") - fun rotateZ(z: Double) = Transform("rotateZ($z)") - fun skew(x: Double, y: Double) = Transform("skew($x, $y)") - fun skewX(x: Double) = Transform("skew($x)") - fun skewY(y: Double) = Transform("skew($y)") - fun perspective(length: Measurement) = Transform("perspective(${length.css()})") - } + fun matrix( + n1: Double, + n2: Double, + n3: Double, + n4: Double, + n5: Double, + n6: Double + ) = Transform("matrix($n1, $n2, $n3, $n4, $n5, $n6)") + + fun matrix3d( + n01: Double, n02: Double, n03: Double, n04: Double, + n05: Double, n06: Double, n07: Double, n08: Double, + n09: Double, n10: Double, n11: Double, n12: Double, + n13: Double, n14: Double, n15: Double, n16: Double + ) = 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 translateY(y: Double) = Transform("translateY($y)") + fun translateZ(z: Double) = Transform("translateZ($z)") + fun scale(x: Double, y: Double) = Transform("scale($x, $y)") + fun scale3d(x: Double, y: Double, z: Double) = Transform("scale3d($x, $y, $z)") + fun scaleX(x: Double) = Transform("scaleX($x)") + fun scaleY(y: Double) = Transform("scaleY($y)") + fun scaleZ(z: Double) = Transform("scaleZ($z)") + fun rotate(angle: Double) = Transform("rotate($angle)") + fun rotate3d(x: Double, y: Double, z: Double, angle: Double) = Transform("scale3d($x, $y, $z, $angle") + fun rotateX(x: Double) = Transform("rotateX($x)") + fun rotateY(y: Double) = Transform("rotateY($y)") + fun rotateZ(z: Double) = Transform("rotateZ($z)") + fun skew(x: Double, y: Double) = Transform("skew($x, $y)") + fun skewX(x: Double) = Transform("skew($x)") + fun skewY(y: Double) = Transform("skew($y)") + fun perspective(length: Measurement) = Transform("perspective(${length.css()})") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/TransformStyle.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/TransformStyle.kt index 11e9f6e..d017579 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/TransformStyle.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/TransformStyle.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class TransformStyle( - value: String + value: String ) : CssProperty(value) { - companion object { - val flat = TransformStyle("flat") - val preserve3d = TransformStyle("preserve-3d") - val initial = TransformStyle("initial") - val inherit = TransformStyle("inherit") - } + companion object { + val flat = TransformStyle("flat") + val preserve3d = TransformStyle("preserve-3d") + val initial = TransformStyle("initial") + val inherit = TransformStyle("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/UnicodeBidi.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/UnicodeBidi.kt index a650d85..f8defaf 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/UnicodeBidi.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/UnicodeBidi.kt @@ -1,15 +1,15 @@ package nl.astraeus.css.properties class UnicodeBidi( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = UnicodeBidi("normal") - val embed = UnicodeBidi("embed") - val bidiOverride = UnicodeBidi("bidi-override") - val initial = UnicodeBidi("initial") - val inherit = UnicodeBidi("inherit") - } + companion object { + val normal = UnicodeBidi("normal") + val embed = UnicodeBidi("embed") + val bidiOverride = UnicodeBidi("bidi-override") + val initial = UnicodeBidi("initial") + val inherit = UnicodeBidi("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/UserSelect.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/UserSelect.kt index 716af01..3b1b714 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/UserSelect.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/UserSelect.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class UserSelect( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = UserSelect("auto") - val none = UserSelect("none") - val text = UserSelect("text") - val all = UserSelect("all") - } + companion object { + val auto = UserSelect("auto") + val none = UserSelect("none") + val text = UserSelect("text") + val all = UserSelect("all") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/VerticalAlign.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/VerticalAlign.kt index f14e116..5b2a80a 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/VerticalAlign.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/VerticalAlign.kt @@ -1,20 +1,20 @@ package nl.astraeus.css.properties class VerticalAlign( - value: String + value: String ) : CssProperty(value) { - companion object { - val baseline = VerticalAlign("baseline") - val sub = VerticalAlign("sub") - val _super = VerticalAlign("super") - val top = VerticalAlign("top") - val textTop = VerticalAlign("text-top") - val middle = VerticalAlign("middle") - val bottom = VerticalAlign("bottom") - val textBottom = VerticalAlign("text-bottom") - val initial = VerticalAlign("initial") - val inherit = VerticalAlign("inherit") - } + companion object { + val baseline = VerticalAlign("baseline") + val sub = VerticalAlign("sub") + val _super = VerticalAlign("super") + val top = VerticalAlign("top") + val textTop = VerticalAlign("text-top") + val middle = VerticalAlign("middle") + val bottom = VerticalAlign("bottom") + val textBottom = VerticalAlign("text-bottom") + val initial = VerticalAlign("initial") + val inherit = VerticalAlign("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/Visibility.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/Visibility.kt index 5d333ad..b737f2f 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/Visibility.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/Visibility.kt @@ -1,15 +1,15 @@ package nl.astraeus.css.properties class Visibility( - value: String + value: String ) : CssProperty(value) { - companion object { - val visible = Visibility("visible") - val hidden = Visibility("hidden") - val collapse = Visibility("collapse") - val initial = Visibility("initial") - val inherit = Visibility("inherit") - } + companion object { + val visible = Visibility("visible") + val hidden = Visibility("hidden") + val collapse = Visibility("collapse") + val initial = Visibility("initial") + val inherit = Visibility("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/WhiteSpace.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/WhiteSpace.kt index 07b60ea..8b50f10 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/WhiteSpace.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/WhiteSpace.kt @@ -1,17 +1,17 @@ package nl.astraeus.css.properties class WhiteSpace( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = WhiteSpace("normal") - val nowrap = WhiteSpace("nowrap") - val pre = WhiteSpace("pre") - val preLine = WhiteSpace("pre-line") - val preWrap = WhiteSpace("pre-wrap") - val initial = WhiteSpace("initial") - val inherit = WhiteSpace("inherit") - } + companion object { + val normal = WhiteSpace("normal") + val nowrap = WhiteSpace("nowrap") + val pre = WhiteSpace("pre") + val preLine = WhiteSpace("pre-line") + val preWrap = WhiteSpace("pre-wrap") + val initial = WhiteSpace("initial") + val inherit = WhiteSpace("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/WordBreak.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/WordBreak.kt index 18abc59..1a5d0cc 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/WordBreak.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/WordBreak.kt @@ -1,16 +1,16 @@ package nl.astraeus.css.properties class WordBreak( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = WordBreak("normal") - val breakAll = WordBreak("break-all") - val keepAll = WordBreak("keep-all") - val breakWord = WordBreak("break-word") - val initial = WordBreak("initial") - val inherit = WordBreak("inherit") - } + companion object { + val normal = WordBreak("normal") + val breakAll = WordBreak("break-all") + val keepAll = WordBreak("keep-all") + val breakWord = WordBreak("break-word") + val initial = WordBreak("initial") + val inherit = WordBreak("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/WordSpacing.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/WordSpacing.kt index 7e27e85..bf97db3 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/WordSpacing.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/WordSpacing.kt @@ -1,13 +1,13 @@ package nl.astraeus.css.properties class WordSpacing( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = WordSpacing("normal") - val initial = WordSpacing("initial") - val inherit = WordSpacing("inherit") - } + companion object { + val normal = WordSpacing("normal") + val initial = WordSpacing("initial") + val inherit = WordSpacing("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/WordWrap.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/WordWrap.kt index a375633..54b5529 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/WordWrap.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/WordWrap.kt @@ -1,14 +1,14 @@ package nl.astraeus.css.properties class WordWrap( - value: String + value: String ) : CssProperty(value) { - companion object { - val normal = WordWrap("normal") - val breakWord = WordWrap("break-word") - val initial = WordWrap("initial") - val inherit = WordWrap("inherit") - } + companion object { + val normal = WordWrap("normal") + val breakWord = WordWrap("break-word") + val initial = WordWrap("initial") + val inherit = WordWrap("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/WritingMode.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/WritingMode.kt index 024f3b7..9ce2b37 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/WritingMode.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/WritingMode.kt @@ -1,13 +1,13 @@ package nl.astraeus.css.properties class WritingMode( - value: String + value: String ) : CssProperty(value) { - companion object { - val horizontalTb = WritingMode("horizontal-tb") - val verticalRl = WritingMode("vertical-rl") - val verticalLr = WritingMode("vertical-lr") - } + companion object { + val horizontalTb = WritingMode("horizontal-tb") + val verticalRl = WritingMode("vertical-rl") + val verticalLr = WritingMode("vertical-lr") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/properties/ZIndex.kt b/src/commonMain/kotlin/nl/astraeus/css/properties/ZIndex.kt index bdca5a3..84b8c54 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/properties/ZIndex.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/properties/ZIndex.kt @@ -1,13 +1,13 @@ package nl.astraeus.css.properties class ZIndex( - value: String + value: String ) : CssProperty(value) { - companion object { - val auto = ZIndex("auto") - val initial = ZIndex("initial") - val inherit = ZIndex("inherit") - } + companion object { + val auto = ZIndex("auto") + val initial = ZIndex("initial") + val inherit = ZIndex("inherit") + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/style/CssFunctions.kt b/src/commonMain/kotlin/nl/astraeus/css/style/CssFunctions.kt index 59a357d..e49c1d4 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/style/CssFunctions.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/style/CssFunctions.kt @@ -4,8 +4,8 @@ import nl.astraeus.css.properties.Color object CssFunctions { - fun darken(color: Color, percentage: Int): Color { - return color - } + fun darken(color: Color, percentage: Int): Color { + return color + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/style/FontFace.kt b/src/commonMain/kotlin/nl/astraeus/css/style/FontFace.kt index a9f4f57..ee5d09b 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/style/FontFace.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/style/FontFace.kt @@ -1,38 +1,42 @@ package nl.astraeus.css.style -import nl.astraeus.css.properties.* +import nl.astraeus.css.properties.CssProperty +import nl.astraeus.css.properties.FontSize +import nl.astraeus.css.properties.FontStretch +import nl.astraeus.css.properties.FontStyle +import nl.astraeus.css.properties.FontWeight @CssTagMarker open class FontFace : CssGenerator() { - override fun getValidator(name: String) = null + override fun getValidator(name: String) = null - fun fontFamily(font: String) { - props["font-family"] = listOf(CssProperty(font)) - } + fun fontFamily(font: String) { + props["font-family"] = listOf(CssProperty(font)) + } - fun fontSize(size: FontSize) { - props["font-size"] = listOf(size) - } + fun fontSize(size: FontSize) { + props["font-size"] = listOf(size) + } - fun src(src: String) { - props["src"] = listOf(CssProperty(src)) - } + fun src(src: String) { + props["src"] = listOf(CssProperty(src)) + } - fun fontStretch(stretch: FontStretch) { - props["font-stretch"] = listOf(stretch) - } + fun fontStretch(stretch: FontStretch) { + props["font-stretch"] = listOf(stretch) + } - fun fontStyle(style: FontStyle) { - props["font-style"] = listOf(style) - } + fun fontStyle(style: FontStyle) { + props["font-style"] = listOf(style) + } - fun fontWeight(weight: FontWeight) { - props["font-weight"] = listOf(weight) - } + fun fontWeight(weight: FontWeight) { + props["font-weight"] = listOf(weight) + } - fun unicodeRange(unicodeRange: String) { - props["unicode-range"] = listOf(CssProperty(unicodeRange)) - } + fun unicodeRange(unicodeRange: String) { + props["unicode-range"] = listOf(CssProperty(unicodeRange)) + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/style/KeyFrames.kt b/src/commonMain/kotlin/nl/astraeus/css/style/KeyFrames.kt index 826b2c3..191995c 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/style/KeyFrames.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/style/KeyFrames.kt @@ -2,15 +2,15 @@ package nl.astraeus.css.style @CssTagMarker open class KeyFrames : CssGenerator() { - val frames: MutableMap = mutableMapOf() + val frames: MutableMap = mutableMapOf() - override fun getValidator(name: String): List? = listOf() + override fun getValidator(name: String): List? = listOf() - fun percentage(percentage: Int, style: Css) { - val css = Style() + fun percentage(percentage: Int, style: Css) { + val css = Style() - style(css) + style(css) - frames[percentage] = style - } + frames[percentage] = style + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/style/Style.kt b/src/commonMain/kotlin/nl/astraeus/css/style/Style.kt index d86e405..7cc2046 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/style/Style.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/style/Style.kt @@ -10,664 +10,1404 @@ typealias ConditionalCss = ConditionalStyle.() -> Unit annotation class CssTagMarker private fun prp(vararg css: CssValue): List { - val result = mutableListOf() + val result = mutableListOf() - for (c in css) { - result.add(CssProperty(c.css())) - } + for (c in css) { + result.add(CssProperty(c.css())) + } - return result + return result } private fun prp(vararg css: String): List { - val result = mutableListOf() + val result = mutableListOf() - for (c in css) { - result.add(CssProperty(c)) - } + for (c in css) { + result.add(CssProperty(c)) + } - return result + return result } abstract class CssGenerator { - val definitions: MutableMap> = LinkedHashMap() - val props: MutableMap> = mutableMapOf() + val definitions: MutableMap> = LinkedHashMap() + val props: MutableMap> = mutableMapOf() - abstract fun getValidator(name: String): List? + abstract fun getValidator(name: String): List? - private fun propertyCss(indent: String, name: String, props: List): String { - val builder = StringBuilder() + private fun propertyCss(indent: String, name: String, props: List): String { + val builder = StringBuilder() - getValidator(name)?.forEach { - if (!it.validate(props)) { - println( "Validate error '$name' - ${it.getMessage(name)}") - } - } - - for (prop in props) { - if (builder.isNotEmpty()) { - builder.append(" ") - } - builder.append(prop.css()) - } - - val paddedName = StringBuilder() - paddedName.append(indent) - paddedName.append(name) - paddedName.append(":") - while (paddedName.length < 32) { - paddedName.append(' ') - } - return "$paddedName$builder;\n" + getValidator(name)?.forEach { + if (!it.validate(props)) { + println("Validate error '$name' - ${it.getMessage(name)}") + } } - fun generatePropertyCss(indent: String): String { - val builder = StringBuilder() - - for ((name, prop) in props) { - builder.append(propertyCss(indent, name, prop)) - } - - return builder.toString() + for (prop in props) { + if (builder.isNotEmpty()) { + builder.append(" ") + } + builder.append(prop.css()) } - open fun generateCss( - namespace: String = "", - indent: String = "", - minified: Boolean = false, - warnOnRedeclaration: Boolean = true - ): String { - val builder = StringBuilder() - - for (name in definitions.keys) { - val props = definitions[name]!! - val css = StringBuilder() - - if (warnOnRedeclaration && props.size > 1) { - css.append("/* style '$name' is defined ${props.size} times! */\n") - } - - val finalStyle = Style() - - for (prop in props) { - prop(finalStyle) - } - - css.append(finalStyle.generatePropertyCss(" $indent")) - - if (css.isNotBlank()) { - builder.append("\n$namespace$name".trim()) - - //builder.append(" $indent") - builder.append(" {\n") - - finalStyle.fontFace?.let { ff -> - builder.append(" $indent") - builder.append("@font-face {\n") - builder.append(ff.generatePropertyCss( " $indent")) - builder.append(" $indent") - builder.append("}\n") - } - - finalStyle.keyFrames.let { kf -> - kf.keys.sorted().forEach { frameName -> - val css = kf[frameName] - - builder.append(" $indent") - builder.append("@keyframes ") - builder.append(frameName) - builder.append(" {\n") - css?.let { css -> - for ((nr, style) in css.frames) { - builder.append(" $indent") - builder.append("${nr}% ") - builder.append(" $indent") - builder.append("{\n") - - val finalStyle = Style() - - style(finalStyle) - - builder.append(finalStyle.generatePropertyCss(" $indent")) - - builder.append(" $indent") - builder.append("}\n") - } - - builder.append(" $indent") - builder.append("}\n") - } - } - } - - builder.append(css) - builder.append("}\n\n") - } - - builder.append(finalStyle.generateCss("$namespace$name".trim(), indent)) - } - - if (this is ConditionalStyle) { - this.media.let { mq -> - mq.keys.sorted().forEach { mediaName -> - val css = mq[mediaName] - - builder.append(indent) - builder.append("@media ") - builder.append(mediaName) - builder.append(" {\n") - css?.let { css -> - val mediaStyle = ConditionalStyle() - - css(mediaStyle) - - builder.append(mediaStyle.generateCss("", " $indent")) - } - - builder.append(indent) - builder.append("}\n") - } - } - - this.supports.let { mq -> - mq.keys.sorted().forEach { mediaName -> - val css = mq[mediaName] - - builder.append(indent) - builder.append("@supports ") - builder.append(mediaName) - builder.append(" {\n") - css?.let { css -> - val mediaStyle = ConditionalStyle() - - css(mediaStyle) - - builder.append(mediaStyle.generateCss(""," $indent")) - } - - builder.append(indent) - builder.append("}\n") - } - } - } - - return if (minified) { - val stripped = StringBuilder() - val skip = arrayOf(' ', '\t', '\n', '\r') - for (char in builder) { - if (!skip.contains(char)) { - stripped.append(char) - } - } - stripped.toString(); - } else { - builder.toString() - } + val paddedName = StringBuilder() + paddedName.append(indent) + paddedName.append(name) + paddedName.append(":") + while (paddedName.length < 32) { + paddedName.append(' ') } + return "$paddedName$builder;\n" + } + + fun generatePropertyCss(indent: String): String { + val builder = StringBuilder() + + for ((name, prop) in props) { + builder.append(propertyCss(indent, name, prop)) + } + + return builder.toString() + } + + open fun generateCss( + namespace: String = "", + indent: String = "", + minified: Boolean = false, + warnOnRedeclaration: Boolean = true + ): String { + val builder = StringBuilder() + + for (name in definitions.keys) { + val props = definitions[name]!! + val css = StringBuilder() + + if (warnOnRedeclaration && props.size > 1) { + css.append("/* style '$name' is defined ${props.size} times! */\n") + } + + val finalStyle = Style() + + for (prop in props) { + prop(finalStyle) + } + + css.append(finalStyle.generatePropertyCss(" $indent")) + + if (css.isNotBlank()) { + builder.append("\n$namespace$name".trim()) + + //builder.append(" $indent") + builder.append(" {\n") + + finalStyle.fontFace?.let { ff -> + builder.append(" $indent") + builder.append("@font-face {\n") + builder.append(ff.generatePropertyCss(" $indent")) + builder.append(" $indent") + builder.append("}\n") + } + + finalStyle.keyFrames.let { kf -> + kf.keys.sorted().forEach { frameName -> + val css = kf[frameName] + + builder.append(" $indent") + builder.append("@keyframes ") + builder.append(frameName) + builder.append(" {\n") + css?.let { css -> + for ((nr, style) in css.frames) { + builder.append(" $indent") + builder.append("${nr}% ") + builder.append(" $indent") + builder.append("{\n") + + val finalStyle = Style() + + style(finalStyle) + + builder.append(finalStyle.generatePropertyCss(" $indent")) + + builder.append(" $indent") + builder.append("}\n") + } + + builder.append(" $indent") + builder.append("}\n") + } + } + } + + builder.append(css) + builder.append("}\n\n") + } + + builder.append(finalStyle.generateCss("$namespace$name".trim(), indent)) + } + + if (this is ConditionalStyle) { + this.media.let { mq -> + mq.keys.sorted().forEach { mediaName -> + val css = mq[mediaName] + + builder.append(indent) + builder.append("@media ") + builder.append(mediaName) + builder.append(" {\n") + css?.let { css -> + val mediaStyle = ConditionalStyle() + + css(mediaStyle) + + builder.append(mediaStyle.generateCss("", " $indent")) + } + + builder.append(indent) + builder.append("}\n") + } + } + + this.supports.let { mq -> + mq.keys.sorted().forEach { mediaName -> + val css = mq[mediaName] + + builder.append(indent) + builder.append("@supports ") + builder.append(mediaName) + builder.append(" {\n") + css?.let { css -> + val mediaStyle = ConditionalStyle() + + css(mediaStyle) + + builder.append(mediaStyle.generateCss("", " $indent")) + } + + builder.append(indent) + builder.append("}\n") + } + } + } + + return if (minified) { + val stripped = StringBuilder() + val skip = arrayOf(' ', '\t', '\n', '\r') + for (char in builder) { + if (!skip.contains(char)) { + stripped.append(char) + } + } + stripped.toString() + } else { + builder.toString() + } + } } interface DescriptionProvider { - fun description(): String + fun description(): String } class ValueDescriptionProvider( - val value: String + val value: String ) : DescriptionProvider { - override fun description() = value + override fun description() = value } -fun id(name: String) : DescriptionProvider = ValueDescriptionProvider("#$name") -fun cls(name: String) : DescriptionProvider = ValueDescriptionProvider(".$name") -fun attr(name: String) : DescriptionProvider = ValueDescriptionProvider("[$name]") -fun attrEquals(name: String, value: String) : DescriptionProvider = ValueDescriptionProvider("[$name=$value]") -fun attrContains(name: String, value: String) : DescriptionProvider = ValueDescriptionProvider("[$name*=$value]") -fun attrEntriesContain(name: String, value: String) : DescriptionProvider = ValueDescriptionProvider("[$name~=$value]") -fun attrEndsWith(name: String, value: String) : DescriptionProvider = ValueDescriptionProvider("[$name$=$value]") -fun attrStartsWith(name: String, value: String) : DescriptionProvider = ValueDescriptionProvider("[$name^=$value]") +fun id(name: String): DescriptionProvider = ValueDescriptionProvider("#$name") +fun cls(name: String): DescriptionProvider = ValueDescriptionProvider(".$name") +fun attr(name: String): DescriptionProvider = ValueDescriptionProvider("[$name]") +fun attrEquals(name: String, value: String): DescriptionProvider = ValueDescriptionProvider("[$name=$value]") +fun attrContains(name: String, value: String): DescriptionProvider = ValueDescriptionProvider("[$name*=$value]") +fun attrEntriesContain(name: String, value: String): DescriptionProvider = ValueDescriptionProvider("[$name~=$value]") +fun attrEndsWith(name: String, value: String): DescriptionProvider = ValueDescriptionProvider("[$name$=$value]") +fun attrStartsWith(name: String, value: String): DescriptionProvider = ValueDescriptionProvider("[$name^=$value]") fun id(name: DescriptionProvider) = ValueDescriptionProvider("#${name.description()}") -fun cls(name: DescriptionProvider) : DescriptionProvider = ValueDescriptionProvider(".${name.description()}") -fun attr(name: DescriptionProvider) : DescriptionProvider = ValueDescriptionProvider("[${name.description()}]") -fun attrEquals(name: DescriptionProvider, value: String) : DescriptionProvider = ValueDescriptionProvider("[${name.description()}=$value]") -fun attrContains(name: DescriptionProvider, value: String) : DescriptionProvider = ValueDescriptionProvider("[${name.description()}*=$value]") -fun attrEntriesContain(name: DescriptionProvider, value: String) : DescriptionProvider = ValueDescriptionProvider("[${name.description()}~=$value]") -fun attrEndsWith(name: DescriptionProvider, value: String) : DescriptionProvider = ValueDescriptionProvider("[${name.description()}$=$value]") -fun attrStartsWith(name: DescriptionProvider, value: String) : DescriptionProvider = ValueDescriptionProvider("[${name.description()}^=$value]") +fun cls(name: DescriptionProvider): DescriptionProvider = ValueDescriptionProvider(".${name.description()}") +fun attr(name: DescriptionProvider): DescriptionProvider = ValueDescriptionProvider("[${name.description()}]") +fun attrEquals(name: DescriptionProvider, value: String): DescriptionProvider = ValueDescriptionProvider("[${name.description()}=$value]") +fun attrContains(name: DescriptionProvider, value: String): DescriptionProvider = + ValueDescriptionProvider("[${name.description()}*=$value]") + +fun attrEntriesContain(name: DescriptionProvider, value: String): DescriptionProvider = + ValueDescriptionProvider("[${name.description()}~=$value]") + +fun attrEndsWith(name: DescriptionProvider, value: String): DescriptionProvider = + ValueDescriptionProvider("[${name.description()}$=$value]") + +fun attrStartsWith(name: DescriptionProvider, value: String): DescriptionProvider = + ValueDescriptionProvider("[${name.description()}^=$value]") @CssTagMarker open class Style : CssGenerator() { - var fontFace: FontFace? = null - var keyFrames: MutableMap = mutableMapOf() + var fontFace: FontFace? = null + var keyFrames: MutableMap = mutableMapOf() - private val validators = mapOf>( - "background-position" to listOf(InitialInheritSingleValue()), - "background-size" to listOf(MaxCountValidator(2)), - "border-radius" to listOf( - MaxCountValidator(4), - InitialInheritSingleValue() - ), + private val validators = mapOf>( + "background-position" to listOf(InitialInheritSingleValue()), + "background-size" to listOf(MaxCountValidator(2)), + "border-radius" to listOf( + MaxCountValidator(4), + InitialInheritSingleValue() + ), - "animation-iteration-mode" to listOf(MaxCountValidator(4)), - "animation-timing-function" to listOf(MaxCountValidator(4)), - "border-image-repeat" to listOf(MaxCountValidator(2)), - "border-image-slice" to listOf(MaxCountValidator(4)), - "border-spacing" to listOf(MaxCountValidator(4)), - "border-style" to listOf(MaxCountValidator(4)) + "animation-iteration-mode" to listOf(MaxCountValidator(4)), + "animation-timing-function" to listOf(MaxCountValidator(4)), + "border-image-repeat" to listOf(MaxCountValidator(2)), + "border-image-slice" to listOf(MaxCountValidator(4)), + "border-spacing" to listOf(MaxCountValidator(4)), + "border-style" to listOf(MaxCountValidator(4)) + ) + + override fun getValidator(name: String) = validators[name] + + private fun addStyle(selector: String, style: Css) { + definitions[selector] = definitions[selector] ?: mutableListOf() + definitions[selector]?.add(style) + } + + /** + * like the scss & + * @param selector blabla + */ + fun and(selector: DescriptionProvider, style: Css) { + addStyle(selector.description(), style) + } + + fun and(selector: String, style: Css) { + addStyle(selector, style) + } + + fun select(selector: DescriptionProvider, style: Css) { + addStyle(" ${selector.description()}", style) + } + + fun select(selector: String, style: Css) { + addStyle(" $selector", style) + } + + fun descendant(descName: DescriptionProvider, style: Css) { + addStyle(" ${descName.description()}", style) + } + + fun descendant(descName: String, style: Css) { + addStyle(" $descName", style) + } + + fun child(childName: DescriptionProvider, style: Css) { + addStyle(" > ${childName.description()}", style) + } + + fun child(childName: String, style: Css) { + addStyle(" > $childName", style) + } + + fun sibling(childName: DescriptionProvider, style: Css) { + addStyle(" ~ ${childName.description()}", style) + } + + fun sibling(childName: String, style: Css) { + addStyle(" ~ $childName", style) + } + + fun adjSibling(childName: DescriptionProvider, style: Css) { + addStyle(" + ${childName.description()}", style) + } + + fun adjSibling(childName: String, style: Css) { + addStyle(" + $childName", style) + } + + fun active(style: Css) { + addStyle(":active", style) + } + + fun focus(style: Css) { + addStyle(":focus", style) + } + + fun focusWithin(style: Css) { + addStyle(":focus-within", style) + } + + fun hover(style: Css) { + addStyle(":hover", style) + } + + fun visited(style: Css) { + addStyle(":visited", style) + } + + fun not(selector: DescriptionProvider, style: Css) { + addStyle(":not(${selector.description()})", style) + } + + fun plain(name: String, value: String) { + props[name] = prp(value) + } + + fun plain(name: String, value: CssProperty) { + props[name] = prp(value) + } + + fun alignContent(value: AlignContent) { + props["align-content"] = prp(value) + } + + fun alignItems(alignItems: AlignItems) { + props["align-items"] = prp(alignItems) + } + + fun all(all: All) { + props["all"] = prp(all) + } + + fun alignSelf(alignSelf: AlignSelf) { + props["align-self"] = prp(alignSelf) + } + + fun animation(text: String) { + props["animation"] = prp(text) + } + + fun animationDelay(delay: DelayDuration) { + props["animation-delay"] = prp(delay) + } + + fun animationDirection(direction: AnimationDirection) { + props["animation-direction"] = prp(direction) + } + + fun animationDuration(duration: DelayDuration) { + props["animation-duration"] = prp(duration) + } + + fun animationFillMode(fillMode: AnimationFillMode) { + props["animation-fill-mode"] = prp(fillMode) + } + + fun animationIterationMode(vararg iterationMode: Count) { + props["animation-iteration-mode"] = prp(*iterationMode) + } + + fun animationFrame(frame: AnimationFrame) { + props["animation-frame"] = prp(frame) + } + + fun animationName(vararg name: String) { + props["animation-name"] = prp(*name) + } + + fun animationPlayState(vararg state: AnimationPlayState) { + props["animation-play-state"] = prp(*state) + } + + fun animationTimingFunction(vararg timingFunction: TimingFunction) { + props["animation-timing-function"] = prp(*timingFunction) + } + + fun backfaceVisibility(backfaceVisibility: BackfaceVisibility) { + props[""] = prp(backfaceVisibility) + } + + fun background(background: String) { + props["background"] = prp(background) + } + + fun backgroundAttachment(attachment: BackgroundAttachment) { + props["background-attachment"] = prp(attachment) + } + + fun backgroundBlendMode(blendMode: BackgroundBlendMode) { + props["background-blend-mode"] = prp(blendMode) + } + + fun backgroundClip(clip: ClipOrigin) { + props["background-clip"] = prp(clip) + } + + fun backgroundColor(color: Color) { + props["background-color"] = prp(color) + } + + fun backgroundImage(image: Image) { + props["background-image"] = prp(image) + } + + fun backgroundOrigin(origin: ClipOrigin) { + props["background-origin"] = prp(origin) + } + + fun backgroundPosition(position: BackgroundPosition) { + props["background-position"] = prp(position) + } + + fun backgroundRepeat(repeat: BackgroundRepeat) { + props["background-repeat"] = prp(repeat) + } + + fun backgroundSize(vararg size: BackgroundSize) { + props["background-size"] = prp(*size) + } + + fun border(border: String) { + props["border"] = prp(border) + } + + fun borderBottom(borderBottom: String) { + props["border-bottom"] = prp(borderBottom) + } + + fun borderBottomColor(color: Color) { + props["border-bottom-color"] = prp(color) + } + + fun borderBottomLeftRadius(vararg radius: BorderRadius) { + props["border-bottom-left-radius"] = prp(*radius) + } + + fun borderBottomRightRadius(vararg radius: BorderRadius) { + props["border-bottom-right-radius"] = prp(*radius) + } + + fun borderBottomStyle(style: BorderStyle) { + props["border-bottom-style"] = prp(style) + } + + fun borderBottomWidth(width: BorderWidth) { + props["border-bottom-width"] = prp(width) + } + + fun borderBottomWidth(width: Measurement) { + props["border-bottom-width"] = prp(width) + } + + fun borderCollapse(collapse: BorderCollapse) { + props["border-collapse"] = prp(collapse) + } + + fun borderColor(vararg color: Color) { + props["border-color"] = prp(*color) + } + + fun borderImage(image: String) { + props["border-image"] = prp(image) + } + + fun borderImageOutset(imageOutset: Length) { + props["border-image-outset"] = prp(imageOutset) + } + + fun borderImageRepeat(vararg repeat: ImageRepeat) { + props["border-image-repeat"] = prp(*repeat) + } + + fun borderImageSlice(vararg slice: ImageSlice) { + props["border-image-slice"] = prp(*slice) + } + + fun borderImageSource(vararg source: ImageSource) { + props["border-image-source"] = prp(*source) + } + + fun borderImageWidth(vararg width: BorderImageWidth) { + props["border-image-width"] = prp(*width) + } + + fun borderLeft(left: String) { + props["border-left"] = prp(left) + } + + fun borderLeftColor(color: Color) { + props["border-left-color"] = prp(color) + } + + fun borderLeftStyle(style: BorderStyle) { + props["border-left-style"] = prp(style) + } + + fun borderLeftWidth(width: BorderWidth) { + props["border-left-width"] = prp(width) + } + + fun borderLeftWidth(width: Measurement) { + props["border-left-width"] = prp(width) + } + + fun borderRadius(radius: Measurement) { + props["border-radius"] = prp(radius) + } + + fun borderRadius( + topLeftBottomRight: Measurement, + topRightBottomLeft: Measurement + ) { + props["border-radius"] = listOf( + topLeftBottomRight, topRightBottomLeft ) + } - override fun getValidator(name: String) = validators[name] - - private fun addStyle(selector: String, style: Css) { - definitions[selector] = definitions[selector] ?: mutableListOf() - definitions[selector]?.add(style) - } - - /** - * like the scss & - * @param selector blabla - */ - fun and(selector: DescriptionProvider, style: Css) { - addStyle(selector.description(), style) - } - - fun and(selector: String, style: Css) { - addStyle(selector, style) - } - - fun select(selector: DescriptionProvider, style: Css) { - addStyle(" ${selector.description()}", style) - } - - fun select(selector: String, style: Css) { - addStyle(" $selector", style) - } - - fun descendant(descName: DescriptionProvider, style: Css) { - addStyle(" ${descName.description()}", style) - } - - fun descendant(descName: String, style: Css) { - addStyle(" $descName", style) - } - - fun child(childName: DescriptionProvider, style: Css) { - addStyle(" > ${childName.description()}", style) - } - - fun child(childName: String, style: Css) { - addStyle(" > $childName", style) - } - - fun sibling(childName: DescriptionProvider, style: Css) { - addStyle(" ~ ${childName.description()}", style) - } - - fun sibling(childName: String, style: Css) { - addStyle(" ~ $childName", style) - } - - fun adjSibling(childName: DescriptionProvider, style: Css) { - addStyle(" + ${childName.description()}", style) - } - - fun adjSibling(childName: String, style: Css) { - addStyle(" + $childName", style) - } - - fun active(style: Css) { - addStyle(":active", style) - } - - fun focus(style: Css) { - addStyle(":focus", style) - } - - fun focusWithin(style: Css) { - addStyle(":focus-within", style) - } - - fun hover(style: Css) { - addStyle(":hover", style) - } - - fun visited(style: Css) { - addStyle(":visited", style) - } - - fun not(selector: DescriptionProvider, style: Css) { - addStyle(":not(${selector.description()})", style) - } - - fun plain(name: String, value: String) { - props[name] = prp(value) - } - - fun plain(name: String, value: CssProperty) { - props[name] = prp(value) - } - - fun alignContent(value: AlignContent) { props["align-content"] = prp(value) } - fun alignItems(alignItems: AlignItems) { props["align-items"] = prp(alignItems) } - fun all(all: All) { props["all"] = prp(all) } - fun alignSelf(alignSelf: AlignSelf) { props["align-self"] = prp(alignSelf) } - fun animation(text: String) { props["animation"] = prp(text) } - fun animationDelay(delay: DelayDuration) { props["animation-delay"] = prp(delay) } - fun animationDirection(direction: AnimationDirection) { props["animation-direction"] = prp(direction) } - fun animationDuration(duration: DelayDuration) { props["animation-duration"] = prp(duration) } - fun animationFillMode(fillMode: AnimationFillMode) { props["animation-fill-mode"] = prp(fillMode) } - fun animationIterationMode(vararg iterationMode: Count) { props["animation-iteration-mode"] = prp(*iterationMode) } - fun animationFrame(frame: AnimationFrame) { props["animation-frame"] = prp(frame) } - fun animationName(vararg name: String) { props["animation-name"] = prp(*name) } - fun animationPlayState(vararg state : AnimationPlayState) { - props["animation-play-state"] = prp(*state) - } - fun animationTimingFunction(vararg timingFunction: TimingFunction) { - props["animation-timing-function"] = prp(*timingFunction) - } - fun backfaceVisibility(backfaceVisibility: BackfaceVisibility) { props[""] = prp(backfaceVisibility) } - fun background(background: String) { props["background"] = prp(background) } - fun backgroundAttachment(attachment: BackgroundAttachment) { props["background-attachment"] = prp(attachment) } - fun backgroundBlendMode(blendMode: BackgroundBlendMode) { props["background-blend-mode"] = prp(blendMode) } - fun backgroundClip(clip: ClipOrigin) { props["background-clip"] = prp(clip) } - fun backgroundColor(color: Color) { props["background-color"] = prp(color) } - fun backgroundImage(image: Image) { props["background-image"] = prp(image) } - fun backgroundOrigin(origin: ClipOrigin) { props["background-origin"] = prp(origin) } - fun backgroundPosition(position: BackgroundPosition) { props["background-position"] = prp(position) } - fun backgroundRepeat(repeat: BackgroundRepeat) { props["background-repeat"] = prp(repeat) } - fun backgroundSize(vararg size: BackgroundSize) { props["background-size"] = prp(*size) } - fun border(border: String) { props["border"] = prp(border) } - fun borderBottom(borderBottom: String) { props["border-bottom"] = prp(borderBottom) } - fun borderBottomColor(color: Color) { props["border-bottom-color"] = prp(color) } - fun borderBottomLeftRadius(vararg radius: BorderRadius) { props["border-bottom-left-radius"] = prp(*radius) } - fun borderBottomRightRadius(vararg radius: BorderRadius) { props["border-bottom-right-radius"] = prp(*radius) } - fun borderBottomStyle(style: BorderStyle) { props["border-bottom-style"] = prp(style) } - fun borderBottomWidth(width: BorderWidth) { props["border-bottom-width"] = prp(width) } - fun borderBottomWidth(width: Measurement) { props["border-bottom-width"] = prp(width) } - fun borderCollapse(collapse: BorderCollapse) { props["border-collapse"] = prp(collapse) } - fun borderColor(vararg color: Color) { props["border-color"] = prp(*color) } - fun borderImage(image: String) { props["border-image"] = prp(image) } - fun borderImageOutset(imageOutset: Length) { props["border-image-outset"] = prp(imageOutset) } - fun borderImageRepeat(vararg repeat: ImageRepeat) { props["border-image-repeat"] = prp(*repeat) } - fun borderImageSlice(vararg slice: ImageSlice) { props["border-image-slice"] = prp(*slice) } - fun borderImageSource(vararg source: ImageSource) { props["border-image-source"] = prp(*source) } - fun borderImageWidth(vararg width: BorderImageWidth) { props["border-image-width"] = prp(*width) } - fun borderLeft(left: String) { props["border-left"] = prp(left) } - fun borderLeftColor(color: Color) { props["border-left-color"] = prp(color) } - fun borderLeftStyle(style: BorderStyle) { props["border-left-style"] = prp(style) } - fun borderLeftWidth(width: BorderWidth) { props["border-left-width"] = prp(width) } - fun borderLeftWidth(width: Measurement) { props["border-left-width"] = prp(width) } - fun borderRadius(radius: Measurement) { props["border-radius"] = prp(radius) } - fun borderRadius( - topLeftBottomRight: Measurement, - topRightBottomLeft: Measurement - ) { - props["border-radius"] = listOf( - topLeftBottomRight, topRightBottomLeft - ) - } - - fun borderRadius( - topLeft: Measurement, - topRightBottomLeft: Measurement, - bottomRight: Measurement - ) { - props["border-radius"] = listOf( - topLeft, topRightBottomLeft, bottomRight - ) - } - - fun borderRadius( - topLeft: Measurement, - topRight: Measurement, - bottomRight: Measurement, - bottomLeft: Measurement - ) { - props["border-radius"] = listOf( - topLeft, topRight, bottomRight, bottomLeft - ) - } - fun borderRight(border: String) { props["border-right"] = prp(border) } - fun borderRightColor(color: Color) { props["border-right-color"] = prp(color) } - fun borderRightStyle(style: BorderStyle) { props["border-right-style"] = prp(style) } - fun borderRightWidth(width: BorderWidth) { props["border-right-width"] = prp(width) } - fun borderRightWidth(width: Measurement) { props["border-right-width"] = prp(width) } - fun borderSpacing(vararg spacing: BorderSpacing) { props["border-spacing"] = prp(*spacing) } - fun borderStyle(vararg style: BorderStyle) { props["border-style"] = prp(*style) } - fun borderTop(border: String) { props["border-top"] = prp(border) } - fun borderTopColor(color: Color) { props["border-top-color"] = prp(color) } - fun borderTopLeftRadius(radius: BorderRadius) { props["border-top-left-radius"] = prp(radius) } - fun borderTopRightRadius(radius: BorderRadius) { props["border-top-right-radius"] = prp(radius) } - fun borderTopStyle(style: BorderStyle) { props["border-top-style"] = prp(style) } - fun borderTopWidth(width: BorderWidth) { props["border-top-width"] = prp(width) } - fun borderTopWidth(width: Measurement) { props["border-top-width"] = prp(width) } - fun borderWidth(width: Measurement) { props["border-width"] = prp(width) } - fun borderWidth(width: BorderWidth) { props["border-width"] = prp(width) } - fun bottom(measurement: Measurement) { props["bottom"] = prp(measurement) } - fun boxDecorationBreak(brk: BoxDecorationBreak) { props["box-decoration-break"] = prp(brk) } - fun boxShadow(shadow: BoxShadow) { props["box-shadow"] = prp(shadow) } - fun boxSizing(sizing: BoxSizing) { props["box-sizing"] = prp(sizing) } - fun breakAfter(brk: Break) { props["break-after"] = prp(brk) } - fun breakBefore(brk: Break) { props["break-before"] = prp(brk) } - fun breakInside(brk: Break) { props["break-inside"] = prp(brk) } - fun captionSide(side: CaptionSide) { props["caption-side"] = prp(side) } - fun caretColor(color: Color) { props["caret-color"] = prp(color) } - fun clear(clear: Clear) { props["clear"] = prp(clear) } - fun clip(clip: Clip) { props["clip"] = prp(clip) } - fun clipPath(path: ClipPath) { props["clip-path"] = prp(path) } - fun color(color: Color) { props["color"] = listOf(color) } - fun columnCount(count: Count) { props["column-count"] = prp(count) } - fun columnFill(fill: Fill) { props["column-fill"] = prp(fill) } - fun columnGap(gap: Measurement) { props["column-gap"] = prp(gap) } - fun columnRule(rule: String) { props["column-rule"] = prp(rule) } - fun columnRuleColor(color: Color) { props["column-rule-color"] = prp(color) } - fun columnRuleStyle(style: BorderStyle) { props["column-rule-style"] = prp(style) } - fun columnRuleWidth(width: Measurement) { props["column-rule-width"] = prp(width) } - fun columnSpan(span: Span) { props["column-span"] = prp(span) } - fun columnWidth(width: Measurement) { props["column-width"] = prp(width) } - fun column(column: String) { props["column"] = prp(column) } - fun content(content: Content) { props["content"] = prp(content) } - fun counterIncrement(increment: String) { props["counter-increment"] = prp(increment) } - fun counterReset(reset: String) { props["counter-reset"] = prp(reset) } - fun cursor(cursor: String) { props["cursor"] = prp(cursor) } - fun direction(direction: Direction) { props["direction"] = prp(direction) } - fun display(display: Display) { props["display"] = prp(display) } - fun emptyCells(cells: EmptyCells) { props["empty-cells"] = prp(cells) } - fun filter(filter: String) { props["filter"] = prp(filter) } - fun flex(flex: String) { props["flex"] = prp(flex) } - fun flexBasis(basis: Measurement) { props["flex-basis"] = prp(basis) } - fun flexDirection(direction: FlexDirection) { props["flex-direction"] = prp(direction) } - fun flexFlow(flow: String) { props["flex-flow"] = prp(flow) } - fun flexGrow(grow: FlexGrowShrink) { props["flex-grow"] = prp(grow) } - fun flexShrink(shrink: FlexGrowShrink) { props["flex-shrink"] = prp(shrink) } - fun flexWrap(wrap: FlexWrap) { props["flex-wrap"] = prp(wrap) } - fun float(cssFloat: CssFloat) { props["float"] = prp(cssFloat) } - fun font(font: String) { props["font"] = prp(font) } - fun fontFace(face: FontFace.() -> Unit) { - fontFace = FontFace() - - face.invoke(fontFace!!) - } - fun fontFamily(font: String) { props["font-family"] = prp(font) } - fun fontFeatureSettings(vararg setting: String) { props["font-feature-settings"] = prp(*setting) } - fun fontKerning(kerning: FontKerning) { props["font-kerking"] = prp(kerning) } - fun fontSize(size: FontSize) { props["font-size"] = prp(size) } - fun fontSize(size: Measurement) { props["font-size"] = prp(size) } - fun fontSizeAdjust(number: Double) { props["font-size-adjust"] = prp(CssProperty("$number")) } - fun fontSizeAdjust(adjust: FontSizeAdjust) { props["font-size-adjust"] = prp(adjust) } - fun fontStretch(stretch: FontStretch) { props["font-stretch"] = prp(stretch) } - fun fontStyle(style: FontStyle) { props["font-style"] = prp(style) } - fun fontVariant(variant: FontVariant) { props["font-variant"] = prp(variant) } - fun fontVariantCaps(caps: FontVariantCaps) { props["font-variant-caps"] = prp(caps) } - fun fontWeight(weight: FontWeight) { props["font-weight"] = prp(weight) } - fun grid(grid: String) { props["grid"] = prp(grid) } - fun gridArea(area: String) { props["grid-area"] = prp(area) } - fun gridAutoColumns(columns: GridAuto) { props["grid-auto-columns"] = prp(columns) } - fun gridAutoFlow(flow: GridFlow) { props["grid-auto-flow"] = prp(flow) } - fun gridAutoRows(autoRows: GridAuto) { props["grid-auto-rows"] = prp(autoRows) } - fun gridAutoRows(size: Measurement) { props["grid-auto-rows"] = prp(size) } - fun gridColumn(start: GridValue, end: GridValue) { props["grid-column"] = prp(CssProperty("${start.css()}/${end.css()}")) } - fun gridColumnEnd(end: GridValue) { props["grid-column-end"] = prp(end) } - fun gridColumnGap(gap: GridValue) { props["grid-column-gap"] = prp(gap) } - fun gridColumnStart(start: GridValue) { props["grid-column-start"] = prp(start) } - fun gridGap( - rowGap: Measurement = Measurement.px(0), - columnGap: Measurement = Measurement.px(0) - ) { props["grid-gap"] = prp(rowGap, columnGap) } - fun gridRow(start: GridValue, end: GridValue) { props["grid-row"] = prp(CssProperty("${start.css()}/${end.css()}")) } - fun gridRowEnd(end: GridValue) { props["grid-row-end"] = prp(end) } - fun gridRowGap(gap: GridValue) { props["grid-row-end"] = prp(gap) } - fun gridRowStart(start: GridValue) { props["grid-row-start"] = prp(start) } - fun gridTemplate(template: String) { props["grid-template"] = prp(template) } - fun gridTemplateAreas(template: String) { props["grid-template-areas"] = prp(template) } - @Deprecated( - "Fixed type, use gridTemplateColumns instead", - ReplaceWith("gridTemplateColumns(columns)") + fun borderRadius( + topLeft: Measurement, + topRightBottomLeft: Measurement, + bottomRight: Measurement + ) { + props["border-radius"] = listOf( + topLeft, topRightBottomLeft, bottomRight ) - fun gridTemplateColumn(vararg columns: TemplateRowColumn) { props["grid-template-columns"] = prp(*columns) } - fun gridTemplateColumns(vararg columns: TemplateRowColumn) { props["grid-template-columns"] = prp(*columns) } - fun gridTemplateColumns(vararg columns: Measurement) { props["grid-template-columns"] = prp(*columns) } - fun gridTemplateRows(vararg rows: TemplateRowColumn) { props["grid-template-rows"] = prp(*rows) } - fun gridTemplateRows(vararg rows: Measurement) { props["grid-template-rows"] = prp(*rows) } - fun hangingPunctuation(punctuation: Isolation) { props["hanging-punctuation"] = prp(punctuation) } - fun height(height: Measurement) { props["height"] = prp(height) } - fun hyphens(hyphens: Hyphens) { props["hyphens"] = prp(hyphens) } - fun import(style: Css) { style(this) } - fun isolation(isolation: Isolation) { props["isolation"] = prp(isolation) } - fun justifyContent(content: JustifyContent) { props["justify-content"] = prp(content) } - fun keyFrames(animationName: String, frames: KeyFrames.() -> Unit) { - val frameCss = KeyFrames() + } - frames.invoke(frameCss) + fun borderRadius( + topLeft: Measurement, + topRight: Measurement, + bottomRight: Measurement, + bottomLeft: Measurement + ) { + props["border-radius"] = listOf( + topLeft, topRight, bottomRight, bottomLeft + ) + } - keyFrames[animationName] = frameCss - } - fun left(left: Measurement) { props["left"] = prp(left) } - fun letterSpacing(length: Measurement) { props["letter-spacing"] = prp(length) } - fun letterSpacing(spacing: LetterSpacing) { props["letter-spacing"] = prp(spacing) } - fun lineHeight(number: Double) { props["line-height"] = prp("$number") } - fun lineHeight(measurement: Measurement) { props["line-height"] = prp(measurement) } - fun lineHeight(height: LineHeight) { props["line-height"] = prp(height) } - fun listStyle(style: String) { props["list-style"] = prp(style) } - fun listStyleImage(url: String) { props["list-style-image"] = prp("url('$url')")} - fun listStylePosition(position: ListStylePosition) { props["list-style-position"] = prp(position) } - fun listStyleType(position: ListStyleType) { props["list-style-type"] = prp(position) } - fun margin(all: Measurement) { props["margin"] = prp(all) } - fun margin( - topBottom: Measurement, - leftRight: Measurement - ) { props["margin"] = prp(topBottom, leftRight) } - fun margin(top: Measurement, right: Measurement, bottom: Measurement, left: Measurement) { - props["margin"] = prp(top, right, bottom, left) - } - fun marginBottom(bottom: Measurement) { props["margin-bottom"] = prp(bottom) } - fun marginLeft(left: Measurement) { props["margin-left"] = prp(left) } - fun marginRight(right: Measurement) { props["margin-right"] = prp(right) } - fun marginTop(top: Measurement) { props["margin-top"] = prp(top) } - fun maxHeight(height: Measurement) { props["max-height"] = prp(height) } - fun maxWidth(width: Measurement) { props["max-width"] = prp(width) } - fun minHeight(height: Measurement) { props["min-height"] = prp(height) } - fun minWidth(width: Measurement) { props["min-width"] = prp(width) } - fun mixBlendMode(blendMode: MixBlendMode) { props["mix-blend-mode"] = prp(blendMode) } - fun objectFit(fit: ObjectFit) { props["object-fit"] = prp(fit) } - fun objectPosition(position: String) { props["object-position"] = prp(position) } - fun opacity(opacity: Double) { props["opacity"] = prp(opacity.toString()) } - fun opacity(opacity: InitialInherit) { props["opacity"] = prp(opacity.toString()) } - fun order(order: Int) { props["order"] = prp(order.toString()) } - fun order(order: InitialInherit) { props["order"] = prp(order) } - fun outline(outline: String) { props["outline"] = prp(outline) } - fun outlineColor(color: Color) { props["outline-color"] = prp(color) } - fun outlineOffset(offset: Measurement) { props["outline-offset"] = prp(offset) } - fun outlineStyle(style: BorderStyle) { props["outline-style"] = prp(style) } - fun outlineWidth(width: OutlineWidth) { props["outline-width"] = prp(width) } - fun outlineWidth(width: Measurement) { props["outline-width"] = prp(width) } - fun overflow(overflow: Overflow) { props["overflow"] = prp(overflow) } - fun overflowX(overflow: Overflow) { props["overflow-x"] = prp(overflow) } - fun overflowY(overflow: Overflow) { props["overflow-y"] = prp(overflow) } - fun padding(padding: Measurement) { props["padding"] = prp(padding) } - fun padding(vertical: Measurement, horizontal: Measurement) { - props["padding"] = prp(vertical, horizontal) - } - fun padding(top: Measurement, right: Measurement, bottom: Measurement, left: Measurement) { - props["padding"] = prp(top, right, bottom, left) - } - fun padding(padding: InitialInherit) { props["padding"] = prp(padding) } - fun paddingBottom(padding: Measurement) { props["padding-bottom"] = prp(padding) } - fun paddingBottom(padding: InitialInherit) { props["padding-bottom"] = prp(padding) } - fun paddingLeft(padding: Measurement) { props["padding-left"] = prp(padding) } - fun paddingLeft(padding: InitialInherit) { props["padding-left"] = prp(padding) } - fun paddingRight(padding: Measurement) { props["padding-right"] = prp(padding) } - fun paddingRight(padding: InitialInherit) { props["padding-right"] = prp(padding) } - fun paddingTop(padding: Measurement) { props["padding-top"] = prp(padding) } - fun paddingTop(padding: InitialInherit) { props["padding-top"] = prp(padding) } - fun pageBreakAfter(pageBreak: PageBreak) { props["page-break-after"] = prp(pageBreak) } - fun pageBreakBefore(pageBreak: PageBreak) { props["page-break-before"] = prp(pageBreak) } - fun pageBreakInside(pageBreak: PageBreak) { props["page-break-inside"] = prp(pageBreak) } - fun perspective(length: Measurement) { props["perspective"] = prp(length) } - fun perspective(perspective: Perspective) { props["perspective"] = prp(perspective) } - fun perspectiveOrigin(po: String) { props["perspective-origin"] = prp(po) } - fun pointerEvents(pe: PointerEvents) { props["pointer-events"] = prp(pe) } - fun position(poition: Position) { props["position"] = prp(poition) } - fun quotes(value: String) { props["quotes"] = prp(value) } - fun resize(resize: Resize) { props["resize"] = prp(resize) } - fun right(right: Measurement) { props["right"] = prp(right) } - fun scrollBehavior(sb: ScrollBehavior) { props["scroll-behavior"] = prp(sb) } - fun tabSize(number: Int) { props["tab-size"] = prp(number.toString()) } - fun tabSize(length: Measurement) { props["tab-size"] = prp(length) } - fun tabSize(ts: InitialInherit) { props["tab-size"] = prp(ts) } - fun tableLayout(tl: TableLayout ) { props["table-layout"] = prp(tl) } - fun textAlign(ta: TextAlign) { props["text-align"] = prp(ta) } - fun textAlignLast(tal: TextAlignLast) { props["text-align-last"] = prp(tal) } - fun textDecoration(decoration: String) { props["text-decoration"] = prp(decoration) } - fun textDecorationColor(color: Color) { props["text-decoration-color"] = prp(color) } - fun textDecorationLine(tdc: TextDecorationLine) { props["text-decoration-line"] = prp(tdc) } - fun textDecorationStyle(tds: TextDecorationStyle) { props["text-decoration-style"] = prp(tds) } - fun textIndent(length: Measurement) { props["text-indent"] = prp(length) } - fun textIndent(indent: InitialInherit) { props["text-indent"] = prp(indent) } - fun textJustify(tj: TextJustify) { props["text-justify"] = prp(tj) } - fun textOverflow(to: String) { props["text-overflow"] = prp(to) } - fun textShadow(ts: String) { props["text-shadow"] = prp(ts) } - fun textTransform(tt: TextTransform) { props["text-transform"] = prp(tt) } - fun top(top: Measurement) { props["top"] = prp(top) } - fun transform(transform: Transform) { props["transform"] = prp(transform) } - fun transformOrigin(origin: String) { props["transform-origin"] = prp(origin) } - fun transformStyle(style: TransformStyle) { props["transform-style"] = prp(style) } - fun transition(transition: String) { props["transition"] = prp(transition) } - fun transitionDelay(timeInSeconds: Double) { props["transition-delay"] = prp("${timeInSeconds}s") } - fun transitionDelay(timeInMillis: Int) { props["transition-delay"] = prp("${timeInMillis}ms") } - fun transitionDelay(delay: DelayDuration) { props["transition-delay"] = prp(delay) } - fun transitionDuration(timeInSeconds: Double) { props["transition-duration"] = prp("${timeInSeconds}s") } - fun transitionDuration(timeInMillis: Int) { props["transition-duration"] = prp("${timeInMillis}ms") } - fun transitionDuration(td: DelayDuration) { props["transition-duration"] = prp(td) } - fun transitionProperty(property: String) { props["transition-property"] = prp(property) } - fun transitionTimingFunction(function: TimingFunction) { props["transition-timing-function"] = prp(function) } - fun unicodeBidi(ub: UnicodeBidi) { props["unicode-bidi"] = prp(ub) } - fun userSelect(us: UserSelect) { props["user-select"] = prp(us) } - fun verticalAlign(length: Measurement) { props["vertical-align"] = prp(length) } - fun verticalAlign(va: VerticalAlign) { props["vertical-align"] = prp(va) } - fun visibility(visibility: Visibility) { props["visibility"] = prp(visibility) } - fun whiteSpace(whiteSpace: WhiteSpace) { props["white-space"] = prp(whiteSpace) } - fun width(width: Measurement) { props["width"] = prp(width) } - fun wordBreak(wordBreak: WordBreak) { props["word-break"] = prp(wordBreak) } - fun wordSpacing(wordSpacing: Measurement) { props["word-spacing"] = prp(wordSpacing) } - fun wordSpacing(wordSpacing: WordSpacing) { props["word-spacing"] = prp(wordSpacing) } - fun wordWrap(wordWrap: WordWrap) { props["word-wrap"] = prp(wordWrap) } - fun writingMode(writingMode: WritingMode) { props["writing-mode"] = prp(writingMode) } - fun zIndex(zIndex: Int) { props["z-index"] = prp(zIndex.toString()) } - fun zIndex(zIndex: ZIndex) { props["z-index"] = prp(zIndex) } + fun borderRight(border: String) { + props["border-right"] = prp(border) + } + + fun borderRightColor(color: Color) { + props["border-right-color"] = prp(color) + } + + fun borderRightStyle(style: BorderStyle) { + props["border-right-style"] = prp(style) + } + + fun borderRightWidth(width: BorderWidth) { + props["border-right-width"] = prp(width) + } + + fun borderRightWidth(width: Measurement) { + props["border-right-width"] = prp(width) + } + + fun borderSpacing(vararg spacing: BorderSpacing) { + props["border-spacing"] = prp(*spacing) + } + + fun borderStyle(vararg style: BorderStyle) { + props["border-style"] = prp(*style) + } + + fun borderTop(border: String) { + props["border-top"] = prp(border) + } + + fun borderTopColor(color: Color) { + props["border-top-color"] = prp(color) + } + + fun borderTopLeftRadius(radius: BorderRadius) { + props["border-top-left-radius"] = prp(radius) + } + + fun borderTopRightRadius(radius: BorderRadius) { + props["border-top-right-radius"] = prp(radius) + } + + fun borderTopStyle(style: BorderStyle) { + props["border-top-style"] = prp(style) + } + + fun borderTopWidth(width: BorderWidth) { + props["border-top-width"] = prp(width) + } + + fun borderTopWidth(width: Measurement) { + props["border-top-width"] = prp(width) + } + + fun borderWidth(width: Measurement) { + props["border-width"] = prp(width) + } + + fun borderWidth(width: BorderWidth) { + props["border-width"] = prp(width) + } + + fun bottom(measurement: Measurement) { + props["bottom"] = prp(measurement) + } + + fun boxDecorationBreak(brk: BoxDecorationBreak) { + props["box-decoration-break"] = prp(brk) + } + + fun boxShadow(shadow: BoxShadow) { + props["box-shadow"] = prp(shadow) + } + + fun boxSizing(sizing: BoxSizing) { + props["box-sizing"] = prp(sizing) + } + + fun breakAfter(brk: Break) { + props["break-after"] = prp(brk) + } + + fun breakBefore(brk: Break) { + props["break-before"] = prp(brk) + } + + fun breakInside(brk: Break) { + props["break-inside"] = prp(brk) + } + + fun captionSide(side: CaptionSide) { + props["caption-side"] = prp(side) + } + + fun caretColor(color: Color) { + props["caret-color"] = prp(color) + } + + fun clear(clear: Clear) { + props["clear"] = prp(clear) + } + + fun clip(clip: Clip) { + props["clip"] = prp(clip) + } + + fun clipPath(path: ClipPath) { + props["clip-path"] = prp(path) + } + + fun color(color: Color) { + props["color"] = listOf(color) + } + + fun columnCount(count: Count) { + props["column-count"] = prp(count) + } + + fun columnFill(fill: Fill) { + props["column-fill"] = prp(fill) + } + + fun columnGap(gap: Measurement) { + props["column-gap"] = prp(gap) + } + + fun columnRule(rule: String) { + props["column-rule"] = prp(rule) + } + + fun columnRuleColor(color: Color) { + props["column-rule-color"] = prp(color) + } + + fun columnRuleStyle(style: BorderStyle) { + props["column-rule-style"] = prp(style) + } + + fun columnRuleWidth(width: Measurement) { + props["column-rule-width"] = prp(width) + } + + fun columnSpan(span: Span) { + props["column-span"] = prp(span) + } + + fun columnWidth(width: Measurement) { + props["column-width"] = prp(width) + } + + fun column(column: String) { + props["column"] = prp(column) + } + + fun content(content: Content) { + props["content"] = prp(content) + } + + fun counterIncrement(increment: String) { + props["counter-increment"] = prp(increment) + } + + fun counterReset(reset: String) { + props["counter-reset"] = prp(reset) + } + + fun cursor(cursor: String) { + props["cursor"] = prp(cursor) + } + + fun direction(direction: Direction) { + props["direction"] = prp(direction) + } + + fun display(display: Display) { + props["display"] = prp(display) + } + + fun emptyCells(cells: EmptyCells) { + props["empty-cells"] = prp(cells) + } + + fun filter(filter: String) { + props["filter"] = prp(filter) + } + + fun flex(flex: String) { + props["flex"] = prp(flex) + } + + fun flexBasis(basis: Measurement) { + props["flex-basis"] = prp(basis) + } + + fun flexDirection(direction: FlexDirection) { + props["flex-direction"] = prp(direction) + } + + fun flexFlow(flow: String) { + props["flex-flow"] = prp(flow) + } + + fun flexGrow(grow: FlexGrowShrink) { + props["flex-grow"] = prp(grow) + } + + fun flexShrink(shrink: FlexGrowShrink) { + props["flex-shrink"] = prp(shrink) + } + + fun flexWrap(wrap: FlexWrap) { + props["flex-wrap"] = prp(wrap) + } + + fun float(cssFloat: CssFloat) { + props["float"] = prp(cssFloat) + } + + fun font(font: String) { + props["font"] = prp(font) + } + + fun fontFace(face: FontFace.() -> Unit) { + fontFace = FontFace() + + face.invoke(fontFace!!) + } + + fun fontFamily(font: String) { + props["font-family"] = prp(font) + } + + fun fontFeatureSettings(vararg setting: String) { + props["font-feature-settings"] = prp(*setting) + } + + fun fontKerning(kerning: FontKerning) { + props["font-kerking"] = prp(kerning) + } + + fun fontSize(size: FontSize) { + props["font-size"] = prp(size) + } + + fun fontSize(size: Measurement) { + props["font-size"] = prp(size) + } + + fun fontSizeAdjust(number: Double) { + props["font-size-adjust"] = prp(CssProperty("$number")) + } + + fun fontSizeAdjust(adjust: FontSizeAdjust) { + props["font-size-adjust"] = prp(adjust) + } + + fun fontStretch(stretch: FontStretch) { + props["font-stretch"] = prp(stretch) + } + + fun fontStyle(style: FontStyle) { + props["font-style"] = prp(style) + } + + fun fontVariant(variant: FontVariant) { + props["font-variant"] = prp(variant) + } + + fun fontVariantCaps(caps: FontVariantCaps) { + props["font-variant-caps"] = prp(caps) + } + + fun fontWeight(weight: FontWeight) { + props["font-weight"] = prp(weight) + } + + fun grid(grid: String) { + props["grid"] = prp(grid) + } + + fun gridArea(area: String) { + props["grid-area"] = prp(area) + } + + fun gridAutoColumns(columns: GridAuto) { + props["grid-auto-columns"] = prp(columns) + } + + fun gridAutoFlow(flow: GridFlow) { + props["grid-auto-flow"] = prp(flow) + } + + fun gridAutoRows(autoRows: GridAuto) { + props["grid-auto-rows"] = prp(autoRows) + } + + fun gridAutoRows(size: Measurement) { + props["grid-auto-rows"] = prp(size) + } + + fun gridColumn(start: GridValue, end: GridValue) { + props["grid-column"] = prp(CssProperty("${start.css()}/${end.css()}")) + } + + fun gridColumnEnd(end: GridValue) { + props["grid-column-end"] = prp(end) + } + + fun gridColumnGap(gap: GridValue) { + props["grid-column-gap"] = prp(gap) + } + + fun gridColumnStart(start: GridValue) { + props["grid-column-start"] = prp(start) + } + + fun gridGap( + rowGap: Measurement = Measurement.px(0), + columnGap: Measurement = Measurement.px(0) + ) { + props["grid-gap"] = prp(rowGap, columnGap) + } + + fun gridRow(start: GridValue, end: GridValue) { + props["grid-row"] = prp(CssProperty("${start.css()}/${end.css()}")) + } + + fun gridRowEnd(end: GridValue) { + props["grid-row-end"] = prp(end) + } + + fun gridRowGap(gap: GridValue) { + props["grid-row-end"] = prp(gap) + } + + fun gridRowStart(start: GridValue) { + props["grid-row-start"] = prp(start) + } + + fun gridTemplate(template: String) { + props["grid-template"] = prp(template) + } + + fun gridTemplateAreas(template: String) { + props["grid-template-areas"] = prp(template) + } + + @Deprecated( + "Fixed type, use gridTemplateColumns instead", + ReplaceWith("gridTemplateColumns(columns)") + ) + fun gridTemplateColumn(vararg columns: TemplateRowColumn) { + props["grid-template-columns"] = prp(*columns) + } + + fun gridTemplateColumns(vararg columns: TemplateRowColumn) { + props["grid-template-columns"] = prp(*columns) + } + + fun gridTemplateColumns(vararg columns: Measurement) { + props["grid-template-columns"] = prp(*columns) + } + + fun gridTemplateRows(vararg rows: TemplateRowColumn) { + props["grid-template-rows"] = prp(*rows) + } + + fun gridTemplateRows(vararg rows: Measurement) { + props["grid-template-rows"] = prp(*rows) + } + + fun hangingPunctuation(punctuation: Isolation) { + props["hanging-punctuation"] = prp(punctuation) + } + + fun height(height: Measurement) { + props["height"] = prp(height) + } + + fun hyphens(hyphens: Hyphens) { + props["hyphens"] = prp(hyphens) + } + + fun import(style: Css) { + style(this) + } + + fun isolation(isolation: Isolation) { + props["isolation"] = prp(isolation) + } + + fun justifyContent(content: JustifyContent) { + props["justify-content"] = prp(content) + } + + fun keyFrames(animationName: String, frames: KeyFrames.() -> Unit) { + val frameCss = KeyFrames() + + frames.invoke(frameCss) + + keyFrames[animationName] = frameCss + } + + fun left(left: Measurement) { + props["left"] = prp(left) + } + + fun letterSpacing(length: Measurement) { + props["letter-spacing"] = prp(length) + } + + fun letterSpacing(spacing: LetterSpacing) { + props["letter-spacing"] = prp(spacing) + } + + fun lineHeight(number: Double) { + props["line-height"] = prp("$number") + } + + fun lineHeight(measurement: Measurement) { + props["line-height"] = prp(measurement) + } + + fun lineHeight(height: LineHeight) { + props["line-height"] = prp(height) + } + + fun listStyle(style: String) { + props["list-style"] = prp(style) + } + + fun listStyleImage(url: String) { + props["list-style-image"] = prp("url('$url')") + } + + fun listStylePosition(position: ListStylePosition) { + props["list-style-position"] = prp(position) + } + + fun listStyleType(position: ListStyleType) { + props["list-style-type"] = prp(position) + } + + fun margin(all: Measurement) { + props["margin"] = prp(all) + } + + fun margin( + topBottom: Measurement, + leftRight: Measurement + ) { + props["margin"] = prp(topBottom, leftRight) + } + + fun margin(top: Measurement, right: Measurement, bottom: Measurement, left: Measurement) { + props["margin"] = prp(top, right, bottom, left) + } + + fun marginBottom(bottom: Measurement) { + props["margin-bottom"] = prp(bottom) + } + + fun marginLeft(left: Measurement) { + props["margin-left"] = prp(left) + } + + fun marginRight(right: Measurement) { + props["margin-right"] = prp(right) + } + + fun marginTop(top: Measurement) { + props["margin-top"] = prp(top) + } + + fun maxHeight(height: Measurement) { + props["max-height"] = prp(height) + } + + fun maxWidth(width: Measurement) { + props["max-width"] = prp(width) + } + + fun minHeight(height: Measurement) { + props["min-height"] = prp(height) + } + + fun minWidth(width: Measurement) { + props["min-width"] = prp(width) + } + + fun mixBlendMode(blendMode: MixBlendMode) { + props["mix-blend-mode"] = prp(blendMode) + } + + fun objectFit(fit: ObjectFit) { + props["object-fit"] = prp(fit) + } + + fun objectPosition(position: String) { + props["object-position"] = prp(position) + } + + fun opacity(opacity: Double) { + props["opacity"] = prp(opacity.toString()) + } + + fun opacity(opacity: InitialInherit) { + props["opacity"] = prp(opacity.toString()) + } + + fun order(order: Int) { + props["order"] = prp(order.toString()) + } + + fun order(order: InitialInherit) { + props["order"] = prp(order) + } + + fun outline(outline: String) { + props["outline"] = prp(outline) + } + + fun outlineColor(color: Color) { + props["outline-color"] = prp(color) + } + + fun outlineOffset(offset: Measurement) { + props["outline-offset"] = prp(offset) + } + + fun outlineStyle(style: BorderStyle) { + props["outline-style"] = prp(style) + } + + fun outlineWidth(width: OutlineWidth) { + props["outline-width"] = prp(width) + } + + fun outlineWidth(width: Measurement) { + props["outline-width"] = prp(width) + } + + fun overflow(overflow: Overflow) { + props["overflow"] = prp(overflow) + } + + fun overflowX(overflow: Overflow) { + props["overflow-x"] = prp(overflow) + } + + fun overflowY(overflow: Overflow) { + props["overflow-y"] = prp(overflow) + } + + fun padding(padding: Measurement) { + props["padding"] = prp(padding) + } + + fun padding(vertical: Measurement, horizontal: Measurement) { + props["padding"] = prp(vertical, horizontal) + } + + fun padding(top: Measurement, right: Measurement, bottom: Measurement, left: Measurement) { + props["padding"] = prp(top, right, bottom, left) + } + + fun padding(padding: InitialInherit) { + props["padding"] = prp(padding) + } + + fun paddingBottom(padding: Measurement) { + props["padding-bottom"] = prp(padding) + } + + fun paddingBottom(padding: InitialInherit) { + props["padding-bottom"] = prp(padding) + } + + fun paddingLeft(padding: Measurement) { + props["padding-left"] = prp(padding) + } + + fun paddingLeft(padding: InitialInherit) { + props["padding-left"] = prp(padding) + } + + fun paddingRight(padding: Measurement) { + props["padding-right"] = prp(padding) + } + + fun paddingRight(padding: InitialInherit) { + props["padding-right"] = prp(padding) + } + + fun paddingTop(padding: Measurement) { + props["padding-top"] = prp(padding) + } + + fun paddingTop(padding: InitialInherit) { + props["padding-top"] = prp(padding) + } + + fun pageBreakAfter(pageBreak: PageBreak) { + props["page-break-after"] = prp(pageBreak) + } + + fun pageBreakBefore(pageBreak: PageBreak) { + props["page-break-before"] = prp(pageBreak) + } + + fun pageBreakInside(pageBreak: PageBreak) { + props["page-break-inside"] = prp(pageBreak) + } + + fun perspective(length: Measurement) { + props["perspective"] = prp(length) + } + + fun perspective(perspective: Perspective) { + props["perspective"] = prp(perspective) + } + + fun perspectiveOrigin(po: String) { + props["perspective-origin"] = prp(po) + } + + fun pointerEvents(pe: PointerEvents) { + props["pointer-events"] = prp(pe) + } + + fun position(poition: Position) { + props["position"] = prp(poition) + } + + fun quotes(value: String) { + props["quotes"] = prp(value) + } + + fun resize(resize: Resize) { + props["resize"] = prp(resize) + } + + fun right(right: Measurement) { + props["right"] = prp(right) + } + + fun scrollBehavior(sb: ScrollBehavior) { + props["scroll-behavior"] = prp(sb) + } + + fun tabSize(number: Int) { + props["tab-size"] = prp(number.toString()) + } + + fun tabSize(length: Measurement) { + props["tab-size"] = prp(length) + } + + fun tabSize(ts: InitialInherit) { + props["tab-size"] = prp(ts) + } + + fun tableLayout(tl: TableLayout) { + props["table-layout"] = prp(tl) + } + + fun textAlign(ta: TextAlign) { + props["text-align"] = prp(ta) + } + + fun textAlignLast(tal: TextAlignLast) { + props["text-align-last"] = prp(tal) + } + + fun textDecoration(decoration: String) { + props["text-decoration"] = prp(decoration) + } + + fun textDecorationColor(color: Color) { + props["text-decoration-color"] = prp(color) + } + + fun textDecorationLine(tdc: TextDecorationLine) { + props["text-decoration-line"] = prp(tdc) + } + + fun textDecorationStyle(tds: TextDecorationStyle) { + props["text-decoration-style"] = prp(tds) + } + + fun textIndent(length: Measurement) { + props["text-indent"] = prp(length) + } + + fun textIndent(indent: InitialInherit) { + props["text-indent"] = prp(indent) + } + + fun textJustify(tj: TextJustify) { + props["text-justify"] = prp(tj) + } + + fun textOverflow(to: String) { + props["text-overflow"] = prp(to) + } + + fun textShadow(ts: String) { + props["text-shadow"] = prp(ts) + } + + fun textTransform(tt: TextTransform) { + props["text-transform"] = prp(tt) + } + + fun top(top: Measurement) { + props["top"] = prp(top) + } + + fun transform(transform: Transform) { + props["transform"] = prp(transform) + } + + fun transformOrigin(origin: String) { + props["transform-origin"] = prp(origin) + } + + fun transformStyle(style: TransformStyle) { + props["transform-style"] = prp(style) + } + + fun transition(transition: String) { + props["transition"] = prp(transition) + } + + fun transitionDelay(timeInSeconds: Double) { + props["transition-delay"] = prp("${timeInSeconds}s") + } + + fun transitionDelay(timeInMillis: Int) { + props["transition-delay"] = prp("${timeInMillis}ms") + } + + fun transitionDelay(delay: DelayDuration) { + props["transition-delay"] = prp(delay) + } + + fun transitionDuration(timeInSeconds: Double) { + props["transition-duration"] = prp("${timeInSeconds}s") + } + + fun transitionDuration(timeInMillis: Int) { + props["transition-duration"] = prp("${timeInMillis}ms") + } + + fun transitionDuration(td: DelayDuration) { + props["transition-duration"] = prp(td) + } + + fun transitionProperty(property: String) { + props["transition-property"] = prp(property) + } + + fun transitionTimingFunction(function: TimingFunction) { + props["transition-timing-function"] = prp(function) + } + + fun unicodeBidi(ub: UnicodeBidi) { + props["unicode-bidi"] = prp(ub) + } + + fun userSelect(us: UserSelect) { + props["user-select"] = prp(us) + } + + fun verticalAlign(length: Measurement) { + props["vertical-align"] = prp(length) + } + + fun verticalAlign(va: VerticalAlign) { + props["vertical-align"] = prp(va) + } + + fun visibility(visibility: Visibility) { + props["visibility"] = prp(visibility) + } + + fun whiteSpace(whiteSpace: WhiteSpace) { + props["white-space"] = prp(whiteSpace) + } + + fun width(width: Measurement) { + props["width"] = prp(width) + } + + fun wordBreak(wordBreak: WordBreak) { + props["word-break"] = prp(wordBreak) + } + + fun wordSpacing(wordSpacing: Measurement) { + props["word-spacing"] = prp(wordSpacing) + } + + fun wordSpacing(wordSpacing: WordSpacing) { + props["word-spacing"] = prp(wordSpacing) + } + + fun wordWrap(wordWrap: WordWrap) { + props["word-wrap"] = prp(wordWrap) + } + + fun writingMode(writingMode: WritingMode) { + props["writing-mode"] = prp(writingMode) + } + + fun zIndex(zIndex: Int) { + props["z-index"] = prp(zIndex.toString()) + } + + fun zIndex(zIndex: ZIndex) { + props["z-index"] = prp(zIndex) + } } @CssTagMarker open class ConditionalStyle : Style() { - var media: MutableMap = mutableMapOf() - var supports: MutableMap = mutableMapOf() + var media: MutableMap = mutableMapOf() + var supports: MutableMap = mutableMapOf() - fun media(definition: String, style: ConditionalCss) { - media[definition] = style - } + fun media(definition: String, style: ConditionalCss) { + media[definition] = style + } - fun supports(query: String, style: ConditionalCss) { - supports[query] = style - } + fun supports(query: String, style: ConditionalCss) { + supports[query] = style + } } diff --git a/src/commonMain/kotlin/nl/astraeus/css/style/Validator.kt b/src/commonMain/kotlin/nl/astraeus/css/style/Validator.kt index d655774..79aaa1a 100644 --- a/src/commonMain/kotlin/nl/astraeus/css/style/Validator.kt +++ b/src/commonMain/kotlin/nl/astraeus/css/style/Validator.kt @@ -4,34 +4,34 @@ import nl.astraeus.css.properties.CssProperty abstract class Validator { - open fun validate(properties: List): Boolean = true + open fun validate(properties: List): 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( - val number: Int -): Validator() { + val number: Int +) : Validator() { - override fun validate(property: List): Boolean = property.size <= number + override fun validate(property: List): 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): Boolean { - for (prop in properties) { - if (prop.css() == "initial" || prop.css() == "inherit") { - return properties.size == 1 - } - } - - return true + override fun validate(properties: List): Boolean { + for (prop in properties) { + if (prop.css() == "initial" || prop.css() == "inherit") { + return properties.size == 1 + } } - 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'" } diff --git a/src/jsMain/kotlin/nl/astraeus/css/Test.kt b/src/jsMain/kotlin/nl/astraeus/css/Test.kt index f0d52b8..d16e74c 100644 --- a/src/jsMain/kotlin/nl/astraeus/css/Test.kt +++ b/src/jsMain/kotlin/nl/astraeus/css/Test.kt @@ -1,24 +1,28 @@ package nl.astraeus.css -import nl.astraeus.css.properties.* +import nl.astraeus.css.properties.AlignContent +import nl.astraeus.css.properties.DelayDuration +import nl.astraeus.css.properties.TimingFunction +import nl.astraeus.css.properties.hex + fun main() { - val sd = style { - select("#pipo") { - backgroundColor(hex(0xeeeeee)) - fontFamily("Arial, Courier") - animationDelay(DelayDuration.initial) + val sd = style { + select("#pipo") { + backgroundColor(hex(0xeeeeee)) + fontFamily("Arial, Courier") + animationDelay(DelayDuration.initial) - select("div") { - color(hex(0x1b1b1b1)) - alignContent(AlignContent.flexStart) - animationName("animname") - animationTimingFunction( - TimingFunction.cubicBezier(0.1, 0.2, 0.3, 0.4), - TimingFunction.easeInOut - ) - } - } + select("div") { + color(hex(0x1b1b1b1)) + alignContent(AlignContent.flexStart) + animationName("animname") + animationTimingFunction( + TimingFunction.cubicBezier(0.1, 0.2, 0.3, 0.4), + TimingFunction.easeInOut + ) + } } + } - println(sd.generateCss()) + println(sd.generateCss()) }