Kotlin version 1.9.22. Kotlin-komponent version 1.2.1.
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,5 @@
|
|||||||
# Created by .ignore support plugin (hsz.mobi)
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
gradle.properties
|
gradle.properties
|
||||||
web
|
web
|
||||||
|
.idea
|
||||||
|
|
||||||
|
|||||||
6
.idea/artifacts/komp_todo_js_0_1_0_SNAPSHOT.xml
generated
6
.idea/artifacts/komp_todo_js_0_1_0_SNAPSHOT.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<component name="ArtifactManager">
|
|
||||||
<artifact type="jar" name="komp-todo-js-0.1.0-SNAPSHOT">
|
|
||||||
<output-path>$PROJECT_DIR$/build/libs</output-path>
|
|
||||||
<root id="archive" name="komp-todo-js-0.1.0-SNAPSHOT.jar" />
|
|
||||||
</artifact>
|
|
||||||
</component>
|
|
||||||
8
.idea/artifacts/komp_todo_js_0_2_0_SNAPSHOT.xml
generated
8
.idea/artifacts/komp_todo_js_0_2_0_SNAPSHOT.xml
generated
@@ -1,8 +0,0 @@
|
|||||||
<component name="ArtifactManager">
|
|
||||||
<artifact type="jar" name="komp-todo-js-0.2.0-SNAPSHOT">
|
|
||||||
<output-path>$PROJECT_DIR$/build/libs</output-path>
|
|
||||||
<root id="archive" name="komp-todo-js-0.2.0-SNAPSHOT.jar">
|
|
||||||
<element id="module-output" name="komp-todo.jsMain" />
|
|
||||||
</root>
|
|
||||||
</artifact>
|
|
||||||
</component>
|
|
||||||
6
.idea/artifacts/komp_todo_js_1_0_0.xml
generated
6
.idea/artifacts/komp_todo_js_1_0_0.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<component name="ArtifactManager">
|
|
||||||
<artifact type="jar" name="komp-todo-js-1.0.0">
|
|
||||||
<output-path>$PROJECT_DIR$/build/libs</output-path>
|
|
||||||
<root id="archive" name="komp-todo-js-1.0.0.jar" />
|
|
||||||
</artifact>
|
|
||||||
</component>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<component name="ArtifactManager">
|
|
||||||
<artifact type="jar" name="komp-todo-jslegacy-0.1.0-SNAPSHOT">
|
|
||||||
<output-path>$PROJECT_DIR$/build/libs</output-path>
|
|
||||||
<root id="archive" name="komp-todo-jslegacy-0.1.0-SNAPSHOT.jar" />
|
|
||||||
</artifact>
|
|
||||||
</component>
|
|
||||||
11
.idea/aws.xml
generated
11
.idea/aws.xml
generated
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="accountSettings">
|
|
||||||
<option name="activeRegion" value="us-east-1" />
|
|
||||||
<option name="recentlyUsedRegions">
|
|
||||||
<list>
|
|
||||||
<option value="us-east-1" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/compiler.xml
generated
6
.idea/compiler.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<bytecodeTargetLevel target="1.8" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
20
.idea/gradle.xml
generated
20
.idea/gradle.xml
generated
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="delegatedBuild" value="true" />
|
|
||||||
<option name="testRunner" value="GRADLE" />
|
|
||||||
<option name="distributionType" value="WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="gradleJvm" value="1.8" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
40
.idea/jarRepositories.xml
generated
40
.idea/jarRepositories.xml
generated
@@ -1,40 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RemoteRepositoriesConfiguration">
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="central" />
|
|
||||||
<option name="name" value="Maven Central repository" />
|
|
||||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="jboss.community" />
|
|
||||||
<option name="name" value="JBoss Community repository" />
|
|
||||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="MavenRepo" />
|
|
||||||
<option name="name" value="MavenRepo" />
|
|
||||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="maven" />
|
|
||||||
<option name="name" value="maven" />
|
|
||||||
<option name="url" value="http://nexus.astraeus.nl/nexus/content/groups/public" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="maven" />
|
|
||||||
<option name="name" value="maven" />
|
|
||||||
<option name="url" value="https://nexus.astraeus.nl/nexus/content/groups/public" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="BintrayJCenter" />
|
|
||||||
<option name="name" value="BintrayJCenter" />
|
|
||||||
<option name="url" value="https://jcenter.bintray.com/" />
|
|
||||||
</remote-repository>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="MavenLocal" />
|
|
||||||
<option name="name" value="MavenLocal" />
|
|
||||||
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
|
||||||
</remote-repository>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
65
.idea/libraries-with-intellij-classes.xml
generated
65
.idea/libraries-with-intellij-classes.xml
generated
@@ -1,65 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="libraries-with-intellij-classes">
|
|
||||||
<option name="intellijApiContainingLibraries">
|
|
||||||
<list>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="ideaIU" />
|
|
||||||
<option name="groupId" value="com.jetbrains.intellij.idea" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="ideaIU" />
|
|
||||||
<option name="groupId" value="com.jetbrains" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="ideaIC" />
|
|
||||||
<option name="groupId" value="com.jetbrains.intellij.idea" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="ideaIC" />
|
|
||||||
<option name="groupId" value="com.jetbrains" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="pycharmPY" />
|
|
||||||
<option name="groupId" value="com.jetbrains.intellij.pycharm" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="pycharmPY" />
|
|
||||||
<option name="groupId" value="com.jetbrains" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="pycharmPC" />
|
|
||||||
<option name="groupId" value="com.jetbrains.intellij.pycharm" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="pycharmPC" />
|
|
||||||
<option name="groupId" value="com.jetbrains" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="clion" />
|
|
||||||
<option name="groupId" value="com.jetbrains.intellij.clion" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="clion" />
|
|
||||||
<option name="groupId" value="com.jetbrains" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="riderRD" />
|
|
||||||
<option name="groupId" value="com.jetbrains.intellij.rider" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="riderRD" />
|
|
||||||
<option name="groupId" value="com.jetbrains" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="goland" />
|
|
||||||
<option name="groupId" value="com.jetbrains.intellij.goland" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
<LibraryCoordinatesState>
|
|
||||||
<option name="artifactId" value="goland" />
|
|
||||||
<option name="groupId" value="com.jetbrains" />
|
|
||||||
</LibraryCoordinatesState>
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
8
.idea/misc.xml
generated
8
.idea/misc.xml
generated
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
|
||||||
</project>
|
|
||||||
15
.idea/modules/komp-todo.main.iml
generated
15
.idea/modules/komp-todo.main.iml
generated
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<output url="file://$MODULE_DIR$/../../build/classes/java/main" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$/../../src/main">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/kotlin" type="kotlin-source" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="jdk" jdkName="Kotlin SDK" jdkType="KotlinSDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-js:1.4.30" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: nl.astraeus:komp:0.2.5-SNAPSHOT" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
14
.idea/modules/komp-todo.test.iml
generated
14
.idea/modules/komp-todo.test.iml
generated
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module external.system.module.type="sourceSet" type="JAVA_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<output-test url="file://$MODULE_DIR$/../../build/classes/java/test" />
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$/../../src/test" />
|
|
||||||
<orderEntry type="jdk" jdkName="Kotlin SDK" jdkType="KotlinSDK" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
<orderEntry type="module" module-name="komp-todo.main" />
|
|
||||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-js:1.4.30" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30" level="project" />
|
|
||||||
<orderEntry type="library" name="Gradle: nl.astraeus:komp:0.2.5-SNAPSHOT" level="project" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -1,10 +1,15 @@
|
|||||||
|
@file:OptIn(ExperimentalDistributionDsl::class)
|
||||||
|
|
||||||
|
import org.gradle.internal.impldep.org.bouncycastle.asn1.crmf.SinglePubInfo.web
|
||||||
|
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDistributionDsl
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("multiplatform") version "1.7.20"
|
kotlin("multiplatform") version "1.9.22"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "nl.astraeus"
|
group = "nl.astraeus"
|
||||||
version = "1.0.0"
|
version = "1.1.0"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
@@ -25,17 +30,17 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
distribution {
|
distribution {
|
||||||
directory = File("$projectDir/web/")
|
outputDirectory.set(File("$projectDir/web/"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
val commonMain by getting {
|
val commonMain by getting
|
||||||
|
val jsMain by getting {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("nl.astraeus:kotlin-komponent:1.0.7")
|
implementation("nl.astraeus:kotlin-komponent:1.2.1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val jsMain by getting
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import kotlin.js.Date
|
|||||||
* see: https://github.com/tastejs/todomvc/
|
* see: https://github.com/tastejs/todomvc/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Todo(
|
data class Todo(
|
||||||
val dataId: String,
|
val dataId: String,
|
||||||
var title: String,
|
var title: String,
|
||||||
var completed: Boolean = false,
|
var completed: Boolean = false,
|
||||||
@@ -89,7 +89,7 @@ class TodoApp : Komponent() {
|
|||||||
if (target is HTMLInputElement) {
|
if (target is HTMLInputElement) {
|
||||||
todoList.add(Todo("${Date().getTime()}", target.value))
|
todoList.add(Todo("${Date().getTime()}", target.value))
|
||||||
|
|
||||||
requestUpdate()
|
this@TodoApp.requestUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ class TodoApp : Komponent() {
|
|||||||
requestUpdate()
|
requestUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clearCompleted() {
|
fun clearCompleted(e: Event) {
|
||||||
for (todo in ArrayList(todoList)) {
|
for (todo in ArrayList(todoList)) {
|
||||||
if (todo.completed) {
|
if (todo.completed) {
|
||||||
todoList.remove(todo)
|
todoList.remove(todo)
|
||||||
@@ -133,15 +133,7 @@ class TodoApp : Komponent() {
|
|||||||
requestUpdate()
|
requestUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getItemsLeft(): Int {
|
private fun getItemsLeft(): Int = todoList.count { todo -> !todo.completed }
|
||||||
var result = 0
|
|
||||||
for (todo in todoList) {
|
|
||||||
if (!todo.completed) {
|
|
||||||
result++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setEditing(editTodo: Todo) {
|
fun setEditing(editTodo: Todo) {
|
||||||
for (todo in todoList) {
|
for (todo in todoList) {
|
||||||
@@ -199,8 +191,16 @@ class TodoApp : Komponent() {
|
|||||||
|
|
||||||
footer(classes = "footer") {
|
footer(classes = "footer") {
|
||||||
span(classes = "todo-count") {
|
span(classes = "todo-count") {
|
||||||
strong { +"${getItemsLeft()}" }
|
when(getItemsLeft()) {
|
||||||
+" item left"
|
0 -> {
|
||||||
|
+ "No items"
|
||||||
|
}
|
||||||
|
1 -> {
|
||||||
|
+ "1 item left"
|
||||||
|
}
|
||||||
|
else ->
|
||||||
|
+ "${getItemsLeft()} items left"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ul(classes = "filters") {
|
ul(classes = "filters") {
|
||||||
for (selection in Selection.values()) {
|
for (selection in Selection.values()) {
|
||||||
@@ -220,9 +220,7 @@ class TodoApp : Komponent() {
|
|||||||
}
|
}
|
||||||
button(classes = "clear-completed") {
|
button(classes = "clear-completed") {
|
||||||
+"Clear completed"
|
+"Clear completed"
|
||||||
onClickFunction = {
|
onClickFunction = ::clearCompleted
|
||||||
clearCompleted()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user