Upgrade to Kotlin 1.9.0, kotlinx-html 0.9.1, version 1.1.1.

This commit is contained in:
2023-07-19 16:18:49 +02:00
parent a1f1f3bb38
commit 5cc4826e65
6 changed files with 43 additions and 28 deletions

View File

@@ -1,19 +1,19 @@
plugins { plugins {
kotlin("multiplatform") version "1.7.20" kotlin("multiplatform") version "1.9.0"
`maven-publish` `maven-publish`
signing signing
id("org.jetbrains.dokka") version "1.5.31" id("org.jetbrains.dokka") version "1.5.31"
} }
group = "nl.astraeus" group = "nl.astraeus"
version = "1.0.8-SNAPSHOT" version = "1.1.1"
repositories { repositories {
mavenCentral() mavenCentral()
} }
kotlin { kotlin {
js(BOTH) { js(IR) {
browser { browser {
testTask { testTask {
useKarma { useKarma {
@@ -26,14 +26,11 @@ kotlin {
sourceSets { sourceSets {
val commonMain by getting { val commonMain by getting {
dependencies { dependencies {
implementation(kotlin("stdlib-common")) api("org.jetbrains.kotlinx:kotlinx-html:0.9.1")
api("org.jetbrains.kotlinx:kotlinx-html:0.7.5")
} }
} }
val jsMain by getting { val jsMain by getting {
dependencies { dependencies {
implementation(kotlin("stdlib-js"))
} }
} }
val jsTest by getting { val jsTest by getting {
@@ -71,25 +68,25 @@ publishing {
maven { maven {
name = "releases" name = "releases"
// change to point to your repo, e.g. http://my.org/repo // change to point to your repo, e.g. http://my.org/repo
setUrl("https://nexus.astraeus.nl/nexus/content/repositories/releases") setUrl("https://reposilite.astraeus.nl/releases")
credentials { credentials {
val nexusUsername: String? by project val reposiliteUsername: String? by project
val nexusPassword: String? by project val reposilitePassword: String? by project
username = nexusUsername username = reposiliteUsername
password = nexusPassword password = reposilitePassword
} }
} }
maven { maven {
name = "snapshots" name = "snapshots"
// change to point to your repo, e.g. http://my.org/repo // change to point to your repo, e.g. http://my.org/repo
setUrl("https://nexus.astraeus.nl/nexus/content/repositories/snapshots") setUrl("https://reposilite.astraeus.nl/snapshots")
credentials { credentials {
val nexusUsername: String? by project val reposiliteUsername: String? by project
val nexusPassword: String? by project val reposilitePassword: String? by project
username = nexusUsername username = reposiliteUsername
password = nexusPassword password = reposilitePassword
} }
} }
maven { maven {
@@ -136,3 +133,20 @@ publishing {
signing { signing {
sign(publishing.publications) sign(publishing.publications)
} }
tasks.named<Task>("signJsPublication") {
dependsOn(tasks.named<Task>("publishKotlinMultiplatformPublicationToMavenLocal"))
}
tasks.named<Task>("publishJsPublicationToReleasesRepository") {
dependsOn(tasks.named<Task>("signKotlinMultiplatformPublication"))
}
tasks.named<Task>("publishKotlinMultiplatformPublicationToMavenLocalRepository") {
dependsOn(tasks.named<Task>("signJsPublication"))
}
tasks.named<Task>("publishKotlinMultiplatformPublicationToReleasesRepository") {
dependsOn(tasks.named<Task>("signJsPublication"))
}

View File

@@ -1,5 +1,5 @@
#Wed Mar 04 13:29:12 CET 2020 #Wed Mar 04 13:29:12 CET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -1,8 +1,9 @@
package nl.astraeus.komp package nl.astraeus.komp
import org.w3c.dom.events.Event
import org.w3c.dom.Element import org.w3c.dom.Element
import org.w3c.dom.HTMLInputElement import org.w3c.dom.HTMLInputElement
import org.w3c.dom.events.Event import org.w3c.dom.events.EventListener
import org.w3c.dom.get import org.w3c.dom.get
private fun Int.asSpaces(): String { private fun Int.asSpaces(): String {

View File

@@ -7,13 +7,13 @@ import kotlinx.html.FlowOrMetaDataOrPhrasingContent
import kotlinx.html.Tag import kotlinx.html.Tag
import kotlinx.html.TagConsumer import kotlinx.html.TagConsumer
import kotlinx.html.Unsafe import kotlinx.html.Unsafe
import org.w3c.dom.events.Event
import org.w3c.dom.Element import org.w3c.dom.Element
import org.w3c.dom.HTMLElement import org.w3c.dom.HTMLElement
import org.w3c.dom.HTMLInputElement import org.w3c.dom.HTMLInputElement
import org.w3c.dom.HTMLSpanElement import org.w3c.dom.HTMLSpanElement
import org.w3c.dom.Node import org.w3c.dom.Node
import org.w3c.dom.asList import org.w3c.dom.asList
import org.w3c.dom.events.Event
import org.w3c.dom.get import org.w3c.dom.get
private var currentElement: Element? = null private var currentElement: Element? = null
@@ -240,7 +240,7 @@ class HtmlBuilder(
override fun onTagEvent( override fun onTagEvent(
tag: Tag, tag: Tag,
event: String, event: String,
value: (Event) -> Unit value: (kotlinx.html.org.w3c.dom.events.Event) -> Unit
) { ) {
logReplace { "onTagEvent, ${tag.tagName} [$event, $value]" } logReplace { "onTagEvent, ${tag.tagName} [$event, $value]" }
@@ -248,7 +248,7 @@ class HtmlBuilder(
checkTag(tag) checkTag(tag)
} }
currentElement?.setKompEvent(event.toLowerCase(), value) currentElement?.setKompEvent(event.lowercase(), value.asDynamic())
} }
override fun onTagEnd(tag: Tag) { override fun onTagEnd(tag: Tag) {
@@ -395,7 +395,7 @@ class HtmlBuilder(
currentPosition.nextElement() currentPosition.nextElement()
} }
override fun onTagError(tag: Tag, exception: Throwable) { fun onTagError(tag: Tag, exception: Throwable) {
exceptionThrown = true exceptionThrown = true
if (exception !is KomponentException) { if (exception !is KomponentException) {

View File

@@ -31,7 +31,7 @@ class MutableCollectionStateDelegate<T>(
} }
// todo: return iterator wrapper to update at changes? // todo: return iterator wrapper to update at changes?
// override fun iterator(): MutableIterator<T> = collection.iterator() //override fun iterator(): MutableIterator<T> = collection.iterator()
override fun remove(element: T): Boolean { override fun remove(element: T): Boolean {
komponent.requestUpdate() komponent.requestUpdate()

View File

@@ -14,8 +14,8 @@ interface Delegate<T> {
property: KProperty<*>, property: KProperty<*>,
value: T value: T
) )
}
}
open class StateDelegate<T>( open class StateDelegate<T>(
val komponent: Komponent, val komponent: Komponent,
@@ -51,6 +51,6 @@ open class StateDelegate<T>(
inline fun <reified T> Komponent.state( inline fun <reified T> Komponent.state(
initialValue: T initialValue: T
): Delegate<T> = StateDelegate( ): Delegate<T> = StateDelegate(
this, this,
initialValue initialValue
) )