aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-03-03 01:00:13 +0100
committerRobert Jaros <rjaros@finn.pl>2019-03-03 01:00:13 +0100
commit4c4cd1bea935a9d9e0c5dbeb6548f91b8dd6751e (patch)
treef145c8d315342179fbce1217873e4027af77b5cb /src/main
parenta5e5c4dab0d1ca51c5b169b4d27fa18d61593067 (diff)
downloadkvision-4c4cd1bea935a9d9e0c5dbeb6548f91b8dd6751e.tar.gz
kvision-4c4cd1bea935a9d9e0c5dbeb6548f91b8dd6751e.tar.bz2
kvision-4c4cd1bea935a9d9e0c5dbeb6548f91b8dd6751e.zip
Support for overflow-wrap, word-break and line-break CSS properties.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Css.kt29
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt21
2 files changed, 50 insertions, 0 deletions
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
@@ -309,6 +309,15 @@ enum class Overflow(internal val overflow: String) {
}
/**
+ * 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.
*/
enum class Resize(internal val resize: String) {
@@ -487,6 +496,26 @@ enum class Clear(internal val clear: String) {
}
/**
+ * 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.
*/
class Border private constructor(
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
@@ -88,6 +88,10 @@ abstract class StyledComponent : 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.
*/
open var resize: Resize? by refreshOnUpdate()
@@ -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<StringPair>? = 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
}