Compare commits
3 Commits
c68a024552
...
6f37c879c2
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f37c879c2 | |||
| ab5689133f | |||
| 9e08601bb7 |
154
build.gradle.kts
154
build.gradle.kts
@@ -1,33 +1,43 @@
|
|||||||
@file:OptIn(ExperimentalWasmDsl::class)
|
@file:OptIn(ExperimentalWasmDsl::class)
|
||||||
|
|
||||||
|
import com.vanniktech.maven.publish.SonatypeHost
|
||||||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("multiplatform") version "2.1.10"
|
kotlin("multiplatform") version "2.1.10"
|
||||||
`maven-publish`
|
|
||||||
signing
|
signing
|
||||||
id("org.jetbrains.dokka") version "1.5.31"
|
id("org.jetbrains.dokka") version "1.5.31"
|
||||||
|
id("com.vanniktech.maven.publish") version "0.31.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "nl.astraeus"
|
group = "nl.astraeus"
|
||||||
version = "1.2.5-SNAPSHOT"
|
version = "1.2.5"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
name = "Sonatype Releases"
|
||||||
|
url = uri("https://central.sonatype.com/api/v1/publisher/deployments/download/")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
tasks.withType<Test>(Test::class.java) {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
js {
|
||||||
browser {
|
browser {
|
||||||
testTask {
|
testTask {
|
||||||
useKarma {
|
useKarma {
|
||||||
useChromiumHeadless()
|
useChromeHeadless()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/* wasmJs {
|
||||||
wasmJs {
|
|
||||||
//moduleName = project.name
|
//moduleName = project.name
|
||||||
browser()
|
browser()
|
||||||
|
|
||||||
@@ -35,8 +45,7 @@ kotlin {
|
|||||||
groupId = group as String
|
groupId = group as String
|
||||||
pom { name = "${project.name}-wasm-js" }
|
pom { name = "${project.name}-wasm-js" }
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
@@ -54,7 +63,12 @@ kotlin {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
val commonMain by getting {
|
val commonMain by getting {
|
||||||
dependencies {
|
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
|
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 {
|
publishing {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
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 {
|
maven {
|
||||||
name = "gitea"
|
name = "gitea"
|
||||||
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
||||||
|
|
||||||
credentials() {
|
credentials {
|
||||||
val giteaUsername: kotlin.String? by project
|
val giteaUsername: String? by project
|
||||||
val giteaPassword: kotlin.String? by project
|
val giteaPassword: String? by project
|
||||||
|
|
||||||
username = giteaUsername
|
username = giteaUsername
|
||||||
password = giteaPassword
|
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> {
|
tasks.withType<AbstractPublishToMaven> {
|
||||||
@@ -175,3 +106,38 @@ tasks.withType<AbstractPublishToMaven> {
|
|||||||
signing {
|
signing {
|
||||||
sign(publishing.publications)
|
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
|
#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
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=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)
|
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"
|
rootProject.name = "kotlin-komponent"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ interface HtmlConsumer : TagConsumer<Element> {
|
|||||||
fun FlowOrMetaDataOrPhrasingContent.currentElement(): Element =
|
fun FlowOrMetaDataOrPhrasingContent.currentElement(): Element =
|
||||||
currentElement ?: error("No current element defined!")
|
currentElement ?: error("No current element defined!")
|
||||||
|
|
||||||
private fun Node.asElement() = this as? HTMLElement
|
private fun Node?.asElement() = this as? HTMLElement
|
||||||
|
|
||||||
class HtmlBuilder(
|
class HtmlBuilder(
|
||||||
private val komponent: Komponent?,
|
private val komponent: Komponent?,
|
||||||
|
|||||||
@@ -191,6 +191,7 @@ abstract class Komponent {
|
|||||||
private var scheduledForUpdate = mutableSetOf<Komponent>()
|
private var scheduledForUpdate = mutableSetOf<Komponent>()
|
||||||
private var interceptor: (Komponent, () -> Unit) -> Unit = { _, block -> block() }
|
private var interceptor: (Komponent, () -> Unit) -> Unit = { _, block -> block() }
|
||||||
|
|
||||||
|
var logUpdateEvent = false
|
||||||
var logRenderEvent = false
|
var logRenderEvent = false
|
||||||
var logReplaceEvent = false
|
var logReplaceEvent = false
|
||||||
var enableAssertions = false
|
var enableAssertions = false
|
||||||
@@ -244,6 +245,9 @@ abstract class Komponent {
|
|||||||
val memoizeHash = next.generateMemoizeHash()
|
val memoizeHash = next.generateMemoizeHash()
|
||||||
|
|
||||||
if (next.memoizeChanged()) {
|
if (next.memoizeChanged()) {
|
||||||
|
if (logUpdateEvent) {
|
||||||
|
console.log("Rendering", next)
|
||||||
|
}
|
||||||
next.onBeforeUpdate()
|
next.onBeforeUpdate()
|
||||||
next.renderUpdate()
|
next.renderUpdate()
|
||||||
next.updateMemoizeHash()
|
next.updateMemoizeHash()
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package nl.astraeus.komp
|
package nl.astraeus.komp
|
||||||
|
|
||||||
import kotlinx.browser.document
|
import kotlinx.browser.document
|
||||||
import kotlinx.html.DIV
|
|
||||||
import kotlinx.html.InputType
|
import kotlinx.html.InputType
|
||||||
import kotlinx.html.classes
|
import kotlinx.html.classes
|
||||||
import kotlinx.html.div
|
import kotlinx.html.div
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package nl.astraeus.komp
|
package nl.astraeus.komp
|
||||||
|
|
||||||
import org.w3c.dom.AddEventListenerOptions
|
|
||||||
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.EventListener
|
import org.w3c.dom.events.Event
|
||||||
import org.w3c.dom.get
|
import org.w3c.dom.get
|
||||||
|
|
||||||
private fun Int.asSpaces(): String {
|
private fun Int.asSpaces(): String {
|
||||||
|
|||||||
Reference in New Issue
Block a user