Small fixes
This commit is contained in:
2
komp.iml
2
komp.iml
@@ -2,7 +2,7 @@
|
||||
<module external.linked.project.id="komp" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.version="0.1.14-SNAPSHOT" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="3" platform="JavaScript " allPlatforms="JS []" useProjectSettings="false" pureKotlinSourceFolders="$MODULE_DIR$/src/test/kotlin;/home/rnentjes/Development/komp/komp/src/main/kotlin">
|
||||
<configuration version="3" platform="JavaScript " allPlatforms="JS []" useProjectSettings="false">
|
||||
<testOutputPath>$MODULE_DIR$/build/classes/kotlin/test/komp_test.js</testOutputPath>
|
||||
<compilerSettings />
|
||||
<compilerArguments>
|
||||
|
||||
22
komp.ipr
22
komp.ipr
@@ -211,6 +211,28 @@
|
||||
<property name="MemberChooser.copyJavadoc" value="false" />
|
||||
<property name="nodejs_interpreter_path" value="/usr/bin/node" />
|
||||
</component>
|
||||
<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>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration default="true" type="Applet" factoryName="Applet">
|
||||
<option name="WIDTH" value="400" />
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.w3c.dom.Document
|
||||
import org.w3c.dom.HTMLElement
|
||||
import org.w3c.dom.Node
|
||||
import org.w3c.dom.asList
|
||||
import org.w3c.dom.css.get
|
||||
import org.w3c.dom.events.Event
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@@ -71,7 +72,7 @@ class HtmlBuilder(
|
||||
|
||||
tag.attributesEntries.forEach {
|
||||
if (it.key == "class") {
|
||||
val classes = it.value.split(" ")
|
||||
val classes = it.value.split(Regex("\\s+"))
|
||||
val classNames = StringBuilder()
|
||||
|
||||
for (cls in classes) {
|
||||
@@ -80,6 +81,9 @@ class HtmlBuilder(
|
||||
if (cssStyle != null) {
|
||||
for (index in 0 until cssStyle.length) {
|
||||
val propertyName = cssStyle.item(index)
|
||||
if (Komponent.logRenderEvent) {
|
||||
console.log("Apply style [$cls] => $propertyName: ${cssStyle.getPropertyValue(propertyName)}")
|
||||
}
|
||||
element.style.setProperty(propertyName, cssStyle.getPropertyValue(propertyName))
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -36,7 +36,7 @@ abstract class Komponent {
|
||||
|
||||
abstract fun HtmlBuilder.render()
|
||||
|
||||
open fun style(className: String, vararg imports: CssStyle, block: CSSStyleDeclaration.() -> Unit = {}) {
|
||||
open fun style(className: String, vararg imports: CssStyle, block: CssStyle = {}) {
|
||||
val style = (document.createElement("div") as HTMLDivElement).style
|
||||
for (imp in imports) {
|
||||
imp(style)
|
||||
|
||||
Reference in New Issue
Block a user