More properties
This commit is contained in:
@@ -2,6 +2,7 @@ package nl.astraeus.css.style
|
|||||||
|
|
||||||
import nl.astraeus.css.properties.*
|
import nl.astraeus.css.properties.*
|
||||||
import nl.astraeus.logging.log
|
import nl.astraeus.logging.log
|
||||||
|
import kotlin.time.Duration
|
||||||
|
|
||||||
typealias Css = Style.() -> Unit
|
typealias Css = Style.() -> Unit
|
||||||
|
|
||||||
@@ -364,6 +365,34 @@ open class Style(
|
|||||||
fun all(all: All) { properties["all"] = toProp(all) }
|
fun all(all: All) { properties["all"] = toProp(all) }
|
||||||
fun alignSelf(alignSelf: AlignSelf) { properties["align-self"] = toProp(alignSelf) }
|
fun alignSelf(alignSelf: AlignSelf) { properties["align-self"] = toProp(alignSelf) }
|
||||||
fun animation(text: String) { properties["animation"] = listOf(CssProperty(text)) }
|
fun animation(text: String) { properties["animation"] = listOf(CssProperty(text)) }
|
||||||
|
fun animationDelay(delay: DelayDuration) { properties["animation-delay"] = listOf(delay) }
|
||||||
|
fun animationDirection(direction: AnimationDirection) { properties["animation-direction"] = listOf(direction) }
|
||||||
|
fun animationDuration(duration: DelayDuration) { properties["animation-duration"] = listOf(duration) }
|
||||||
|
fun animationFillMode(fillMode: AnimationFillMode) { properties["animation-fill-mode"] = listOf(fillMode) }
|
||||||
|
fun animationIterationMode(vararg iterationMode: Count) { properties["animation-iteration-mode"] = iterationMode.toList() }
|
||||||
|
fun animationFrame(frame: AnimationFrame) { properties["animation-frame"] = listOf(frame) }
|
||||||
|
fun animationName(vararg name: String) { properties["animation-name"] = name.toList().map { an -> CssProperty(an) } }
|
||||||
|
fun animationPlayState(vararg state : AnimationPlayState) {
|
||||||
|
properties["animation-play-state"] = state.toList()
|
||||||
|
}
|
||||||
|
fun animationTimingFunction(vararg timingFunction: AnimationTimingFunction) {
|
||||||
|
properties["animation-timing-function"] = timingFunction.toList()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
"animation-delay" to animationDelay,
|
||||||
|
"animation-direction" to animationDirection,
|
||||||
|
"animation-duration" to animationDuration,
|
||||||
|
"animation-fill-mode" to animationFillMode,
|
||||||
|
"animation-iteration-count" to animationIterationCount,
|
||||||
|
"animation-frame" to animationFrame,
|
||||||
|
"animation-name" to animationName,
|
||||||
|
"animation-play-state" to animationPlayState,
|
||||||
|
"animation-timing-function" to animationTimingFunction,
|
||||||
|
*/
|
||||||
|
fun color(color: Color) { properties["color"] = listOf(color) }
|
||||||
fun backgroundColor(color: Color) { properties["background-color"] = listOf(color) }
|
fun backgroundColor(color: Color) { properties["background-color"] = listOf(color) }
|
||||||
fun borderRadius(radius: Measurement) { properties["border-radius"] = listOf(radius) }
|
fun borderRadius(radius: Measurement) { properties["border-radius"] = listOf(radius) }
|
||||||
fun borderRadius(
|
fun borderRadius(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package nl.astraeus.css
|
package nl.astraeus.css
|
||||||
|
|
||||||
import nl.astraeus.css.properties.*
|
import nl.astraeus.css.properties.*
|
||||||
|
import nl.astraeus.css.properties.Color.Companion.hex
|
||||||
import nl.astraeus.css.properties.Measurement.Companion.em
|
import nl.astraeus.css.properties.Measurement.Companion.em
|
||||||
import nl.astraeus.css.properties.Measurement.Companion.px
|
import nl.astraeus.css.properties.Measurement.Companion.px
|
||||||
import nl.astraeus.css.style.Style
|
import nl.astraeus.css.style.Style
|
||||||
@@ -32,14 +33,14 @@ private fun generateCss(
|
|||||||
select("body") {
|
select("body") {
|
||||||
// fontFamily = base.mainFont
|
// fontFamily = base.mainFont
|
||||||
// color = base.mainColor
|
// color = base.mainColor
|
||||||
// backgroundColor = base.mainBackgroundColor
|
backgroundColor(base.mainBackgroundColor)
|
||||||
// alignContent = AlignContent.initial()
|
// alignContent = AlignContent.initial()
|
||||||
}
|
}
|
||||||
|
|
||||||
select(".test") {
|
select(".test") {
|
||||||
// top = px(10)
|
// top = px(10)
|
||||||
// left = em(5)
|
// left = em(5)
|
||||||
// backgroundColor = Color.rgba(255, 255, 255, 0.75)
|
backgroundColor(Color.rgba(255, 255, 255, 0.75))
|
||||||
//
|
//
|
||||||
// select("> a") {
|
// select("> a") {
|
||||||
// color = Color.hsl(200, 50, 50)
|
// color = Color.hsl(200, 50, 50)
|
||||||
@@ -48,11 +49,12 @@ private fun generateCss(
|
|||||||
|
|
||||||
select("nav") {
|
select("nav") {
|
||||||
select("ul") {
|
select("ul") {
|
||||||
// color = Color.hsl(0, 100, 25)
|
color(Color.hsl(0, 100, 25))
|
||||||
// backgroundColor = base.mainBackgroundColor
|
backgroundColor(base.mainBackgroundColor)
|
||||||
}
|
}
|
||||||
select("li") {
|
select("li") {
|
||||||
sizePX(25, 25, 200, 200)
|
sizePX(25, 25, 200, 200)
|
||||||
|
animationPlayState(AnimationPlayState.paused(), AnimationPlayState.running())
|
||||||
|
|
||||||
select("a") {
|
select("a") {
|
||||||
// width = px(725)
|
// width = px(725)
|
||||||
@@ -79,6 +81,8 @@ fun main() {
|
|||||||
|
|
||||||
val sd = style {
|
val sd = style {
|
||||||
select("#pipo") {
|
select("#pipo") {
|
||||||
|
backgroundColor(hex("ffeedd"))
|
||||||
|
fontFamily("Arial, Courier")
|
||||||
// backgroundColor = Color.hex("eeeeee")
|
// backgroundColor = Color.hex("eeeeee")
|
||||||
// fontFamily = text("Arial, Courier")
|
// fontFamily = text("Arial, Courier")
|
||||||
// animationDelay = listOf(DelayDuration.initial())
|
// animationDelay = listOf(DelayDuration.initial())
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ fun main() {
|
|||||||
select("border-2") {
|
select("border-2") {
|
||||||
// borderRadius = BorderRadius(4, 5, 6, 7)
|
// borderRadius = BorderRadius(4, 5, 6, 7)
|
||||||
apply(border2)
|
apply(border2)
|
||||||
|
animationPlayState(AnimationPlayState.paused(), AnimationPlayState.running())
|
||||||
|
|
||||||
// display = Display.none()
|
// display = Display.none()
|
||||||
// borderBottomWidth = BorderWidth.perc(13)
|
// borderBottomWidth = BorderWidth.perc(13)
|
||||||
|
|||||||
Reference in New Issue
Block a user