This commit is contained in:
Alexander Nozik 2020-10-06 17:33:13 +03:00
parent 6116523091
commit c3001cd858
9 changed files with 15 additions and 19 deletions

View File

@ -20,11 +20,6 @@ kotlin {
withJava() withJava()
} }
} }
js {
useCommonJs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {

View File

@ -31,7 +31,7 @@ import react.dom.h1
import styled.css import styled.css
import kotlin.math.PI import kotlin.math.PI
interface GDMLAppProps : RProps { external interface GDMLAppProps : RProps {
var context: Context var context: Context
var rootObject: Vision? var rootObject: Vision?
var selected: Name? var selected: Name?

View File

@ -31,10 +31,6 @@ kotlin {
} }
} }
js {
useCommonJs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {

View File

@ -25,7 +25,7 @@ import react.RProps
import react.dom.* import react.dom.*
import kotlin.math.PI import kotlin.math.PI
interface MMAppProps : RProps { external interface MMAppProps : RProps {
var model: Model var model: Model
var context: Context var context: Context
var connection: HttpClient var connection: HttpClient
@ -40,6 +40,7 @@ private val canvasConfig = Canvas3DOptions {
} }
} }
@JsExport
val MMApp = component<MMAppProps> { props -> val MMApp = component<MMAppProps> { props ->
var selected by state { props.selected } var selected by state { props.selected }
var canvas: ThreeCanvas? by state { null } var canvas: ThreeCanvas? by state { null }

View File

@ -14,7 +14,7 @@ import react.*
import react.dom.render import react.dom.render
import styled.* import styled.*
interface ConfigEditorItemProps : RProps { public external interface ConfigEditorItemProps : RProps {
/** /**
* Root config object - always non null * 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 id: Name
var root: Config var root: Config
var default: Meta? var default: Meta?

View File

@ -17,7 +17,7 @@ import react.*
import react.dom.a import react.dom.a
import styled.* import styled.*
interface MetaViewerProps : RProps { public external interface MetaViewerProps : RProps {
/** /**
* Root meta * Root meta
*/ */
@ -136,6 +136,7 @@ private fun RFBuilder.metaViewerItem(props: MetaViewerProps) {
} }
} }
@JsExport
val MetaViewer = component<MetaViewerProps> { props -> val MetaViewer = component<MetaViewerProps> { props ->
child(MetaViewerItem) { child(MetaViewerItem) {
attrs { attrs {

View File

@ -12,7 +12,7 @@ import org.w3c.dom.events.Event
import react.* import react.*
import styled.* import styled.*
interface ObjectTreeProps : RProps { public external interface ObjectTreeProps : RProps {
var name: Name var name: Name
var selected: Name? var selected: Name?
var obj: Vision var obj: Vision
@ -102,6 +102,7 @@ private fun RFBuilder.objectTree(props: ObjectTreeProps): Unit {
} }
} }
@JsExport
val ObjectTree: FunctionalComponent<ObjectTreeProps> = component { props -> val ObjectTree: FunctionalComponent<ObjectTreeProps> = component { props ->
objectTree(props) objectTree(props)
} }

View File

@ -19,16 +19,17 @@ import react.dom.option
import styled.styledInput import styled.styledInput
import styled.styledSelect import styled.styledSelect
interface ValueChooserProps : RProps { public external interface ValueChooserProps : RProps {
var item: MetaItem<*>? var item: MetaItem<*>?
var descriptor: ValueDescriptor? var descriptor: ValueDescriptor?
var valueChanged: ((Value?) -> Unit)? var valueChanged: ((Value?) -> Unit)?
} }
interface ValueChooserState : RState { public external interface ValueChooserState : RState {
var rawInput: Boolean? var rawInput: Boolean?
} }
@JsExport
class ValueChooserComponent(props: ValueChooserProps) : RComponent<ValueChooserProps, ValueChooserState>(props) { class ValueChooserComponent(props: ValueChooserProps) : RComponent<ValueChooserProps, ValueChooserState>(props) {
private val element = createRef<HTMLElement>() private val element = createRef<HTMLElement>()

View File

@ -13,7 +13,7 @@ import react.RState
import react.dom.div import react.dom.div
import react.dom.findDOMNode import react.dom.findDOMNode
interface ThreeCanvasProps : RProps { public external interface ThreeCanvasProps : RProps {
var context: Context var context: Context
var obj: Solid var obj: Solid
var options: Canvas3DOptions? var options: Canvas3DOptions?
@ -22,11 +22,12 @@ interface ThreeCanvasProps : RProps {
var canvasCallback: ((ThreeCanvas?) -> Unit)? var canvasCallback: ((ThreeCanvas?) -> Unit)?
} }
interface ThreeCanvasState : RState { public external interface ThreeCanvasState : RState {
var element: Element? var element: Element?
// var canvas: ThreeCanvas? // var canvas: ThreeCanvas?
} }
@JsExport
class ThreeCanvasComponent : RComponent<ThreeCanvasProps, ThreeCanvasState>() { class ThreeCanvasComponent : RComponent<ThreeCanvasProps, ThreeCanvasState>() {
private var canvas: ThreeCanvas? = null private var canvas: ThreeCanvas? = null