1.9.20-Beta

This commit is contained in:
Alexander Nozik 2023-09-30 09:40:12 +03:00
parent ba70af3a24
commit 35ec4bac0e
10 changed files with 26 additions and 38 deletions

View File

@ -2,7 +2,6 @@ package space.kscience.visionforge.gdml.demo
import drop.FileDrop import drop.FileDrop
import kotlinx.css.* import kotlinx.css.*
import kotlinx.css.properties.border
import org.w3c.files.FileList import org.w3c.files.FileList
import react.RBuilder import react.RBuilder
import styled.css import styled.css
@ -13,7 +12,7 @@ import styled.styledDiv
fun RBuilder.fileDrop(title: String, action: (files: FileList?) -> Unit) { fun RBuilder.fileDrop(title: String, action: (files: FileList?) -> Unit) {
styledDiv { styledDiv {
css { css {
border(style = BorderStyle.dashed, width = 1.px, color = Color.orange) border = Border(style = BorderStyle.dashed, width = 1.px, color = Color.orange)
flexGrow = 0.0 flexGrow = 0.0
alignContent = Align.center alignContent = Align.center
} }

View File

@ -43,8 +43,8 @@ private class JsPlaygroundApp : Application {
createRoot(element).render { createRoot(element).render {
styledDiv { styledDiv {
css { css {
padding(0.pt) padding = Padding(0.pt)
margin(0.pt) margin = Margin(0.pt)
height = 100.vh height = 100.vh
width = 100.vw width = 100.vw
} }

View File

@ -1,5 +1,4 @@
import kotlinx.css.* import kotlinx.css.*
import kotlinx.css.properties.border
import kotlinx.dom.clear import kotlinx.dom.clear
import kotlinx.html.dom.append import kotlinx.html.dom.append
import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor
@ -45,10 +44,10 @@ val Markup = fc<MarkupProps>("Markup") { props ->
css { css {
width = 100.pct width = 100.pct
height = 100.pct height = 100.pct
border(2.pt, BorderStyle.solid, Color.blue) border= Border(2.pt, BorderStyle.solid, Color.blue)
padding(left = 8.pt) padding = Padding(left = 8.pt)
backgroundColor = Color.white backgroundColor = Color.white
flex(1.0) flex = Flex(1.0)
zIndex = 10000 zIndex = 10000
} }
ref = elementRef ref = elementRef

View File

@ -1,5 +1,4 @@
import kotlinx.css.* import kotlinx.css.*
import kotlinx.css.properties.border
import org.w3c.dom.Element import org.w3c.dom.Element
import org.w3c.dom.HTMLElement import org.w3c.dom.HTMLElement
import react.* import react.*
@ -30,8 +29,8 @@ val Plotly = fc<PlotlyProps>("Plotly") { props ->
css { css {
width = 100.pct width = 100.pct
height = 100.pct height = 100.pct
border(2.pt, BorderStyle.solid, Color.blue) border = Border(2.pt, BorderStyle.solid, Color.blue)
flex(1.0) flex = Flex(1.0)
} }
ref = elementRef ref = elementRef
} }

View File

@ -8,6 +8,6 @@ org.gradle.jvmargs=-Xmx4G
org.jetbrains.compose.experimental.jscanvas.enabled=true org.jetbrains.compose.experimental.jscanvas.enabled=true
toolsVersion=0.15.0-kotlin-1.9.20-Beta toolsVersion=0.15.0-kotlin-1.9.20-Beta2
#kotlin.experimental.tryK2=true kotlin.experimental.tryK2=true
#kscience.wasm.disabled=true #kscience.wasm.disabled=true

View File

@ -1,8 +1,8 @@
package space.kscience.visionforge.bootstrap package space.kscience.visionforge.bootstrap
public fun useBootstrap(){ public fun useBootstrap(){
kotlinext.js.require("bootstrap/dist/css/bootstrap.min.css") kotlinext.js.require<dynamic>("bootstrap/dist/css/bootstrap.min.css")
kotlinext.js.require("bootstrap") kotlinext.js.require<dynamic>("bootstrap")
} }
//public inline fun TagConsumer<HTMLElement>.card(title: String, crossinline block: TagConsumer<HTMLElement>.() -> Unit) { //public inline fun TagConsumer<HTMLElement>.card(title: String, crossinline block: TagConsumer<HTMLElement>.() -> Unit) {

View File

@ -2,11 +2,7 @@ package space.kscience.visionforge.bootstrap
import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.css.BorderStyle import kotlinx.css.*
import kotlinx.css.Color
import kotlinx.css.padding
import kotlinx.css.properties.border
import kotlinx.css.px
import kotlinx.html.js.onClickFunction import kotlinx.html.js.onClickFunction
import org.w3c.dom.events.Event import org.w3c.dom.events.Event
import org.w3c.files.Blob import org.w3c.files.Blob
@ -29,7 +25,7 @@ private fun saveData(event: Event, fileName: String, mimeType: String = "text/pl
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
val fileSaver = kotlinext.js.require("file-saver") val fileSaver = kotlinext.js.require<dynamic>("file-saver")
val blob = Blob(arrayOf(dataBuilder()), BlobPropertyBag("$mimeType;charset=utf-8")) val blob = Blob(arrayOf(dataBuilder()), BlobPropertyBag("$mimeType;charset=utf-8"))
fileSaver.saveAs(blob, fileName) fileSaver.saveAs(blob, fileName)
} }
@ -53,8 +49,8 @@ public val CanvasControls: FC<CanvasControlsProps> = fc("CanvasControls") { prop
flexColumn { flexColumn {
flexRow { flexRow {
css { css {
border(1.px, BorderStyle.solid, Color.blue) border = Border(1.px, BorderStyle.solid, Color.blue)
padding(4.px) padding = Padding(4.px)
} }
props.vision?.let { vision -> props.vision?.let { vision ->
button { button {

View File

@ -1,7 +1,6 @@
package space.kscience.visionforge.bootstrap package space.kscience.visionforge.bootstrap
import kotlinx.css.* import kotlinx.css.*
import kotlinx.css.properties.border
import react.FC import react.FC
import react.PropsWithChildren import react.PropsWithChildren
import react.RBuilder import react.RBuilder
@ -33,13 +32,13 @@ public val ThreeControls: FC<ThreeControlsProps> = fc { props ->
} }
tab("Tree") { tab("Tree") {
css { css {
border(1.px, BorderStyle.solid, Color.lightGray) border = Border(1.px, BorderStyle.solid, Color.lightGray)
padding(10.px) padding = Padding(10.px)
} }
h2 { +"Object tree" } h2 { +"Object tree" }
styledDiv { styledDiv {
css { css {
flex(1.0, 1.0, FlexBasis.inherit) flex = Flex(1.0, 1.0, FlexBasis.inherit)
} }
props.vision?.let { props.vision?.let {
visionTree(it, props.selected, props.onSelect) visionTree(it, props.selected, props.onSelect)

View File

@ -130,7 +130,7 @@ public val ThreeCanvasWithControls: FC<ThreeCanvasWithControlsProps> = fc("Three
css { css {
height = 100.pct height = 100.pct
minWidth = 600.px minWidth = 600.px
flex(10.0, 1.0, FlexBasis("600px")) flex = Flex(10.0, 1.0, FlexBasis("600px"))
position = Position.relative position = Position.relative
} }
@ -199,11 +199,11 @@ public val ThreeCanvasWithControls: FC<ThreeCanvasWithControlsProps> = fc("Three
} }
flexColumn { flexColumn {
css { css {
padding(4.px) padding = Padding(4.px)
minWidth = 400.px minWidth = 400.px
height = 100.pct height = 100.pct
overflowY = Overflow.auto overflowY = Overflow.auto
flex(1.0, 10.0, FlexBasis("300px")) flex = Flex(1.0, 10.0, FlexBasis("300px"))
} }
ringThreeControls(options, solid, selected, onSelect, additionalTabs = props.additionalTabs) ringThreeControls(options, solid, selected, onSelect, additionalTabs = props.additionalTabs)
} }

View File

@ -2,11 +2,7 @@ package space.kscience.visionforge.ring
import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.css.BorderStyle import kotlinx.css.*
import kotlinx.css.Color
import kotlinx.css.padding
import kotlinx.css.properties.border
import kotlinx.css.px
import kotlinx.html.js.onClickFunction import kotlinx.html.js.onClickFunction
import org.w3c.dom.events.Event import org.w3c.dom.events.Event
import org.w3c.files.Blob import org.w3c.files.Blob
@ -34,7 +30,7 @@ internal fun saveData(event: Event, fileName: String, mimeType: String = "text/p
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
val fileSaver = kotlinext.js.require("file-saver") val fileSaver = kotlinext.js.require<dynamic>("file-saver")
val blob = Blob(arrayOf(dataBuilder()), BlobPropertyBag("$mimeType;charset=utf-8")) val blob = Blob(arrayOf(dataBuilder()), BlobPropertyBag("$mimeType;charset=utf-8"))
fileSaver.saveAs(blob, fileName) fileSaver.saveAs(blob, fileName)
} }
@ -58,8 +54,8 @@ internal val CanvasControls: FC<CanvasControlsProps> = fc("CanvasControls") { pr
flexColumn { flexColumn {
flexRow { flexRow {
css { css {
border(1.px, BorderStyle.solid, Color.blue) border = Border(1.px, BorderStyle.solid, Color.blue)
padding(4.px) padding = Padding(4.px)
} }
props.vision?.let { vision -> props.vision?.let { vision ->
button { button {