Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7.0 #104

Merged
merged 3 commits into from
Feb 6, 2024
Merged

0.7.0 #104

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ val plotlyVersion by extra("2.29.0")

allprojects {
group = "space.kscience"
version = "0.7.0-dev-1"
version = "0.7.0"
}

apiValidation {
ignoredProjects.addAll(listOf("examples", "fx-demo", "js-demo"))
ignoredProjects.addAll(listOf("examples", "fx-demo", "js-demo", "compose-demo"))
}

ksciencePublish{
Expand Down
4 changes: 2 additions & 2 deletions examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
val copyPlotlyResources by tasks.creating(Copy::class){
dependsOn(":plotlykt-core:jvmProcessResources")
mustRunAfter(":plotlykt-core:jvmTestProcessResources")
from(project(":plotlykt-core").buildDir.resolve("processedResources/jvm"))
into(buildDir.resolve("resources"))
from(project(":plotlykt-core").layout.buildDirectory.file("processedResources/jvm"))
into(layout.buildDirectory.file("resources"))
}

tasks.getByName("classes").dependsOn(copyPlotlyResources)
Expand Down
2 changes: 1 addition & 1 deletion examples/compose-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("multiplatform")
id("org.jetbrains.compose") version "1.5.12"
alias(spclibs.plugins.compose)
}

repositories {
Expand Down
17 changes: 10 additions & 7 deletions examples/js-demo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("js")
kotlin("multiplatform")
}

repositories {
Expand All @@ -12,13 +12,16 @@ kotlin {
browser()
binaries.executable()
}
}

