aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-event-flow
diff options
context:
space:
mode:
Diffstat (limited to 'kvision-modules/kvision-event-flow')
-rw-r--r--kvision-modules/kvision-event-flow/build.gradle5
-rw-r--r--kvision-modules/kvision-event-flow/build.gradle.kts43
-rw-r--r--kvision-modules/kvision-event-flow/package.json.d/project.info3
-rw-r--r--kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt8
-rw-r--r--kvision-modules/kvision-event-flow/webpack.config.d/bootstrap.js3
-rw-r--r--kvision-modules/kvision-event-flow/webpack.config.d/file.js9
6 files changed, 59 insertions, 12 deletions
diff --git a/kvision-modules/kvision-event-flow/build.gradle b/kvision-modules/kvision-event-flow/build.gradle
deleted file mode 100644
index 4aaef76d..00000000
--- a/kvision-modules/kvision-event-flow/build.gradle
+++ /dev/null
@@ -1,5 +0,0 @@
-apply from: "../shared.gradle"
-
-dependencies {
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
-}
diff --git a/kvision-modules/kvision-event-flow/build.gradle.kts b/kvision-modules/kvision-event-flow/build.gradle.kts
new file mode 100644
index 00000000..f31fb11e
--- /dev/null
+++ b/kvision-modules/kvision-event-flow/build.gradle.kts
@@ -0,0 +1,43 @@
+buildscript {
+ extra.set("production", (findProperty("prod") ?: findProperty("production") ?: "false") == "true")
+}
+
+plugins {
+ kotlin("js")
+ id("maven-publish")
+}
+
+repositories()
+
+// Versions
+val coroutinesVersion: String by project
+
+kotlin {
+ kotlinJsTargets()
+}
+
+dependencies {
+ implementation(kotlin("stdlib-js"))
+ api(rootProject)
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion")
+ testImplementation(kotlin("test-js"))
+}
+
+val sourcesJar by tasks.registering(Jar::class) {
+ archiveClassifier.set("sources")
+ from(kotlin.sourceSets.main.get().kotlin)
+}
+
+publishing {
+ publications {
+ create<MavenPublication>("kotlin") {
+ from(components["kotlin"])
+ artifact(tasks["sourcesJar"])
+ pom {
+ defaultPom()
+ }
+ }
+ }
+}
+
+setupPublication()
diff --git a/kvision-modules/kvision-event-flow/package.json.d/project.info b/kvision-modules/kvision-event-flow/package.json.d/project.info
deleted file mode 100644
index f9d34fd1..00000000
--- a/kvision-modules/kvision-event-flow/package.json.d/project.info
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "description": "KVision event flow module"
-}
diff --git a/kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt b/kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt
index 3a93d2a5..f9556e62 100644
--- a/kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt
+++ b/kvision-modules/kvision-event-flow/src/main/kotlin/pl/treksoft/kvision/event/EventFlow.kt
@@ -29,7 +29,7 @@ import org.w3c.dom.events.Event
import pl.treksoft.kvision.core.Widget
import pl.treksoft.kvision.core.onEvent
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
inline fun <reified T : Widget> T.eventFlow(event: String): Flow<Pair<T, Event>> = callbackFlow {
val id = onEvent {
this.asDynamic()[event] = { e: Event ->
@@ -41,7 +41,7 @@ inline fun <reified T : Widget> T.eventFlow(event: String): Flow<Pair<T, Event>>
}
}
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
inline val <reified T : Widget> T.clickFlow: Flow<T>
get() = callbackFlow {
val id = onEvent {
@@ -54,7 +54,7 @@ inline val <reified T : Widget> T.clickFlow: Flow<T>
}
}
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
inline val <reified T : Widget> T.inputFlow: Flow<T>
get() = callbackFlow {
val id = onEvent {
@@ -67,7 +67,7 @@ inline val <reified T : Widget> T.inputFlow: Flow<T>
}
}
-@UseExperimental(ExperimentalCoroutinesApi::class)
+@OptIn(ExperimentalCoroutinesApi::class)
inline val <reified T : Widget> T.changeFlow: Flow<T>
get() = callbackFlow {
val id = onEvent {
diff --git a/kvision-modules/kvision-event-flow/webpack.config.d/bootstrap.js b/kvision-modules/kvision-event-flow/webpack.config.d/bootstrap.js
new file mode 100644
index 00000000..35b28e6a
--- /dev/null
+++ b/kvision-modules/kvision-event-flow/webpack.config.d/bootstrap.js
@@ -0,0 +1,3 @@
+config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'});
+config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'});
+config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'});
diff --git a/kvision-modules/kvision-event-flow/webpack.config.d/file.js b/kvision-modules/kvision-event-flow/webpack.config.d/file.js
new file mode 100644
index 00000000..653ca21f
--- /dev/null
+++ b/kvision-modules/kvision-event-flow/webpack.config.d/file.js
@@ -0,0 +1,9 @@
+config.module.rules.push(
+ {
+ test: /\.(jpe?g|png|gif|svg)$/i,
+ loader: 'file-loader',
+ options: {
+ esModule: false,
+ },
+ }
+);