Compare commits
3 Commits
c68a024552
...
6f37c879c2
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f37c879c2 | |||
| ab5689133f | |||
| 9e08601bb7 |
186
build.gradle.kts
186
build.gradle.kts
@@ -1,60 +1,74 @@
|
||||
@file:OptIn(ExperimentalWasmDsl::class)
|
||||
|
||||
import com.vanniktech.maven.publish.SonatypeHost
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform") version "2.1.10"
|
||||
`maven-publish`
|
||||
signing
|
||||
id("org.jetbrains.dokka") version "1.5.31"
|
||||
id("com.vanniktech.maven.publish") version "0.31.0"
|
||||
}
|
||||
|
||||
group = "nl.astraeus"
|
||||
version = "1.2.5-SNAPSHOT"
|
||||
version = "1.2.5"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "Sonatype Releases"
|
||||
url = uri("https://central.sonatype.com/api/v1/publisher/deployments/download/")
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
tasks.withType<Test>(Test::class.java) {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
*/
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
browser {
|
||||
testTask {
|
||||
useKarma {
|
||||
useChromiumHeadless()
|
||||
useChromeHeadless()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
wasmJs {
|
||||
//moduleName = project.name
|
||||
browser()
|
||||
/* wasmJs {
|
||||
//moduleName = project.name
|
||||
browser()
|
||||
|
||||
mavenPublication {
|
||||
groupId = group as String
|
||||
pom { name = "${project.name}-wasm-js" }
|
||||
}
|
||||
}
|
||||
*/
|
||||
mavenPublication {
|
||||
groupId = group as String
|
||||
pom { name = "${project.name}-wasm-js" }
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||
applyDefaultHierarchyTemplate {
|
||||
common {
|
||||
group("jsCommon") {
|
||||
withJs()
|
||||
// TODO: switch to `withWasmJs()` after upgrade to Kotlin 2.0
|
||||
withWasm()
|
||||
/*
|
||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||
applyDefaultHierarchyTemplate {
|
||||
common {
|
||||
group("jsCommon") {
|
||||
withJs()
|
||||
// TODO: switch to `withWasmJs()` after upgrade to Kotlin 2.0
|
||||
withWasm()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlinx:kotlinx-html:0.11.0")
|
||||
api("org.jetbrains.kotlinx:kotlinx-html:0.12.0")
|
||||
}
|
||||
}
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test"))
|
||||
}
|
||||
}
|
||||
val jsMain by getting
|
||||
@@ -67,105 +81,22 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
extra["PUBLISH_GROUP_ID"] = group
|
||||
extra["PUBLISH_VERSION"] = version
|
||||
extra["PUBLISH_ARTIFACT_ID"] = name
|
||||
|
||||
// Stub secrets to let the project sync and build without the publication values set up
|
||||
val signingKeyId: String? by project
|
||||
val signingPassword: String? by project
|
||||
val signingSecretKeyRingFile: String? by project
|
||||
val ossrhUsername: String? by project
|
||||
val ossrhPassword: String? by project
|
||||
|
||||
extra["signing.keyId"] = signingKeyId
|
||||
extra["signing.password"] = signingPassword
|
||||
extra["signing.secretKeyRingFile"] = signingSecretKeyRingFile
|
||||
extra["ossrhUsername"] = ossrhUsername
|
||||
extra["ossrhPassword"] = ossrhPassword
|
||||
|
||||
val javadocJar by tasks.registering(Jar::class) {
|
||||
archiveClassifier.set("javadoc")
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = "releases"
|
||||
// change to point to your repo, e.g. http://my.org/repo
|
||||
setUrl("https://reposilite.astraeus.nl/releases")
|
||||
credentials {
|
||||
val reposiliteUsername: String? by project
|
||||
val reposilitePassword: String? by project
|
||||
|
||||
username = reposiliteUsername
|
||||
password = reposilitePassword
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "snapshots"
|
||||
// change to point to your repo, e.g. http://my.org/repo
|
||||
setUrl("https://reposilite.astraeus.nl/snapshots")
|
||||
credentials {
|
||||
val reposiliteUsername: String? by project
|
||||
val reposilitePassword: String? by project
|
||||
|
||||
username = reposiliteUsername
|
||||
password = reposilitePassword
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
|
||||
credentials {
|
||||
username = ossrhUsername
|
||||
password = ossrhPassword
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "gitea"
|
||||
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
||||
|
||||
credentials() {
|
||||
val giteaUsername: kotlin.String? by project
|
||||
val giteaPassword: kotlin.String? by project
|
||||
credentials {
|
||||
val giteaUsername: String? by project
|
||||
val giteaPassword: String? by project
|
||||
|
||||
username = giteaUsername
|
||||
password = giteaPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Configure all publications
|
||||
publications.withType<MavenPublication> {
|
||||
// Stub javadoc.jar artifact
|
||||
artifact(javadocJar.get())
|
||||
|
||||
// Provide artifacts information requited by Maven Central
|
||||
pom {
|
||||
name.set("kotlin-komponent")
|
||||
description.set("Kotlin komponent")
|
||||
url.set("https://github.com/rnentjes/komponent")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("MIT")
|
||||
url.set("https://opensource.org/licenses/MIT")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("rnentjes")
|
||||
name.set("Rien Nentjes")
|
||||
email.set("info@nentjes.com")
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url.set("https://github.com/rnentjes/komponent")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<AbstractPublishToMaven> {
|
||||
@@ -175,3 +106,38 @@ tasks.withType<AbstractPublishToMaven> {
|
||||
signing {
|
||||
sign(publishing.publications)
|
||||
}
|
||||
|
||||
mavenPublishing {
|
||||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
|
||||
|
||||
signAllPublications()
|
||||
|
||||
coordinates(group.toString(), name.toString(), version.toString())
|
||||
|
||||
pom {
|
||||
name = "kotlin-komponent"
|
||||
description = "Kotlin komponent"
|
||||
inceptionYear = "2017"
|
||||
url = "https://github.com/rnentjes/komponent"
|
||||
licenses {
|
||||
license {
|
||||
name = "MIT"
|
||||
url = "https://opensource.org/licenses/MIT"
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "rnentjes"
|
||||
name = "Rien Nentjes"
|
||||
email = "info@nentjes.com"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = "https://github.com/rnentjes/komponent"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<PublishToMavenRepository> {
|
||||
dependsOn(tasks.withType<Sign>())
|
||||
}
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
#Wed Mar 04 13:29:12 CET 2020
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -8,6 +8,6 @@ See the komp-todo repository for a basic example here: [komp-todo](https://githu
|
||||
|
||||
For a more complete example take a look at the simple-password-manager repository: [simple-password-manager](https://github.com/rnentjes/simple-password-manager)
|
||||
|
||||
Available on maven central: "nl.astraeus:kotlin-komponent-js:1.0.0"
|
||||
Available on maven central: "nl.astraeus:kotlin-komponent-js:1.2.5"
|
||||
|
||||
Some getting started documentation can be found [here](docs/getting-started.md)
|
||||
Some getting started documentation can be found [here](docs/getting-started.md)
|
||||
|
||||
@@ -1,2 +1,17 @@
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "kotlin-komponent"
|
||||
|
||||
@@ -26,7 +26,7 @@ interface HtmlConsumer : TagConsumer<Element> {
|
||||
fun FlowOrMetaDataOrPhrasingContent.currentElement(): Element =
|
||||
currentElement ?: error("No current element defined!")
|
||||
|
||||
private fun Node.asElement() = this as? HTMLElement
|
||||
private fun Node?.asElement() = this as? HTMLElement
|
||||
|
||||
class HtmlBuilder(
|
||||
private val komponent: Komponent?,
|
||||
|
||||
@@ -191,6 +191,7 @@ abstract class Komponent {
|
||||
private var scheduledForUpdate = mutableSetOf<Komponent>()
|
||||
private var interceptor: (Komponent, () -> Unit) -> Unit = { _, block -> block() }
|
||||
|
||||
var logUpdateEvent = false
|
||||
var logRenderEvent = false
|
||||
var logReplaceEvent = false
|
||||
var enableAssertions = false
|
||||
@@ -244,6 +245,9 @@ abstract class Komponent {
|
||||
val memoizeHash = next.generateMemoizeHash()
|
||||
|
||||
if (next.memoizeChanged()) {
|
||||
if (logUpdateEvent) {
|
||||
console.log("Rendering", next)
|
||||
}
|
||||
next.onBeforeUpdate()
|
||||
next.renderUpdate()
|
||||
next.updateMemoizeHash()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package nl.astraeus.komp
|
||||
|
||||
import kotlinx.browser.document
|
||||
import kotlinx.html.DIV
|
||||
import kotlinx.html.InputType
|
||||
import kotlinx.html.classes
|
||||
import kotlinx.html.div
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package nl.astraeus.komp
|
||||
|
||||
import org.w3c.dom.AddEventListenerOptions
|
||||
import org.w3c.dom.events.Event
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.HTMLInputElement
|
||||
import org.w3c.dom.events.EventListener
|
||||
import org.w3c.dom.events.Event
|
||||
import org.w3c.dom.get
|
||||
|
||||
private fun Int.asSpaces(): String {
|
||||
|
||||
Reference in New Issue
Block a user