diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-02-04 21:49:23 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-02-04 21:49:23 +0100 |
commit | 70d2f14d4a34f841a3161482eec5d355cbd755f6 (patch) | |
tree | 847cb461a2f261f6f2b3a6b0ebbc6918f1da0467 /src/main/kotlin/pl/treksoft/kvision/snabbdom | |
parent | 9665fe692681bc958e55d00cc0d0b238b7aee694 (diff) | |
download | kvision-70d2f14d4a34f841a3161482eec5d355cbd755f6.tar.gz kvision-70d2f14d4a34f841a3161482eec5d355cbd755f6.tar.bz2 kvision-70d2f14d4a34f841a3161482eec5d355cbd755f6.zip |
Refactoring packages layout
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/snabbdom')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt b/src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt deleted file mode 100644 index 0367633c..00000000 --- a/src/main/kotlin/pl/treksoft/kvision/snabbdom/Types.kt +++ /dev/null @@ -1,107 +0,0 @@ -package pl.treksoft.kvision.snabbdom - -import com.github.snabbdom.Attrs -import com.github.snabbdom.Classes -import com.github.snabbdom.Hooks -import com.github.snabbdom.On -import com.github.snabbdom.Props -import com.github.snabbdom.VNodeData -import com.github.snabbdom.VNodeStyle -import org.w3c.dom.CustomEvent -import org.w3c.dom.CustomEventInit -import pl.treksoft.jquery.JQueryEventObject -import pl.treksoft.kvision.core.Widget - -external class Object - -fun obj(init: dynamic.() -> Unit): dynamic { - return (Object()).apply(init) -} - -@Suppress("UnsafeCastFromDynamic") -private fun vNodeData(): VNodeData = js("({})") - -interface KvJQueryEventObject : JQueryEventObject { - val clickedIndex: Int -} - -@Suppress("UnsafeCastFromDynamic") -class KvEvent(type: String, eventInitDict: CustomEventInit) : CustomEvent(type, eventInitDict) { - override val detail: KvJQueryEventObject = obj {} -} - -interface BtOn : On { - var showBsDropdown: ((KvEvent) -> kotlin.Unit)? - var shownBsDropdown: ((KvEvent) -> kotlin.Unit)? - var hideBsDropdown: ((KvEvent) -> kotlin.Unit)? - var hiddenBsDropdown: ((KvEvent) -> kotlin.Unit)? - var showBsModal: ((KvEvent) -> kotlin.Unit)? - var shownBsModal: ((KvEvent) -> kotlin.Unit)? - var hideBsModal: ((KvEvent) -> kotlin.Unit)? - var hiddenBsModal: ((KvEvent) -> kotlin.Unit)? - var dragSplitPanel: ((KvEvent) -> kotlin.Unit)? - var dragEndSplitPanel: ((KvEvent) -> kotlin.Unit)? - var showBsSelect: ((KvEvent) -> kotlin.Unit)? - var shownBsSelect: ((KvEvent) -> kotlin.Unit)? - var hideBsSelect: ((KvEvent) -> kotlin.Unit)? - var hiddenBsSelect: ((KvEvent) -> kotlin.Unit)? - var loadedBsSelect: ((KvEvent) -> kotlin.Unit)? - var renderedBsSelect: ((KvEvent) -> kotlin.Unit)? - var refreshedBsSelect: ((KvEvent) -> kotlin.Unit)? - var changedBsSelect: ((KvEvent) -> kotlin.Unit)? - var changeDate: ((KvEvent) -> kotlin.Unit)? - var showBsDateTime: ((KvEvent) -> kotlin.Unit)? - var hideBsDateTime: ((KvEvent) -> kotlin.Unit)? - var onMinBsSpinner: ((KvEvent) -> kotlin.Unit)? - var onMaxBsSpinner: ((KvEvent) -> kotlin.Unit)? - var updateModel: ((KvEvent) -> kotlin.Unit)? -} - -interface SnOn<T> : BtOn { - var self: T -} - -fun snOpt(block: VNodeData.() -> Unit) = (vNodeData()::apply)(block) - -@Suppress("UnsafeCastFromDynamic") -internal fun on(widget: Widget): SnOn<Widget> { - val obj = js("({})") - obj["self"] = widget - return obj -} - -@Suppress("UnsafeCastFromDynamic") -internal fun hooks(): Hooks { - return js("({})") -} - -typealias StringPair = Pair<String, String> -typealias StringBoolPair = Pair<String, Boolean> - -@Suppress("UnsafeCastFromDynamic") -fun snStyle(pairs: List<StringPair>): VNodeStyle { - return obj { - pairs.forEach { (key, value) -> this[key] = value } - } -} - -@Suppress("UnsafeCastFromDynamic") -fun snProps(pairs: List<StringPair>): Props { - return obj { - pairs.forEach { (key, value) -> this[key] = value } - } -} - -@Suppress("UnsafeCastFromDynamic") -fun snClasses(pairs: List<StringBoolPair>): Classes { - return obj { - pairs.forEach { (key, value) -> this[key] = value } - } -} - -@Suppress("UnsafeCastFromDynamic") -fun snAttrs(pairs: List<StringPair>): Attrs { - return obj { - pairs.forEach { (key, value) -> this[key] = value } - } -} |