From 7cf819d7ce57378f099cea943c6554fa801a09ae Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 29 Jun 2021 11:49:41 +0300 Subject: [PATCH] Move to external RingUI implementation. wrappers-bom --- build.gradle.kts | 17 +++--- demo/gdml/build.gradle.kts | 1 - demo/gdml/webpack.config.d/02.boostrap.js | 7 --- demo/solid-showcase/build.gradle.kts | 12 ++--- gradle.properties | 3 -- .../visionforge-gdml-jupyter/build.gradle.kts | 6 ++- settings.gradle.kts | 8 +-- ui/build.gradle.kts | 0 ui/react/build.gradle.kts | 6 +-- .../kscience/visionforge/react/MetaViewer.kt | 17 +++--- .../visionforge/react/PropertyEditor.kt | 6 ++- .../visionforge/react/ThreeCanvasComponent.kt | 8 +-- ui/ring/build.gradle.kts | 2 + ui/ring/src/main/kotlin/ringui/Alert.kt | 41 -------------- ui/ring/src/main/kotlin/ringui/Button.kt | 43 --------------- ui/ring/src/main/kotlin/ringui/Dialog.kt | 35 ------------ ui/ring/src/main/kotlin/ringui/Dropdown.kt | 46 ---------------- ui/ring/src/main/kotlin/ringui/Icon.kt | 28 ---------- ui/ring/src/main/kotlin/ringui/Link.kt | 31 ----------- ui/ring/src/main/kotlin/ringui/UserCard.kt | 38 ------------- ui/ring/src/main/kotlin/ringui/grid/Col.kt | 23 -------- ui/ring/src/main/kotlin/ringui/grid/Grid.kt | 20 ------- ui/ring/src/main/kotlin/ringui/grid/Row.kt | 33 ------------ .../src/main/kotlin/ringui/header/Header.kt | 33 ------------ ui/ring/src/main/kotlin/ringui/header/Logo.kt | 21 -------- ui/ring/src/main/kotlin/ringui/header/Tray.kt | 26 --------- .../src/main/kotlin/ringui/island/Content.kt | 20 ------- .../src/main/kotlin/ringui/island/Header.kt | 18 ------- .../src/main/kotlin/ringui/island/Island.kt | 45 ---------------- .../src/main/kotlin/ringui/tabs/SmartTabs.kt | 21 -------- ui/ring/src/main/kotlin/ringui/tabs/Tabs.kt | 51 ------------------ .../ThreeViewWithControls.kt | 6 +-- .../ringPropertyEditor.kt | 53 ++++++++----------- .../ringThreeControls.kt | 20 +++---- visionforge-core/build.gradle.kts | 5 +- visionforge-fx/build.gradle.kts | 2 - .../visionforge/solid/SolidReference.kt | 6 +-- visionforge-threejs/build.gradle.kts | 7 --- 38 files changed, 80 insertions(+), 685 deletions(-) delete mode 100644 demo/gdml/webpack.config.d/02.boostrap.js delete mode 100644 ui/build.gradle.kts delete mode 100644 ui/ring/src/main/kotlin/ringui/Alert.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/Button.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/Dialog.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/Dropdown.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/Icon.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/Link.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/UserCard.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/grid/Col.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/grid/Grid.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/grid/Row.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/header/Header.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/header/Logo.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/header/Tray.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/island/Content.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/island/Header.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/island/Island.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/tabs/SmartTabs.kt delete mode 100644 ui/ring/src/main/kotlin/ringui/tabs/Tabs.kt diff --git a/build.gradle.kts b/build.gradle.kts index 4170628c..b75039f7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,14 +1,14 @@ plugins { id("ru.mipt.npm.gradle.project") - kotlin("multiplatform") apply false - kotlin("jvm") apply false - kotlin("js") apply false - kotlin("jupyter.api") apply false - id("ru.mipt.npm.gradle.js") apply false + + //Override kotlin version +// val kotlinVersion = "1.5.20-RC" +// kotlin("multiplatform") version(kotlinVersion) apply false +// kotlin("jvm") version(kotlinVersion) apply false +// kotlin("js") version(kotlinVersion) apply false } -val dataforgeVersion by extra("0.4.2") -val kotlinWrappersVersion by extra("pre.206-kotlin-1.5.10") +val dataforgeVersion by extra("0.4.3") val fxVersion by extra("11") allprojects { @@ -17,10 +17,11 @@ allprojects { jcenter() maven("https://repo.kotlin.link") maven("https://maven.jzy3d.org/releases") + maven("https://maven.pkg.jetbrains.space/mipt-npm/p/mipt-npm/maven") } group = "space.kscience" - version = "0.2.0-dev-19" + version = "0.2.0-dev-20" } subprojects { diff --git a/demo/gdml/build.gradle.kts b/demo/gdml/build.gradle.kts index 31232cc8..391db4f9 100644 --- a/demo/gdml/build.gradle.kts +++ b/demo/gdml/build.gradle.kts @@ -38,7 +38,6 @@ kotlin { } jsMain { dependencies { - implementation(project(":ui:bootstrap")) implementation(project(":ui:ring")) implementation(project(":visionforge-threejs")) implementation(npm("react-file-drop", "3.0.6")) diff --git a/demo/gdml/webpack.config.d/02.boostrap.js b/demo/gdml/webpack.config.d/02.boostrap.js deleted file mode 100644 index e1d53b36..00000000 --- a/demo/gdml/webpack.config.d/02.boostrap.js +++ /dev/null @@ -1,7 +0,0 @@ -config.module.rules.push({ - test: /\.css$/, - include: [ - require.resolve('bootstrap/dist/css/bootstrap.min.css') - ], - use: ['style-loader', 'css-loader'] -}); \ No newline at end of file diff --git a/demo/solid-showcase/build.gradle.kts b/demo/solid-showcase/build.gradle.kts index a4b38e82..bc391b9d 100644 --- a/demo/solid-showcase/build.gradle.kts +++ b/demo/solid-showcase/build.gradle.kts @@ -13,14 +13,10 @@ kscience { application() } -val kotlinWrappersVersion: String by rootProject.extra - kotlin { jvm { - afterEvaluate { - withJava() - } + withJava() } sourceSets { @@ -30,12 +26,12 @@ kotlin { // implementation(project(":visionforge-gdml")) } } - jvmMain{ - dependencies{ + jvmMain { + dependencies { implementation(project(":visionforge-fx")) } } - jsMain{ + jsMain { dependencies { implementation(project(":visionforge-threejs")) } diff --git a/gradle.properties b/gradle.properties index d9bddc47..2ffacd8f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,7 @@ kotlin.code.style=official - kotlin.mpp.enableGranularSourceSetsMetadata=true kotlin.mpp.stability.nowarn=true - kotlin.native.enableDependencyPropagation=false -kotlin.parallel.tasks.in.project=true org.gradle.jvmargs=-XX:MaxMetaspaceSize=1G org.gradle.parallel=true \ No newline at end of file diff --git a/jupyter/visionforge-gdml-jupyter/build.gradle.kts b/jupyter/visionforge-gdml-jupyter/build.gradle.kts index 48391b5d..e2d1db03 100644 --- a/jupyter/visionforge-gdml-jupyter/build.gradle.kts +++ b/jupyter/visionforge-gdml-jupyter/build.gradle.kts @@ -1,6 +1,5 @@ plugins { id("ru.mipt.npm.gradle.mpp") - kotlin("jupyter.api") } description = "Jupyter api artifact for GDML rendering" @@ -41,7 +40,6 @@ kotlin{ jvmMain{ dependencies { implementation(project(":visionforge-gdml")) - implementation(kotlin("script-runtime")) } } jsMain { @@ -54,6 +52,10 @@ kotlin{ } } +kscience{ + useJupyter() +} + readme{ maturity = ru.mipt.npm.gradle.Maturity.EXPERIMENTAL } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 630dc8dc..bc62b31e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,6 @@ pluginManagement { - val kotlinVersion = "1.5.10" - val toolsVersion = "0.9.10" + + val toolsVersion = "0.10.0" repositories { maven("https://repo.kotlin.link") @@ -13,10 +13,6 @@ pluginManagement { id("ru.mipt.npm.gradle.mpp") version toolsVersion id("ru.mipt.npm.gradle.jvm") version toolsVersion id("ru.mipt.npm.gradle.js") version toolsVersion - kotlin("multiplatform") version kotlinVersion - kotlin("jvm") version kotlinVersion - kotlin("js") version kotlinVersion - kotlin("jupyter.api") version "0.9.1-20" } } diff --git a/ui/build.gradle.kts b/ui/build.gradle.kts deleted file mode 100644 index e69de29b..00000000 diff --git a/ui/react/build.gradle.kts b/ui/react/build.gradle.kts index 151b92fe..40853ca9 100644 --- a/ui/react/build.gradle.kts +++ b/ui/react/build.gradle.kts @@ -2,12 +2,10 @@ plugins { id("ru.mipt.npm.gradle.js") } -val kotlinWrappersVersion: String by rootProject.extra - dependencies{ api(project(":visionforge-solid")) - api("org.jetbrains.kotlin-wrappers:kotlin-styled:5.3.0-$kotlinWrappersVersion") - api("org.jetbrains.kotlin-wrappers:kotlin-react-dom:17.0.2-$kotlinWrappersVersion") + api("org.jetbrains.kotlin-wrappers:kotlin-styled") + api("org.jetbrains.kotlin-wrappers:kotlin-react-dom") // implementation(npm("react-select","4.3.0")) implementation(project(":visionforge-threejs")) } \ No newline at end of file diff --git a/ui/react/src/main/kotlin/space/kscience/visionforge/react/MetaViewer.kt b/ui/react/src/main/kotlin/space/kscience/visionforge/react/MetaViewer.kt index 2a786f20..b86f11fc 100644 --- a/ui/react/src/main/kotlin/space/kscience/visionforge/react/MetaViewer.kt +++ b/ui/react/src/main/kotlin/space/kscience/visionforge/react/MetaViewer.kt @@ -145,16 +145,17 @@ private fun RBuilder.metaViewerItem(props: MetaViewerProps) { } @JsExport -public val MetaViewer:FunctionalComponent = functionalComponent("MetaViewer") { props -> - child(MetaViewerItem) { - attrs { - this.key = "" - this.root = props.root - this.name = Name.EMPTY - this.descriptor = props.descriptor +public val MetaViewer: FunctionalComponent = + functionalComponent("MetaViewer") { props -> + child(MetaViewerItem) { + attrs { + this.key = "" + this.root = props.root + this.name = Name.EMPTY + this.descriptor = props.descriptor + } } } -} public fun RBuilder.metaViewer(meta: Meta, descriptor: NodeDescriptor? = null, key: Any? = null) { child(MetaViewer) { diff --git a/ui/react/src/main/kotlin/space/kscience/visionforge/react/PropertyEditor.kt b/ui/react/src/main/kotlin/space/kscience/visionforge/react/PropertyEditor.kt index f48b258b..66779588 100644 --- a/ui/react/src/main/kotlin/space/kscience/visionforge/react/PropertyEditor.kt +++ b/ui/react/src/main/kotlin/space/kscience/visionforge/react/PropertyEditor.kt @@ -87,13 +87,15 @@ private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) { } if (props.updateFlow != null) { - useEffectWithCleanup(listOf(props.ownProperties, props.updateFlow)) { + useEffect(props.ownProperties, props.updateFlow) { val updateJob = props.updateFlow!!.onEach { updatedName -> if (updatedName == props.name) { update() } }.launchIn(props.scope ?: GlobalScope) - return@useEffectWithCleanup { updateJob.cancel() } + cleanup { + updateJob.cancel() + } } } diff --git a/ui/react/src/main/kotlin/space/kscience/visionforge/react/ThreeCanvasComponent.kt b/ui/react/src/main/kotlin/space/kscience/visionforge/react/ThreeCanvasComponent.kt index 2534e746..0c42caf3 100644 --- a/ui/react/src/main/kotlin/space/kscience/visionforge/react/ThreeCanvasComponent.kt +++ b/ui/react/src/main/kotlin/space/kscience/visionforge/react/ThreeCanvasComponent.kt @@ -27,22 +27,22 @@ public val ThreeCanvasComponent: FunctionalComponent = functio val elementRef = useRef(null) var canvas by useState(null) - val three: ThreePlugin = useMemo({ props.context.fetch(ThreePlugin) }, arrayOf(props.context)) + val three: ThreePlugin = useMemo(props.context){ props.context.fetch(ThreePlugin) } - useEffect(listOf(props.solid, props.options, elementRef)) { + useEffect(props.solid, props.options, elementRef) { if (canvas == null) { val element = elementRef.current as? HTMLElement ?: error("Canvas element not found") canvas = ThreeCanvas(three, element, props.options ?: Canvas3DOptions()) } } - useEffect(listOf(canvas, props.solid)) { + useEffect(canvas, props.solid) { props.solid?.let { obj -> canvas?.render(obj) } } - useEffect(listOf(canvas, props.selected)) { + useEffect(canvas, props.selected) { canvas?.select(props.selected) } diff --git a/ui/ring/build.gradle.kts b/ui/ring/build.gradle.kts index 54d6b737..84d33b43 100644 --- a/ui/ring/build.gradle.kts +++ b/ui/ring/build.gradle.kts @@ -17,6 +17,8 @@ kotlin{ dependencies{ api(project(":ui:react")) + //TODO replace by kotlin-wrappers + api("ru.mipt.npm:ring-ui:0.1.0") implementation(npm("@jetbrains/icons", "3.14.1")) implementation(npm("@jetbrains/ring-ui", "4.0.7")) diff --git a/ui/ring/src/main/kotlin/ringui/Alert.kt b/ui/ring/src/main/kotlin/ringui/Alert.kt deleted file mode 100644 index db2647cb..00000000 --- a/ui/ring/src/main/kotlin/ringui/Alert.kt +++ /dev/null @@ -1,41 +0,0 @@ -package ringui - -import react.RBuilder -import react.RClass -import react.RHandler -import react.dom.WithClassName - -// https://github.com/JetBrains/ring-ui/blob/master/components/alert/alert.js -public external interface AlertProps : WithClassName { - public var timeout: Number - public var onCloseRequest: () -> Unit - public var onClose: () -> Unit - public var isShaking: Boolean - public var isClosing: Boolean - public var inline: Boolean - public var showWithAnimation: Boolean - public var closeable: Boolean - public var type: AlertType -} - -public typealias AlertType = String - -public object AlertTypes { - public var ERROR: String = "error" - public var MESSAGE: String = "message" - public var SUCCESS: String = "success" - public var WARNING: String = "warning" - public var LOADING: String = "loading" -} - -@JsModule("@jetbrains/ring-ui/components/alert/alert") -internal external object AlertModule { - @JsName("default") - val Alert: RClass -} - -public fun RBuilder.ringAlert(handler: RHandler) { - AlertModule.Alert { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/Button.kt b/ui/ring/src/main/kotlin/ringui/Button.kt deleted file mode 100644 index 421de6ce..00000000 --- a/ui/ring/src/main/kotlin/ringui/Button.kt +++ /dev/null @@ -1,43 +0,0 @@ -package ringui - -import org.w3c.dom.events.MouseEvent -import react.RBuilder -import react.RClass -import react.RHandler -import react.dom.WithClassName - -// https://github.com/JetBrains/ring-ui/blob/master/components/button/button.js -public external interface ButtonProps : WithClassName { - public var theme: String - public var active: Boolean - public var danger: Boolean - public var delayed: Boolean - public var loader: Boolean - public var primary: Boolean - - public var short: Boolean - public var text: Boolean - public var inline: Boolean - public var dropdown: Boolean - - public var href: String - - public var icon: dynamic /* string | func */ - public var iconSize: Number - public var iconClassName: String - - public var onMouseDown: (MouseEvent) -> Unit -} - -@JsModule("@jetbrains/ring-ui/components/button/button") -internal external object ButtonModule { - @JsName("default") - val Button: RClass -} - - -public fun RBuilder.ringButton(handler: RHandler) { - ButtonModule.Button { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/Dialog.kt b/ui/ring/src/main/kotlin/ringui/Dialog.kt deleted file mode 100644 index 7df7df1a..00000000 --- a/ui/ring/src/main/kotlin/ringui/Dialog.kt +++ /dev/null @@ -1,35 +0,0 @@ -package ringui - -import react.RBuilder -import react.RClass -import react.RHandler -import react.dom.WithClassName - -// https://github.com/JetBrains/ring-ui/blob/master/components/dialog/dialog.js -public external interface DialogProps : WithClassName { - public var contentClassName: String - public var show: Boolean - public var showCloseButton: Boolean - public var onOverlayClick: () -> Unit - public var onEscPress: () -> Unit - public var onCloseClick: () -> Unit - // onCloseAttempt is a common callback for ESC pressing and overlay clicking. - // Use it if you don't need different behaviors for this cases. - public var onCloseAttempt: () -> Unit - // focusTrap may break popups inside dialog, so use it carefully - public var trapFocus: Boolean - public var autoFocusFirst: Boolean -} - -@JsModule("@jetbrains/ring-ui/components/dialog/dialog") -internal external object DialogModule { - @JsName("default") - val Dialog: RClass -} - -public fun RBuilder.ringDialog(show: Boolean, handler: RHandler) { - DialogModule.Dialog { - attrs.show = show - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/Dropdown.kt b/ui/ring/src/main/kotlin/ringui/Dropdown.kt deleted file mode 100644 index 4fde43c6..00000000 --- a/ui/ring/src/main/kotlin/ringui/Dropdown.kt +++ /dev/null @@ -1,46 +0,0 @@ -package ringui - -import org.w3c.dom.events.Event -import react.RBuilder -import react.RClass -import react.RHandler -import react.ReactElement -import react.dom.WithClassName - -public external interface AnchorProps : WithClassName - -public external interface DropdownProps : WithClassName { - /** - * Can be string, React element, or a function accepting an object with {active, pinned} properties and returning a React element - * React element should render some interactive HTML element like `button` or `a` - */ - public var anchor: dynamic //: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired, - public var initShown: Boolean - public var activeClassName: String - public var clickMode: Boolean - public var hoverMode: Boolean - public var hoverShowTimeOut: Number - public var hoverHideTimeOut: Number - public var onShow: () -> Unit - public var onHide: () -> Unit - public var onMouseEnter: (Event) -> Unit - public var onMouseLeave: (Event) -> Unit - //'data-test': PropTypes.string -} - -@JsModule("@jetbrains/ring-ui/components/dropdown/dropdown") -public external object DropdownModule { - public val Anchor: RClass - - @JsName("default") - public val Dropdown: RClass -} - - -public fun RBuilder.ringDropdown(anchor: dynamic, handler: RHandler): ReactElement = - DropdownModule.Dropdown { - attrs { - this.anchor = anchor - } - handler() - } \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/Icon.kt b/ui/ring/src/main/kotlin/ringui/Icon.kt deleted file mode 100644 index ad41b18a..00000000 --- a/ui/ring/src/main/kotlin/ringui/Icon.kt +++ /dev/null @@ -1,28 +0,0 @@ -package ringui - -import react.RBuilder -import react.RClass -import react.RHandler -import react.dom.WithClassName - -// https://github.com/JetBrains/ring-ui/blob/master/components/icon/icon.js -public external interface IconProps : WithClassName { - public var color: String - public var glyph: dynamic /* string | func */ - public var height: Number - public var size: Number - public var width: Number - public var loading: Boolean -} - -@JsModule("@jetbrains/ring-ui/components/icon/icon") -internal external object IconModule { - @JsName("default") - val Icon: RClass -} - -public fun RBuilder.ringIcon(handler: RHandler) { - IconModule.Icon { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/Link.kt b/ui/ring/src/main/kotlin/ringui/Link.kt deleted file mode 100644 index 712a30ca..00000000 --- a/ui/ring/src/main/kotlin/ringui/Link.kt +++ /dev/null @@ -1,31 +0,0 @@ -package ringui - -import org.w3c.dom.events.MouseEvent -import react.RBuilder -import react.RClass -import react.RHandler -import react.dom.WithClassName - -// https://github.com/JetBrains/ring-ui/blob/master/components/link/link.js -public external interface LinkProps : WithClassName { - public var innerClassName: String - public var active: Boolean - public var inherit: Boolean - public var pseudo: Boolean - public var hover: Boolean - public var href: String - public var onPlainLeftClick: (MouseEvent) -> Unit - public var onClick: (MouseEvent) -> Unit -} - -@JsModule("@jetbrains/ring-ui/components/link/link") -internal external object LinkModule { - @JsName("default") - val Link: RClass -} - -public fun RBuilder.ringLink(handler: RHandler) { - LinkModule.Link { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/UserCard.kt b/ui/ring/src/main/kotlin/ringui/UserCard.kt deleted file mode 100644 index 89ab105a..00000000 --- a/ui/ring/src/main/kotlin/ringui/UserCard.kt +++ /dev/null @@ -1,38 +0,0 @@ -package ringui - -import react.RBuilder -import react.RClass -import react.RHandler -import react.RProps - -@JsModule("@jetbrains/ring-ui/components/user-card/user-card") -private external object UserCardModule { - val UserCard: RClass -} - -// https://github.com/JetBrains/ring-ui/blob/master/components/user-card/card.js -public external interface UserCardProps : RProps { - public var user: UserCardModel - public var wording: UserCardWording -} - -public data class UserCardModel( - val name: String, - val login: String, - val avatarUrl: String, - val email: String? = null, - val href: String? = null -) - -public data class UserCardWording( - val banned: String, - val online: String, - val offline: String -) - -public fun RBuilder.ringUserCard(user: UserCardModel, handler: RHandler = {}) { - UserCardModule.UserCard { - attrs.user = user - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/grid/Col.kt b/ui/ring/src/main/kotlin/ringui/grid/Col.kt deleted file mode 100644 index 057415db..00000000 --- a/ui/ring/src/main/kotlin/ringui/grid/Col.kt +++ /dev/null @@ -1,23 +0,0 @@ -package ringui.grid - -import react.RBuilder -import react.RHandler -import react.dom.WithClassName - -public external interface ColProps : WithClassName { - public var xs: dynamic // number or boolean - public var sm: dynamic // number or boolean - public var md: dynamic // number or boolean - public var lg: dynamic // number or boolean - public var xsOffset: Number - public var smOffset: Number - public var mdOffset: Number - public var lgOffset: Number - public var reverse: Boolean -} - -public fun RBuilder.ringCol(handler: RHandler){ - GridModule.Col { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/grid/Grid.kt b/ui/ring/src/main/kotlin/ringui/grid/Grid.kt deleted file mode 100644 index 7613a6c4..00000000 --- a/ui/ring/src/main/kotlin/ringui/grid/Grid.kt +++ /dev/null @@ -1,20 +0,0 @@ -package ringui.grid - -import react.RBuilder -import react.RClass -import react.RHandler -import react.RProps - -@JsModule("@jetbrains/ring-ui/components/grid/grid") -internal external object GridModule { - val Grid: RClass - val Row: RClass - val Col: RClass -} - - -public fun RBuilder.ringGrid(handler: RHandler) { - GridModule.Grid { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/grid/Row.kt b/ui/ring/src/main/kotlin/ringui/grid/Row.kt deleted file mode 100644 index 78131971..00000000 --- a/ui/ring/src/main/kotlin/ringui/grid/Row.kt +++ /dev/null @@ -1,33 +0,0 @@ -package ringui.grid - -import react.RBuilder -import react.RHandler -import react.dom.WithClassName - -public enum class RowPosition { - xs, - sm, - md, - lg -} - -public external interface RowProps : WithClassName { - public var reverse: Boolean - public var start: RowPosition - public var center: RowPosition - public var end: RowPosition - public var top: RowPosition - public var middle: RowPosition - public var baseline: RowPosition - public var bottom: RowPosition - public var around: RowPosition - public var between: RowPosition - public var first: RowPosition - public var last: RowPosition -} - -public fun RBuilder.ringRow(handler: RHandler){ - GridModule.Row { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/header/Header.kt b/ui/ring/src/main/kotlin/ringui/header/Header.kt deleted file mode 100644 index 182fe6de..00000000 --- a/ui/ring/src/main/kotlin/ringui/header/Header.kt +++ /dev/null @@ -1,33 +0,0 @@ -package ringui.header - -import react.RBuilder -import react.RClass -import react.RHandler -import react.dom.WithClassName - -@JsModule("@jetbrains/ring-ui/components/header/header") -internal external object HeaderModule { - @JsName("default") - val Header: RClass - val RerenderableHeader: RClass - val Logo: RClass - val Tray: RClass - val TrayIcon: RClass - val Profile: RClass - val SmartProfile: RClass - val Services: RClass - val SmartServices: RClass -} - -// https://github.com/JetBrains/ring-ui/blob/master/components/header/header.js -public external interface HeaderProps : WithClassName { - public var spaced: Boolean - public var theme: String -} - - -public fun RBuilder.ringHeader(handler: RHandler) { - HeaderModule.Header { - handler() - } -} diff --git a/ui/ring/src/main/kotlin/ringui/header/Logo.kt b/ui/ring/src/main/kotlin/ringui/header/Logo.kt deleted file mode 100644 index 5773517d..00000000 --- a/ui/ring/src/main/kotlin/ringui/header/Logo.kt +++ /dev/null @@ -1,21 +0,0 @@ -package ringui.header - -import kotlinx.html.A -import react.RElementBuilder -import react.RHandler -import ringui.IconProps -import styled.StyledDOMBuilder - -public external interface HeaderLogoProps : IconProps - -public fun StyledDOMBuilder.ringLogo(handler: RHandler) { - HeaderModule.Logo { - handler() - } -} - -public fun RElementBuilder.ringLogo(handler: RHandler) { - HeaderModule.Logo { - handler() - } -} diff --git a/ui/ring/src/main/kotlin/ringui/header/Tray.kt b/ui/ring/src/main/kotlin/ringui/header/Tray.kt deleted file mode 100644 index b04e96a7..00000000 --- a/ui/ring/src/main/kotlin/ringui/header/Tray.kt +++ /dev/null @@ -1,26 +0,0 @@ -package ringui.header - -import react.RElementBuilder -import react.RHandler -import react.dom.WithClassName -import ringui.ButtonProps - -// https://github.com/JetBrains/ring-ui/blob/master/components/header/tray.js -public external interface HeaderTrayProps : WithClassName - -// https://github.com/JetBrains/ring-ui/blob/master/components/header/tray-icon.js -public external interface HeaderTrayIconProps : ButtonProps { - public var rotatable: Boolean -} - -public fun RElementBuilder.ringTray(handler: RHandler) { - HeaderModule.Tray { - handler() - } -} - -public fun RElementBuilder.ringTrayIcon(handler: RHandler) { - HeaderModule.TrayIcon { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/island/Content.kt b/ui/ring/src/main/kotlin/ringui/island/Content.kt deleted file mode 100644 index 63124dc2..00000000 --- a/ui/ring/src/main/kotlin/ringui/island/Content.kt +++ /dev/null @@ -1,20 +0,0 @@ -package ringui.island - -import react.RElementBuilder -import react.RHandler -import react.dom.WithClassName - -// https://github.com/JetBrains/ring-ui/blob/master/components/island/content.js -public external interface IslandContentProps : WithClassName { - public var scrollableWrapperClassName: String - public var fade: Boolean - public var bottomBorder: Boolean - public var onScroll: () -> Unit - public var onScrollToBottom: () -> Unit -} - -public fun RElementBuilder.ringIslandContent(handler: RHandler) { - IslandModule.Content { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/island/Header.kt b/ui/ring/src/main/kotlin/ringui/island/Header.kt deleted file mode 100644 index 1a970d89..00000000 --- a/ui/ring/src/main/kotlin/ringui/island/Header.kt +++ /dev/null @@ -1,18 +0,0 @@ -package ringui.island - -import react.RElementBuilder -import react.RHandler -import react.dom.WithClassName - -// https://github.com/JetBrains/ring-ui/blob/master/components/island/header.js -public external interface IslandHeaderProps : WithClassName { - public var border: Boolean - public var wrapWithTitle: Boolean - public var phase: Number -} - -public fun RElementBuilder.ringIslandHeader(handler: RHandler) { - IslandModule.Header { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/island/Island.kt b/ui/ring/src/main/kotlin/ringui/island/Island.kt deleted file mode 100644 index 03530902..00000000 --- a/ui/ring/src/main/kotlin/ringui/island/Island.kt +++ /dev/null @@ -1,45 +0,0 @@ -package ringui.island - -import react.RBuilder -import react.RClass -import react.RHandler -import react.dom.WithClassName - -@JsModule("@jetbrains/ring-ui/components/island/island") -internal external object IslandModule { - val default: RClass - val Content: RClass - val Header: RClass - val AdaptiveIsland: RClass -} - -// https://github.com/JetBrains/ring-ui/blob/master/components/island/island.js -public external interface IslandProps : WithClassName { - public val narrow: Boolean - public val withoutPaddings: Boolean -} - -public fun RBuilder.ringIsland(handler: RHandler) { - IslandModule.default { - handler() - } -} - -public fun RBuilder.ringIsland(header: String, handler: RHandler) { - ringIsland { - ringIslandHeader { - attrs{ - border = true - } - +header - } - ringIslandContent(handler) - } -} - - -public fun RBuilder.ringAdaptiveIsland(handler: RHandler) { - IslandModule.AdaptiveIsland { - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/tabs/SmartTabs.kt b/ui/ring/src/main/kotlin/ringui/tabs/SmartTabs.kt deleted file mode 100644 index 081181a3..00000000 --- a/ui/ring/src/main/kotlin/ringui/tabs/SmartTabs.kt +++ /dev/null @@ -1,21 +0,0 @@ -package ringui.tabs - -import react.RBuilder -import react.RHandler -import react.dom.WithClassName - -public external interface SmartTabsProps : WithClassName { - public var initSelected: String -} - - -public fun RBuilder.ringSmartTabs(active: String? = null, handler: RHandler) { - TabsModule.SmartTabs { - active?.let { - attrs { - initSelected = active - } - } - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/ringui/tabs/Tabs.kt b/ui/ring/src/main/kotlin/ringui/tabs/Tabs.kt deleted file mode 100644 index 6c029110..00000000 --- a/ui/ring/src/main/kotlin/ringui/tabs/Tabs.kt +++ /dev/null @@ -1,51 +0,0 @@ -package ringui.tabs - -import react.RBuilder -import react.RClass -import react.RHandler -import react.dom.WithClassName - -@JsModule("@jetbrains/ring-ui/components/tabs/tabs") -internal external object TabsModule { - val Tabs: RClass - val Tab: RClass - val SmartTabs: RClass - //val CustomItem: RClass -} - -//https://github.com/JetBrains/ring-ui/blob/master/components/tabs/tabs.js -public external interface TabsProps : WithClassName { - public var theme: String - public var selected: String - public var onSelect: (String) -> Unit - public var href: String - public var autoCollapse: Boolean -} - -public external interface CustomItemProps : WithClassName - -public external interface TabProps : WithClassName { - public var title: dynamic // PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired, - public var id: String -} - -public fun RBuilder.ringTabs(active: String? = null, handler: RHandler) { - TabsModule.Tabs { - active?.let{ - attrs { - selected = active - } - } - handler() - } -} - -public fun RBuilder.ringTab(title: dynamic, id: String = title.toString(), handler: RHandler) { - TabsModule.Tab { - attrs { - this.title = title - this.id = id - } - handler() - } -} \ No newline at end of file diff --git a/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ThreeViewWithControls.kt b/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ThreeViewWithControls.kt index 6fb32a4e..a6518bd2 100644 --- a/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ThreeViewWithControls.kt +++ b/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ThreeViewWithControls.kt @@ -4,7 +4,7 @@ import kotlinx.css.* import react.* import react.dom.div import react.dom.span -import ringui.ringLink +import ringui.Link import space.kscience.dataforge.context.Context import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.NameToken @@ -36,7 +36,7 @@ public fun ThreeCanvasWithControlsProps.tab(title: String, block: RBuilder.() -> public fun RBuilder.nameCrumbs(name: Name?, link: (Name) -> Unit): ReactElement = styledDiv { div { - ringLink { + Link { attrs { onClick = { link(Name.EMPTY) @@ -51,7 +51,7 @@ public fun RBuilder.nameCrumbs(name: Name?, link: (Name) -> Unit): ReactElement tokens.add(token) val fullName = Name(tokens.toList()) span { +"/" } - ringLink { + Link { +token.toString() attrs { onClick = { diff --git a/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ringPropertyEditor.kt b/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ringPropertyEditor.kt index 5ef7da96..e33dfb2b 100644 --- a/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ringPropertyEditor.kt +++ b/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ringPropertyEditor.kt @@ -4,11 +4,9 @@ import org.w3c.dom.Element import react.RBuilder import react.dom.p import react.dom.render -import ringui.island.ringIsland -import ringui.island.ringIslandContent -import ringui.island.ringIslandHeader -import ringui.tabs.ringSmartTabs -import ringui.tabs.ringTab +import ringui.Island +import ringui.SmartTabs +import ringui.Tab import space.kscience.dataforge.meta.descriptors.NodeDescriptor import space.kscience.visionforge.* import space.kscience.visionforge.react.flexColumn @@ -28,7 +26,7 @@ public fun RBuilder.ringPropertyEditor( } flexColumn { - ringIsland("Properties") { + Island("Properties") { propertyEditor( ownProperties = vision.ownProperties, allProperties = vision.allProperties(), @@ -39,33 +37,25 @@ public fun RBuilder.ringPropertyEditor( } if (styles.isNotEmpty()) { - ringIsland { - ringIslandHeader { - attrs { - border = true + Island("Styles") { + if (styles.size == 1) { + val styleName = styles.first() + p { + +styleName } - +"Styles" - } - ringIslandContent { - if (styles.size == 1) { - val styleName = styles.first() - p { - +styleName + val style = vision.getStyle(styleName) + if (style != null) { + Tab(styleName, id = styleName) { + metaViewer(style) } - val style = vision.getStyle(styleName) - if (style != null) { - ringTab(styleName, id = styleName) { - metaViewer(style) - } - } - } else { - ringSmartTabs { - styles.forEach { styleName -> - val style = vision.getStyle(styleName) - if (style != null) { - ringTab(styleName, id = styleName) { - metaViewer(style) - } + } + } else { + SmartTabs { + styles.forEach { styleName -> + val style = vision.getStyle(styleName) + if (style != null) { + Tab(styleName, id = styleName) { + metaViewer(style) } } } @@ -76,6 +66,7 @@ public fun RBuilder.ringPropertyEditor( } } + public fun Element.ringPropertyEditor( item: Vision, descriptor: NodeDescriptor? = item.descriptor, diff --git a/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ringThreeControls.kt b/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ringThreeControls.kt index 58b7839f..1104a52d 100644 --- a/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ringThreeControls.kt +++ b/ui/ring/src/main/kotlin/space.kscience.visionforge.ring/ringThreeControls.kt @@ -9,9 +9,9 @@ import org.w3c.files.BlobPropertyBag import react.* import react.dom.attrs import react.dom.button -import ringui.island.ringIsland -import ringui.tabs.ringSmartTabs -import ringui.tabs.ringTab +import ringui.Island +import ringui.SmartTabs +import ringui.Tab import space.kscience.dataforge.meta.withDefault import space.kscience.dataforge.names.Name import space.kscience.visionforge.Vision @@ -90,27 +90,27 @@ public external interface ThreeControlsProps : RProps { @JsExport public val ThreeControls: FunctionalComponent = functionalComponent { props -> - ringSmartTabs("Tree") { + SmartTabs("Tree") { props.vision?.let { - ringTab("Tree") { + Tab("Tree") { styledDiv { css { height = 100.pct overflowY = Overflow.auto } - ringIsland("Vision tree") { + Island("Vision tree") { visionTree(it, props.selected, props.onSelect) } } } } - ringTab("Settings") { - ringIsland("Canvas configuration") { + Tab("Settings") { + Island("Canvas configuration") { canvasControls(props.canvasOptions, props.vision) } } props.additionalTabs.forEach { (name, handler) -> - ringTab(name){ + Tab(name) { handler() } } @@ -129,6 +129,6 @@ public fun RBuilder.ringThreeControls( this.vision = vision this.selected = selected this.onSelect = onSelect - this.additionalTabs = additionalTabs?: emptyMap() + this.additionalTabs = additionalTabs ?: emptyMap() } } \ No newline at end of file diff --git a/visionforge-core/build.gradle.kts b/visionforge-core/build.gradle.kts index 92c0bdd6..3af5c602 100644 --- a/visionforge-core/build.gradle.kts +++ b/visionforge-core/build.gradle.kts @@ -3,7 +3,6 @@ plugins { } val dataforgeVersion: String by rootProject.extra -val kotlinWrappersVersion: String by rootProject.extra kscience{ useSerialization() @@ -15,12 +14,12 @@ kotlin { dependencies { api("space.kscience:dataforge-context:$dataforgeVersion") api("org.jetbrains.kotlinx:kotlinx-html:${ru.mipt.npm.gradle.KScienceVersions.htmlVersion}") - api("org.jetbrains.kotlin-wrappers:kotlin-css:1.0.0-$kotlinWrappersVersion") + api("org.jetbrains.kotlin-wrappers:kotlin-css") } } jsMain { dependencies { - api("org.jetbrains.kotlin-wrappers:kotlin-extensions:1.0.1-$kotlinWrappersVersion") + api("org.jetbrains.kotlin-wrappers:kotlin-extensions") } } } diff --git a/visionforge-fx/build.gradle.kts b/visionforge-fx/build.gradle.kts index 2ba679a1..391517d7 100644 --- a/visionforge-fx/build.gradle.kts +++ b/visionforge-fx/build.gradle.kts @@ -3,8 +3,6 @@ plugins { } val dataforgeVersion: String by rootProject.extra -val kotlinWrappersVersion: String by rootProject.extra -val htmlVersion: String by rootProject.extra val fxVersion: String by rootProject.extra kscience{ diff --git a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/SolidReference.kt b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/SolidReference.kt index bab671d9..17ee9141 100644 --- a/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/SolidReference.kt +++ b/visionforge-solid/src/commonMain/kotlin/space/kscience/visionforge/solid/SolidReference.kt @@ -99,17 +99,17 @@ public class SolidReferenceGroup( //TODO replace by properties override var position: Point3D? get() = prototype.position - set(value) { + set(_) { error("Can't set position of reference") } override var rotation: Point3D? get() = prototype.rotation - set(value) { + set(_) { error("Can't set position of reference") } override var scale: Point3D? get() = prototype.scale - set(value) { + set(_) { error("Can't set position of reference") } override val prototype: Solid get() = prototypeFor(childName) diff --git a/visionforge-threejs/build.gradle.kts b/visionforge-threejs/build.gradle.kts index 68ab9204..60c00061 100644 --- a/visionforge-threejs/build.gradle.kts +++ b/visionforge-threejs/build.gradle.kts @@ -2,13 +2,6 @@ plugins { id("ru.mipt.npm.gradle.js") } -kotlin{ - explicitApi = null - js{ - binaries.library() - } -} - dependencies { api(project(":visionforge-solid")) implementation(npm("three", "0.124.0"))