diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b24f56b..5a337073 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed ### Fixed +- Wrong script reference for static file generation ### Security diff --git a/build.gradle.kts b/build.gradle.kts index 9349600f..2c439c7f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ val plotlyVersion by extra("2.29.0") allprojects { group = "space.kscience" - version = "0.7.1" + version = "0.7.1.1" } apiValidation { diff --git a/examples/compose-demo/build.gradle.kts b/examples/compose-demo/build.gradle.kts index d1d6f55a..5344b79e 100644 --- a/examples/compose-demo/build.gradle.kts +++ b/examples/compose-demo/build.gradle.kts @@ -11,11 +11,11 @@ repositories { maven("https://jogamp.org/deployment/maven") } -kotlin{ +kotlin { jvm() jvmToolchain(17) - sourceSets{ - jvmMain{ + sourceSets { + jvmMain { dependencies { implementation(compose.runtime) implementation(compose.foundation) diff --git a/examples/notebooks/plotlykt-server-demo.ipynb b/examples/notebooks/plotlykt-server-demo.ipynb index 2798393f..190e35a6 100644 --- a/examples/notebooks/plotlykt-server-demo.ipynb +++ b/examples/notebooks/plotlykt-server-demo.ipynb @@ -2,35 +2,30 @@ "cells": [ { "cell_type": "code", - "execution_count": null, - "outputs": [], "source": [ "import space.kscience.plotly.server.PlotlyServerIntegration\n", "import space.kscience.plotly.server.jupyter\n", "\n", - "val integration = PlotlyServerIntegration()\n", - "integration.getDefinitions(notebook).forEach {\n", - " USE(it)\n", - "}" + "USE(PlotlyServerIntegration())" ], "metadata": { "collapsed": false - } + }, + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "import kotlin.math.*" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "val x1 = (0..100).map { it.toDouble() / 100.0 }\n", "val y1 = x1.map { sin(2.0 * PI * it) }\n", @@ -67,13 +62,13 @@ " }\n", "}\n", "fragment" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "Plotly.plot {\n", " traces(trace1, trace2)\n", @@ -83,13 +78,13 @@ " yaxis.title = \"y axis name\"\n", " }\n", "}" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "val x = (0..100).map { it.toDouble() / 100.0 }\n", "val y = x.map { sin(2.0 * PI * it) }\n", @@ -107,13 +102,13 @@ "}\n", "\n", "dynamicPlot" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "import kotlinx.coroutines.*\n", "\n", @@ -126,52 +121,54 @@ " trace.y.set(dynamicY)\n", " }\n", "}" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "job.cancel()" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "dynamicPlot.layout.xaxis.title = \"крокозябра\"" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "Plotly.jupyter.port = 8884" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, "metadata": {}, - "outputs": [], "source": [ "Plotly.jupyter.port" - ] + ], + "outputs": [], + "execution_count": null }, { "cell_type": "code", - "execution_count": null, - "outputs": [], "source": [], "metadata": { "collapsed": false - } + }, + "outputs": [], + "execution_count": null } ], "metadata": { diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt index 8fcd5234..fffde72e 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt @@ -12,21 +12,6 @@ import kotlin.time.toDuration //extensions for DataForge -private fun MutableMeta.getIndexedProviders(name: Name): Map { - val parent = get(name.cutLast()) ?: return emptyMap() - return parent.items.keys.filter { - it.body == name.lastOrNull()?.body - }.map { - it.index - }.associate { index -> - if (index == null) { - "" to getOrCreate(name) - } else { - index to getOrCreate(name.withIndex(index)) - } - } -} - /** * List of values delegate */ @@ -201,35 +186,6 @@ internal fun Scheme.duration( } } -///** -// * Infer type of value and set -// */ -//public operator fun MutableMeta.set(name: String, value: Any?) { -// when (value) { -// null -> this[name] = null -// is Meta -> this[name] = value -// is Value -> set(Name.parse(name), value) -// is String -> this[name] = value.asValue() -// is Number -> this[name] = value.asValue() -// is Boolean -> this[name] = value.asValue() -// is Iterable<*> -> { -// if (value.all { it is Meta }) { -// this.setIndexed(Name.parse(name), value.map { it as Meta }) -// } else { -// this[name] = value.map { Value.of(it) }.asValue() -// } -// } -// } -//} - -///** -// * A patch to cover API no longer existing in DataForge -// */ -//@Deprecated("Use specialized meta methods instead") -//public operator fun Scheme.set(name: String, value: Any?) { -// meta[name] = value -//} - /** * Append the observable note to same-name-siblings and observe its changes. */ diff --git a/plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/plotlyHeaders.kt b/plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/plotlyHeaders.kt index 73abd52f..0bedfde8 100644 --- a/plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/plotlyHeaders.kt +++ b/plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/plotlyHeaders.kt @@ -8,7 +8,7 @@ import java.nio.file.Path import java.nio.file.StandardOpenOption -internal const val PLOTLY_SCRIPT_PATH = "/js/plotly.min.js" +internal const val PLOTLY_SCRIPT_PATH = "/js/plotly-kt.js" //const val PLOTLY_PROMISE_NAME = "promiseOfPlotly" /** * Check if the asset exists in given local location and put it there if it does not diff --git a/plotlykt-jupyter/src/jvmMain/kotlin/space/kscience/plotly/PlotlyIntegration.kt b/plotlykt-jupyter/src/jvmMain/kotlin/space/kscience/plotly/PlotlyIntegration.kt index b6737978..dc0d197b 100644 --- a/plotlykt-jupyter/src/jvmMain/kotlin/space/kscience/plotly/PlotlyIntegration.kt +++ b/plotlykt-jupyter/src/jvmMain/kotlin/space/kscience/plotly/PlotlyIntegration.kt @@ -82,6 +82,7 @@ public class PlotlyIntegration : JupyterIntegration(), PlotlyRenderer { resources { js("plotly-kt") { + url("https://cdn.plot.ly/plotly-2.29.1.min.js") classPath("js/plotly-kt.js") } }