From c3001cd85897018cd2466ff3d0126de27998225a Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 6 Oct 2020 17:33:13 +0300 Subject: [PATCH] Fix for https://youtrack.jetbrains.com/issue/KT-42427 --- demo/gdml/build.gradle.kts | 5 ----- .../hep/dataforge/vision/gdml/demo/GDMLAppComponent.kt | 2 +- demo/muon-monitor/build.gradle.kts | 4 ---- .../jsMain/kotlin/ru/mipt/npm/muon/monitor/MMAppComponent.kt | 3 ++- .../main/kotlin/hep/dataforge/vision/react/ConfigEditor.kt | 4 ++-- .../src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt | 3 ++- .../src/main/kotlin/hep/dataforge/vision/react/ObjectTree.kt | 3 ++- .../main/kotlin/hep/dataforge/vision/react/valueChooser.kt | 5 +++-- .../hep/dataforge/vision/solid/three/ThreeCanvasComponent.kt | 5 +++-- 9 files changed, 15 insertions(+), 19 deletions(-) diff --git a/demo/gdml/build.gradle.kts b/demo/gdml/build.gradle.kts index b0a00e61..1824345c 100644 --- a/demo/gdml/build.gradle.kts +++ b/demo/gdml/build.gradle.kts @@ -20,11 +20,6 @@ kotlin { withJava() } } - - js { - useCommonJs() - } - sourceSets { commonMain { dependencies { diff --git a/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLAppComponent.kt b/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLAppComponent.kt index 2392e042..4b9a4e0d 100644 --- a/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLAppComponent.kt +++ b/demo/gdml/src/jsMain/kotlin/hep/dataforge/vision/gdml/demo/GDMLAppComponent.kt @@ -31,7 +31,7 @@ import react.dom.h1 import styled.css import kotlin.math.PI -interface GDMLAppProps : RProps { +external interface GDMLAppProps : RProps { var context: Context var rootObject: Vision? var selected: Name? diff --git a/demo/muon-monitor/build.gradle.kts b/demo/muon-monitor/build.gradle.kts index f4ba471d..3e0cb8d9 100644 --- a/demo/muon-monitor/build.gradle.kts +++ b/demo/muon-monitor/build.gradle.kts @@ -31,10 +31,6 @@ kotlin { } } - js { - useCommonJs() - } - sourceSets { commonMain { dependencies { diff --git a/demo/muon-monitor/src/jsMain/kotlin/ru/mipt/npm/muon/monitor/MMAppComponent.kt b/demo/muon-monitor/src/jsMain/kotlin/ru/mipt/npm/muon/monitor/MMAppComponent.kt index 61deb655..a4540ebd 100644 --- a/demo/muon-monitor/src/jsMain/kotlin/ru/mipt/npm/muon/monitor/MMAppComponent.kt +++ b/demo/muon-monitor/src/jsMain/kotlin/ru/mipt/npm/muon/monitor/MMAppComponent.kt @@ -25,7 +25,7 @@ import react.RProps import react.dom.* import kotlin.math.PI -interface MMAppProps : RProps { +external interface MMAppProps : RProps { var model: Model var context: Context var connection: HttpClient @@ -40,6 +40,7 @@ private val canvasConfig = Canvas3DOptions { } } +@JsExport val MMApp = component { props -> var selected by state { props.selected } var canvas: ThreeCanvas? by state { null } diff --git a/ui/react/src/main/kotlin/hep/dataforge/vision/react/ConfigEditor.kt b/ui/react/src/main/kotlin/hep/dataforge/vision/react/ConfigEditor.kt index b7c4407e..6669f491 100644 --- a/ui/react/src/main/kotlin/hep/dataforge/vision/react/ConfigEditor.kt +++ b/ui/react/src/main/kotlin/hep/dataforge/vision/react/ConfigEditor.kt @@ -14,7 +14,7 @@ import react.* import react.dom.render import styled.* -interface ConfigEditorItemProps : RProps { +public external interface ConfigEditorItemProps : RProps { /** * Root config object - always non null @@ -190,7 +190,7 @@ private fun RFBuilder.configEditorItem(props: ConfigEditorItemProps) { } } -interface ConfigEditorProps : RProps { +public external interface ConfigEditorProps : RProps { var id: Name var root: Config var default: Meta? diff --git a/ui/react/src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt b/ui/react/src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt index 5f98e40f..48e49a19 100644 --- a/ui/react/src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt +++ b/ui/react/src/main/kotlin/hep/dataforge/vision/react/MetaViewer.kt @@ -17,7 +17,7 @@ import react.* import react.dom.a import styled.* -interface MetaViewerProps : RProps { +public external interface MetaViewerProps : RProps { /** * Root meta */ @@ -136,6 +136,7 @@ private fun RFBuilder.metaViewerItem(props: MetaViewerProps) { } } +@JsExport val MetaViewer = component { props -> child(MetaViewerItem) { attrs { diff --git a/ui/react/src/main/kotlin/hep/dataforge/vision/react/ObjectTree.kt b/ui/react/src/main/kotlin/hep/dataforge/vision/react/ObjectTree.kt index ece2a32b..91760b4a 100644 --- a/ui/react/src/main/kotlin/hep/dataforge/vision/react/ObjectTree.kt +++ b/ui/react/src/main/kotlin/hep/dataforge/vision/react/ObjectTree.kt @@ -12,7 +12,7 @@ import org.w3c.dom.events.Event import react.* import styled.* -interface ObjectTreeProps : RProps { +public external interface ObjectTreeProps : RProps { var name: Name var selected: Name? var obj: Vision @@ -102,6 +102,7 @@ private fun RFBuilder.objectTree(props: ObjectTreeProps): Unit { } } +@JsExport val ObjectTree: FunctionalComponent = component { props -> objectTree(props) } diff --git a/ui/react/src/main/kotlin/hep/dataforge/vision/react/valueChooser.kt b/ui/react/src/main/kotlin/hep/dataforge/vision/react/valueChooser.kt index cf51b5aa..e0888a46 100644 --- a/ui/react/src/main/kotlin/hep/dataforge/vision/react/valueChooser.kt +++ b/ui/react/src/main/kotlin/hep/dataforge/vision/react/valueChooser.kt @@ -19,16 +19,17 @@ import react.dom.option import styled.styledInput import styled.styledSelect -interface ValueChooserProps : RProps { +public external interface ValueChooserProps : RProps { var item: MetaItem<*>? var descriptor: ValueDescriptor? var valueChanged: ((Value?) -> Unit)? } -interface ValueChooserState : RState { +public external interface ValueChooserState : RState { var rawInput: Boolean? } +@JsExport class ValueChooserComponent(props: ValueChooserProps) : RComponent(props) { private val element = createRef() diff --git a/visionforge-solid/src/jsMain/kotlin/hep/dataforge/vision/solid/three/ThreeCanvasComponent.kt b/visionforge-solid/src/jsMain/kotlin/hep/dataforge/vision/solid/three/ThreeCanvasComponent.kt index eb9ed292..fbc90a62 100644 --- a/visionforge-solid/src/jsMain/kotlin/hep/dataforge/vision/solid/three/ThreeCanvasComponent.kt +++ b/visionforge-solid/src/jsMain/kotlin/hep/dataforge/vision/solid/three/ThreeCanvasComponent.kt @@ -13,7 +13,7 @@ import react.RState import react.dom.div import react.dom.findDOMNode -interface ThreeCanvasProps : RProps { +public external interface ThreeCanvasProps : RProps { var context: Context var obj: Solid var options: Canvas3DOptions? @@ -22,11 +22,12 @@ interface ThreeCanvasProps : RProps { var canvasCallback: ((ThreeCanvas?) -> Unit)? } -interface ThreeCanvasState : RState { +public external interface ThreeCanvasState : RState { var element: Element? // var canvas: ThreeCanvas? } +@JsExport class ThreeCanvasComponent : RComponent() { private var canvas: ThreeCanvas? = null