Update to tools 0.10.9
This commit is contained in:
parent
3caa22f8bf
commit
b5fdc6c4fe
@ -5,7 +5,7 @@ plugins {
|
||||
|
||||
group = "ru.mipt.npm"
|
||||
|
||||
val ktorVersion: String = ru.mipt.npm.gradle.KScienceVersions.ktorVersion
|
||||
val ktorVersion: String = npmlibs.versions.ktor.get()
|
||||
|
||||
kscience {
|
||||
useCoroutines()
|
||||
@ -45,17 +45,17 @@ kotlin {
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("io.ktor:ktor-server-cio:$ktorVersion")
|
||||
implementation("io.ktor:ktor-serialization:$ktorVersion")
|
||||
implementation(npmlibs.ktor.server.cio)
|
||||
implementation(npmlibs.ktor.serialization)
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation(project(":ui:ring"))
|
||||
implementation("io.ktor:ktor-client-js:$ktorVersion")
|
||||
implementation("io.ktor:ktor-client-serialization:$ktorVersion")
|
||||
implementation(npmlibs.ktor.client.js)
|
||||
implementation(npmlibs.ktor.client.serialization)
|
||||
implementation(project(":visionforge-threejs"))
|
||||
implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
|
||||
//implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,3 +8,5 @@ org.gradle.parallel=true
|
||||
|
||||
publishing.github=false
|
||||
publishing.sonatype=false
|
||||
|
||||
toolsVersion=0.10.9-kotlin-1.6.10
|
@ -1,6 +1,6 @@
|
||||
pluginManagement {
|
||||
|
||||
val toolsVersion = "0.10.7"
|
||||
val toolsVersion: String by extra
|
||||
|
||||
repositories {
|
||||
//mavenLocal()
|
||||
@ -23,6 +23,9 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
|
||||
dependencyResolutionManagement {
|
||||
|
||||
val toolsVersion: String by extra
|
||||
|
||||
repositories {
|
||||
maven("https://repo.kotlin.link")
|
||||
mavenCentral()
|
||||
@ -30,7 +33,7 @@ dependencyResolutionManagement {
|
||||
|
||||
versionCatalogs {
|
||||
create("npmlibs") {
|
||||
from("ru.mipt.npm:version-catalog:0.10.7")
|
||||
from("ru.mipt.npm:version-catalog:$toolsVersion")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,18 +5,17 @@ import org.w3c.dom.HTMLOptionElement
|
||||
import org.w3c.dom.HTMLSelectElement
|
||||
import org.w3c.dom.asList
|
||||
import org.w3c.dom.events.Event
|
||||
import react.FunctionComponent
|
||||
import react.FC
|
||||
import react.dom.attrs
|
||||
import react.dom.option
|
||||
import react.dom.select
|
||||
import react.functionComponent
|
||||
import react.fc
|
||||
import space.kscience.dataforge.meta.descriptors.allowedValues
|
||||
import space.kscience.dataforge.values.asValue
|
||||
import space.kscience.dataforge.values.string
|
||||
|
||||
@JsExport
|
||||
public val MultiSelectChooser: FunctionComponent<ValueChooserProps> =
|
||||
functionComponent("MultiSelectChooser") { props ->
|
||||
public val MultiSelectChooser: FC<ValueChooserProps> = fc("MultiSelectChooser") { props ->
|
||||
val onChange: (Event) -> Unit = { event: Event ->
|
||||
val newSelected = (event.target as HTMLSelectElement).selectedOptions.asList()
|
||||
.map { (it as HTMLOptionElement).value.asValue() }
|
||||
@ -36,4 +35,4 @@ public val MultiSelectChooser: FunctionComponent<ValueChooserProps> =
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -47,10 +47,9 @@ public external interface PropertyEditorProps : Props {
|
||||
public var expanded: Boolean?
|
||||
}
|
||||
|
||||
private val PropertyEditorItem: FunctionComponent<PropertyEditorProps> =
|
||||
functionComponent("PropertyEditorItem") { props ->
|
||||
private val PropertyEditorItem: FC<PropertyEditorProps> = fc("PropertyEditorItem") { props ->
|
||||
propertyEditorItem(props)
|
||||
}
|
||||
}
|
||||
|
||||
private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) {
|
||||
var expanded: Boolean by useState { props.expanded ?: true }
|
||||
@ -129,7 +128,7 @@ private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) {
|
||||
width = 160.px
|
||||
margin(1.px, 5.px)
|
||||
}
|
||||
ValueChooser{
|
||||
ValueChooser {
|
||||
attrs {
|
||||
this.descriptor = descriptor
|
||||
this.meta = ownProperty
|
||||
@ -193,7 +192,7 @@ private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) {
|
||||
}
|
||||
|
||||
@JsExport
|
||||
public val PropertyEditor: FunctionComponent<PropertyEditorProps> = functionComponent("PropertyEditor") { props ->
|
||||
public val PropertyEditor: FC<PropertyEditorProps> = fc("PropertyEditor") { props ->
|
||||
child(PropertyEditorItem) {
|
||||
attrs {
|
||||
this.key = ""
|
||||
@ -211,7 +210,7 @@ public fun RBuilder.propertyEditor(
|
||||
allProperties: MetaProvider = ownProperties,
|
||||
descriptor: MetaDescriptor? = null,
|
||||
key: Any? = null,
|
||||
expanded: Boolean? = null
|
||||
expanded: Boolean? = null,
|
||||
) {
|
||||
child(PropertyEditor) {
|
||||
attrs {
|
||||
|
@ -6,9 +6,9 @@ import kotlinx.html.InputType
|
||||
import kotlinx.html.js.onChangeFunction
|
||||
import org.w3c.dom.HTMLInputElement
|
||||
import org.w3c.dom.events.Event
|
||||
import react.FunctionComponent
|
||||
import react.FC
|
||||
import react.dom.attrs
|
||||
import react.functionComponent
|
||||
import react.fc
|
||||
import react.useState
|
||||
import space.kscience.dataforge.meta.descriptors.ValueRequirement
|
||||
import space.kscience.dataforge.meta.double
|
||||
@ -19,15 +19,14 @@ import styled.css
|
||||
import styled.styledInput
|
||||
|
||||
@JsExport
|
||||
public val RangeValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
functionComponent("RangeValueChooser") { props ->
|
||||
public val RangeValueChooser: FC<ValueChooserProps> = fc("RangeValueChooser") { props ->
|
||||
var innerValue by useState(props.actual.double)
|
||||
var rangeDisabled: Boolean by useState(props.meta.value == null)
|
||||
|
||||
val handleDisable: (Event) -> Unit = {
|
||||
val checkBoxValue = (it.target as HTMLInputElement).checked
|
||||
rangeDisabled = !checkBoxValue
|
||||
props.meta.value = if(!checkBoxValue) {
|
||||
props.meta.value = if (!checkBoxValue) {
|
||||
null
|
||||
} else {
|
||||
innerValue?.asValue()
|
||||
@ -41,7 +40,7 @@ public val RangeValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
}
|
||||
|
||||
flexRow {
|
||||
if(props.descriptor?.valueRequirement != ValueRequirement.REQUIRED) {
|
||||
if (props.descriptor?.valueRequirement != ValueRequirement.REQUIRED) {
|
||||
styledInput(type = InputType.checkBox) {
|
||||
attrs {
|
||||
defaultChecked = rangeDisabled.not()
|
||||
@ -51,7 +50,7 @@ public val RangeValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
}
|
||||
|
||||
styledInput(type = InputType.range) {
|
||||
css{
|
||||
css {
|
||||
width = 100.pct
|
||||
}
|
||||
attrs {
|
||||
@ -73,4 +72,4 @@ public val RangeValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -21,13 +21,11 @@ public external interface ThreeCanvasProps : Props {
|
||||
public var selected: Name?
|
||||
}
|
||||
|
||||
public val ThreeCanvasComponent: FunctionComponent<ThreeCanvasProps> = functionComponent(
|
||||
"ThreeCanvasComponent"
|
||||
) { props ->
|
||||
public val ThreeCanvasComponent: FC<ThreeCanvasProps> = fc("ThreeCanvasComponent") { props ->
|
||||
val elementRef = useRef<Element>(null)
|
||||
var canvas by useState<ThreeCanvas?>(null)
|
||||
|
||||
val three: ThreePlugin = useMemo(props.context){ props.context.fetch(ThreePlugin) }
|
||||
val three: ThreePlugin = useMemo(props.context) { props.context.fetch(ThreePlugin) }
|
||||
|
||||
useEffect(props.solid, props.options, elementRef) {
|
||||
if (canvas == null) {
|
||||
|
@ -28,7 +28,7 @@ public external interface ObjectTreeProps : Props {
|
||||
public var clickCallback: (Name) -> Unit
|
||||
}
|
||||
|
||||
private val TreeLabel = functionComponent<ObjectTreeProps> { props ->
|
||||
private val TreeLabel = fc<ObjectTreeProps> { props ->
|
||||
val token = useMemo(props.name) { props.name.lastOrNull()?.toString() ?: "World" }
|
||||
styledSpan {
|
||||
css {
|
||||
@ -107,14 +107,14 @@ private fun RBuilder.visionTree(props: ObjectTreeProps): Unit {
|
||||
}
|
||||
|
||||
@JsExport
|
||||
public val ObjectTree: FunctionComponent<ObjectTreeProps> = functionComponent("ObjectTree") { props ->
|
||||
public val ObjectTree: FC<ObjectTreeProps> = fc("ObjectTree") { props ->
|
||||
visionTree(props)
|
||||
}
|
||||
|
||||
public fun RBuilder.visionTree(
|
||||
vision: Vision,
|
||||
selected: Name? = null,
|
||||
clickCallback: (Name) -> Unit = {}
|
||||
clickCallback: (Name) -> Unit = {},
|
||||
) {
|
||||
child(ObjectTree) {
|
||||
attrs {
|
||||
|
@ -10,11 +10,11 @@ import kotlinx.html.js.onKeyDownFunction
|
||||
import org.w3c.dom.HTMLInputElement
|
||||
import org.w3c.dom.HTMLSelectElement
|
||||
import org.w3c.dom.events.Event
|
||||
import react.FunctionComponent
|
||||
import react.FC
|
||||
import react.Props
|
||||
import react.dom.attrs
|
||||
import react.dom.option
|
||||
import react.functionComponent
|
||||
import react.fc
|
||||
import react.useState
|
||||
import space.kscience.dataforge.meta.*
|
||||
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
|
||||
@ -36,8 +36,7 @@ public external interface ValueChooserProps : Props {
|
||||
}
|
||||
|
||||
@JsExport
|
||||
public val StringValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
functionComponent("StringValueChooser") { props ->
|
||||
public val StringValueChooser: FC<ValueChooserProps> = fc("StringValueChooser") { props ->
|
||||
var value by useState(props.actual.string ?: "")
|
||||
val keyDown: (Event) -> Unit = { event ->
|
||||
if (event.type == "keydown" && event.asDynamic().key == "Enter") {
|
||||
@ -58,11 +57,10 @@ public val StringValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
onChangeFunction = handleChange
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
public val BooleanValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
functionComponent("BooleanValueChooser") { props ->
|
||||
public val BooleanValueChooser: FC<ValueChooserProps> = fc("BooleanValueChooser") { props ->
|
||||
val handleChange: (Event) -> Unit = {
|
||||
val newValue = (it.target as HTMLInputElement).checked
|
||||
props.meta.value = newValue.asValue()
|
||||
@ -77,11 +75,10 @@ public val BooleanValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
onChangeFunction = handleChange
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
public val NumberValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
functionComponent("NumberValueChooser") { props ->
|
||||
public val NumberValueChooser: FC<ValueChooserProps> = fc("NumberValueChooser") { props ->
|
||||
var innerValue by useState(props.actual.string ?: "")
|
||||
val keyDown: (Event) -> Unit = { event ->
|
||||
if (event.type == "keydown" && event.asDynamic().key == "Enter") {
|
||||
@ -116,11 +113,10 @@ public val NumberValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
public val ComboValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
functionComponent("ComboValueChooser") { props ->
|
||||
public val ComboValueChooser: FC<ValueChooserProps> = fc("ComboValueChooser") { props ->
|
||||
var selected by useState(props.actual.string ?: "")
|
||||
val handleChange: (Event) -> Unit = {
|
||||
selected = (it.target as HTMLSelectElement).value
|
||||
@ -141,11 +137,10 @@ public val ComboValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
onChangeFunction = handleChange
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
public val ColorValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
functionComponent("ColorValueChooser") { props ->
|
||||
public val ColorValueChooser: FC<ValueChooserProps> = fc("ColorValueChooser") { props ->
|
||||
val handleChange: (Event) -> Unit = {
|
||||
props.meta.value = (it.target as HTMLInputElement).value.asValue()
|
||||
}
|
||||
@ -162,10 +157,10 @@ public val ColorValueChooser: FunctionComponent<ValueChooserProps> =
|
||||
onChangeFunction = handleChange
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
public val ValueChooser: FunctionComponent<ValueChooserProps> = functionComponent("ValueChooser") { props ->
|
||||
public val ValueChooser: FC<ValueChooserProps> = fc("ValueChooser") { props ->
|
||||
val rawInput by useState(false)
|
||||
|
||||
val descriptor = props.descriptor
|
||||
|
@ -5,7 +5,9 @@ plugins {
|
||||
val dataforgeVersion: String by rootProject.extra
|
||||
|
||||
kscience{
|
||||
useSerialization()
|
||||
useSerialization{
|
||||
json()
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
|
@ -71,17 +71,14 @@ public interface ValueChooser {
|
||||
|
||||
public companion object {
|
||||
|
||||
private fun findWidgetByType(context: Context, type: String): Factory? {
|
||||
return when (Name.parse(type)) {
|
||||
private fun findWidgetByType(context: Context, type: String): Factory? = when (Name.parse(type)) {
|
||||
TextValueChooser.name -> TextValueChooser
|
||||
ColorValueChooser.name -> ColorValueChooser
|
||||
ComboBoxValueChooser.name -> ComboBoxValueChooser
|
||||
else -> null//context.provideByType(type)//Search for additional factories in the plugin
|
||||
}
|
||||
}
|
||||
|
||||
private fun build(context: Context, descriptor: MetaDescriptor?): ValueChooser {
|
||||
return if (descriptor == null) {
|
||||
private fun build(context: Context, descriptor: MetaDescriptor?): ValueChooser = if (descriptor == null) {
|
||||
TextValueChooser();
|
||||
} else {
|
||||
val widgetType = descriptor.widgetType
|
||||
@ -100,7 +97,6 @@ public interface ValueChooser {
|
||||
chooser.descriptor = descriptor
|
||||
chooser
|
||||
}
|
||||
}
|
||||
|
||||
public fun build(
|
||||
context: Context,
|
||||
|
@ -42,6 +42,7 @@ public interface Point3D {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
|
||||
@Serializable(Point3DSerializer::class)
|
||||
public interface MutablePoint3D : Point3D {
|
||||
override var x: Float
|
||||
@ -56,7 +57,6 @@ internal object Point3DSerializer : KSerializer<Point3D> {
|
||||
|
||||
override val descriptor: SerialDescriptor = Point3DImpl.serializer().descriptor
|
||||
|
||||
|
||||
override fun deserialize(decoder: Decoder): MutablePoint3D = decoder.decodeSerializableValue(Point3DImpl.serializer())
|
||||
|
||||
override fun serialize(encoder: Encoder, value: Point3D) {
|
||||
|
Loading…
Reference in New Issue
Block a user