wip Kotlin 2.0

This commit is contained in:
Alexander Nozik 2024-01-31 16:45:43 +03:00
parent 6ce1e68b86
commit c499c3fc47
8 changed files with 31 additions and 19 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ out/
.gradle .gradle
build/ build/
data/ data/
.kotlin/
!gradle-wrapper.jar !gradle-wrapper.jar

View File

@ -8,6 +8,6 @@ org.gradle.jvmargs=-Xmx4G
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
toolsVersion=0.15.2-kotlin-2.0.0-Beta2 toolsVersion=0.15.2-kotlin-2.0.0-Beta3
#kotlin.experimental.tryK2=true #kotlin.experimental.tryK2=true
#kscience.wasm.disabled=true #kscience.wasm.disabled=true

View File

@ -373,7 +373,7 @@ private class GdmlLoader(val settings: GdmlLoaderOptions) {
rootSolid.prototypes { rootSolid.prototypes {
templates.items.forEach { (token, item) -> templates.items.forEach { (token, item) ->
item.parent = null item.parent = null
setChild(token.asName(), item as? Solid) setChild(token.asName(), item)
} }
} }
settings.styleCache.forEach { settings.styleCache.forEach {

View File

@ -19,8 +19,8 @@ import space.kscience.visionforge.markup.VisionOfMarkup.Companion.GFM_FORMAT
public actual class MarkupPlugin : VisionPlugin(), ElementVisionRenderer { public actual class MarkupPlugin : VisionPlugin(), ElementVisionRenderer {
public val visionClient: JsVisionClient by require(JsVisionClient) public val visionClient: JsVisionClient by require(JsVisionClient)
override val tag: PluginTag get() = Companion.tag actual override val tag: PluginTag get() = Companion.tag
override val visionSerializersModule: SerializersModule get() = markupSerializersModule actual override val visionSerializersModule: SerializersModule get() = markupSerializersModule
override fun rateVision(vision: Vision): Int = when (vision) { override fun rateVision(vision: Vision): Int = when (vision) {
is VisionOfMarkup -> ElementVisionRenderer.DEFAULT_RATING is VisionOfMarkup -> ElementVisionRenderer.DEFAULT_RATING
@ -51,9 +51,9 @@ public actual class MarkupPlugin : VisionPlugin(), ElementVisionRenderer {
} }
public actual companion object : PluginFactory<MarkupPlugin> { public actual companion object : PluginFactory<MarkupPlugin> {
override val tag: PluginTag = PluginTag("vision.markup.js", PluginTag.DATAFORGE_GROUP) actual override val tag: PluginTag = PluginTag("vision.markup.js", PluginTag.DATAFORGE_GROUP)
override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin() actual override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin()
} }
} }

View File

@ -9,14 +9,14 @@ import space.kscience.dataforge.meta.Meta
import space.kscience.visionforge.VisionPlugin import space.kscience.visionforge.VisionPlugin
public actual class MarkupPlugin : VisionPlugin() { public actual class MarkupPlugin : VisionPlugin() {
override val visionSerializersModule: SerializersModule get() = markupSerializersModule actual override val visionSerializersModule: SerializersModule get() = markupSerializersModule
override val tag: PluginTag get() = Companion.tag actual override val tag: PluginTag get() = Companion.tag
public actual companion object : PluginFactory<MarkupPlugin> { public actual companion object : PluginFactory<MarkupPlugin> {
override val tag: PluginTag = PluginTag("vision.markup.jvm", PluginTag.DATAFORGE_GROUP) actual override val tag: PluginTag = PluginTag("vision.markup.jvm", PluginTag.DATAFORGE_GROUP)
override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin() actual override fun build(context: Context, meta: Meta): MarkupPlugin = MarkupPlugin()
} }
} }

View File

@ -3,12 +3,23 @@ package space.kscience.visionforge.plotly
import kotlinx.serialization.modules.SerializersModule import kotlinx.serialization.modules.SerializersModule
import kotlinx.serialization.modules.polymorphic import kotlinx.serialization.modules.polymorphic
import kotlinx.serialization.modules.subclass import kotlinx.serialization.modules.subclass
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.PluginFactory import space.kscience.dataforge.context.PluginFactory
import space.kscience.dataforge.context.PluginTag
import space.kscience.dataforge.meta.Meta
import space.kscience.visionforge.Vision import space.kscience.visionforge.Vision
import space.kscience.visionforge.VisionPlugin import space.kscience.visionforge.VisionPlugin
public expect class PlotlyPlugin : VisionPlugin { public expect class PlotlyPlugin : VisionPlugin {
public companion object : PluginFactory<PlotlyPlugin>
override val tag: PluginTag
override val visionSerializersModule: SerializersModule
public companion object : PluginFactory<PlotlyPlugin>{
override fun build(context: Context, meta: Meta): PlotlyPlugin
override val tag: PluginTag
}
} }
internal val plotlySerializersModule = SerializersModule { internal val plotlySerializersModule = SerializersModule {

View File

@ -18,9 +18,9 @@ import space.kscience.visionforge.VisionPlugin
public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer { public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer {
public val visionClient: JsVisionClient by require(JsVisionClient) public val visionClient: JsVisionClient by require(JsVisionClient)
override val tag: PluginTag get() = Companion.tag actual override val tag: PluginTag get() = Companion.tag
override val visionSerializersModule: SerializersModule get() = plotlySerializersModule actual override val visionSerializersModule: SerializersModule get() = plotlySerializersModule
override fun rateVision(vision: Vision): Int = when (vision) { override fun rateVision(vision: Vision): Int = when (vision) {
is VisionOfPlotly -> ElementVisionRenderer.DEFAULT_RATING is VisionOfPlotly -> ElementVisionRenderer.DEFAULT_RATING
@ -39,9 +39,9 @@ public actual class PlotlyPlugin : VisionPlugin(), ElementVisionRenderer {
} }
public actual companion object : PluginFactory<PlotlyPlugin> { public actual companion object : PluginFactory<PlotlyPlugin> {
override val tag: PluginTag = PluginTag("vision.plotly.js", PluginTag.DATAFORGE_GROUP) actual override val tag: PluginTag = PluginTag("vision.plotly.js", PluginTag.DATAFORGE_GROUP)
override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin() actual override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin()
} }
} }

View File

@ -9,14 +9,14 @@ import space.kscience.visionforge.VisionPlugin
public actual class PlotlyPlugin : VisionPlugin() { public actual class PlotlyPlugin : VisionPlugin() {
override val tag: PluginTag get() = Companion.tag actual override val tag: PluginTag get() = Companion.tag
override val visionSerializersModule: SerializersModule get() = plotlySerializersModule actual override val visionSerializersModule: SerializersModule get() = plotlySerializersModule
public actual companion object : PluginFactory<PlotlyPlugin> { public actual companion object : PluginFactory<PlotlyPlugin> {
override val tag: PluginTag = PluginTag("vision.plotly", PluginTag.DATAFORGE_GROUP) actual override val tag: PluginTag = PluginTag("vision.plotly", PluginTag.DATAFORGE_GROUP)
override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin() actual override fun build(context: Context, meta: Meta): PlotlyPlugin = PlotlyPlugin()
} }
} }