summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2018-02-03 23:21:46 +0100
committerRobert Jaros <rjaros@finn.pl>2018-02-03 23:21:46 +0100
commit9665fe692681bc958e55d00cc0d0b238b7aee694 (patch)
treedd222dec725f64b8065a09311d9b034e9b9751b3 /src
parent180528f620e53e4a828d6f4d427ce83817572f44 (diff)
downloadkvision-9665fe692681bc958e55d00cc0d0b238b7aee694.tar.gz
kvision-9665fe692681bc958e55d00cc0d0b238b7aee694.tar.bz2
kvision-9665fe692681bc958e55d00cc0d0b238b7aee694.zip
Refactoring for kdoc API documentation with dokka
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt21
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/HMR.kt15
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Component.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt4
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/html/Label.kt (renamed from src/main/kotlin/pl/treksoft/kvision/basic/Label.kt)2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt5
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt (renamed from src/test/kotlin/test/pl/treksoft/kvision/basic/LabelSpec.kt)6
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt2
-rw-r--r--src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt2
18 files changed, 54 insertions, 23 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt b/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt
index e9e99fc7..83ad69ca 100644
--- a/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt
@@ -1,6 +1,23 @@
+/**
+ * @author Robert Jaros
+ */
package pl.treksoft.kvision
+/**
+ * Base class for applications.
+ *
+ * Every application class should inherit from this abstract class.
+*/
abstract class ApplicationBase {
- abstract fun start(state: Map<String, Any>)
- abstract fun dispose(): Map<String, Any>
+/**
+ * Starting point for an application.
+ * @param state Initial state between Hot Module Replacement (HMR).
+*/
+abstract fun start(state: Map<String, Any>)
+
+/**
+ * Ending point for an application.
+ * @return final state for Hot Module Replacement (HMR).
+*/
+abstract fun dispose(): Map<String, Any>
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/HMR.kt b/src/main/kotlin/pl/treksoft/kvision/HMR.kt
index e657567a..6fb9dfed 100644
--- a/src/main/kotlin/pl/treksoft/kvision/HMR.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/HMR.kt
@@ -1,11 +1,23 @@
+/**
+ * @author Robert Jaros
+ */
package pl.treksoft.kvision
+/**
+ * Helper variable for Hot Module Replacement (HMR).
+ */
external val module: Module
+/**
+ * Helper interface for Hot Module Replacement (HMR).
+ */
external interface Module {
val hot: Hot?
}
+/**
+ * Helper interface for Hot Module Replacement (HMR).
+ */
external interface Hot {
val data: dynamic
@@ -16,4 +28,7 @@ external interface Hot {
fun dispose(callback: (data: dynamic) -> Unit)
}
+/**
+ * External function for loading CommonJS modules.
+ */
external fun require(name: String): dynamic
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Component.kt b/src/main/kotlin/pl/treksoft/kvision/core/Component.kt
index af5ac830..bdd254ba 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Component.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Component.kt
@@ -8,8 +8,6 @@ import pl.treksoft.jquery.JQuery
interface Component {
var parent: Component?
var visible: Boolean
- var width: CssSize?
- var height: CssSize?
fun addCssClass(css: String): Widget
fun removeCssClass(css: String): Widget
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
index f4bf6e09..b2676929 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt
@@ -5,7 +5,7 @@ import pl.treksoft.kvision.utils.asString
abstract class StyledComponent : Component {
- override var width: CssSize? = null
+ open var width: CssSize? = null
set(value) {
field = value
refresh()
@@ -20,7 +20,7 @@ abstract class StyledComponent : Component {
field = value
refresh()
}
- override var height: CssSize? = null
+ var height: CssSize? = null
set(value) {
field = value
refresh()
diff --git a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
index 6f9dfaeb..af53807c 100644
--- a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt
@@ -58,7 +58,7 @@ class DataContainer<M : DataComponent, C : Widget>(
return this.child.renderVNode()
}
- fun get(index: Int) = model[index]
+ fun get(index: Int): M = model[index]
override fun update() {
model.forEach { it.container = this }
diff --git a/src/main/kotlin/pl/treksoft/kvision/basic/Label.kt b/src/main/kotlin/pl/treksoft/kvision/html/Label.kt
index a8d8bc16..3ce23639 100644
--- a/src/main/kotlin/pl/treksoft/kvision/basic/Label.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/html/Label.kt
@@ -1,4 +1,4 @@
-package pl.treksoft.kvision.basic
+package pl.treksoft.kvision.html
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
index 4f06a38f..722f60e6 100644
--- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt
@@ -3,6 +3,7 @@ package pl.treksoft.kvision.panel
import com.github.snabbdom.VNode
import pl.treksoft.jquery.JQuery
import pl.treksoft.jquery.JQueryEventObject
+import pl.treksoft.kvision.core.StyledComponent
import pl.treksoft.kvision.core.UNIT
import pl.treksoft.kvision.html.TAG
import pl.treksoft.kvision.html.Tag
@@ -39,9 +40,9 @@ open class SplitPanel(
}
onDragEnd = { e: JQueryEventObject, el: JQuery, _: dynamic ->
if (horizontal) {
- children[0].height = el.height().toInt() to px
+ (children[0] as? StyledComponent)?.height = el.height().toInt() to px
} else {
- children[0].width = el.width().toInt() to px
+ (children[0] as? StyledComponent)?.width = el.width().toInt() to px
}
self.dispatchEvent("dragEndSplitPanel", obj { detail = e })
}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt
index e2fd7a0d..20a1e484 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt
@@ -1,7 +1,7 @@
package test.pl.treksoft.kvision.data
import com.lightningkite.kotlin.observable.list.observableListOf
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.data.BaseDataComponent
import pl.treksoft.kvision.data.DataContainer
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/basic/LabelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt
index c3019cc9..9c6c4e6e 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/basic/LabelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt
@@ -1,7 +1,7 @@
-package test.pl.treksoft.kvision.basic
+package test.pl.treksoft.kvision.html
-import pl.treksoft.kvision.basic.Label
import pl.treksoft.kvision.core.Root
+import pl.treksoft.kvision.html.Label
import test.pl.treksoft.kvision.DomSpec
import kotlin.browser.document
import kotlin.test.Test
@@ -20,4 +20,4 @@ class LabelSpec : DomSpec {
}
}
-} \ No newline at end of file
+}
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt
index a83bbc6a..c748a45c 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.DockPanel
import pl.treksoft.kvision.panel.SIDE
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt
index e1c3d160..d79b06f9 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.FLEXDIR
import pl.treksoft.kvision.panel.FLEXJUSTIFY
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt
index 571f13e9..6590e0b0 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.GridPanel
import test.pl.treksoft.kvision.DomSpec
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt
index 589bd9df..a76c7eb0 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.FLEXJUSTIFY
import pl.treksoft.kvision.panel.HPanel
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt
index 2bbb3774..d52fb3d7 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.ResponsiveGridPanel
import test.pl.treksoft.kvision.DomSpec
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt
index 0cce9bb5..4be7f441 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.DIRECTION
import pl.treksoft.kvision.panel.SplitPanel
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt
index f9f3f68a..51e4a3f2 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.StackPanel
import test.pl.treksoft.kvision.DomSpec
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
index d8c0f905..4d1803b1 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.TabPanel
import test.pl.treksoft.kvision.DomSpec
diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt
index 26fb2675..ad8ceaac 100644
--- a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt
+++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt
@@ -1,6 +1,6 @@
package test.pl.treksoft.kvision.panel
-import pl.treksoft.kvision.basic.Label
+import pl.treksoft.kvision.html.Label
import pl.treksoft.kvision.core.Root
import pl.treksoft.kvision.panel.FLEXJUSTIFY
import pl.treksoft.kvision.panel.VPanel