From 4c4cd1bea935a9d9e0c5dbeb6548f91b8dd6751e Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sun, 3 Mar 2019 01:00:13 +0100 Subject: Support for overflow-wrap, word-break and line-break CSS properties. --- src/main/kotlin/pl/treksoft/kvision/core/Css.kt | 29 ++++++++++++++++++++++ .../pl/treksoft/kvision/core/StyledComponent.kt | 21 ++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'src/main/kotlin/pl') diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt index f3ff5d5e..d36a8d69 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Css.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Css.kt @@ -308,6 +308,15 @@ enum class Overflow(internal val overflow: String) { INHERIT("inherit") } +/** + * Definitions of CSS overflow-wrap options. + */ +enum class OverflowWrap(internal val overflowWrap: String) { + NORMAL("normal"), + BREAKWORK("break-word"), + ANYWHERE("anywhere") +} + /** * Definitions of CSS resize options. */ @@ -486,6 +495,26 @@ enum class Clear(internal val clear: String) { INHERIT("inherit") } +/** + * Definitions of CSS word-break options. + */ +enum class WordBreak(internal val wordBreak: String) { + NORMAL("normal"), + KEEPALL("keep-all"), + BREAKALL("break-all") +} + +/** + * Definitions of CSS line-break options. + */ +enum class LineBreak(internal val lineBreak: String) { + AUTO("auto"), + LOOSE("loose"), + NORMAL("normal"), + STRICT("strict"), + ANYWHERE("anywhere") +} + /** * Type-safe definition of CSS border. */ diff --git a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt index d54af6f7..428728b7 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt @@ -87,6 +87,10 @@ abstract class StyledComponent : Component { * CSS overflow of the current component. */ open var overflow: Overflow? by refreshOnUpdate() + /** + * CSS overflow-wrap of the current component. + */ + open var overflowWrap: OverflowWrap? by refreshOnUpdate() /** * CSS resize of the current component. */ @@ -271,6 +275,14 @@ abstract class StyledComponent : Component { * CSS clear float of the current component. */ open var clear: Clear? by refreshOnUpdate() + /** + * CSS word break of the current component. + */ + open var wordBreak: WordBreak? by refreshOnUpdate() + /** + * CSS line break of the current component. + */ + open var lineBreak: LineBreak? by refreshOnUpdate() private var snStyleCache: List? = null @@ -342,6 +354,9 @@ abstract class StyledComponent : Component { overflow?.let { snstyle.add("overflow" to it.overflow) } + overflowWrap?.let { + snstyle.add("overflow-wrap" to it.overflowWrap) + } resize?.let { snstyle.add("resize" to it.resize) } @@ -459,6 +474,12 @@ abstract class StyledComponent : Component { clear?.let { snstyle.add("clear" to it.clear) } + wordBreak?.let { + snstyle.add("word-break" to it.wordBreak) + } + lineBreak?.let { + snstyle.add("line-break" to it.lineBreak) + } return snstyle } -- cgit