dependencies {
implementation(projects.plotlyktCore)
implementation(spclibs.kotlinx.coroutines.core)
sourceSets{
jsMain{
dependencies{
implementation(projects.plotlyktCore)
implementation(spclibs.kotlinx.coroutines.core)
}
}
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.freeCompilerArgs = kotlinOptions.freeCompilerArgs +"-Xopt-in=kotlin.RequiresOptIn"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
63 changes: 59 additions & 4 deletions examples/src/main/kotlin/tabPageLayout.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import kotlinx.html.*
import space.kscience.plotly.*
import space.kscience.plotly.models.Trace
import space.kscience.plotly.models.invoke
Expand All @@ -6,6 +7,60 @@ import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.sin


public class PlotTabs {
public data class Tab(val title: String, val id: String, val content: PlotlyFragment)

private val _tabs = ArrayList<Tab>()
public val tabs: List<Tab> get() = _tabs

public fun tab(title: String, id: String = title, block: FlowContent.(renderer: PlotlyRenderer) -> Unit) {
_tabs.add(Tab(title, id, PlotlyFragment(block)))
}
}

public fun Plotly.tabs(tabsID: String = "tabs", block: PlotTabs.() -> Unit): PlotlyPage {
val grid = PlotTabs().apply(block)

return page(cdnBootstrap, cdnPlotlyHeader) { container ->
ul("nav nav-tabs") {
role = "tablist"
id = tabsID
grid.tabs.forEachIndexed { index, tab ->
li("nav-item") {
a(classes = "nav-link") {
if (index == 0) {
classes = classes + "active"
}
id = "${tab.id}-tab"
attributes["data-toggle"] = "tab"
href = "#${tab.id}"
role = "tab"
attributes["aria-controls"] = tab.id
attributes["aria-selected"] = "true"
+tab.title
}
}
}
}
div("tab-content") {
id = "$tabsID-content"
grid.tabs.forEachIndexed { index, tab ->
div("tab-pane fade") {
if (index == 0) {
classes = classes + setOf("show", "active")
}
id = tab.id
role = "tabpanel"
attributes["aria-labelledby"] = "${tab.id}-tab"
tab.content.render(this, container)
}
}
}
}
}


@Suppress("DEPRECATION")
@UnstablePlotlyAPI
fun main() {
Expand All @@ -26,14 +81,14 @@ fun main() {

}

val responsive = PlotlyConfig{
val responsive = PlotlyConfig {
responsive = true
}

val plot = Plotly.tabs {

tab("First"){
plot (config = responsive){
tab("First") {
plot(config = responsive) {
traces(trace1)
layout {
title = "First graph"
Expand All @@ -42,7 +97,7 @@ fun main() {
}
}
}
tab("Second"){
tab("Second") {
plot(config = responsive) {
traces(trace2)
layout {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ kotlin.mpp.stability.nowarn=true
kotlin.jupyter.add.scanner=false
kotlin.incremental.js.ir=true

toolsVersion=0.15.2-kotlin-1.9.21
toolsVersion=0.15.2-kotlin-1.9.22
61 changes: 0 additions & 61 deletions plotlykt-core/api/plotlykt-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -79,74 +79,13 @@ public final class space/kscience/plotly/PlotExtensionsKt {
public static final fun violin (Lspace/kscience/plotly/Plot;Lkotlin/jvm/functions/Function1;)Lspace/kscience/plotly/models/Violin;
}

public final class space/kscience/plotly/PlotGrid {
public fun <init> ()V
public final fun get (Ljava/lang/String;)Lspace/kscience/plotly/PlotGrid$PlotCell;
public final fun getGrid ()Ljava/util/List;
public final fun plot (Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;ILkotlin/jvm/functions/Function1;)Lspace/kscience/plotly/Plot;
public final fun plot (Lspace/kscience/plotly/Plot;Ljava/lang/String;ILjava/lang/Integer;Ljava/lang/Integer;)Lspace/kscience/plotly/Plot;
public static synthetic fun plot$default (Lspace/kscience/plotly/PlotGrid;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/plotly/Plot;
public static synthetic fun plot$default (Lspace/kscience/plotly/PlotGrid;Lspace/kscience/plotly/Plot;Ljava/lang/String;ILjava/lang/Integer;Ljava/lang/Integer;ILjava/lang/Object;)Lspace/kscience/plotly/Plot;
}

public final class space/kscience/plotly/PlotGrid$PlotCell {
public fun <init> (Ljava/lang/String;Lspace/kscience/plotly/Plot;III)V
public synthetic fun <init> (Ljava/lang/String;Lspace/kscience/plotly/Plot;IIIILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Lspace/kscience/plotly/Plot;
public final fun component3 ()I
public final fun component4 ()I
public final fun component5 ()I
public final fun copy (Ljava/lang/String;Lspace/kscience/plotly/Plot;III)Lspace/kscience/plotly/PlotGrid$PlotCell;
public static synthetic fun copy$default (Lspace/kscience/plotly/PlotGrid$PlotCell;Ljava/lang/String;Lspace/kscience/plotly/Plot;IIIILjava/lang/Object;)Lspace/kscience/plotly/PlotGrid$PlotCell;
public fun equals (Ljava/lang/Object;)Z
public final fun getCol ()I
public final fun getId ()Ljava/lang/String;
public final fun getPlot ()Lspace/kscience/plotly/Plot;
public final fun getRow ()I
public final fun getWidth ()I
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class space/kscience/plotly/PlotGridKt {
public static final fun grid (Lspace/kscience/plotly/Plotly;Lkotlin/jvm/functions/Function1;)Lspace/kscience/plotly/PlotlyPage;
}

public final class space/kscience/plotly/PlotKt {
public static final fun Plot (Lspace/kscience/dataforge/meta/Meta;)Lspace/kscience/plotly/Plot;
public static final fun layout (Lspace/kscience/plotly/Plot;Lkotlin/jvm/functions/Function1;)V
public static final fun toJsonString (Lspace/kscience/plotly/Plot;)Ljava/lang/String;
public static final fun trace (Lspace/kscience/plotly/Plot;Lkotlin/jvm/functions/Function1;)Lspace/kscience/plotly/models/Trace;
}

public final class space/kscience/plotly/PlotTabs {
public fun <init> ()V
public final fun getTabs ()Ljava/util/List;
public final fun tab (Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function2;)V
public static synthetic fun tab$default (Lspace/kscience/plotly/PlotTabs;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)V
}

public final class space/kscience/plotly/PlotTabs$Tab {
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lspace/kscience/plotly/PlotlyFragment;)V
public final fun component1 ()Ljava/lang/String;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Lspace/kscience/plotly/PlotlyFragment;
public final fun copy (Ljava/lang/String;Ljava/lang/String;Lspace/kscience/plotly/PlotlyFragment;)Lspace/kscience/plotly/PlotTabs$Tab;
public static synthetic fun copy$default (Lspace/kscience/plotly/PlotTabs$Tab;Ljava/lang/String;Ljava/lang/String;Lspace/kscience/plotly/PlotlyFragment;ILjava/lang/Object;)Lspace/kscience/plotly/PlotTabs$Tab;
public fun equals (Ljava/lang/Object;)Z
public final fun getContent ()Lspace/kscience/plotly/PlotlyFragment;
public final fun getId ()Ljava/lang/String;
public final fun getTitle ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class space/kscience/plotly/PlotTabsKt {
public static final fun tabs (Lspace/kscience/plotly/Plotly;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lspace/kscience/plotly/PlotlyPage;
public static synthetic fun tabs$default (Lspace/kscience/plotly/Plotly;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lspace/kscience/plotly/PlotlyPage;
}

public final class space/kscience/plotly/Plotly {
public static final field INSTANCE Lspace/kscience/plotly/Plotly;
public static final field PLOTLY_CDN Ljava/lang/String;
Expand Down
4 changes: 2 additions & 2 deletions plotlykt-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ kscience {

dependencies {
api("space.kscience:dataforge-meta:$dataforgeVersion")
//api(spclibs.kotlinx.html)
api("org.jetbrains.kotlinx:kotlinx-html:0.11.0")
api(spclibs.kotlinx.html)
// api("org.jetbrains.kotlinx:kotlinx-html:0.11.0")
}

jsMain{
Expand Down
59 changes: 0 additions & 59 deletions plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/PlotTabs.kt

This file was deleted.

9 changes: 6 additions & 3 deletions plotlykt-jupyter/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
plugins {
id("space.kscience.gradle.jvm")
id("space.kscience.gradle.mpp")
kotlin("jupyter.api")
`maven-publish`
}

val dataforgeVersion: String by rootProject.extra

dependencies {
api(projects.plotlyktCore)
kscience{
jvm()
jvmMain{
api(projects.plotlyktCore)
}
}

tasks.processJupyterApiResources{
Expand Down
28 changes: 15 additions & 13 deletions plotlykt-script/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
plugins {
id("space.kscience.gradle.jvm")
id("space.kscience.gradle.mpp")
application
`maven-publish`
}

repositories {
maven("https://dl.bintray.com/kotlin/ktor/")
}

val ktorVersion: String by rootProject.extra
val dataforgeVersion: String by rootProject.extra

dependencies {
api(projects.plotlyktCore)
api(spclibs.kotlinx.html)
api(kotlin("scripting-jvm-host"))
api(kotlin("scripting-jvm"))
api("io.github.microutils:kotlin-logging:3.0.5")
implementation(spclibs.logback.classic)
implementation(spclibs.kotlinx.cli)
kscience{
jvm{
withJava()
}
jvmMain{
api(projects.plotlyktCore)
api(spclibs.kotlinx.html)
api(kotlin("scripting-jvm-host"))
api(kotlin("scripting-jvm"))
api("io.github.microutils:kotlin-logging:3.0.5")
implementation(spclibs.logback.classic)
implementation(spclibs.kotlinx.cli)
}
}


application{
mainClass.set("space.kscience.plotly.script.CliKt")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import kotlin.script.experimental.jvm.jvm
fileExtension = "plotly.kts",
compilationConfiguration = PlotlyScriptCompilationConfiguration::class
)
abstract class PlotlyScript
public abstract class PlotlyScript


class PlotlyScriptCompilationConfiguration: ScriptCompilationConfiguration({
public class PlotlyScriptCompilationConfiguration: ScriptCompilationConfiguration({
baseClass(PlotlyScript::class)
implicitReceivers(FlowContent::class)
defaultImports(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.io.File
import java.nio.file.Path

@OptIn(UnstablePlotlyAPI::class)
fun main(args: Array<String>) {
public fun main(args: Array<String>) {
val parser = ArgParser("plotlykt-script")
val input by parser.argument(ArgType.String, description ="Input file path")
val output by parser.argument(ArgType.String, description = "Output file path").optional()
Expand Down
Loading
Loading