diff --git a/.gitignore b/.gitignore
index 4dc36cae..51dec909 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
*.iws
out/
.gradle
+.kotlin
build/
data/
.kotlin/
diff --git a/.space.kts b/.space.kts
deleted file mode 100644
index 45b2ed53..00000000
--- a/.space.kts
+++ /dev/null
@@ -1,4 +0,0 @@
-job("Build") {
- gradlew("openjdk:11", "build")
-}
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bf2c3478..2fa6c42d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,12 +1,54 @@
# Changelog
-## [Unreleased]
+## Unreleased
+
### Added
+
+### Changed
+
+### Deprecated
+
+### Removed
+
+### Fixed
+
+### Security
+
+## 0.4.1 - 2024-03-15
+
+### Changed
+
+- VisionProperties `flowChanges()` -> `changes`
+
+### Fixed
+
+- Bug with ElementVisionRenderer having the same name
+- Plotly update problem
+
+## 0.4.0 - 2024-02-16
+
+### Added
+
+- Added compose-mpp rendering.
+
+### Changed
+
+- **Breaking API** Move vision cache to upper level for renderers to avoid re-creating visions for page reload.
+- **Breaking API** Forms refactor.
+- **Breaking API** Migrated from React to Compose-html.
+- **Breaking API** changed js package for `visionforge-core` to `space.kscience.visionforge.html` to avoid mixing html and generic parts.
+
+## 0.3.0 - 2023-12-23
+
+### Added
+
- Context receivers flag
- MeshLine for thick lines
- Custom client-side events and thier processing in VisionServer
+- Control/input visions
### Changed
+
- Color accessor property is now `colorProperty`. Color uses non-nullable `invoke` instead of `set`.
- API update for server and pages
- Edges moved to solids module for easier construction
@@ -17,17 +59,14 @@
- Naming of Canvas3D options.
- Lights are added to the scene instead of 3D options.
-### Deprecated
-
-### Removed
-
### Fixed
+
- Jupyter integration for IDEA and Jupyter lab.
-### Security
+## 0.2.0
-## [0.2.0]
### Added
+
- Server module
- Change collector
- Customizable accessors for colors
@@ -38,8 +77,8 @@
- Markdown module
- Tables module
-
### Changed
+
- Vision does not implement ItemProvider anymore. Property changes are done via `getProperty`/`setProperty` and `property` delegate.
- Point3D and Point2D are made separate classes instead of expect/actual (to split up different engines.
- JavaFX support moved to a separate module
@@ -54,16 +93,10 @@
- Property listeners are not triggered if there are no changes.
- Feedback websocket connection in the client.
-
-### Deprecated
-
### Removed
+
- Primary modules dependencies on UI
-
### Fixed
+
- Version conflicts
-
-
-### Security
-
diff --git a/README.md b/README.md
index eeeaab9e..b75dcb55 100644
--- a/README.md
+++ b/README.md
@@ -61,157 +61,96 @@ To learn more about DataForge, please consult the following URLs:
## Modules contained in this repository
-
-* ### [cern-root-loader](cern-root-loader)
->
+### [cern-root-loader](cern-root-loader)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [demo](demo)
->
+### [demo](demo)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [jupyter](jupyter)
->
+### [visionforge-compose-html](visionforge-compose-html)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [ui](ui)
->
+### [visionforge-compose-multiplatform](visionforge-compose-multiplatform)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [visionforge-core](visionforge-core)
->
+### [visionforge-core](visionforge-core)
>
> **Maturity**: DEVELOPMENT
-
-* ### [visionforge-fx](visionforge-fx)
->
->
-> **Maturity**: PROTOTYPE
-
-
-* ### [visionforge-gdml](visionforge-gdml)
->
+### [visionforge-gdml](visionforge-gdml)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [visionforge-markdown](visionforge-markdown)
->
+### [visionforge-jupyter](visionforge-jupyter)
+> Common visionforge jupyter module
>
> **Maturity**: EXPERIMENTAL
-
-* ### [visionforge-plotly](visionforge-plotly)
->
+### [visionforge-markdown](visionforge-markdown)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [visionforge-server](visionforge-server)
->
+### [visionforge-plotly](visionforge-plotly)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [visionforge-solid](visionforge-solid)
->
+### [visionforge-server](visionforge-server)
+>
+> **Maturity**: EXPERIMENTAL
+
+### [visionforge-solid](visionforge-solid)
>
> **Maturity**: DEVELOPMENT
-
-* ### [visionforge-tables](visionforge-tables)
->
+### [visionforge-tables](visionforge-tables)
>
> **Maturity**: PROTOTYPE
-
-* ### [visionforge-threejs](visionforge-threejs)
->
+### [visionforge-threejs](visionforge-threejs)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [gdml](demo/gdml)
->
+### [demo/compose-desktop-demo](demo/compose-desktop-demo)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [js-playground](demo/js-playground)
->
+### [demo/gdml](demo/gdml)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [muon-monitor](demo/muon-monitor)
->
+### [demo/js-playground](demo/js-playground)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [playground](demo/playground)
->
+### [demo/muon-monitor](demo/muon-monitor)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [plotly-fx](demo/plotly-fx)
->
+### [demo/playground](demo/playground)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [sat-demo](demo/sat-demo)
->
+### [demo/sat-demo](demo/sat-demo)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [solid-showcase](demo/solid-showcase)
->
+### [demo/solid-showcase](demo/solid-showcase)
>
> **Maturity**: EXPERIMENTAL
-
-* ### [visionforge-jupyter-gdml](jupyter/visionforge-jupyter-gdml)
->
+### [visionforge-jupyter/visionforge-jupyter-common](visionforge-jupyter/visionforge-jupyter-common)
+> Jupyter api artifact including all common modules
>
> **Maturity**: EXPERIMENTAL
-
-* ### [bootstrap](ui/bootstrap)
->
+### [visionforge-threejs/visionforge-threejs-server](visionforge-threejs/visionforge-threejs-server)
>
> **Maturity**: EXPERIMENTAL
-
-
-* ### [react](ui/react)
->
->
-> **Maturity**: EXPERIMENTAL
-
-
-* ### [ring](ui/ring)
->
->
-> **Maturity**: EXPERIMENTAL
-
-
-* ### [visionforge-threejs-server](visionforge-threejs/visionforge-threejs-server)
->
->
-> **Maturity**: EXPERIMENTAL
-
**Class diagram:**
@@ -283,6 +222,21 @@ Visualization example for geometry defined as GDML file.
![](docs/images/gdml-demo.png)
+## Stability and documentation
+
+VisionForge is a modular library. Different modules provide different features with different API stability guarantees. All core modules are released with the same version, but with different API change policy. The features are described in module definitions below. The module stability could have the following levels:
+
+* **PROTOTYPE**. On this level there are no compatibility guarantees. All methods and classes form those modules could break any moment. You can still use it, but be sure to fix the specific version.
+* **EXPERIMENTAL**. The general API is decided, but some changes could be made. Volatile API is marked
+ with `@DFExperimental` or other stability warning annotations.
+* **DEVELOPMENT**. API breaking generally follows semantic versioning ideology. There could be changes in minor
+ versions, but not in patch versions. API is protected with [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) tool.
+* **STABLE**. The API stabilized. Breaking changes are allowed only in major releases.
+
+Additionally, one should note that the VisionForge Json format impacts the reproducibility of stored vision fragments. There should not be any breaks of the format between major releases. All problems should be reported.
+
+The documentation for the project is a work in progress. Please report any issues with missing, vague or wrong information. The contributions into documentation are quite welcome.
+
## Thanks and references
The original three.js bindings were made by [Lars Ivar Hatledal](https://github.com/markaren), but the project is discontinued right now.
diff --git a/build.gradle.kts b/build.gradle.kts
index 2da86b96..eb7e4fe4 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,18 +1,16 @@
-import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
import space.kscience.gradle.useApache2Licence
import space.kscience.gradle.useSPCTeam
plugins {
id("space.kscience.gradle.project")
-// id("org.jetbrains.kotlinx.kover") version "0.5.0"
+ id("org.jetbrains.kotlinx.kover") version "0.5.0"
}
-val dataforgeVersion by extra("0.6.2")
-val fxVersion by extra("11")
+val dataforgeVersion by extra("0.8.0")
allprojects {
group = "space.kscience"
- version = "0.3.0-dev-16"
+ version = "0.4.1"
}
subprojects {
@@ -32,11 +30,11 @@ subprojects {
}
}
- tasks.withType{
- kotlinOptions{
- useEsClasses = true
- }
- }
+// tasks.withType{
+// kotlinOptions{
+// useEsClasses = true
+// }
+// }
}
ksciencePublish {
diff --git a/cern-root-loader/api/cern-root-loader.api b/cern-root-loader/api/cern-root-loader.api
index 2788976b..7150af55 100644
--- a/cern-root-loader/api/cern-root-loader.api
+++ b/cern-root-loader/api/cern-root-loader.api
@@ -1,3 +1,77 @@
+public final class ru/mipt/npm/root/BMN {
+ public static final field INSTANCE Lru/mipt/npm/root/BMN;
+ public final fun getJson ()Lkotlinx/serialization/json/Json;
+ public final fun readEventJson (Ljava/lang/String;)Lru/mipt/npm/root/BmnEventContainer;
+}
+
+public final class ru/mipt/npm/root/BMNKt {
+ public static final fun toVector (Lru/mipt/npm/root/FairTrackParam;)Lspace/kscience/visionforge/solid/Float32Vector3D;
+}
+
+public final class ru/mipt/npm/root/BmnEventContainer {
+ public fun (Ljava/util/List;Ljava/util/List;)V
+ public final fun getBmnGlobalTracks ()Ljava/util/List;
+ public final fun getCbmTracks ()Ljava/util/List;
+}
+
+public final class ru/mipt/npm/root/BmnGlobalTrack {
+ public static final field Companion Lru/mipt/npm/root/BmnGlobalTrack$Companion;
+ public fun (Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;)V
+ public final fun component1 ()Lru/mipt/npm/root/FairTrackParam;
+ public final fun component2 ()Lru/mipt/npm/root/FairTrackParam;
+ public final fun copy (Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;)Lru/mipt/npm/root/BmnGlobalTrack;
+ public static synthetic fun copy$default (Lru/mipt/npm/root/BmnGlobalTrack;Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;ILjava/lang/Object;)Lru/mipt/npm/root/BmnGlobalTrack;
+ public fun equals (Ljava/lang/Object;)Z
+ public final fun getFParamFirst ()Lru/mipt/npm/root/FairTrackParam;
+ public final fun getFParamLast ()Lru/mipt/npm/root/FairTrackParam;
+ public fun hashCode ()I
+ public fun toString ()Ljava/lang/String;
+}
+
+public final class ru/mipt/npm/root/BmnGlobalTrack$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
+ public static final field INSTANCE Lru/mipt/npm/root/BmnGlobalTrack$$serializer;
+ public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/BmnGlobalTrack;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/BmnGlobalTrack;)V
+ public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
+}
+
+public final class ru/mipt/npm/root/BmnGlobalTrack$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public final class ru/mipt/npm/root/CbmStsTrack {
+ public static final field Companion Lru/mipt/npm/root/CbmStsTrack$Companion;
+ public fun (Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;)V
+ public final fun component1 ()Lru/mipt/npm/root/FairTrackParam;
+ public final fun component2 ()Lru/mipt/npm/root/FairTrackParam;
+ public final fun copy (Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;)Lru/mipt/npm/root/CbmStsTrack;
+ public static synthetic fun copy$default (Lru/mipt/npm/root/CbmStsTrack;Lru/mipt/npm/root/FairTrackParam;Lru/mipt/npm/root/FairTrackParam;ILjava/lang/Object;)Lru/mipt/npm/root/CbmStsTrack;
+ public fun equals (Ljava/lang/Object;)Z
+ public final fun getFParamFirst ()Lru/mipt/npm/root/FairTrackParam;
+ public final fun getFParamLast ()Lru/mipt/npm/root/FairTrackParam;
+ public fun hashCode ()I
+ public fun toString ()Ljava/lang/String;
+}
+
+public final class ru/mipt/npm/root/CbmStsTrack$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
+ public static final field INSTANCE Lru/mipt/npm/root/CbmStsTrack$$serializer;
+ public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/CbmStsTrack;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/CbmStsTrack;)V
+ public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
+}
+
+public final class ru/mipt/npm/root/CbmStsTrack$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
public final class ru/mipt/npm/root/DGeoBoolNode : ru/mipt/npm/root/DObject {
public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
public final fun getFLeft ()Lru/mipt/npm/root/DGeoShape;
@@ -6,6 +80,28 @@ public final class ru/mipt/npm/root/DGeoBoolNode : ru/mipt/npm/root/DObject {
public final fun getFRightMat ()Lru/mipt/npm/root/DGeoMatrix;
}
+public class ru/mipt/npm/root/DGeoCombiTrans : ru/mipt/npm/root/DGeoMatrix {
+ public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
+ public final fun getFRotation ()Lru/mipt/npm/root/DGeoRotation;
+ public final fun getFTranslation ()[D
+}
+
+public final class ru/mipt/npm/root/DGeoGenTrans : ru/mipt/npm/root/DGeoCombiTrans {
+ public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
+ public final fun getFScale ()[D
+}
+
+public final class ru/mipt/npm/root/DGeoHMatrix : ru/mipt/npm/root/DGeoMatrix {
+ public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
+ public final fun getFRotation ()Lru/mipt/npm/root/DGeoRotation;
+ public final fun getFScale ()[D
+ public final fun getFTranslation ()[D
+}
+
+public final class ru/mipt/npm/root/DGeoIdentity : ru/mipt/npm/root/DGeoMatrix {
+ public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
+}
+
public final class ru/mipt/npm/root/DGeoManager : ru/mipt/npm/root/DNamed {
public static final field Companion Lru/mipt/npm/root/DGeoManager$Companion;
public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
@@ -23,8 +119,8 @@ public final class ru/mipt/npm/root/DGeoMaterial : ru/mipt/npm/root/DNamed {
public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
}
-public class ru/mipt/npm/root/DGeoMatrix : ru/mipt/npm/root/DNamed {
- public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
+public abstract class ru/mipt/npm/root/DGeoMatrix : ru/mipt/npm/root/DNamed {
+ public synthetic fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
}
public final class ru/mipt/npm/root/DGeoMedium : ru/mipt/npm/root/DNamed {
@@ -38,7 +134,12 @@ public final class ru/mipt/npm/root/DGeoNode : ru/mipt/npm/root/DNamed {
public final fun getFVolume ()Lru/mipt/npm/root/DGeoVolume;
}
-public class ru/mipt/npm/root/DGeoScale : ru/mipt/npm/root/DGeoMatrix {
+public final class ru/mipt/npm/root/DGeoRotation : ru/mipt/npm/root/DGeoMatrix {
+ public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
+ public final fun getFRotationMatrix ()[D
+}
+
+public final class ru/mipt/npm/root/DGeoScale : ru/mipt/npm/root/DGeoMatrix {
public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
public final fun getFScale ()[D
public final fun getX ()D
@@ -53,6 +154,11 @@ public final class ru/mipt/npm/root/DGeoShape : ru/mipt/npm/root/DNamed {
public final fun getFDZ ()D
}
+public final class ru/mipt/npm/root/DGeoTranslation : ru/mipt/npm/root/DGeoMatrix {
+ public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
+ public final fun getFTranslation ()[D
+}
+
public final class ru/mipt/npm/root/DGeoVolume : ru/mipt/npm/root/DNamed, space/kscience/dataforge/misc/Named {
public fun (Lspace/kscience/dataforge/meta/Meta;Lru/mipt/npm/root/DObjectCache;)V
public final fun getFFillColor ()Ljava/lang/Integer;
@@ -94,7 +200,45 @@ public final class ru/mipt/npm/root/DObjectKt {
}
public final class ru/mipt/npm/root/DRootToSolidKt {
- public static final fun toSolid (Lru/mipt/npm/root/DGeoManager;)Lspace/kscience/visionforge/solid/SolidGroup;
+ public static final fun rootGeo (Lspace/kscience/visionforge/MutableVisionContainer;Lru/mipt/npm/root/DGeoManager;Ljava/lang/String;IZ)Lspace/kscience/visionforge/solid/SolidGroup;
+ public static synthetic fun rootGeo$default (Lspace/kscience/visionforge/MutableVisionContainer;Lru/mipt/npm/root/DGeoManager;Ljava/lang/String;IZILjava/lang/Object;)Lspace/kscience/visionforge/solid/SolidGroup;
+}
+
+public final class ru/mipt/npm/root/FairTrackParam {
+ public static final field Companion Lru/mipt/npm/root/FairTrackParam$Companion;
+ public fun (DDDDDD)V
+ public final fun component1 ()D
+ public final fun component2 ()D
+ public final fun component3 ()D
+ public final fun component4 ()D
+ public final fun component5 ()D
+ public final fun component6 ()D
+ public final fun copy (DDDDDD)Lru/mipt/npm/root/FairTrackParam;
+ public static synthetic fun copy$default (Lru/mipt/npm/root/FairTrackParam;DDDDDDILjava/lang/Object;)Lru/mipt/npm/root/FairTrackParam;
+ public fun equals (Ljava/lang/Object;)Z
+ public final fun getFQp ()D
+ public final fun getFTx ()D
+ public final fun getFTy ()D
+ public final fun getFX ()D
+ public final fun getFY ()D
+ public final fun getFZ ()D
+ public fun hashCode ()I
+ public fun toString ()Ljava/lang/String;
+}
+
+public final class ru/mipt/npm/root/FairTrackParam$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
+ public static final field INSTANCE Lru/mipt/npm/root/FairTrackParam$$serializer;
+ public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/FairTrackParam;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lru/mipt/npm/root/FairTrackParam;)V
+ public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
+}
+
+public final class ru/mipt/npm/root/FairTrackParam$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public final class ru/mipt/npm/root/RootColors {
@@ -108,7 +252,7 @@ public final class ru/mipt/npm/root/serialization/JsonToRootKt {
}
public final class ru/mipt/npm/root/serialization/RootToSolidKt {
- public static final fun toSolid (Lru/mipt/npm/root/serialization/TGeoManager;)Lspace/kscience/visionforge/solid/SolidGroup;
+ public static final fun rootGeo (Lspace/kscience/visionforge/MutableVisionContainer;Lru/mipt/npm/root/serialization/TGeoManager;)Lspace/kscience/visionforge/solid/SolidGroup;
}
public class ru/mipt/npm/root/serialization/TGeoBBox : ru/mipt/npm/root/serialization/TGeoShape {
@@ -119,12 +263,11 @@ public class ru/mipt/npm/root/serialization/TGeoBBox : ru/mipt/npm/root/serializ
public final fun getFDY ()D
public final fun getFDZ ()D
public final fun getFOrigin ()[D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoBBox;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoBBox;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoBBox$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoBBox$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoBBox;
@@ -145,7 +288,7 @@ public abstract class ru/mipt/npm/root/serialization/TGeoBoolNode : ru/mipt/npm/
public final fun getFLeftMat ()Lru/mipt/npm/root/serialization/TGeoMatrix;
public abstract fun getFRight ()Lru/mipt/npm/root/serialization/TGeoShape;
public final fun getFRightMat ()Lru/mipt/npm/root/serialization/TGeoMatrix;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoBoolNode;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoBoolNode;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoBoolNode$Companion {
@@ -154,17 +297,14 @@ public final class ru/mipt/npm/root/serialization/TGeoBoolNode$Companion {
public final class ru/mipt/npm/root/serialization/TGeoCombiTrans : ru/mipt/npm/root/serialization/TGeoMatrix {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoCombiTrans$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;[DLru/mipt/npm/root/serialization/TGeoRotation;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun ([DLru/mipt/npm/root/serialization/TGeoRotation;)V
public synthetic fun ([DLru/mipt/npm/root/serialization/TGeoRotation;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFRotation ()Lru/mipt/npm/root/serialization/TGeoRotation;
public final fun getFTranslation ()[D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoCombiTrans;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoCombiTrans$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoCombiTrans$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoCombiTrans;
@@ -180,15 +320,12 @@ public final class ru/mipt/npm/root/serialization/TGeoCombiTrans$Companion {
public final class ru/mipt/npm/root/serialization/TGeoCompositeShape : ru/mipt/npm/root/serialization/TGeoBBox {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoCompositeShape$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DLru/mipt/npm/root/serialization/TGeoBoolNode;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (Lru/mipt/npm/root/serialization/TGeoBoolNode;)V
public final fun getFNode ()Lru/mipt/npm/root/serialization/TGeoBoolNode;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoCompositeShape;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoCompositeShape$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoCompositeShape$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoCompositeShape;
@@ -204,17 +341,14 @@ public final class ru/mipt/npm/root/serialization/TGeoCompositeShape$Companion {
public final class ru/mipt/npm/root/serialization/TGeoHMatrix : ru/mipt/npm/root/serialization/TGeoMatrix {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoHMatrix$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;[D[D[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun ([D[D[D)V
public final fun getFRotationMatrix ()[D
public final fun getFScale ()[D
public final fun getFTranslation ()[D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoHMatrix;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoHMatrix$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoHMatrix$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoHMatrix;
@@ -231,13 +365,10 @@ public final class ru/mipt/npm/root/serialization/TGeoHMatrix$Companion {
public final class ru/mipt/npm/root/serialization/TGeoIdentity : ru/mipt/npm/root/serialization/TGeoMatrix {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoIdentity$Companion;
public fun ()V
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoIdentity;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoIdentity$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoIdentity$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoIdentity;
@@ -253,16 +384,13 @@ public final class ru/mipt/npm/root/serialization/TGeoIdentity$Companion {
public final class ru/mipt/npm/root/serialization/TGeoIntersection : ru/mipt/npm/root/serialization/TGeoBoolNode {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoIntersection$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;)V
public fun getFLeft ()Lru/mipt/npm/root/serialization/TGeoShape;
public fun getFRight ()Lru/mipt/npm/root/serialization/TGeoShape;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoIntersection;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoIntersection$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoIntersection$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoIntersection;
@@ -279,17 +407,14 @@ public final class ru/mipt/npm/root/serialization/TGeoIntersection$Companion {
public final class ru/mipt/npm/root/serialization/TGeoManager : ru/mipt/npm/root/serialization/TNamed {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoManager$Companion;
public fun ()V
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lru/mipt/npm/root/serialization/TObjArray;Lru/mipt/npm/root/serialization/TObjArray;Lru/mipt/npm/root/serialization/TObjArray;Lru/mipt/npm/root/serialization/TObjArray;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFMatrices ()Lru/mipt/npm/root/serialization/TObjArray;
public final fun getFNodes ()Lru/mipt/npm/root/serialization/TObjArray;
public final fun getFShapes ()Lru/mipt/npm/root/serialization/TObjArray;
public final fun getFVolumes ()Lru/mipt/npm/root/serialization/TObjArray;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoManager;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoManager$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoManager$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoManager;
@@ -307,12 +432,11 @@ public class ru/mipt/npm/root/serialization/TGeoMaterial : ru/mipt/npm/root/seri
public static final field Companion Lru/mipt/npm/root/serialization/TGeoMaterial$Companion;
public fun ()V
public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoMaterial;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoMaterial;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoMaterial$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoMaterial$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoMaterial;
@@ -329,7 +453,7 @@ public final class ru/mipt/npm/root/serialization/TGeoMaterial$Companion {
public abstract class ru/mipt/npm/root/serialization/TGeoMatrix : ru/mipt/npm/root/serialization/TNamed {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoMatrix$Companion;
public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoMatrix;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoMatrix;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoMatrix$Companion {
@@ -338,17 +462,14 @@ public final class ru/mipt/npm/root/serialization/TGeoMatrix$Companion {
public final class ru/mipt/npm/root/serialization/TGeoMedium : ru/mipt/npm/root/serialization/TNamed {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoMedium$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;ILru/mipt/npm/root/serialization/TGeoMaterial;[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (ILru/mipt/npm/root/serialization/TGeoMaterial;[D)V
public final fun getFId ()I
public final fun getFMaterial ()Lru/mipt/npm/root/serialization/TGeoMaterial;
public final fun getFParams ()[D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoMedium;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoMedium$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoMedium$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoMedium;
@@ -365,13 +486,10 @@ public final class ru/mipt/npm/root/serialization/TGeoMedium$Companion {
public final class ru/mipt/npm/root/serialization/TGeoMixture : ru/mipt/npm/root/serialization/TGeoMaterial {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoMixture$Companion;
public fun ()V
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoMixture;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoMixture$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoMixture$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoMixture;
@@ -394,12 +512,11 @@ public class ru/mipt/npm/root/serialization/TGeoNode : ru/mipt/npm/root/serializ
public final fun getFNumber ()I
public final fun getFOverlaps ()[I
public final fun getFVolume ()Lru/mipt/npm/root/serialization/TGeoVolume;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoNode;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoNode;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoNode$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoNode$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoNode;
@@ -416,14 +533,11 @@ public final class ru/mipt/npm/root/serialization/TGeoNode$Companion {
public final class ru/mipt/npm/root/serialization/TGeoNodeMatrix : ru/mipt/npm/root/serialization/TGeoNode {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoNodeMatrix$Companion;
public fun ()V
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoVolume;II[ILru/mipt/npm/root/serialization/TGeoMatrix;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFMatrix ()Lru/mipt/npm/root/serialization/TGeoMatrix;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoNodeMatrix;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoNodeMatrix$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoNodeMatrix$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoNodeMatrix;
@@ -440,14 +554,11 @@ public final class ru/mipt/npm/root/serialization/TGeoNodeMatrix$Companion {
public final class ru/mipt/npm/root/serialization/TGeoNodeOffset : ru/mipt/npm/root/serialization/TGeoNode {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoNodeOffset$Companion;
public fun ()V
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoVolume;II[IDLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFOffset ()D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoNodeOffset;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoNodeOffset$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoNodeOffset$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoNodeOffset;
@@ -471,12 +582,11 @@ public class ru/mipt/npm/root/serialization/TGeoPcon : ru/mipt/npm/root/serializ
public final fun getFRmax ()[D
public final fun getFRmin ()[D
public final fun getFZ ()[D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoPcon;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoPcon;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoPcon$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoPcon$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoPcon;
@@ -495,12 +605,11 @@ public class ru/mipt/npm/root/serialization/TGeoPgon : ru/mipt/npm/root/serializ
public fun ()V
public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DIDD[D[D[DILkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFNedges ()I
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoPgon;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoPgon;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoPgon$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoPgon$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoPgon;
@@ -516,15 +625,12 @@ public final class ru/mipt/npm/root/serialization/TGeoPgon$Companion {
public final class ru/mipt/npm/root/serialization/TGeoRotation : ru/mipt/npm/root/serialization/TGeoMatrix {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoRotation$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun ([D)V
public final fun getFRotationMatrix ()[D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoRotation;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoRotation$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoRotation$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoRotation;
@@ -543,7 +649,7 @@ public abstract class ru/mipt/npm/root/serialization/TGeoShape : ru/mipt/npm/roo
public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;ILkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFShapeBits-pVg5ArA ()I
public final fun getFShapeId ()I
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoShape$Companion {
@@ -552,17 +658,14 @@ public final class ru/mipt/npm/root/serialization/TGeoShape$Companion {
public final class ru/mipt/npm/root/serialization/TGeoShapeAssembly : ru/mipt/npm/root/serialization/TGeoBBox {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoShapeAssembly$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DLru/mipt/npm/root/serialization/TGeoVolumeAssembly;ZLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;Z)V
public synthetic fun (Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFBBoxOK ()Z
public final fun getFVolume ()Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoShapeAssembly;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoShapeAssembly$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoShapeAssembly$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoShapeAssembly;
@@ -583,16 +686,13 @@ public final class ru/mipt/npm/root/serialization/TGeoShapeRef : ru/mipt/npm/roo
public final class ru/mipt/npm/root/serialization/TGeoSubtraction : ru/mipt/npm/root/serialization/TGeoBoolNode {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoSubtraction$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;)V
public fun getFLeft ()Lru/mipt/npm/root/serialization/TGeoShape;
public fun getFRight ()Lru/mipt/npm/root/serialization/TGeoShape;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoSubtraction;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoSubtraction$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoSubtraction$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoSubtraction;
@@ -608,15 +708,12 @@ public final class ru/mipt/npm/root/serialization/TGeoSubtraction$Companion {
public final class ru/mipt/npm/root/serialization/TGeoTranslation : ru/mipt/npm/root/serialization/TGeoMatrix {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoTranslation$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun ([D)V
public final fun getFTranslation ()[D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoTranslation;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoTranslation$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoTranslation$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoTranslation;
@@ -637,12 +734,11 @@ public class ru/mipt/npm/root/serialization/TGeoTube : ru/mipt/npm/root/serializ
public final fun getFDz ()D
public final fun getFRmax ()D
public final fun getFRmin ()D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoTube;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoTube;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoTube$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoTube$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoTube;
@@ -659,7 +755,6 @@ public final class ru/mipt/npm/root/serialization/TGeoTube$Companion {
public final class ru/mipt/npm/root/serialization/TGeoTubeSeg : ru/mipt/npm/root/serialization/TGeoTube {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoTubeSeg$Companion;
public fun (DDDDDDDDD)V
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DDDDDDDDDDDDDLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFC1 ()D
public final fun getFC2 ()D
public final fun getFCdfi ()D
@@ -669,12 +764,10 @@ public final class ru/mipt/npm/root/serialization/TGeoTubeSeg : ru/mipt/npm/root
public final fun getFS1 ()D
public final fun getFS2 ()D
public final fun getFSm ()D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoTubeSeg;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoTubeSeg$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoTubeSeg$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoTubeSeg;
@@ -690,16 +783,13 @@ public final class ru/mipt/npm/root/serialization/TGeoTubeSeg$Companion {
public final class ru/mipt/npm/root/serialization/TGeoUnion : ru/mipt/npm/root/serialization/TGeoBoolNode {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoUnion$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoMatrix;Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoShape;)V
public fun getFLeft ()Lru/mipt/npm/root/serialization/TGeoShape;
public fun getFRight ()Lru/mipt/npm/root/serialization/TGeoShape;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoUnion;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoUnion$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoUnion$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoUnion;
@@ -729,12 +819,11 @@ public class ru/mipt/npm/root/serialization/TGeoVolume : ru/mipt/npm/root/serial
public final fun getFNumber ()I
public final fun getFRefCount ()I
public final fun getFShape ()Lru/mipt/npm/root/serialization/TGeoShape;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoVolume;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoVolume;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoVolume$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoVolume$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoVolume;
@@ -752,12 +841,11 @@ public class ru/mipt/npm/root/serialization/TGeoVolumeAssembly : ru/mipt/npm/roo
public static final field Companion Lru/mipt/npm/root/serialization/TGeoVolumeAssembly$Companion;
public fun ()V
public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;ILjava/lang/Integer;Lkotlin/UInt;Ljava/lang/Integer;Ljava/lang/Integer;Lru/mipt/npm/root/serialization/TObjArray;Lru/mipt/npm/root/serialization/TGeoShape;Lru/mipt/npm/root/serialization/TGeoMedium;IIILkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoVolumeAssembly$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoVolumeAssembly$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoVolumeAssembly;
@@ -784,7 +872,6 @@ public final class ru/mipt/npm/root/serialization/TGeoVolumeRef : ru/mipt/npm/ro
public final class ru/mipt/npm/root/serialization/TGeoXtru : ru/mipt/npm/root/serialization/TGeoBBox {
public static final field Companion Lru/mipt/npm/root/serialization/TGeoXtru$Companion;
public fun (IID[D[D[D[D[D[D)V
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlin/UInt;IDDD[DIID[D[D[D[D[D[DLkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFNvert ()I
public final fun getFNz ()I
public final fun getFScale ()[D
@@ -794,12 +881,10 @@ public final class ru/mipt/npm/root/serialization/TGeoXtru : ru/mipt/npm/root/se
public final fun getFY0 ()[D
public final fun getFZ ()[D
public final fun getFZcurrent ()D
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TGeoXtru;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TGeoXtru$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TGeoXtru$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TGeoXtru;
@@ -815,15 +900,12 @@ public final class ru/mipt/npm/root/serialization/TGeoXtru$Companion {
public final class ru/mipt/npm/root/serialization/THashList : ru/mipt/npm/root/serialization/TObject {
public static final field Companion Lru/mipt/npm/root/serialization/THashList$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/util/List;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (Ljava/util/List;)V
public final fun getArr ()Ljava/util/List;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/THashList;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/THashList$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/THashList$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/THashList;
@@ -839,15 +921,12 @@ public final class ru/mipt/npm/root/serialization/THashList$Companion {
public final class ru/mipt/npm/root/serialization/TList : ru/mipt/npm/root/serialization/TObject {
public static final field Companion Lru/mipt/npm/root/serialization/TList$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/util/List;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (Ljava/util/List;)V
public final fun getArr ()Ljava/util/List;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TList;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TList$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TList$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TList;
@@ -867,12 +946,11 @@ public class ru/mipt/npm/root/serialization/TNamed : ru/mipt/npm/root/serializat
public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/lang/String;Ljava/lang/String;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFName ()Ljava/lang/String;
public final fun getFTitle ()Ljava/lang/String;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TNamed;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TNamed;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TNamed$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lru/mipt/npm/root/serialization/TNamed$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/root/serialization/TNamed;
@@ -888,14 +966,11 @@ public final class ru/mipt/npm/root/serialization/TNamed$Companion {
public final class ru/mipt/npm/root/serialization/TObjArray : ru/mipt/npm/root/serialization/TObject {
public static final field Companion Lru/mipt/npm/root/serialization/TObjArray$Companion;
- public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Ljava/util/List;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun (Ljava/util/List;)V
public final fun getArr ()Ljava/util/List;
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TObjArray;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;Lkotlinx/serialization/KSerializer;)V
}
public final class ru/mipt/npm/root/serialization/TObjArray$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
- public final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public synthetic fun (Lkotlinx/serialization/KSerializer;)V
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
@@ -917,7 +992,7 @@ public abstract class ru/mipt/npm/root/serialization/TObject {
public synthetic fun (ILkotlin/UInt;Lkotlin/UInt;Lkotlinx/serialization/internal/SerializationConstructorMarker;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getFBits-pVg5ArA ()I
public final fun getFUniqueID-pVg5ArA ()I
- public static final fun write$Self (Lru/mipt/npm/root/serialization/TObject;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+ public static final synthetic fun write$Self (Lru/mipt/npm/root/serialization/TObject;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/root/serialization/TObject$Companion {
diff --git a/cern-root-loader/src/commonMain/kotlin/ru/mipt/npm/root/dRootToSolid.kt b/cern-root-loader/src/commonMain/kotlin/ru/mipt/npm/root/dRootToSolid.kt
index 2c501fd7..e6536d6f 100644
--- a/cern-root-loader/src/commonMain/kotlin/ru/mipt/npm/root/dRootToSolid.kt
+++ b/cern-root-loader/src/commonMain/kotlin/ru/mipt/npm/root/dRootToSolid.kt
@@ -1,9 +1,6 @@
package ru.mipt.npm.root
-import space.kscience.dataforge.meta.Meta
-import space.kscience.dataforge.meta.double
-import space.kscience.dataforge.meta.int
-import space.kscience.dataforge.meta.set
+import space.kscience.dataforge.meta.*
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.parseAsName
import space.kscience.dataforge.names.plus
@@ -365,7 +362,7 @@ private fun buildVolume(volume: DGeoVolume, context: RootToSolidContext): Solid?
}
return if (group.children.isEmpty()) {
null
- } else if (group.items.size == 1 && group.properties.own == null) {
+ } else if (group.items.size == 1 && group.properties.own.isEmpty()) {
group.items.values.first().apply { parent = null }
} else {
group
diff --git a/demo/compose-desktop-demo/README.md b/demo/compose-desktop-demo/README.md
new file mode 100644
index 00000000..591acad6
--- /dev/null
+++ b/demo/compose-desktop-demo/README.md
@@ -0,0 +1,4 @@
+# Module compose-desktop-demo
+
+
+
diff --git a/demo/compose-desktop-demo/api/compose-desktop-demo.api b/demo/compose-desktop-demo/api/compose-desktop-demo.api
new file mode 100644
index 00000000..7a968e47
--- /dev/null
+++ b/demo/compose-desktop-demo/api/compose-desktop-demo.api
@@ -0,0 +1,17 @@
+public final class ComposableSingletons$MainKt {
+ public static final field INSTANCE LComposableSingletons$MainKt;
+ public static field lambda-1 Lkotlin/jvm/functions/Function2;
+ public static field lambda-2 Lkotlin/jvm/functions/Function3;
+ public static field lambda-3 Lkotlin/jvm/functions/Function3;
+ public fun ()V
+ public final fun getLambda-1$compose_desktop_demo ()Lkotlin/jvm/functions/Function2;
+ public final fun getLambda-2$compose_desktop_demo ()Lkotlin/jvm/functions/Function3;
+ public final fun getLambda-3$compose_desktop_demo ()Lkotlin/jvm/functions/Function3;
+}
+
+public final class MainKt {
+ public static final fun App (Landroidx/compose/runtime/Composer;I)V
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
diff --git a/demo/compose-desktop-demo/build.gradle.kts b/demo/compose-desktop-demo/build.gradle.kts
new file mode 100644
index 00000000..ff6bc292
--- /dev/null
+++ b/demo/compose-desktop-demo/build.gradle.kts
@@ -0,0 +1,40 @@
+plugins {
+ id("space.kscience.gradle.mpp")
+ alias(spclibs.plugins.compose)
+}
+
+kscience {
+ jvm()
+ useCoroutines()
+
+ commonMain{
+ implementation(projects.visionforgeSolid)
+ }
+
+ jvmMain {
+ implementation(projects.visionforgeComposeMultiplatform)
+ }
+}
+
+kotlin{
+ explicitApi = null
+ sourceSets{
+ commonMain{
+ dependencies {
+ implementation(compose.desktop.currentOs)
+ api(compose.preview)
+ }
+ }
+ }
+}
+
+
+compose{
+ desktop{
+ desktop {
+ application {
+ mainClass = "MainKt"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/demo/compose-desktop-demo/src/jvmMain/kotlin/main.kt b/demo/compose-desktop-demo/src/jvmMain/kotlin/main.kt
new file mode 100644
index 00000000..c9a1b8d6
--- /dev/null
+++ b/demo/compose-desktop-demo/src/jvmMain/kotlin/main.kt
@@ -0,0 +1,33 @@
+import androidx.compose.desktop.ui.tooling.preview.Preview
+import androidx.compose.material.MaterialTheme
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.remember
+import androidx.compose.ui.window.Window
+import androidx.compose.ui.window.application
+import space.kscience.dataforge.meta.set
+import space.kscience.visionforge.compose.PropertyEditor
+import space.kscience.visionforge.solid.specifications.Canvas3DOptions
+
+@Composable
+@Preview
+fun App(){
+ val options = remember {
+ Canvas3DOptions{
+ meta["custom.field"] = 32
+ }
+ }
+ PropertyEditor(
+ properties = options.meta,
+ descriptor = Canvas3DOptions.descriptor,
+ expanded = true
+ )
+}
+
+
+fun main() = application {
+ Window(onCloseRequest = ::exitApplication) {
+ MaterialTheme {
+ App()
+ }
+ }
+}
diff --git a/demo/gdml/api/gdml.api b/demo/gdml/api/gdml.api
index 480385c3..1dba1ad6 100644
--- a/demo/gdml/api/gdml.api
+++ b/demo/gdml/api/gdml.api
@@ -1,21 +1,3 @@
-public final class space/kscience/visionforge/gdml/demo/GDMLDemoApp : tornadofx/App {
- public fun ()V
-}
-
-public final class space/kscience/visionforge/gdml/demo/GDMLView : tornadofx/View {
- public static final field Companion Lspace/kscience/visionforge/gdml/demo/GDMLView$Companion;
- public fun ()V
- public fun getRoot ()Ljavafx/scene/Parent;
-}
-
-public final class space/kscience/visionforge/gdml/demo/GDMLView$Companion {
-}
-
-public final class space/kscience/visionforge/gdml/demo/GdmlFxDemoAppKt {
- public static final fun main ()V
- public static synthetic fun main ([Ljava/lang/String;)V
-}
-
public final class space/kscience/visionforge/gdml/demo/ReadFileKt {
public static final fun readFile (Lspace/kscience/visionforge/VisionManager;Ljava/io/File;)Lspace/kscience/visionforge/Vision;
public static final fun readFile (Lspace/kscience/visionforge/VisionManager;Ljava/lang/String;)Lspace/kscience/visionforge/Vision;
diff --git a/demo/gdml/build.gradle.kts b/demo/gdml/build.gradle.kts
index 4cccf686..48a3298e 100644
--- a/demo/gdml/build.gradle.kts
+++ b/demo/gdml/build.gradle.kts
@@ -1,19 +1,23 @@
plugins {
id("space.kscience.gradle.mpp")
+ alias(spclibs.plugins.compose)
}
group = "demo"
kscience {
- jvm()
+// jvm()
js {
- useCommonJs()
browser {
binaries.executable()
- commonWebpackConfig {
- cssSupport {
- enabled.set(false)
+ commonWebpackConfig{
+ cssSupport{
+ enabled = true
}
+ scssSupport{
+ enabled = true
+ }
+ sourceMaps = true
}
}
}
@@ -21,14 +25,12 @@ kscience {
implementation(projects.visionforgeSolid)
implementation(projects.visionforgeGdml)
}
- jvmMain {
-// implementation(project(":visionforge-fx"))
- implementation(spclibs.logback.classic)
- }
+// jvmMain {
+//// implementation(project(":visionforge-fx"))
+// implementation(spclibs.logback.classic)
+// }
jsMain {
- implementation(projects.ui.ring)
implementation(projects.visionforgeThreejs)
- implementation(npm("react-file-drop", "3.0.6"))
}
}
@@ -36,30 +38,6 @@ kotlin {
explicitApi = null
}
-//kotlin {
-//
-// sourceSets {
-// commonMain {
-// dependencies {
-// implementation(project(":visionforge-solid"))
-// implementation(project(":visionforge-gdml"))
-// }
-// }
-// jvmMain {
-// dependencies {
-//// implementation(project(":visionforge-fx"))
-// implementation("ch.qos.logback:logback-classic:1.2.11")
-// }
-// }
-// jsMain {
-// dependencies {
-// implementation(project(":ui:ring"))
-// implementation(project(":visionforge-threejs"))
-// implementation(npm("react-file-drop", "3.0.6"))
-// }
-// }
-// }
-//}
//val convertGdmlToJson by tasks.creating(JavaExec::class) {
// group = "application"
diff --git a/demo/gdml/src/commonTest/kotlin/space/kscience/visionforge/gdml/GDMLVisionTest.kt b/demo/gdml/src/commonTest/kotlin/space/kscience/visionforge/gdml/GDMLVisionTest.kt
index ba9cb333..6ade4ec8 100644
--- a/demo/gdml/src/commonTest/kotlin/space/kscience/visionforge/gdml/GDMLVisionTest.kt
+++ b/demo/gdml/src/commonTest/kotlin/space/kscience/visionforge/gdml/GDMLVisionTest.kt
@@ -34,6 +34,6 @@ class GDMLVisionTest {
val child = cubes[Name.of("composite-000","segment-0")]
assertNotNull(child)
child.properties.setValue(SolidMaterial.MATERIAL_COLOR_KEY, "red".asValue())
- assertEquals("red", child.properties.getMeta(SolidMaterial.MATERIAL_COLOR_KEY).string)
+ assertEquals("red", child.properties[SolidMaterial.MATERIAL_COLOR_KEY].string)
}
}
\ No newline at end of file
diff --git a/demo/gdml/src/jsMain/kotlin/drop/FileDrop.kt b/demo/gdml/src/jsMain/kotlin/drop/FileDrop.kt
deleted file mode 100644
index 5116155b..00000000
--- a/demo/gdml/src/jsMain/kotlin/drop/FileDrop.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-@file:JsModule("react-file-drop")
-@file:JsNonModule
-
-package drop
-
-import org.w3c.dom.DragEvent
-import org.w3c.files.FileList
-import react.Component
-import react.Props
-import react.State
-
-sealed external class DropEffects {
- @JsName("copy")
- object Copy : DropEffects
-
- @JsName("move")
- object Move : DropEffects
-
- @JsName("link")
- object Link : DropEffects
-
- @JsName("none")
- object None : DropEffects
-}
-
-external interface FileDropProps : Props {
- var className: String?
- var targetClassName: String?
- var draggingOverFrameClassName: String?
- var draggingOverTargetClassName: String?
-
- // var frame?: Exclude | HTMLDocument;
- var onFrameDragEnter: ((event: DragEvent) -> Unit)?
- var onFrameDragLeave: ((event: DragEvent) -> Unit)?
- var onFrameDrop: ((event: DragEvent) -> Unit)?
-
- // var onDragOver: ReactDragEventHandler?
-// var onDragLeave: ReactDragEventHandler?
- var onDrop: ((files: FileList?, event: dynamic) -> Unit)?//event:DragEvent)
- var dropEffect: DropEffects?
-}
-
-external interface FileDropState : State {
- var draggingOverFrame: Boolean
- var draggingOverTarget: Boolean
-}
-
-external class FileDrop : Component {
- override fun render(): dynamic
-}
\ No newline at end of file
diff --git a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/FileDrop.kt b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/FileDrop.kt
new file mode 100644
index 00000000..3fdedb64
--- /dev/null
+++ b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/FileDrop.kt
@@ -0,0 +1,86 @@
+@file:OptIn(ExperimentalComposeWebApi::class)
+
+package space.kscience.visionforge.gdml.demo
+
+import androidx.compose.runtime.*
+import app.softwork.bootstrapcompose.Container
+import app.softwork.bootstrapcompose.Icon
+import org.jetbrains.compose.web.ExperimentalComposeWebApi
+import org.jetbrains.compose.web.attributes.InputType
+import org.jetbrains.compose.web.attributes.name
+import org.jetbrains.compose.web.css.*
+import org.jetbrains.compose.web.dom.Input
+import org.jetbrains.compose.web.dom.Text
+import org.w3c.files.FileList
+
+
+//https://codepen.io/zahedkamal87/pen/PobNNwE
+@Composable
+fun FileDrop(
+ title: String = "Drop files or Click here to select files to upload.",
+ onFileDrop: (FileList) -> Unit,
+) {
+ var dragOver by remember { mutableStateOf(false) }
+
+ Container(attrs = {
+ id("dropzone")
+ style {
+ border(
+ width = 0.2.cssRem,
+ style = LineStyle.Dashed,
+ color = Color("#6583fe")
+ )
+ padding(2.cssRem)
+ borderRadius(0.25.cssRem)
+ backgroundColor(Color("#fff"))
+ textAlign("center")
+ fontSize(1.5.cssRem)
+ transitions {
+ all {
+ delay(0.25.s)
+ timingFunction(AnimationTimingFunction.EaseInOut)
+ properties("background-color")
+ }
+ }
+ cursor("pointer")
+ }
+ listOf("drag", "dragstart", "dragend", "dragenter").forEach {
+ addEventListener(it) { event ->
+ event.preventDefault()
+ event.stopPropagation()
+ }
+ }
+ onDragOver { event ->
+ event.preventDefault()
+ event.stopPropagation()
+ dragOver = true
+ }
+ onDragLeave { event ->
+ event.preventDefault()
+ event.stopPropagation()
+ dragOver = false
+ }
+ onDrop { event ->
+ event.preventDefault()
+ event.stopPropagation()
+ dragOver = false
+ event.dataTransfer?.files?.let {
+ onFileDrop(it)
+ }
+ }
+ }) {
+ Icon("cloud-upload"){ classes("dropzone-icon") }
+ Text(title)
+ Input(type = InputType.File, attrs = {
+ style {
+ display(DisplayStyle.None)
+ }
+ classes("dropzone-input")
+ name("files")
+ })
+ }
+}
+//
+//dropzone.addEventListener("click", function(e) {
+// dropzone_input.click();
+//});
\ No newline at end of file
diff --git a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GDMLAppComponent.kt b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GDMLAppComponent.kt
index 37c178f4..56c408e6 100644
--- a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GDMLAppComponent.kt
+++ b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GDMLAppComponent.kt
@@ -1,46 +1,35 @@
package space.kscience.visionforge.gdml.demo
+import androidx.compose.runtime.*
import kotlinx.browser.window
-import kotlinx.coroutines.CompletableDeferred
-import kotlinx.coroutines.Deferred
-import kotlinx.css.*
+import org.jetbrains.compose.web.css.*
+import org.jetbrains.compose.web.dom.Div
+import org.jetbrains.compose.web.dom.P
+import org.jetbrains.compose.web.dom.Text
import org.w3c.files.File
import org.w3c.files.FileReader
import org.w3c.files.get
-import react.Props
-import react.dom.h2
-import react.fc
-import react.useState
+import space.kscience.dataforge.context.Context
import space.kscience.dataforge.names.Name
import space.kscience.gdml.Gdml
import space.kscience.gdml.decodeFromString
import space.kscience.visionforge.Colors
import space.kscience.visionforge.gdml.markLayers
import space.kscience.visionforge.gdml.toVision
-import space.kscience.visionforge.ring.ThreeCanvasWithControls
-import space.kscience.visionforge.ring.tab
import space.kscience.visionforge.setAsRoot
import space.kscience.visionforge.solid.Solid
-import space.kscience.visionforge.solid.Solids
import space.kscience.visionforge.solid.ambientLight
import space.kscience.visionforge.solid.invoke
-import styled.css
-import styled.styledDiv
+import space.kscience.visionforge.solid.three.compose.ThreeView
+import space.kscience.visionforge.visionManager
-external interface GDMLAppProps : Props {
- var solids: Solids
- var vision: Solid?
- var selected: Name?
-}
-@JsExport
-val GDMLApp = fc("GDMLApp") { props ->
- var deferredVision: Deferred by useState {
- CompletableDeferred(props.vision)
- }
+@Composable
+fun GDMLApp(context: Context, initialVision: Solid?, selected: Name? = null) {
+ var vision: Solid? by remember { mutableStateOf(initialVision) }
- fun readFileAsync(file: File): Deferred {
- val deferred = CompletableDeferred()
+ fun readFileAsync(file: File) {
+ val visionManager = context.visionManager
FileReader().apply {
onload = {
val data = result as String
@@ -49,7 +38,7 @@ val GDMLApp = fc("GDMLApp") { props ->
name.endsWith(".gdml") || name.endsWith(".xml") -> {
val gdml = Gdml.decodeFromString(data)
gdml.toVision().apply {
- setAsRoot(props.solids.visionManager)
+ setAsRoot(visionManager)
console.info("Marking layers for file $name")
markLayers()
ambientLight {
@@ -57,43 +46,38 @@ val GDMLApp = fc("GDMLApp") { props ->
}
}
}
- name.endsWith(".json") -> props.solids.visionManager.decodeFromString(data)
+
+ name.endsWith(".json") -> visionManager.decodeFromString(data)
else -> {
window.alert("File extension is not recognized: $name")
error("File extension is not recognized: $name")
}
}
- deferred.complete(parsedVision as? Solid ?: error("Parsed vision is not a solid"))
+ vision = parsedVision as? Solid ?: error("Parsed vision is not a solid")
+ Unit
}
readAsText(file)
}
-
- return deferred
}
- styledDiv {
- css {
- height = 100.vh - 12.pt
- width = 100.vw
+ Div({
+ style {
+ height(100.vh - 12.pt)
+ width(100.vw)
}
- child(ThreeCanvasWithControls) {
- attrs {
- this.solids = props.solids
- this.builderOfSolid = deferredVision
- this.selected = props.selected
- tab("Load") {
- h2 {
- +"Drag and drop .gdml or .json VisionForge files here"
- }
- fileDrop("(drag file here)") { files ->
- val file = files?.get(0)
- if (file != null) {
- deferredVision = readFileAsync(file)
- }
+ }) {
+ ThreeView(context, vision, selected) {
+ Tab("Load") {
+ P {
+ Text("Drag and drop .gdml or .json VisionForge files here")
+ }
+ FileDrop("(drag file here)") { files ->
+ val file = files[0]
+ if (file != null) {
+ readFileAsync(file)
}
}
}
-
}
}
}
diff --git a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt
index 7c6514bf..3f4d775c 100644
--- a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt
+++ b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt
@@ -1,63 +1,57 @@
package space.kscience.visionforge.gdml.demo
-import kotlinx.css.*
+import org.jetbrains.compose.web.css.*
+import org.jetbrains.compose.web.dom.Style
+import org.jetbrains.compose.web.renderComposable
import org.w3c.dom.Document
import space.kscience.dataforge.context.Context
-import space.kscience.dataforge.context.request
import space.kscience.gdml.GdmlShowCase
-import space.kscience.visionforge.Application
import space.kscience.visionforge.Colors
import space.kscience.visionforge.gdml.toVision
-import space.kscience.visionforge.react.createRoot
-import space.kscience.visionforge.react.render
-import space.kscience.visionforge.solid.Solids
+import space.kscience.visionforge.html.Application
+import space.kscience.visionforge.html.VisionForgeStyles
+import space.kscience.visionforge.html.startApplication
import space.kscience.visionforge.solid.ambientLight
import space.kscience.visionforge.solid.invoke
import space.kscience.visionforge.solid.three.ThreePlugin
-import space.kscience.visionforge.startApplication
-import styled.injectGlobal
private class GDMLDemoApp : Application {
+ val context = Context("gdml-demo") {
+ plugin(ThreePlugin)
+ }
+
override fun start(document: Document, state: Map) {
- val context = Context("gdml-demo"){
- plugin(ThreePlugin)
- }
-
- injectGlobal {
- html{
- height = 100.pct
- }
-
- body{
- height = 100.pct
- display = Display.flex
- alignItems = Align.stretch
- }
-
- "#application"{
- width = 100.pct
- display = Display.flex
- alignItems = Align.stretch
- }
- }
val element = document.getElementById("application") ?: error("Element with id 'application' not found on page")
- createRoot(element).render {
- child(GDMLApp) {
- val vision = GdmlShowCase.cubes().toVision().apply {
- ambientLight {
- color(Colors.white)
- }
+ val vision = GdmlShowCase.cubes().toVision().apply {
+ ambientLight {
+ color(Colors.white)
+ }
+ }
+
+ renderComposable(element) {
+ Style(VisionForgeStyles)
+ Style {
+ "html" {
+ height(100.percent)
}
- //println(context.plugins.fetch(VisionManager).encodeToString(vision))
- attrs {
- this.solids = context.request(Solids)
- this.vision = vision
+
+ "body" {
+ height(100.percent)
+ display(DisplayStyle.Flex)
+ alignItems(AlignItems.Stretch)
+ }
+
+ "#application" {
+ width(100.percent)
+ display(DisplayStyle.Flex)
+ alignItems(AlignItems.Stretch)
}
}
+ GDMLApp(context, vision)
}
}
}
diff --git a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/fileDrop.kt b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/fileDrop.kt
deleted file mode 100644
index 2478c3af..00000000
--- a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/fileDrop.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package space.kscience.visionforge.gdml.demo
-
-import drop.FileDrop
-import kotlinx.css.*
-import org.w3c.files.FileList
-import react.RBuilder
-import styled.css
-import styled.styledDiv
-
-//TODO move styles to inline
-
-fun RBuilder.fileDrop(title: String, action: (files: FileList?) -> Unit) {
- styledDiv {
- css {
- border = Border(style = BorderStyle.dashed, width = 1.px, color = Color.orange)
- flexGrow = 0.0
- alignContent = Align.center
- }
-
- child(FileDrop::class) {
- attrs {
- onDrop = { files, _ ->
- console.info("loaded $files")
- action(files)
- }
- }
- +title
- }
- }
-}
\ No newline at end of file
diff --git a/demo/gdml/webpack.config.d/01.ring.js b/demo/gdml/webpack.config.d/01.ring.js
deleted file mode 100644
index 41da041c..00000000
--- a/demo/gdml/webpack.config.d/01.ring.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
-
-config.module.rules.push(...ringConfig.module.rules)
\ No newline at end of file
diff --git a/demo/js-playground/build.gradle.kts b/demo/js-playground/build.gradle.kts
index eca736e4..86067e7a 100644
--- a/demo/js-playground/build.gradle.kts
+++ b/demo/js-playground/build.gradle.kts
@@ -1,5 +1,6 @@
plugins {
id("space.kscience.gradle.mpp")
+ alias(spclibs.plugins.compose)
}
kscience {
@@ -9,27 +10,26 @@ kscience {
kotlin {
explicitApi = null
js {
- useCommonJs()
browser {
binaries.executable()
- commonWebpackConfig {
- cssSupport {
- enabled.set(false)
+ commonWebpackConfig{
+ cssSupport{
+ enabled = true
}
+ scssSupport{
+ enabled = true
+ }
+ sourceMaps = true
}
}
}
}
kscience {
-
dependencies {
implementation(projects.visionforge.visionforgeGdml)
implementation(projects.visionforge.visionforgePlotly)
implementation(projects.visionforge.visionforgeMarkdown)
implementation(projects.visionforge.visionforgeThreejs)
}
- jsMain {
- implementation(projects.ui.ring)
- }
}
\ No newline at end of file
diff --git a/demo/js-playground/src/jsMain/kotlin/JsPlaygroundApp.kt b/demo/js-playground/src/jsMain/kotlin/JsPlaygroundApp.kt
index dd0d0b26..b544b17a 100644
--- a/demo/js-playground/src/jsMain/kotlin/JsPlaygroundApp.kt
+++ b/demo/js-playground/src/jsMain/kotlin/JsPlaygroundApp.kt
@@ -1,24 +1,20 @@
-import kotlinx.css.*
+import org.jetbrains.compose.web.css.*
+import org.jetbrains.compose.web.dom.Div
+import org.jetbrains.compose.web.renderComposable
import org.w3c.dom.Document
-import ringui.SmartTabs
-import ringui.Tab
import space.kscience.dataforge.context.Context
-import space.kscience.dataforge.context.request
import space.kscience.plotly.models.Trace
import space.kscience.plotly.scatter
-import space.kscience.visionforge.Application
import space.kscience.visionforge.Colors
-import space.kscience.visionforge.JsVisionClient
+import space.kscience.visionforge.html.Application
+import space.kscience.visionforge.html.Tabs
+import space.kscience.visionforge.html.VisionForgeStyles
+import space.kscience.visionforge.html.startApplication
+import space.kscience.visionforge.markup.MarkupPlugin
import space.kscience.visionforge.plotly.PlotlyPlugin
-import space.kscience.visionforge.react.createRoot
-import space.kscience.visionforge.react.render
-import space.kscience.visionforge.ring.ThreeCanvasWithControls
-import space.kscience.visionforge.ring.ThreeWithControlsPlugin
-import space.kscience.visionforge.ring.solid
import space.kscience.visionforge.solid.*
-import space.kscience.visionforge.startApplication
-import styled.css
-import styled.styledDiv
+import space.kscience.visionforge.solid.three.ThreePlugin
+import space.kscience.visionforge.solid.three.compose.ThreeView
import kotlin.random.Random
fun Trace.appendXYLatest(x: Number, y: Number, history: Int = 400, xErr: Number? = null, yErr: Number? = null) {
@@ -30,31 +26,32 @@ fun Trace.appendXYLatest(x: Number, y: Number, history: Int = 400, xErr: Number?
private class JsPlaygroundApp : Application {
+ val playgroundContext = Context {
+ plugin(ThreePlugin)
+ plugin(PlotlyPlugin)
+ plugin(MarkupPlugin)
+ }
+
override fun start(document: Document, state: Map) {
- val playgroundContext = Context {
- plugin(ThreeWithControlsPlugin)
- plugin(JsVisionClient)
- plugin(PlotlyPlugin)
- }
+// val solids = playgroundContext.request(Solids)
+// val client = playgroundContext.request(JsVisionClient)
val element = document.getElementById("playground") ?: error("Element with id 'playground' not found on page")
- createRoot(element).render {
- styledDiv {
- css {
- padding = Padding(0.pt)
- margin = Margin(0.pt)
- height = 100.vh
- width = 100.vw
+ renderComposable(element) {
+ Style(VisionForgeStyles)
+ Div({
+ style {
+ padding(0.pt)
+ margin(0.pt)
+ height(100.vh)
+ width(100.vw)
}
- SmartTabs("gravity") {
+ }) {
+ Tabs("gravity") {
Tab("gravity") {
- GravityDemo {
- attrs {
- this.solids = playgroundContext.request(Solids)
- }
- }
+ GravityDemo(playgroundContext)
}
// Tab("D0") {
@@ -66,43 +63,34 @@ private class JsPlaygroundApp : Application {
// }
// }
Tab("spheres") {
- styledDiv {
- css {
- height = 100.vh - 50.pt
+ Div({
+ style {
+ height(100.vh - 50.pt)
}
- child(ThreeCanvasWithControls) {
- val random = Random(112233)
- attrs {
- solids = playgroundContext.request(Solids)
- solid {
- ambientLight {
- color(Colors.white)
- }
- repeat(100) {
- sphere(5, name = "sphere[$it]") {
- x = random.nextDouble(-300.0, 300.0)
- y = random.nextDouble(-300.0, 300.0)
- z = random.nextDouble(-300.0, 300.0)
- material {
- color(random.nextInt())
- }
- detail = 16
- }
+ }) {
+ ThreeView(playgroundContext, SolidGroup {
+ ambientLight {
+ color(Colors.white)
+ }
+ repeat(100) {
+ sphere(5, name = "sphere[$it]") {
+ x = Random.nextDouble(-300.0, 300.0)
+ y = Random.nextDouble(-300.0, 300.0)
+ z = Random.nextDouble(-300.0, 300.0)
+ material {
+ color(Random.nextInt())
}
+ detail = 16
}
}
- }
+ })
}
}
Tab("plotly") {
- Plotly {
- attrs {
- plot = space.kscience.plotly.Plotly.plot {
- scatter {
- x(1, 2, 3)
- y(5, 8, 7)
- }
- }
+ Plot(playgroundContext) {
+ scatter {
+ x(1, 2, 3)
+ y(5, 8, 7)
}
}
}
@@ -110,6 +98,7 @@ private class JsPlaygroundApp : Application {
}
}
}
+
}
public fun main() {
diff --git a/demo/js-playground/src/jsMain/kotlin/gravityDemo.kt b/demo/js-playground/src/jsMain/kotlin/gravityDemo.kt
index a4bc9057..9a5089fa 100644
--- a/demo/js-playground/src/jsMain/kotlin/gravityDemo.kt
+++ b/demo/js-playground/src/jsMain/kotlin/gravityDemo.kt
@@ -1,110 +1,163 @@
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.remember
+import app.softwork.bootstrapcompose.Column
+import app.softwork.bootstrapcompose.Row
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
-import kotlinx.coroutines.launch
-import kotlinx.css.*
-import react.Props
-import react.fc
+import org.jetbrains.compose.web.css.*
+import org.jetbrains.compose.web.dom.AttrBuilderContext
+import org.jetbrains.compose.web.dom.Div
+import org.w3c.dom.HTMLDivElement
+import space.kscience.dataforge.context.Context
+import space.kscience.dataforge.meta.Meta
+import space.kscience.plotly.Plot
import space.kscience.plotly.layout
import space.kscience.plotly.models.Trace
import space.kscience.visionforge.Colors
+import space.kscience.visionforge.html.Vision
+import space.kscience.visionforge.html.zIndex
import space.kscience.visionforge.markup.VisionOfMarkup
-import space.kscience.visionforge.react.flexRow
-import space.kscience.visionforge.ring.ThreeCanvasWithControls
-import space.kscience.visionforge.ring.solid
+import space.kscience.visionforge.plotly.asVision
import space.kscience.visionforge.solid.*
-import styled.css
-import styled.styledDiv
+import space.kscience.visionforge.solid.three.compose.ThreeView
import kotlin.math.sqrt
-external interface DemoProps : Props {
- var solids: Solids
-}
+@Composable
+fun Plot(
+ context: Context,
+ meta: Meta = Meta.EMPTY,
+ attrs: AttrBuilderContext? = null,
+ block: Plot.() -> Unit,
+) = Vision(
+ context = context,
+ attrs = attrs,
+ meta = meta,
+ vision = Plot().apply(block).asVision()
+)
-val GravityDemo = fc { props ->
- val velocityTrace = Trace {
- name = "velocity"
- }
- val energyTrace = Trace {
- name = "energy"
- }
- val markup = VisionOfMarkup()
+@Composable
+fun Markup(
+ context: Context,
+ markup: VisionOfMarkup,
+ meta: Meta = Meta.EMPTY,
+ attrs: AttrBuilderContext? = null,
+) = Vision(
+ context = context,
+ attrs = attrs,
+ meta = meta,
+ vision = markup
+)
- styledDiv {
- css {
- height = 100.vh - 50.pt
+
+private val h = 100.0
+
+@Composable
+fun GravityDemo(context: Context) {
+ val velocityTrace = remember {
+ Trace {
+ name = "velocity"
}
- styledDiv {
- css {
- height = 50.vh
+ }
+
+ val energyTrace = remember {
+ Trace {
+ name = "energy"
+ }
+ }
+
+ val markup = remember { VisionOfMarkup() }
+
+ val solid = remember {
+ SolidGroup {
+ pointLight(200, 200, 200, name = "light") {
+ color(Colors.white)
}
- child(ThreeCanvasWithControls) {
- attrs {
- solids = props.solids
- solid {
- pointLight(200, 200, 200, name = "light"){
- color(Colors.white)
- }
- ambientLight()
+ ambientLight()
- sphere(5.0, "ball") {
- detail = 16
- color("red")
- val h = 100.0
- y = h
- solids.context.launch {
- val g = 10.0
- val dt = 0.1
- var time = 0.0
- var velocity = 0.0
- while (isActive) {
- delay(20)
- time += dt
- velocity -= g * dt
- val energy = g * y.toDouble() + velocity * velocity / 2
- y = y.toDouble() + velocity * dt
+ sphere(5.0, "ball") {
+ detail = 16
+ color("red")
+ y = h
- velocityTrace.appendXYLatest(time, y)
- energyTrace.appendXYLatest(time, energy)
- if (y.toDouble() <= 2.5) {
- //conservation of energy
- velocity = sqrt(2 * g * h)
- }
+ box(200, 5, 200, name = "floor") {
+ y = -2.5
+ }
+ }
+ }
+ }
- markup.content = """
- ## Bouncing sphere parameters
-
- **velocity** = $velocity
-
- **energy** = $energy
- """.trimIndent()
- }
- }
- }
+ LaunchedEffect(solid) {
+ val ball = solid["ball"]!!
+ val g = 10.0
+ val dt = 0.1
+ var time = 0.0
+ var velocity = 0.0
+ while (isActive) {
+ delay(20)
+ time += dt
+ velocity -= g * dt
+ val energy = g * ball.y.toDouble() + velocity * velocity / 2
+ ball.y = ball.y.toDouble() + velocity * dt
- box(200, 5, 200, name = "floor") {
- y = -2.5
- }
+ velocityTrace.appendXYLatest(time, ball.y)
+ energyTrace.appendXYLatest(time, energy)
+
+ if (ball.y.toDouble() <= 2.5) {
+ //conservation of energy
+ velocity = sqrt(2 * g * h)
+ }
+
+ markup.content = """
+ ## Bouncing sphere parameters
+
+ **velocity** = $velocity
+
+ **energy** = $energy
+ """.trimIndent()
+ }
+ }
+
+ Div({
+ style {
+ height(100.vh - 50.pt)
+ }
+ }) {
+ Div({
+ style {
+ height(50.vh)
+ }
+ }) {
+ ThreeView(context, solid)
+ }
+ Row(attrs = {
+ style {
+ alignContent(AlignContent.Stretch)
+ alignItems(AlignItems.Stretch)
+ height(50.vh - 50.pt)
+ }
+ }) {
+ Column {
+ Plot(context) {
+ traces(velocityTrace, energyTrace)
+ layout {
+ xaxis.title = "time"
}
}
}
- }
- flexRow {
- css {
- alignContent = Align.stretch
- alignItems = Align.stretch
- height = 50.vh - 50.pt
- }
- plotly {
- traces(velocityTrace, energyTrace)
- layout {
- xaxis.title = "time"
- }
- }
- Markup {
- attrs {
- this.markup = markup
- }
+ Column {
+ Markup(context, markup, attrs = {
+ style {
+ width(100.percent)
+ height(100.percent)
+ border(2.pt, LineStyle.Solid, Color.blue)
+ paddingLeft(8.pt)
+ backgroundColor(Color.white)
+ flex(1)
+ zIndex(10000)
+ }
+ })
}
}
}
diff --git a/demo/js-playground/src/jsMain/kotlin/markupComponent.kt b/demo/js-playground/src/jsMain/kotlin/markupComponent.kt
deleted file mode 100644
index a47c28cf..00000000
--- a/demo/js-playground/src/jsMain/kotlin/markupComponent.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-import kotlinx.css.*
-import kotlinx.dom.clear
-import kotlinx.html.dom.append
-import org.intellij.markdown.flavours.commonmark.CommonMarkFlavourDescriptor
-import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor
-import org.w3c.dom.Element
-import org.w3c.dom.HTMLElement
-import react.Props
-import react.fc
-import react.useEffect
-import react.useRef
-import space.kscience.visionforge.markup.VisionOfMarkup
-import space.kscience.visionforge.markup.markdown
-import space.kscience.visionforge.useProperty
-import styled.css
-import styled.styledDiv
-
-external interface MarkupProps : Props {
- var markup: VisionOfMarkup?
-}
-
-val Markup = fc("Markup") { props ->
- val elementRef = useRef(null)
-
- useEffect(props.markup, elementRef) {
- val element = elementRef.current as? HTMLElement ?: error("Markup element not found")
- props.markup?.let { vision ->
- val flavour = when (vision.format) {
- VisionOfMarkup.COMMONMARK_FORMAT -> CommonMarkFlavourDescriptor()
- VisionOfMarkup.GFM_FORMAT -> GFMFlavourDescriptor()
- //TODO add new formats via plugins
- else -> error("Format ${vision.format} not recognized")
- }
- vision.useProperty(VisionOfMarkup::content) { content: String? ->
- element.clear()
- element.append {
- markdown(flavour) { content ?: "" }
- }
- }
- }
- }
-
- styledDiv {
- css {
- width = 100.pct
- height = 100.pct
- border= Border(2.pt, BorderStyle.solid, Color.blue)
- padding = Padding(left = 8.pt)
- backgroundColor = Color.white
- flex = Flex(1.0)
- zIndex = 10000
- }
- ref = elementRef
- }
-}
\ No newline at end of file
diff --git a/demo/js-playground/src/jsMain/kotlin/plotlyComponent.kt b/demo/js-playground/src/jsMain/kotlin/plotlyComponent.kt
deleted file mode 100644
index 80417dde..00000000
--- a/demo/js-playground/src/jsMain/kotlin/plotlyComponent.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-import kotlinx.css.*
-import org.w3c.dom.Element
-import org.w3c.dom.HTMLElement
-import react.*
-import space.kscience.plotly.Plot
-import space.kscience.plotly.PlotlyConfig
-import space.kscience.plotly.plot
-import styled.css
-import styled.styledDiv
-
-external interface PlotlyProps : Props {
- var plot: Plot?
-}
-
-
-val Plotly = fc("Plotly") { props ->
- val elementRef = useRef(null)
-
- useEffect(props.plot, elementRef) {
- val element = elementRef.current as? HTMLElement ?: error("Plotly element not found")
- props.plot?.let {
- element.plot(PlotlyConfig {
- responsive = true
- }, it)
- }
- }
-
- styledDiv {
- css {
- width = 100.pct
- height = 100.pct
- border = Border(2.pt, BorderStyle.solid, Color.blue)
- flex = Flex(1.0)
- }
- ref = elementRef
- }
-}
-
-fun RBuilder.plotly(plotbuilder: Plot.() -> Unit) = Plotly {
- attrs {
- this.plot = Plot().apply(plotbuilder)
- }
-}
\ No newline at end of file
diff --git a/demo/js-playground/webpack.config.d/01.ring.js b/demo/js-playground/webpack.config.d/01.ring.js
deleted file mode 100644
index 41da041c..00000000
--- a/demo/js-playground/webpack.config.d/01.ring.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
-
-config.module.rules.push(...ringConfig.module.rules)
\ No newline at end of file
diff --git a/demo/muon-monitor/api/muon-monitor.api b/demo/muon-monitor/api/muon-monitor.api
index da3a84ed..24b6218c 100644
--- a/demo/muon-monitor/api/muon-monitor.api
+++ b/demo/muon-monitor/api/muon-monitor.api
@@ -1,6 +1,6 @@
public final class ru/mipt/npm/muon/monitor/Event {
+ public static final field $stable I
public static final field Companion Lru/mipt/npm/muon/monitor/Event$Companion;
- public synthetic fun (IILjava/util/List;Ljava/util/Collection;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
public fun (ILjava/util/List;Ljava/util/Collection;)V
public final fun component1 ()I
public final fun component2 ()Ljava/util/List;
@@ -13,12 +13,11 @@ public final class ru/mipt/npm/muon/monitor/Event {
public final fun getTrack ()Ljava/util/List;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
- public static final fun write$Self (Lru/mipt/npm/muon/monitor/Event;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class ru/mipt/npm/muon/monitor/Event$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
+ public static final field $stable I
public static final field INSTANCE Lru/mipt/npm/muon/monitor/Event$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lru/mipt/npm/muon/monitor/Event;
@@ -33,6 +32,7 @@ public final class ru/mipt/npm/muon/monitor/Event$Companion {
}
public final class ru/mipt/npm/muon/monitor/Model {
+ public static final field $stable I
public fun (Lspace/kscience/visionforge/VisionManager;)V
public final fun displayEvent (Lru/mipt/npm/muon/monitor/Event;)V
public final fun encodeToString ()Ljava/lang/String;
@@ -40,10 +40,10 @@ public final class ru/mipt/npm/muon/monitor/Model {
public final fun getRoot ()Lspace/kscience/visionforge/solid/SolidGroup;
public final fun getTracks ()Lspace/kscience/visionforge/solid/SolidGroup;
public final fun reset ()V
- public final fun setTracks (Lspace/kscience/visionforge/solid/SolidGroup;)V
}
public final class ru/mipt/npm/muon/monitor/Monitor {
+ public static final field $stable I
public static final field CENTRAL_LAYER_Z F
public static final field GEOMETRY_TOLERANCE D
public static final field INSTANCE Lru/mipt/npm/muon/monitor/Monitor;
@@ -61,9 +61,10 @@ public final class ru/mipt/npm/muon/monitor/ReadResourceKt {
}
public final class ru/mipt/npm/muon/monitor/SC1 {
- public fun (Ljava/lang/String;Lspace/kscience/visionforge/solid/Point3D;FFF)V
- public synthetic fun (Ljava/lang/String;Lspace/kscience/visionforge/solid/Point3D;FFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
- public final fun getCenter ()Lspace/kscience/visionforge/solid/Point3D;
+ public static final field $stable I
+ public fun (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;FFF)V
+ public synthetic fun (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;FFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public final fun getCenter ()Lspace/kscience/visionforge/solid/Float32Vector3D;
public final fun getName ()Ljava/lang/String;
public final fun getXSize ()F
public final fun getYSize ()F
@@ -71,8 +72,9 @@ public final class ru/mipt/npm/muon/monitor/SC1 {
}
public final class ru/mipt/npm/muon/monitor/SC16 {
- public fun (Ljava/lang/String;Lspace/kscience/visionforge/solid/Point3D;)V
- public final fun getCenter ()Lspace/kscience/visionforge/solid/Point3D;
+ public static final field $stable I
+ public fun (Ljava/lang/String;Lspace/kscience/visionforge/solid/Float32Vector3D;)V
+ public final fun getCenter ()Lspace/kscience/visionforge/solid/Float32Vector3D;
public final fun getName ()Ljava/lang/String;
public final fun getPixels ()Ljava/util/Collection;
}
@@ -80,11 +82,12 @@ public final class ru/mipt/npm/muon/monitor/SC16 {
public final class ru/mipt/npm/muon/monitor/server/MMServerKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
- public static final fun module (Lio/ktor/application/Application;Lspace/kscience/dataforge/context/Context;)V
- public static synthetic fun module$default (Lio/ktor/application/Application;Lspace/kscience/dataforge/context/Context;ILjava/lang/Object;)V
+ public static final fun module (Lio/ktor/server/application/Application;Lspace/kscience/dataforge/context/Context;)V
+ public static synthetic fun module$default (Lio/ktor/server/application/Application;Lspace/kscience/dataforge/context/Context;ILjava/lang/Object;)V
}
public final class ru/mipt/npm/muon/monitor/sim/Cos2TrackGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
+ public static final field $stable I
public fun (Lorg/apache/commons/math3/random/RandomGenerator;DFF)V
public synthetic fun (Lorg/apache/commons/math3/random/RandomGenerator;DFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun generate ()Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
@@ -95,6 +98,7 @@ public final class ru/mipt/npm/muon/monitor/sim/Cos2TrackGenerator : ru/mipt/npm
}
public final class ru/mipt/npm/muon/monitor/sim/FixedAngleGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
+ public static final field $stable I
public fun (Lorg/apache/commons/math3/random/RandomGenerator;DDFF)V
public synthetic fun (Lorg/apache/commons/math3/random/RandomGenerator;DDFFILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun generate ()Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
@@ -112,8 +116,8 @@ public final class ru/mipt/npm/muon/monitor/sim/LineKt {
public static final fun getY (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)D
public static final fun makeTrack (DDDD)Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
public static final fun makeTrack (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
- public static final fun toPoint (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lspace/kscience/visionforge/solid/Point3D;
- public static final fun toPoints (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)Ljava/util/List;
+ public static final fun toKMathVector (Lorg/apache/commons/math3/geometry/euclidean/threed/Vector3D;)Lspace/kscience/visionforge/solid/Float32Vector3D;
+ public static final fun toKMathVectors (Lorg/apache/commons/math3/geometry/euclidean/threed/Line;)Ljava/util/List;
}
public final class ru/mipt/npm/muon/monitor/sim/MonitorKt {
@@ -138,6 +142,7 @@ public abstract interface class ru/mipt/npm/muon/monitor/sim/TrackGenerator {
}
public final class ru/mipt/npm/muon/monitor/sim/UniformTrackGenerator : ru/mipt/npm/muon/monitor/sim/TrackGenerator {
+ public static final field $stable I
public fun (Lorg/apache/commons/math3/random/RandomGenerator;FF)V
public synthetic fun (Lorg/apache/commons/math3/random/RandomGenerator;FFILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun generate ()Lorg/apache/commons/math3/geometry/euclidean/threed/Line;
diff --git a/demo/muon-monitor/build.gradle.kts b/demo/muon-monitor/build.gradle.kts
index d01b9dc9..3893e40e 100644
--- a/demo/muon-monitor/build.gradle.kts
+++ b/demo/muon-monitor/build.gradle.kts
@@ -1,5 +1,6 @@
plugins {
id("space.kscience.gradle.mpp")
+ alias(spclibs.plugins.compose)
application
}
@@ -14,17 +15,22 @@ kscience {
fullStack(
"muon-monitor.js",
jvmConfig = { withJava() },
- jsConfig = { useCommonJs() }
- ) {
- commonWebpackConfig {
- cssSupport {
- enabled.set(false)
+// jsConfig = { useCommonJs() },
+ browserConfig = {
+ webpackTask{
+ cssSupport{
+ enabled = true
+ }
+ scssSupport{
+ enabled = true
+ }
}
}
- }
+ )
commonMain {
implementation(projects.visionforgeSolid)
+ implementation(projects.visionforgeComposeHtml)
}
jvmMain {
implementation("org.apache.commons:commons-math3:3.6.1")
@@ -34,13 +40,14 @@ kscience {
implementation("ch.qos.logback:logback-classic:1.2.11")
}
jsMain {
- implementation(projects.ui.ring)
implementation(projects.visionforgeThreejs)
//implementation(devNpm("webpack-bundle-analyzer", "4.4.0"))
}
}
+kotlin{
+ explicitApi = null
+}
-kotlin.explicitApi = null
application {
mainClass.set("ru.mipt.npm.muon.monitor.server.MMServerKt")
diff --git a/demo/muon-monitor/src/commonMain/kotlin/ru/mipt/npm/muon/monitor/Model.kt b/demo/muon-monitor/src/commonMain/kotlin/ru/mipt/npm/muon/monitor/Model.kt
index 7f7958b9..34b750e9 100644
--- a/demo/muon-monitor/src/commonMain/kotlin/ru/mipt/npm/muon/monitor/Model.kt
+++ b/demo/muon-monitor/src/commonMain/kotlin/ru/mipt/npm/muon/monitor/Model.kt
@@ -71,7 +71,7 @@ class Model(val manager: VisionManager) {
fun reset() {
map.values.forEach {
- it.properties.setMeta(SolidMaterial.MATERIAL_COLOR_KEY, null)
+ it.properties[SolidMaterial.MATERIAL_COLOR_KEY] = null
}
tracks.children.clear()
}
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 07dc7c7c..63924c42 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
@@ -1,281 +1,113 @@
package ru.mipt.npm.muon.monitor
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableStateListOf
+import androidx.compose.runtime.remember
+import app.softwork.bootstrapcompose.Button
+import app.softwork.bootstrapcompose.ButtonGroup
+import app.softwork.bootstrapcompose.Color.Secondary
+import app.softwork.bootstrapcompose.Container
+import app.softwork.bootstrapcompose.Layout.Width
import kotlinx.browser.window
-import kotlinx.coroutines.CompletableDeferred
-import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.await
import kotlinx.coroutines.launch
-import kotlinx.css.*
-import kotlinx.html.js.onClickFunction
import kotlinx.serialization.json.Json
+import org.jetbrains.compose.web.css.*
+import org.jetbrains.compose.web.dom.P
+import org.jetbrains.compose.web.dom.Span
+import org.jetbrains.compose.web.dom.Text
import org.w3c.fetch.RequestInit
-import react.Props
-import react.dom.attrs
-import react.dom.button
-import react.dom.p
-import react.fc
-import react.useMemo
-import react.useState
+import space.kscience.dataforge.context.Context
import space.kscience.dataforge.meta.invoke
import space.kscience.dataforge.names.Name
import space.kscience.visionforge.Colors
-import space.kscience.visionforge.react.flexColumn
-import space.kscience.visionforge.react.flexRow
-import space.kscience.visionforge.ring.ThreeCanvasWithControls
-import space.kscience.visionforge.ring.tab
-import space.kscience.visionforge.solid.Solids
import space.kscience.visionforge.solid.ambientLight
import space.kscience.visionforge.solid.edges
import space.kscience.visionforge.solid.invoke
import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-import styled.css
-import styled.styledDiv
-import styled.styledSpan
+import space.kscience.visionforge.solid.three.compose.ThreeView
import kotlin.math.PI
-external interface MMAppProps : Props {
- var model: Model
- var solids: Solids
- var selected: Name?
-}
+@Composable
+fun MMApp(context: Context, model: Model, selected: Name? = null) {
-@OptIn(DelicateCoroutinesApi::class)
-@JsExport
-val MMApp = fc("Muon monitor") { props ->
-
- val mmOptions = useMemo {
+ val mmOptions = remember {
Canvas3DOptions {
camera {
distance = 2100.0
latitude = PI / 6
azimuth = PI + PI / 6
}
-
}
}
- val root = useMemo(props.model) {
- props.model.root.apply {
+ val root = remember(model) {
+ model.root.apply {
edges()
- ambientLight{
+ ambientLight {
color(Colors.white)
}
}
}
- var events: Set by useState(emptySet())
+ val events = remember { mutableStateListOf() }
- styledDiv {
- css {
- height = 100.vh - 12.pt
+ Container(fluid = true,
+ attrs = {
+ style {
+ height(100.vh - 12.pt)
+ }
}
- child(ThreeCanvasWithControls) {
- attrs {
- this.solids = props.solids
- this.builderOfSolid = CompletableDeferred(root)
- this.selected = props.selected
- this.options = mmOptions
- tab("Events") {
- flexColumn {
- flexRow {
- button {
- +"Next"
- attrs {
- onClickFunction = {
- solids.context.launch {
- val event = window.fetch(
- "http://localhost:8080/event",
- RequestInit("GET")
- ).then { response ->
- if (response.ok) {
- response.text()
- } else {
- error("Failed to get event")
- }
- }.then { body ->
- Json.decodeFromString(Event.serializer(), body)
- }.await()
- events = events + event
- props.model.displayEvent(event)
- }
+ ) {
+ ThreeView(
+ context,
+ solid = root,
+ initialSelected = selected,
+ options = mmOptions,
+ sidebarTabs = {
+ Tab("Events") {
+ ButtonGroup({ Layout.width = Width.Full }) {
+ Button("Next") {
+ context.launch {
+ val event = window.fetch(
+ "http://localhost:8080/event",
+ RequestInit("GET")
+ ).then { response ->
+ if (response.ok) {
+ response.text()
+ } else {
+ error("Failed to get event")
}
- }
- }
- button {
- +"Clear"
- attrs {
- onClickFunction = {
- events = emptySet()
- props.model.reset()
- }
- }
+ }.then { body ->
+ Json.decodeFromString(Event.serializer(), body)
+ }.await()
+ events.add(event)
+ model.displayEvent(event)
}
}
+ Button("Clear", color = Secondary) {
+ events.clear()
+ model.reset()
+ }
}
+
events.forEach { event ->
- p {
- styledSpan {
- +event.id.toString()
+ P {
+ Span {
+ Text(event.id.toString())
}
- +" : "
- styledSpan {
- css {
- color = Color.blue
+ Text(" : ")
+ Span({
+ style {
+ color(Color.blue)
}
- +event.hits.toString()
+ }) {
+ Text(event.hits.toString())
}
}
}
}
}
-
- }
+ )
}
-
-// var selected by useState { props.selected }
-//
-// val onSelect: (Name?) -> Unit = {
-// selected = it
-// }
-//
-
-//
-// gridRow {
-// flexColumn {
-// css {
-// +"col-lg-3"
-// +"order-lg-1"
-// +"order-2"
-// padding(0.px)
-// overflowY = Overflow.auto
-// height = 100.vh
-// }
-// //tree
-// card("Object tree") {
-// css {
-// flex(1.0, 1.0, FlexBasis.auto)
-// }
-// visionTree(root, selected, onSelect)
-// }
-// }
-// flexColumn {
-// css {
-// +"col-lg-6"
-// +"order-lg-2"
-// +"order-1"
-// height = 100.vh
-// }
-// h1("mx-auto page-header") {
-// +"Muon monitor demo"
-// }
-// //canvas
-//
-// child(ThreeCanvasComponent) {
-// attrs {
-// this.context = props.context
-// this.solid = root
-// this.selected = selected
-// this.options = mmOptions
-// }
-// }
-// }
-// flexColumn {
-// css {
-// +"col-lg-3"
-// +"order-3"
-// padding(0.px)
-// height = 100.vh
-// }
-// styledDiv {
-// css {
-// flex(0.0, 1.0, FlexBasis.zero)
-// }
-// //settings
-// card("Canvas configuration") {
-// canvasControls(mmOptions, root)
-// }
-//
-// card("Events") {
-// button {
-// +"Next"
-// attrs {
-// onClickFunction = {
-// GlobalScope.launch {
-// val event = props.connection.get("http://localhost:8080/event")
-// props.model.displayEvent(event)
-// }
-// }
-// }
-// }
-// button {
-// +"Clear"
-// attrs {
-// onClickFunction = {
-// props.model.reset()
-// }
-// }
-// }
-// }
-// }
-// styledDiv {
-// css {
-// padding(0.px)
-// }
-// nav {
-// attrs {
-// attributes["aria-label"] = "breadcrumb"
-// }
-// ol("breadcrumb") {
-// li("breadcrumb-item") {
-// button(classes = "btn btn-link p-0") {
-// +"World"
-// attrs {
-// onClickFunction = {
-// selected = Name.EMPTY
-// }
-// }
-// }
-// }
-// if (selected != null) {
-// val tokens = ArrayList(selected?.length ?: 1)
-// selected?.tokens?.forEach { token ->
-// tokens.add(token)
-// val fullName = Name(tokens.toList())
-// li("breadcrumb-item") {
-// button(classes = "btn btn-link p-0") {
-// +token.toString()
-// attrs {
-// onClickFunction = {
-// console.log("Selected = $fullName")
-// selected = fullName
-// }
-// }
-// }
-// }
-// }
-// }
-// }
-// }
-// }
-// styledDiv {
-// css {
-// overflowY = Overflow.auto
-// }
-// //properties
-// card("Properties") {
-// selected.let { selected ->
-// val selectedObject: Vision? = when {
-// selected == null -> null
-// selected.isEmpty() -> root
-// else -> root[selected]
-// }
-// if (selectedObject != null) {
-// visionPropertyEditor(selectedObject, key = selected)
-// }
-// }
-// }
-// }
-// }
-//
-// }
}
\ No newline at end of file
diff --git a/demo/muon-monitor/src/jsMain/kotlin/ru/mipt/npm/muon/monitor/MMDemoApp.kt b/demo/muon-monitor/src/jsMain/kotlin/ru/mipt/npm/muon/monitor/MMDemoApp.kt
index afc9ce80..bf985b4c 100644
--- a/demo/muon-monitor/src/jsMain/kotlin/ru/mipt/npm/muon/monitor/MMDemoApp.kt
+++ b/demo/muon-monitor/src/jsMain/kotlin/ru/mipt/npm/muon/monitor/MMDemoApp.kt
@@ -1,15 +1,15 @@
package ru.mipt.npm.muon.monitor
+import org.jetbrains.compose.web.css.Style
+import org.jetbrains.compose.web.renderComposable
import org.w3c.dom.Document
import space.kscience.dataforge.context.Context
import space.kscience.dataforge.context.request
-import space.kscience.visionforge.Application
import space.kscience.visionforge.VisionManager
-import space.kscience.visionforge.react.createRoot
-import space.kscience.visionforge.react.render
-import space.kscience.visionforge.solid.Solids
+import space.kscience.visionforge.html.Application
+import space.kscience.visionforge.html.VisionForgeStyles
+import space.kscience.visionforge.html.startApplication
import space.kscience.visionforge.solid.three.ThreePlugin
-import space.kscience.visionforge.startApplication
private class MMDemoApp : Application {
@@ -23,14 +23,9 @@ private class MMDemoApp : Application {
val model = Model(visionManager)
- val element = document.getElementById("app") ?: error("Element with id 'app' not found on page")
- createRoot(element).render {
- child(MMApp) {
- attrs {
- this.model = model
- this.solids = context.request(Solids)
- }
- }
+ renderComposable("app") {
+ Style(VisionForgeStyles)
+ MMApp(context, model)
}
}
}
diff --git a/demo/muon-monitor/webpack.config.d/01.ring.js b/demo/muon-monitor/webpack.config.d/01.ring.js
deleted file mode 100644
index 41da041c..00000000
--- a/demo/muon-monitor/webpack.config.d/01.ring.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
-
-config.module.rules.push(...ringConfig.module.rules)
\ No newline at end of file
diff --git a/demo/playground/api/playground.api b/demo/playground/api/playground.api
index 7a050caa..e133494f 100644
--- a/demo/playground/api/playground.api
+++ b/demo/playground/api/playground.api
@@ -3,6 +3,36 @@ public final class space/kscience/visionforge/examples/AllThingsDemoKt {
public static synthetic fun main ([Ljava/lang/String;)V
}
+public final class space/kscience/visionforge/examples/AntennaKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
+public final class space/kscience/visionforge/examples/AxesKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
+public final class space/kscience/visionforge/examples/BmnDemoKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
+public final class space/kscience/visionforge/examples/ControlVisionKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
+public final class space/kscience/visionforge/examples/DynamicPlotlyVisionKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
+public final class space/kscience/visionforge/examples/ExtrudedKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
public final class space/kscience/visionforge/examples/FormServerKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
@@ -28,6 +58,11 @@ public final class space/kscience/visionforge/examples/GenerateSchemaKt {
public static synthetic fun main ([Ljava/lang/String;)V
}
+public final class space/kscience/visionforge/examples/MarkdownVisionKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
public final class space/kscience/visionforge/examples/PlotlyVisionKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
@@ -38,17 +73,24 @@ public final class space/kscience/visionforge/examples/RandomSpheresKt {
public static synthetic fun main ([Ljava/lang/String;)V
}
-public final class space/kscience/visionforge/examples/RootParserKt {
+public final class space/kscience/visionforge/examples/ServerExtensionsKt {
+ public static final fun makeVisionFile (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLspace/kscience/visionforge/html/HtmlVisionFragment;)V
+ public static synthetic fun makeVisionFile$default (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLspace/kscience/visionforge/html/HtmlVisionFragment;ILjava/lang/Object;)V
+ public static final fun serve (Ljava/lang/String;ZLspace/kscience/visionforge/html/HtmlVisionFragment;)V
+ public static synthetic fun serve$default (Ljava/lang/String;ZLspace/kscience/visionforge/html/HtmlVisionFragment;ILjava/lang/Object;)V
+}
+
+public final class space/kscience/visionforge/examples/ShapesKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
}
-public final class space/kscience/visionforge/examples/ServerExtensionsKt {
- public static final fun makeVisionFile (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLkotlin/jvm/functions/Function1;)V
- public static synthetic fun makeVisionFile$default (Ljava/nio/file/Path;Ljava/lang/String;Lspace/kscience/visionforge/html/ResourceLocation;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
+public final class space/kscience/visionforge/examples/SimpleCubeKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
}
-public final class space/kscience/visionforge/examples/SimpleCubeKt {
+public final class space/kscience/visionforge/examples/SurfaceKt {
public static final fun main ()V
public static synthetic fun main ([Ljava/lang/String;)V
}
diff --git a/demo/playground/build.gradle.kts b/demo/playground/build.gradle.kts
index c51f6691..71004852 100644
--- a/demo/playground/build.gradle.kts
+++ b/demo/playground/build.gradle.kts
@@ -14,16 +14,15 @@ repositories {
kotlin {
js(IR) {
- useCommonJs()
browser {
webpackTask {
- mainOutputFileName.set("js/visionforge-playground.js")
- }
- commonWebpackConfig {
- sourceMaps = true
cssSupport{
- enabled.set(false)
+ enabled = true
}
+ scssSupport{
+ enabled = true
+ }
+ mainOutputFileName.set("js/visionforge-playground.js")
}
}
binaries.executable()
@@ -57,7 +56,6 @@ kotlin {
val jsMain by getting {
dependencies {
- implementation(projects.ui.ring)
implementation(projects.visionforgeThreejs)
compileOnly(npm("webpack-bundle-analyzer","4.5.0"))
}
diff --git a/demo/playground/notebooks/common-demo.ipynb b/demo/playground/notebooks/common-demo.ipynb
index 78797545..caa7306f 100644
--- a/demo/playground/notebooks/common-demo.ipynb
+++ b/demo/playground/notebooks/common-demo.ipynb
@@ -54,9 +54,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "jupyter": {
- "outputs_hidden": false
- },
"tags": []
},
"outputs": [],
@@ -83,9 +80,6 @@
"language": "kotlin",
"name": "kotlin"
},
- "ktnbPluginMetadata": {
- "isAddProjectLibrariesToClasspath": false
- },
"language_info": {
"codemirror_mode": "text/x-kotlin",
"file_extension": ".kt",
@@ -94,6 +88,9 @@
"nbconvert_exporter": "",
"pygments_lexer": "kotlin",
"version": "1.8.20"
+ },
+ "ktnbPluginMetadata": {
+ "projectLibraries": []
}
},
"nbformat": 4,
diff --git a/demo/playground/notebooks/controls.ipynb b/demo/playground/notebooks/controls.ipynb
new file mode 100644
index 00000000..8552a178
--- /dev/null
+++ b/demo/playground/notebooks/controls.ipynb
@@ -0,0 +1,45 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "USE(JupyterCommonIntegration())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
+ "source": [],
+ "metadata": {
+ "collapsed": false
+ }
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Kotlin",
+ "language": "kotlin",
+ "name": "kotlin"
+ },
+ "language_info": {
+ "name": "kotlin",
+ "version": "1.9.0",
+ "mimetype": "text/x-kotlin",
+ "file_extension": ".kt",
+ "pygments_lexer": "kotlin",
+ "codemirror_mode": "text/x-kotlin",
+ "nbconvert_exporter": ""
+ },
+ "ktnbPluginMetadata": {
+ "projectDependencies": true
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/demo/playground/notebooks/dynamic-demo.ipynb b/demo/playground/notebooks/dynamic-demo.ipynb
index ac70b4c2..3fcd31e3 100644
--- a/demo/playground/notebooks/dynamic-demo.ipynb
+++ b/demo/playground/notebooks/dynamic-demo.ipynb
@@ -25,10 +25,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false,
- "jupyter": {
- "outputs_hidden": false
- }
+ "collapsed": false
},
"outputs": [],
"source": [
@@ -84,7 +81,7 @@
"version": "1.8.0-dev-3517"
},
"ktnbPluginMetadata": {
- "isAddProjectLibrariesToClasspath": false
+ "projectLibraries": []
}
},
"nbformat": 4,
diff --git a/demo/playground/src/jsMain/kotlin/playgroundMain.kt b/demo/playground/src/jsMain/kotlin/playgroundMain.kt
index feff4de1..1ae93b7f 100644
--- a/demo/playground/src/jsMain/kotlin/playgroundMain.kt
+++ b/demo/playground/src/jsMain/kotlin/playgroundMain.kt
@@ -1,14 +1,14 @@
import space.kscience.dataforge.misc.DFExperimental
+import space.kscience.visionforge.html.runVisionClient
import space.kscience.visionforge.jupyter.VFNotebookClient
import space.kscience.visionforge.markup.MarkupPlugin
import space.kscience.visionforge.plotly.PlotlyPlugin
-import space.kscience.visionforge.ring.ThreeWithControlsPlugin
-import space.kscience.visionforge.runVisionClient
+import space.kscience.visionforge.solid.three.ThreePlugin
import space.kscience.visionforge.tables.TableVisionJsPlugin
@DFExperimental
fun main() = runVisionClient {
- plugin(ThreeWithControlsPlugin)
+ plugin(ThreePlugin)
plugin(PlotlyPlugin)
plugin(MarkupPlugin)
plugin(TableVisionJsPlugin)
diff --git a/demo/playground/src/jvmMain/kotlin/allThingsDemo.kt b/demo/playground/src/jvmMain/kotlin/allThingsDemo.kt
index 5b272b72..9227f014 100644
--- a/demo/playground/src/jvmMain/kotlin/allThingsDemo.kt
+++ b/demo/playground/src/jvmMain/kotlin/allThingsDemo.kt
@@ -2,7 +2,6 @@ package space.kscience.visionforge.examples
import kotlinx.html.h2
import space.kscience.dataforge.meta.ValueType
-import space.kscience.dataforge.meta.invoke
import space.kscience.plotly.layout
import space.kscience.plotly.models.ScatterMode
import space.kscience.plotly.models.TextPosition
@@ -11,9 +10,9 @@ import space.kscience.tables.ColumnHeader
import space.kscience.visionforge.html.ResourceLocation
import space.kscience.visionforge.markup.markdown
import space.kscience.visionforge.plotly.plotly
+import space.kscience.visionforge.solid.axes
import space.kscience.visionforge.solid.box
import space.kscience.visionforge.solid.solid
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
import space.kscience.visionforge.solid.z
import space.kscience.visionforge.tables.columnTable
import kotlin.io.path.Path
@@ -34,14 +33,8 @@ fun main() = makeVisionFile(
h2 { +"3D visualization with Three-js" }
vision("3D") {
- solid(
- Canvas3DOptions {
- axes {
- size = 200.0
- visible = true
- }
- }
- ) {
+ solid {
+ axes(200)
box(100, 100, 100, name = "aBox") {
z = 50.0
}
diff --git a/demo/playground/src/jvmMain/kotlin/controlVision.kt b/demo/playground/src/jvmMain/kotlin/controlVision.kt
new file mode 100644
index 00000000..a0383ea2
--- /dev/null
+++ b/demo/playground/src/jvmMain/kotlin/controlVision.kt
@@ -0,0 +1,71 @@
+package space.kscience.visionforge.examples
+
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.isActive
+import kotlinx.coroutines.launch
+import kotlinx.html.h2
+import kotlinx.html.p
+import space.kscience.visionforge.VisionControlEvent
+import space.kscience.visionforge.html.*
+import space.kscience.visionforge.onSubmit
+import kotlin.time.Duration.Companion.seconds
+
+
+fun main() = serve {
+
+ val events = ArrayDeque(10)
+
+ val html = VisionOfPlainHtml()
+
+ fun pushEvent(event: VisionControlEvent) {
+ events.addFirst(event)
+ if (events.size >= 10) {
+ events.removeLast()
+ }
+ html.content {
+ events.forEach { event ->
+ p {
+ text(event.toString())
+ }
+ }
+ }
+ }
+ h2 { +"Control elements" }
+
+ vision {
+ htmlCheckBox {
+ checked = true
+ onValueChange(context) {
+ pushEvent(this)
+ }
+ }
+ }
+
+ vision {
+ htmlRangeField(1, 10) {
+ numberValue = 4
+ onValueChange(context) {
+ pushEvent(this)
+ }
+ context.launch {
+ while (isActive) {
+ delay(1.seconds)
+ numberValue = ((numberValue?.toInt() ?: 0) + 1) % 10
+ }
+ }
+ }
+ }
+
+
+ vision {
+ button("Click me") {
+ onSubmit(context) {
+ pushEvent(this)
+ }
+ }
+ }
+
+
+
+ vision(html)
+}
\ No newline at end of file
diff --git a/demo/playground/src/jvmMain/kotlin/dynamicPlotlyVision.kt b/demo/playground/src/jvmMain/kotlin/dynamicPlotlyVision.kt
new file mode 100644
index 00000000..818e1ccf
--- /dev/null
+++ b/demo/playground/src/jvmMain/kotlin/dynamicPlotlyVision.kt
@@ -0,0 +1,112 @@
+package space.kscience.visionforge.examples
+
+import io.ktor.server.cio.CIO
+import io.ktor.server.engine.embeddedServer
+import io.ktor.server.http.content.staticResources
+import io.ktor.server.routing.routing
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.isActive
+import kotlinx.coroutines.launch
+import kotlinx.html.a
+import kotlinx.html.h1
+import space.kscience.dataforge.context.Global
+import space.kscience.dataforge.context.request
+import space.kscience.plotly.layout
+import space.kscience.plotly.models.Trace
+import space.kscience.plotly.models.invoke
+import space.kscience.visionforge.html.VisionPage
+import space.kscience.visionforge.plotly.PlotlyPlugin
+import space.kscience.visionforge.plotly.plotly
+import space.kscience.visionforge.server.close
+import space.kscience.visionforge.server.openInBrowser
+import space.kscience.visionforge.server.visionPage
+import kotlin.math.PI
+import kotlin.math.cos
+import kotlin.math.sin
+
+fun main() {
+ val plotlyPlugin = Global.request(PlotlyPlugin)
+ val visionManager = plotlyPlugin.visionManager
+
+ val server = embeddedServer(CIO) {
+
+ routing {
+ staticResources("/", null)
+ }
+
+
+ val freq = 1.0 / 1000
+ val oscillationFreq = 1.0 / 10000
+
+ val x = (0..100).map { it.toDouble() / 100.0 }
+ val sinY = x.map { sin(2.0 * PI * it) }
+ val cosY = x.map { cos(2.0 * PI * it) }
+
+ val sinTrace = Trace(x, sinY) { name = "sin" }
+ val cosTrace = Trace(x, cosY) { name = "cos" }
+
+ visionPage(
+ visionManager,
+ VisionPage.scriptHeader("js/visionforge-playground.js"),
+ ) {
+
+ h1 { +"This is the plot page" }
+ a("/other") { +"The other page" }
+ vision {
+
+
+ plotly {
+ traces(sinTrace, cosTrace)
+ layout {
+ title = "Other dynamic plot"
+ xaxis.title = "x axis name"
+ yaxis.title = "y axis name"
+ }
+ }
+ }
+ }
+
+ visionPage(
+ visionManager,
+ VisionPage.scriptHeader("js/visionforge-playground.js"),
+ route = "other"
+ ) {
+ h1 { +"This is the other plot page" }
+ a("/") { +"Back to the main page" }
+ vision {
+ plotly {
+ traces(sinTrace)
+ layout {
+ title = "Dynamic plot"
+ xaxis.title = "x axis name"
+ yaxis.title = "y axis name"
+ }
+ }
+ }
+ }
+
+
+ //Start pushing updates
+ launch {
+ var time: Long = 0
+
+ while (isActive) {
+ delay(10)
+ time += 10
+ sinTrace.y.numbers = x.map { sin(2.0 * PI * (it + time.toDouble() * freq)) }
+ val cosAmp = cos(2.0 * PI * oscillationFreq * time)
+ cosTrace.y.numbers = x.map { cos(2.0 * PI * (it + time.toDouble() * freq)) * cosAmp }
+ }
+ }
+
+ }.start(false)
+
+
+ server.openInBrowser()
+
+ while (readlnOrNull() != "exit") {
+
+ }
+
+ server.close()
+}
diff --git a/demo/playground/src/jvmMain/kotlin/formServer.kt b/demo/playground/src/jvmMain/kotlin/formServer.kt
index d832d85a..c0539d0a 100644
--- a/demo/playground/src/jvmMain/kotlin/formServer.kt
+++ b/demo/playground/src/jvmMain/kotlin/formServer.kt
@@ -10,7 +10,7 @@ import space.kscience.dataforge.context.request
import space.kscience.visionforge.VisionManager
import space.kscience.visionforge.html.VisionOfHtmlForm
import space.kscience.visionforge.html.VisionPage
-import space.kscience.visionforge.html.bindForm
+import space.kscience.visionforge.html.visionOfForm
import space.kscience.visionforge.onPropertyChange
import space.kscience.visionforge.server.close
import space.kscience.visionforge.server.openInBrowser
@@ -36,7 +36,7 @@ fun main() {
visionManager,
VisionPage.scriptHeader("js/visionforge-playground.js"),
) {
- bindForm(form) {
+ visionOfForm(form) {
label {
htmlFor = "fname"
+"First name:"
@@ -67,15 +67,15 @@ fun main() {
value = "Submit"
}
}
- println(form.values)
vision(form)
+ println(form.values)
}
}.start(false)
server.openInBrowser()
- while (readln() != "exit") {
+ while (readlnOrNull() != "exit") {
}
diff --git a/demo/playground/src/jvmMain/kotlin/markdownVision.kt b/demo/playground/src/jvmMain/kotlin/markdownVision.kt
new file mode 100644
index 00000000..63edbcb6
--- /dev/null
+++ b/demo/playground/src/jvmMain/kotlin/markdownVision.kt
@@ -0,0 +1,19 @@
+package space.kscience.visionforge.examples
+
+import space.kscience.visionforge.html.ResourceLocation
+import space.kscience.visionforge.markup.markdown
+
+fun main() = makeVisionFile(resourceLocation = ResourceLocation.SYSTEM) {
+ vision {
+ markdown{
+ content = """
+ # h1 Heading 8-)
+ ## h2 Heading
+ ### h3 Heading
+ #### h4 Heading
+ ##### h5 Heading
+ ###### h6 Heading
+ """.trimIndent()
+ }
+ }
+}
\ No newline at end of file
diff --git a/demo/playground/webpack.config.d/01.ring.js b/demo/playground/webpack.config.d/01.ring.js
deleted file mode 100644
index b3cc4770..00000000
--- a/demo/playground/webpack.config.d/01.ring.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
-const path = require('path');
-
-config.module.rules.push(...ringConfig.module.rules)
-
-config.module.rules.push(
- {
- test: /\.css$/,
- exclude: [
- path.resolve(__dirname, "../../node_modules/@jetbrains/ring-ui")
- ],
- use: [
- {
- loader: 'style-loader',
- options: {}
- },
- {
- loader: 'css-loader',
- options: {}
- }
- ]
- }
-)
\ No newline at end of file
diff --git a/demo/sat-demo/api/sat-demo.api b/demo/sat-demo/api/sat-demo.api
index 00e5cedd..2fdc412b 100644
--- a/demo/sat-demo/api/sat-demo.api
+++ b/demo/sat-demo/api/sat-demo.api
@@ -3,3 +3,8 @@ public final class ru/mipt/npm/sat/SatServerKt {
public static synthetic fun main ([Ljava/lang/String;)V
}
+public final class ru/mipt/npm/sat/StaticKt {
+ public static final fun main ()V
+ public static synthetic fun main ([Ljava/lang/String;)V
+}
+
diff --git a/demo/sat-demo/build.gradle.kts b/demo/sat-demo/build.gradle.kts
index 5e881b63..9b6f63b9 100644
--- a/demo/sat-demo/build.gradle.kts
+++ b/demo/sat-demo/build.gradle.kts
@@ -1,5 +1,9 @@
+import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
+
+
plugins {
- id("space.kscience.gradle.jvm")
+ id("space.kscience.gradle.mpp")
+ alias(spclibs.plugins.ktor)
application
}
@@ -8,8 +12,10 @@ kscience {
// useSerialization {
// json()
// }
- useKtor()
- dependencies{
+ jvm{
+ withJava()
+ }
+ jvmMain{
implementation("io.ktor:ktor-server-cio")
implementation(projects.visionforgeThreejs.visionforgeThreejsServer)
implementation(spclibs.logback.classic)
@@ -18,6 +24,8 @@ kscience {
group = "center.sciprog"
+kotlin.explicitApi = ExplicitApiMode.Disabled
+
application {
mainClass.set("ru.mipt.npm.sat.SatServerKt")
}
diff --git a/demo/sat-demo/src/main/kotlin/ru/mipt/npm/sat/geometry.kt b/demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/geometry.kt
similarity index 100%
rename from demo/sat-demo/src/main/kotlin/ru/mipt/npm/sat/geometry.kt
rename to demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/geometry.kt
diff --git a/demo/sat-demo/src/main/kotlin/ru/mipt/npm/sat/satServer.kt b/demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/satServer.kt
similarity index 88%
rename from demo/sat-demo/src/main/kotlin/ru/mipt/npm/sat/satServer.kt
rename to demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/satServer.kt
index 9f2f7e59..af4fbca4 100644
--- a/demo/sat-demo/src/main/kotlin/ru/mipt/npm/sat/satServer.kt
+++ b/demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/satServer.kt
@@ -14,10 +14,12 @@ import space.kscience.dataforge.meta.Null
import space.kscience.dataforge.names.Name
import space.kscience.visionforge.Colors
import space.kscience.visionforge.html.VisionPage
+import space.kscience.visionforge.html.meta
import space.kscience.visionforge.server.close
import space.kscience.visionforge.server.openInBrowser
import space.kscience.visionforge.server.visionPage
import space.kscience.visionforge.solid.*
+import space.kscience.visionforge.solid.specifications.Canvas3DOptions
import space.kscience.visionforge.three.threeJsHeader
import kotlin.random.Random
@@ -47,7 +49,12 @@ fun main() {
) {
div("flex-column") {
h1 { +"Satellite detector demo" }
- vision { sat }
+ vision {
+ meta(Canvas3DOptions {
+ controls.enabled = false
+ })
+ sat
+ }
}
}
diff --git a/demo/sat-demo/src/main/kotlin/ru/mipt/npm/sat/static.kt b/demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/static.kt
similarity index 100%
rename from demo/sat-demo/src/main/kotlin/ru/mipt/npm/sat/static.kt
rename to demo/sat-demo/src/jvmMain/kotlin/ru/mipt/npm/sat/static.kt
diff --git a/demo/sat-demo/src/main/resources/css/styles.css b/demo/sat-demo/src/jvmMain/resources/css/styles.css
similarity index 100%
rename from demo/sat-demo/src/main/resources/css/styles.css
rename to demo/sat-demo/src/jvmMain/resources/css/styles.css
diff --git a/demo/solid-showcase/api/solid-showcase.api b/demo/solid-showcase/api/solid-showcase.api
index 4cc47c7d..8b5b3a52 100644
--- a/demo/solid-showcase/api/solid-showcase.api
+++ b/demo/solid-showcase/api/solid-showcase.api
@@ -1,20 +1,3 @@
-public final class space/kscience/visionforge/demo/MetaEditorDemo : tornadofx/View {
- public fun ()V
- public final fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
- public final fun getMeta ()Lspace/kscience/dataforge/meta/ObservableMutableMeta;
- public synthetic fun getRoot ()Ljavafx/scene/Parent;
- public fun getRoot ()Ljavafx/scene/control/SplitPane;
-}
-
-public final class space/kscience/visionforge/demo/MetaEditorDemoApp : tornadofx/App {
- public fun ()V
-}
-
-public final class space/kscience/visionforge/demo/MetaEditorDemoKt {
- public static final fun main ()V
- public static synthetic fun main ([Ljava/lang/String;)V
-}
-
public final class space/kscience/visionforge/solid/demo/DemoKt {
public static final fun demo (Lspace/kscience/visionforge/solid/demo/VisionLayout;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun demo$default (Lspace/kscience/visionforge/solid/demo/VisionLayout;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
@@ -23,25 +6,8 @@ public final class space/kscience/visionforge/solid/demo/DemoKt {
public static final fun showcaseCSG (Lspace/kscience/visionforge/solid/demo/VisionLayout;)V
}
-public final class space/kscience/visionforge/solid/demo/FXDemoApp : tornadofx/App {
- public fun ()V
- public final fun getView ()Lspace/kscience/visionforge/solid/demo/FXDemoGrid;
- public fun start (Ljavafx/stage/Stage;)V
-}
-
-public final class space/kscience/visionforge/solid/demo/FXDemoAppKt {
- public static final fun main ()V
- public static synthetic fun main ([Ljava/lang/String;)V
-}
-
-public final class space/kscience/visionforge/solid/demo/FXDemoGrid : tornadofx/View, space/kscience/visionforge/solid/demo/VisionLayout {
- public fun ()V
- public fun getRoot ()Ljavafx/scene/Parent;
- public synthetic fun render (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;)V
- public fun render (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/solid/Solid;Lspace/kscience/dataforge/meta/Meta;)V
-}
-
public abstract interface class space/kscience/visionforge/solid/demo/VisionLayout {
+ public abstract fun getSolids ()Lspace/kscience/visionforge/solid/Solids;
public abstract fun render (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;)V
public static synthetic fun render$default (Lspace/kscience/visionforge/solid/demo/VisionLayout;Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;ILjava/lang/Object;)V
}
diff --git a/demo/solid-showcase/build.gradle.kts b/demo/solid-showcase/build.gradle.kts
index 05a02260..f4a9820d 100644
--- a/demo/solid-showcase/build.gradle.kts
+++ b/demo/solid-showcase/build.gradle.kts
@@ -8,6 +8,16 @@ kscience {
jvm()
js{
binaries.executable()
+ browser{
+ commonWebpackConfig{
+ cssSupport{
+ enabled = true
+ }
+ scssSupport{
+ enabled = true
+ }
+ }
+ }
}
dependencies {
implementation(projects.visionforgeSolid)
diff --git a/demo/solid-showcase/src/commonMain/kotlin/space/kscience/visionforge/solid/demo/demo.kt b/demo/solid-showcase/src/commonMain/kotlin/space/kscience/visionforge/solid/demo/demo.kt
index 9e2ecedb..52a524e1 100644
--- a/demo/solid-showcase/src/commonMain/kotlin/space/kscience/visionforge/solid/demo/demo.kt
+++ b/demo/solid-showcase/src/commonMain/kotlin/space/kscience/visionforge/solid/demo/demo.kt
@@ -24,6 +24,11 @@ fun VisionLayout.demo(name: String, title: String = name, block: SolidGro
block()
ambientLight {
color(Colors.white)
+ intensity = 0.5
+ }
+ pointLight(0, 0, 1000) {
+ color(Colors.white)
+ intensity = 10.0
}
}
render(Name.parse(name), vision, meta)
@@ -33,10 +38,6 @@ val canvasOptions = Canvas3DOptions {
size {
minSize = 400
}
- axes {
- size = 500.0
- visible = true
- }
camera {
distance = 600.0
latitude = PI / 6
@@ -47,6 +48,8 @@ val canvasOptions = Canvas3DOptions {
fun VisionLayout.showcase() {
demo("shapes", "Basic shapes") {
ambientLight()
+ axes(size = 500.0)
+
box(100.0, 100.0, 100.0) {
z = -110.0
color("teal")
@@ -111,7 +114,7 @@ fun VisionLayout.showcase() {
GlobalScope.launch(Dispatchers.Main) {
while (isActive) {
delay(100)
- rotate((PI/20).radians,Euclidean3DSpace.yAxis)
+ rotate((PI / 20).radians, Euclidean3DSpace.yAxis)
}
}
color(Colors.red)
@@ -122,13 +125,16 @@ fun VisionLayout.showcase() {
demo("extrude", "extruded shape") {
extruded {
shape {
- polygon(8, 50)
+ polygon(32, 50)
}
for (i in 0..100) {
layer(i * 5, 20 * sin(2 * PI / 100 * i), 20 * cos(2 * PI / 100 * i))
}
- color(Colors.teal)
- rotationX = -PI / 2
+ rotationY = -PI / 2
+ material {
+ type = "lambert"
+ color(Colors.teal)
+ }
}
}
@@ -161,7 +167,15 @@ fun VisionLayout.showcase() {
}
demo("STL", "STL loaded from URL") {
- stl("https://ozeki.hu/attachments/116/Menger_sponge_sample.stl")
+ stl("Menger_sponge_sample.stl") {
+ scale(100f)
+ material {
+ type = "phong"
+ color("red")
+ specularColor("blue")
+ }
+ }
+ //stl("https://ozeki.hu/attachments/116/Menger_sponge_sample.stl")
}
}
diff --git a/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/ThreeDemoApp.kt b/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/ThreeDemoApp.kt
index 5bdbcefe..5be57d31 100644
--- a/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/ThreeDemoApp.kt
+++ b/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/ThreeDemoApp.kt
@@ -4,10 +4,10 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import org.w3c.dom.Document
-import space.kscience.visionforge.Application
+import space.kscience.visionforge.html.Application
+import space.kscience.visionforge.html.startApplication
import space.kscience.visionforge.solid.x
import space.kscience.visionforge.solid.y
-import space.kscience.visionforge.startApplication
import kotlin.random.Random
private class ThreeDemoApp : Application {
diff --git a/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/ThreeDemoGrid.kt b/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/ThreeDemoGrid.kt
index 50e7f174..8715f75d 100644
--- a/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/ThreeDemoGrid.kt
+++ b/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/ThreeDemoGrid.kt
@@ -72,7 +72,7 @@ class ThreeDemoGrid(element: Element) : VisionLayout {
}
}
val element = document.getElementById("output-$name") ?: error("Element not found")
- three.getOrCreateCanvas(element, canvasOptions)
+ ThreeCanvas(three, element, canvasOptions)
}.render(vision)
}
}
diff --git a/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/VariableBox.kt b/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/VariableBox.kt
index 701df81b..5787b6b3 100644
--- a/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/VariableBox.kt
+++ b/demo/solid-showcase/src/jsMain/kotlin/space/kscience/visionforge/solid/demo/VariableBox.kt
@@ -46,7 +46,7 @@ internal class VariableBox(val xSize: Number, val ySize: Number) : ThreeJsVision
mesh.scale.z = properties.getValue(VALUE)?.number?.toDouble() ?: 1.0
//add listener to object properties
- onPropertyChange { name ->
+ onPropertyChange(three.context) { name ->
when {
name == VALUE -> {
val value = properties.getValue(VALUE)?.int ?: 0
diff --git a/demo/solid-showcase/src/jsMain/resources/Menger_sponge_sample.stl b/demo/solid-showcase/src/jsMain/resources/Menger_sponge_sample.stl
new file mode 100644
index 00000000..dfebb0a3
Binary files /dev/null and b/demo/solid-showcase/src/jsMain/resources/Menger_sponge_sample.stl differ
diff --git a/docs/images/event-display-final.png b/docs/images/event-display-final.png
new file mode 100644
index 00000000..d492e15b
Binary files /dev/null and b/docs/images/event-display-final.png differ
diff --git a/docs/images/event-display-selection.png b/docs/images/event-display-selection.png
new file mode 100644
index 00000000..cb50a83e
Binary files /dev/null and b/docs/images/event-display-selection.png differ
diff --git a/docs/tutorials/tutorial-event-display.md b/docs/tutorials/tutorial-event-display.md
new file mode 100644
index 00000000..e257178d
--- /dev/null
+++ b/docs/tutorials/tutorial-event-display.md
@@ -0,0 +1,416 @@
+# Event Display Tutorial
+
+In this tutorial, we will explore properties of Visions and build a simple front-end application. You may find a complete project [here](https://git.sciprog.center/teldufalsari/visionforge-event-display-demo).
+
+__NOTE:__ You will need Kotlin Multiplatform 1.9.0 or higher to complete this tutorial!
+
+### Starting the Project
+
+We will use Idea's default project template for Kotlin Multiplatform. To initialize the project, go to *File -> New -> Project...*, Then choose *Full-Stack Web Application* project template and
+*Kotlin Gradle* build system. Then select *Next -> Finish*. You will end up with a project with some sample code.
+
+To check that everything is working correctly, run *application -> run* Gradle target. You should see a greeting page when you open `http://localhost:8080` in a web browser.
+
+We will use Kotlin React as our main UI library and Ktor Netty both as a web server. Our event display frontend and server will reside in `jsMain` and `jvmMain` directories respectively.
+Before we start, we have to load necessary dependencies:
+
+* Add SciProgCentre maven repo in `build.gradle.kts` file:
+```kotlin
+repositories {
+ mavenCentral()
+ maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
+
+ // Add either the line below:
+ maven("https://repo.kotlin.link")
+
+ // Or this line:
+ maven("https://maven.sciprog.center/kscience")
+
+}
+```
+
+* Add `visionforge-threejs-server` into the list of JS dependencies of your project:
+```kotlin
+kotlin {
+ sourceSets {
+ val jsMain by getting {
+ dependencies {
+ implementation("space.kscience:visionforge-threejs-server:0.3.0-dev-14")
+ }
+ }
+ }
+}
+```
+
+Refresh build model in the Idea to make sure the dependencies are successfully resolved.
+
+__NOTE:__ In previous versions of VisionForge, some imports may be broken. If these dependencies fail to resolve, replace `space.kscience:visionforge-threejs-server:0.3.0-dev-14` with `space.kscience:visionforge-threejs:0.3.0-dev-14`. The resulting bundle will lack a React component used in the tutorial (see "Managing Visions"). You may copy and paste it directly from either [VisionForge](https://git.sciprog.center/kscience/visionforge/src/branch/master/ui/react/src/main/kotlin/space/kscience/visionforge/react/ThreeCanvasComponent.kt) or the [tutorial repo](https://git.sciprog.center/teldufalsari/visionforge-event-display-demo/src/branch/main/src/jsMain/kotlin/canvas/ThreeCanvasComponent.kt), or even come up with a better implementation if your own.
+
+### Setting up Page Markup
+
+We need to create a page layout and set up Netty to serve our page to clients. There is nothing special related to VisionForge, so feel free to copy and paste the code below.
+
+File: `src/jvmMain/.../Server.kt`
+```kotlin
+// ... imports go here
+
+fun HTML.index() {
+ head {
+ // Compatibility headers
+ meta { charset = "UTF-8" }
+ meta {
+ name = "viewport"
+ content = "width=device-width, initial-scale=1.0"
+ }
+ meta {
+ httpEquiv = "X-UA-Compatible"
+ content = "IE=edge"
+ }
+ title("VF Demo")
+ }
+ // Link to our react script
+ body {
+ script(src = "/static/vf-demo.js") {}
+ }
+}
+
+fun main() {
+ // Seting up Netty
+ embeddedServer(Netty, port = 8080, host = "127.0.0.1") {
+ routing {
+ get("/") {
+ call.respondHtml(HttpStatusCode.OK, HTML::index)
+ }
+ static("/static") {
+ resources()
+ }
+ }
+ }.start(wait = true)
+}
+```
+
+File: `src/jsMain/.../Client.kt`
+```kotlin
+
+fun main() {
+ val container = document.createElement("div")
+ document.body!!.appendChild(container)
+
+ val eventDisplay = EventDisplay.create {}
+ createRoot(container).render(eventDisplay)
+}
+```
+
+File: `src/jsMain/.../Display.kt`
+```kotlin
+// All markup goes here:
+val EventDisplay = FC {
+ // Global CSS rules
+ Global {
+ styles {
+ "html,\n" +
+ "body" {
+ height = 100.vh
+ width = 100.vw
+ margin = 0.px
+ }
+ "body > div" {
+ height = 100.vh
+ width = 100.vw
+ display = Display.flex
+ flexDirection = FlexDirection.column
+ justifyContent = JustifyContent.start
+ alignItems = AlignItems.center
+ }
+ "*,\n" +
+ "*:before,\n" +
+ "*:after" {
+ boxSizing = BoxSizing.borderBox
+ }
+ }
+ }
+
+ div {
+ css {
+ height = 100.pct
+ width = 100.pct
+ display = Display.flex
+ flexDirection = FlexDirection.column
+ alignItems = AlignItems.center
+ }
+ div {
+ css {
+ width = 100.pct
+ display = Display.flex
+ flexDirection = FlexDirection.row
+ alignItems = AlignItems.center
+ justifyContent = JustifyContent.center
+
+ }
+ input {
+ css {
+ margin = 5.px
+ padding = 5.px
+ }
+ type = InputType.button
+ value = "Update Events"
+ }
+ input {
+ css {
+ margin = 5.px
+ padding = 5.px
+ }
+ type = InputType.button
+ value = "Update Geometry"
+ }
+ }
+ div {
+ css {
+ width = 98.pct
+ height = 1.pct
+ margin = 5.px
+ display = Display.flex
+ flexGrow = number(1.0)
+ justifyContent = JustifyContent.center
+ alignItems = AlignItems.center
+ backgroundColor = Color("#b3b3b3")
+ }
+
+ }
+ }
+}
+```
+
+After setting everything up, you should see a gray rectangle with two buttons above it when opening `localhost:8080`.
+
+### Managing Visions
+
+We are approaching the main part of the tutorial - the place where we will create a working demo. In particle accelerator experiments, event displays are employed to visualise particle collision events. Essentially, it requires drawing a detector setup and visual interpretation of events: tracks, detector hits etc. Usually, a number of events share a common detector setup (e.g. if these events occured in a single experiment run). It makes sense to update and re-render only event information, while keeping detector geometry constant between updates.
+
+Visions (namely, the `SolidGroup` class) allow us to create an object tree for our displayed event. `SolidGroup` can hold other Visions as its child nodes, access these nodes by names and update/delete them. We will use this property to update our event display efficiently.
+
+To display Visions as actual 3D object, we will use `ThreePlugin` that renders Visions using *three.js* library. The plugin allows us to create a Three.js representation of a vision that will observe changes of its correspondent Vision. This way we can update only Visions without diving deep into three.js stuff. Using observable Visions is also efficient: Three.js representations are not generated from scratch after each Vision update but are modified too.
+
+First, let's simulate data load operations:
+* Add state variables to our `EventDisplay` React component. These variables will be treated as data loaded from a remote server. In real life, these may be JSON string with event data:
+```kotlin
+val EventDisplay = FC {
+ // ...
+
+ var eventData: kotlin.Float? by useState(null)
+ var geometryData: kotlin.Float? by useState(null)
+
+ // ...
+}
+```
+* Write two simple functions that will convert data to a Vision. In this case, we will simply parameters of solids like color of size; in real life, these functions will usually take raw data and convert it into Visions.
+```kotlin
+fun generateEvents(radius: Float): SolidGroup {
+ val count = Random.nextInt(10, 20)
+ return SolidGroup {
+ repeat(count) {
+ sphere(radius) {
+ x = 5.0 * (Random.nextFloat() - 0.5)
+ y = 2.0 * (Random.nextFloat() - 0.5)
+ z = 2.0 * (Random.nextFloat() - 0.5)
+ color(Colors.red)
+ }
+ }
+ }
+}
+
+fun generateGeometry(distance: Float): SolidGroup {
+ return SolidGroup {
+ box(10, 3, 3) {
+ x = 0.0
+ y = -distance
+ z = 0.0
+ color(Colors.gray)
+ }
+ box(10, 3, 3) {
+ x = 0.0
+ y = distance
+ z = 0.0
+ color(Colors.gray)
+ }
+ }
+}
+```
+* Then, let's create our main Vision and add a static light source:
+```kotlin
+val EventDisplay = FC {
+ // ...
+
+ val containedVision: SolidGroup by useState(SolidGroup {
+ ambientLight {
+ color(Colors.white)
+ }
+ })
+
+ // ...
+}
+```
+
+* A `Context` object is required to hold plugins like `ThreePlugin`. It is also necessary to make Visions observable: we have to root our main Vision in the context. Declare a global `Context` in the same file with `EventDisplay` component:
+```kotlin
+val viewContext = Context {
+ plugin(Solids)
+ plugin(ThreePlugin)
+}
+
+```
+
+* Import `ThreeCanvasComponent` from VisionForge. This is a React component that handles all display work. It creates three.js canvas, attaches it to its own parent element and creates and draws `Object3D` on the canvas. We will attach this component to a
+separate React component. Note order for Visions to update their Three.js representations, these Visions need to be rooted in a `Context`. This way Visions will be observed for changes, and any such change will trigger an update of the corresponding Three.js object.
+```kotlin
+external interface EventViewProps: Props {
+ var displayedVision: Solid?
+ var context: Context
+}
+
+val EventView = FC { props ->
+ ThreeCanvasComponent {
+ solid = props.displayedVision
+ context = props.context
+ }
+ // Make displayedVision observed:
+ useEffect(props.displayedVision) {
+ props.displayedVision?.setAsRoot(props.context.visionManager)
+ }
+}
+```
+
+__NOTE:__ If you had problems with dependency resolution, `ThreeCanvasComponent` may missing from your import scope. You may find a compatible implementation [here](https://git.sciprog.center/teldufalsari/visionforge-event-display-demo/src/branch/main/src/jsMain/kotlin/canvas/ThreeCanvasComponent.kt).
+
+* Finally, we need to attach EventView to our main component and connect raw data updates to Vision updates using React hooks:
+```kotlin
+// ...
+
+// Names used as keys to access and update Visions
+// Refer to DataForge documentation for more details
+val EVENTS_NAME = "DEMO_EVENTS".parseAsName(false)
+val GEOMETRY_NAME = "DEMO_GEOMETRY".parseAsName(false)
+
+// ...
+
+val EventDisplay = FC {
+ // ...
+
+ useEffect(eventData) {
+ eventData?.let {
+ containedVision.setChild(EVENTS_NAME, generateEvents(it))
+ }
+ }
+ useEffect(geometryData) {
+ geometryData?.let {
+ containedVision.setChild(GEOMETRY_NAME, generateGeometry(it))
+ }
+ }
+ // ...
+
+ div {
+ // ...
+
+ div {
+ css {
+ width = 98.pct
+ height = 1.pct
+ flexGrow = number(1.0)
+ margin = 5.px
+ display = Display.flex
+ justifyContent = JustifyContent.center
+ alignItems = AlignItems.center
+ }
+ // Replace the gray rectangle with an EventView:
+ EventView {
+ displayedVision = containedVision
+ context = viewContext
+ }
+ }
+ }
+// ...
+}
+```
+
+When we press either of the buttons, corresponding raw data changes. This update triggers `UseEffect` hook, which generates new event or geometry data and replaces the old data in the main Vision. Three.js representation is then updated to match our new Vision, so that changes are visible on the canvas.
+
+Recompile the project and go on `http://localhost:8080`. See how the displayed scene changes with each click: for example, when you update geometry, only the distance between "magnets" varies, but spheres remain intact.
+
+### Clearing the Scene
+
+We can erase children Visions from the scene completely. To do so, we cat pass `null` to the function `setChild` as `child` argument. Add these lines to the hooks that update Visions to remove the corresponding Vision from our diplayed `SolidGroup` when raw data changes to `null`:
+```kotlin
+useEffect(eventData) {
+ // ...
+
+ if (eventData == null) {
+ containedVision.setChild(EVENT_NAME, null)
+ }
+}
+useEffect(geometryData) {
+ // ...
+
+ if (geometryData == null) {
+ containedVision.setChild(GEOMETRY_NAME, null)
+ }
+}
+```
+To test how this works, let's create an erase button that will completely clear the scene:
+```kotlin
+val EventDisplay = FC {
+ // ...
+
+ div {
+ // ...
+
+ input {
+ css {
+ margin = 5.px
+ padding = 5.px
+ backgroundColor = NamedColor.lightcoral
+ color = NamedColor.white
+ }
+ type = InputType.button
+ value = "Clear Scene"
+ onClick = {
+ geometryData = null
+ eventData = null
+ }
+ }
+ }
+
+ // ...
+}
+```
+![Picture of an event display with a red button with a caption "Clear Scene" added to the two previous buttons](../images/event-display-final.png "Scene clearing function")
+
+### Making Selection Fine-Grained
+
+You may feel annoyed by how selection works in our demo. That's right, selecting the whole detector or the entire event array is not that useful. This is due to the fact that VisionForge selects object based on names. We used names to distinguish SolidGroups, but in fact not only groups but every single Vision can have a name. But when we were randomly generating Vision, we did not use any names, did we? Right, Vision can be nameless, in which case they are treated as a monolithic object together with their parent. So it should be clear now that when we were selecting a single rectangle, we were in fact selecting the whole pair of rectangles and the other one went lit up as well.
+
+Fortunately, every `Solid` constructor takes a `name` parameter after essential parameters, so it should be easy to fix it. Go to the generator functions and add the change construction invocations to the following:
+```kotlin
+fun generateGeometry(distance: Float): SolidGroup {
+ return SolidGroup {
+ box(10, 3, 3, "Magnet1") {
+ // ...
+ }
+ box(10, 3, 3, "Magnet2") {
+ // ...
+ }
+ }
+}
+```
+For the events part, we will use the index in a loop as a name:
+```kotlin
+fun generateEvents(radius: Float): SolidGroup {
+ // ...
+ repeat(count) {
+ sphere(radius, it.toString()) {
+ // ...
+}
+```
+
+After you update the build, it should be possible to select only one sphere or rectangle:
+
+![Picture of an event display with only one sphere between the magnets selected](../images/event-display-selection.png "Selection demonstration")
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index e7b89633..b0efb732 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,7 +1,6 @@
kotlin.code.style=official
kotlin.mpp.stability.nowarn=true
kotlin.js.compiler=ir
-#kotlin.incremental.js.ir=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4G
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index e411586a..a5952066 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 31119a06..d8cf13ae 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -40,13 +40,9 @@ dependencyResolutionManagement {
}
include(
-// ":ui",
- ":ui:react",
- ":ui:ring",
-// ":ui:material",
- ":ui:bootstrap",
-// ":ui:compose",
":visionforge-core",
+ ":visionforge-compose-html",
+ ":visionforge-compose-multiplatform",
":visionforge-solid",
// ":visionforge-fx",
":visionforge-threejs",
@@ -64,6 +60,7 @@ include(
":demo:playground",
// ":demo:plotly-fx",
":demo:js-playground",
+ ":demo:compose-desktop-demo",
":visionforge-jupyter",
":visionforge-jupyter:visionforge-jupyter-common"
)
diff --git a/ui/README.md b/ui/README.md
deleted file mode 100644
index ec08d176..00000000
--- a/ui/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Module ui
-
-
-
diff --git a/ui/bootstrap/README.md b/ui/bootstrap/README.md
deleted file mode 100644
index 0cc57002..00000000
--- a/ui/bootstrap/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Module bootstrap
-
-
-
diff --git a/ui/bootstrap/build.gradle.kts b/ui/bootstrap/build.gradle.kts
deleted file mode 100644
index f50ae119..00000000
--- a/ui/bootstrap/build.gradle.kts
+++ /dev/null
@@ -1,19 +0,0 @@
-plugins {
- id("space.kscience.gradle.mpp")
-}
-
-val dataforgeVersion: String by rootProject.extra
-
-kscience{
- js()
- jsMain{
- dependencies {
- api(project(":visionforge-solid"))
- api(project(":ui:react"))
- implementation(npm("file-saver", "2.0.2"))
- implementation(npm("bootstrap","4.6.0"))
- implementation(npm("jquery","3.5.1"))
- implementation(npm("popper.js","1.16.1"))
- }
- }
-}
\ No newline at end of file
diff --git a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/bootstrap.kt b/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/bootstrap.kt
deleted file mode 100644
index c0171cb7..00000000
--- a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/bootstrap.kt
+++ /dev/null
@@ -1,121 +0,0 @@
-package space.kscience.visionforge.bootstrap
-
-public fun useBootstrap(){
- kotlinext.js.require("bootstrap/dist/css/bootstrap.min.css")
- kotlinext.js.require("bootstrap")
-}
-
-//public inline fun TagConsumer.card(title: String, crossinline block: TagConsumer.() -> Unit) {
-// div("card w-100") {
-// div("card-body") {
-// h3(classes = "card-title") { +title }
-// block()
-// }
-// }
-//}
-
-//public typealias SectionsBuilder = MutableList Unit>>
-//
-//public fun SectionsBuilder.entry(title: String, builder: DIV.() -> Unit) {
-// add(title to builder)
-//}
-
-
-//public fun TagConsumer.accordion(id: String, elements: List Unit>>) {
-// div("container-fluid") {
-// div("accordion") {
-// this.id = id
-// elements.forEachIndexed { index, (title, builder) ->
-// val headerID = "${id}-${index}-heading"
-// val collapseID = "${id}-${index}-collapse"
-// div("card") {
-// div("card-header") {
-// this.id = headerID
-// h5("mb-0") {
-// button(classes = "btn btn-link collapsed", type = ButtonType.button) {
-// attributes["data-toggle"] = "collapse"
-// attributes["data-target"] = "#$collapseID"
-// attributes["aria-expanded"] = "false"
-// attributes["aria-controls"] = collapseID
-// +title
-// }
-// }
-// }
-// div("collapse") {
-// this.id = collapseID
-// attributes["aria-labelledby"] = headerID
-// attributes["data-parent"] = "#$id"
-// div("card-body", block = builder)
-// }
-// }
-// }
-// }
-// }
-//}
-
-
-//public fun TagConsumer.accordion(id: String, builder: AccordionBuilder.() -> Unit) {
-// val list = ArrayList Unit>>().apply(builder)
-// accordion(id, list)
-//}
-
-//public fun Element.displayCanvasControls(canvas: ThreeCanvas, block: TagConsumer.() -> Unit = {}) {
-// clear()
-// append {
-// accordion("controls") {
-// entry("Settings") {
-// div("row") {
-// div("col-2") {
-// label("checkbox-inline") {
-// input(type = InputType.checkBox) {
-// checked = canvas.axes.visible
-// onChangeFunction = {
-// canvas.axes.visible = checked
-// }
-// }
-// +"Axes"
-// }
-// }
-// div("col-1") {
-// button {
-// +"Export"
-// onClickFunction = {
-// val json = (canvas.content as? SolidGroup)?.let { group ->
-// val visionManager = canvas.context.plugins.fetch(SolidManager).visionManager
-// visionManager.encodeToString(group)
-// }
-// if (json != null) {
-// saveData(it, "object.json", "text/json") {
-// json
-// }
-// }
-// }
-// }
-// }
-// }
-// }
-// entry("Layers") {
-// div("row") {
-// (0..11).forEach { layer ->
-// div("col-1") {
-// label { +layer.toString() }
-// input(type = InputType.checkBox) {
-// if (layer == 0) {
-// checked = true
-// }
-// onChangeFunction = {
-// if (checked) {
-// canvas.camera.layers.enable(layer)
-// } else {
-// canvas.camera.layers.disable(layer)
-// }
-// }
-// }
-// }
-// }
-// }
-// }
-// }
-// block()
-// }
-//}
\ No newline at end of file
diff --git a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/outputConfig.kt b/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/outputConfig.kt
deleted file mode 100644
index f42235a8..00000000
--- a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/outputConfig.kt
+++ /dev/null
@@ -1,77 +0,0 @@
-package space.kscience.visionforge.bootstrap
-
-import kotlinx.coroutines.DelicateCoroutinesApi
-import kotlinx.coroutines.GlobalScope
-import kotlinx.css.*
-import kotlinx.html.js.onClickFunction
-import org.w3c.dom.events.Event
-import org.w3c.files.Blob
-import org.w3c.files.BlobPropertyBag
-import react.FC
-import react.Props
-import react.RBuilder
-import react.dom.attrs
-import react.dom.button
-import react.fc
-import space.kscience.visionforge.Vision
-import space.kscience.visionforge.encodeToString
-import space.kscience.visionforge.react.flexColumn
-import space.kscience.visionforge.react.flexRow
-import space.kscience.visionforge.react.propertyEditor
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-import styled.css
-
-private fun saveData(event: Event, fileName: String, mimeType: String = "text/plain", dataBuilder: () -> String) {
- event.stopPropagation();
- event.preventDefault();
-
- val fileSaver = kotlinext.js.require("file-saver")
- val blob = Blob(arrayOf(dataBuilder()), BlobPropertyBag("$mimeType;charset=utf-8"))
- fileSaver.saveAs(blob, fileName)
-}
-
-public fun RBuilder.canvasControls(canvasOptions: Canvas3DOptions, vision: Vision?) {
- child(CanvasControls) {
- attrs {
- this.canvasOptions = canvasOptions
- this.vision = vision
- }
- }
-}
-
-public external interface CanvasControlsProps : Props {
- public var canvasOptions: Canvas3DOptions
- public var vision: Vision?
-}
-
-
-public val CanvasControls: FC = fc("CanvasControls") { props ->
- flexColumn {
- flexRow {
- css {
- border = Border(1.px, BorderStyle.solid, Color.blue)
- padding = Padding(4.px)
- }
- props.vision?.let { vision ->
- button {
- +"Export"
- attrs {
- onClickFunction = {
- val json = vision.encodeToString()
- saveData(it, "object.json", "text/json") {
- json
- }
- }
- }
- }
- }
- }
- @OptIn(DelicateCoroutinesApi::class)
- propertyEditor(
- scope = props.vision?.manager?.context ?: GlobalScope,
- properties = props.canvasOptions.meta,
- descriptor = Canvas3DOptions.descriptor,
- expanded = false
- )
- }
-}
\ No newline at end of file
diff --git a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/reactBootstrap.kt b/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/reactBootstrap.kt
deleted file mode 100644
index b37637fe..00000000
--- a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/reactBootstrap.kt
+++ /dev/null
@@ -1,181 +0,0 @@
-package space.kscience.visionforge.bootstrap
-
-import kotlinx.html.ButtonType
-import kotlinx.html.DIV
-import kotlinx.html.id
-import kotlinx.html.js.onClickFunction
-import react.RBuilder
-import react.dom.*
-import space.kscience.dataforge.names.Name
-import space.kscience.dataforge.names.NameToken
-import space.kscience.dataforge.names.length
-import styled.StyledDOMBuilder
-import styled.css
-import styled.styledDiv
-import styled.styledNav
-
-
-public inline fun RBuilder.card(title: String, crossinline block: StyledDOMBuilder.() -> Unit): Unit =
- styledDiv {
- css {
- +"card"
- +"w-100"
- }
- styledDiv {
- css {
- +"card-body"
- }
- h3(classes = "card-title") {
- +title
- }
- block()
- }
- }
-
-public fun RBuilder.accordion(
- id: String,
- elements: List
.() -> Unit>>,
-): Unit = styledDiv {
- css {
- +"accordion"
- //+"p-1"
- }
- attrs {
- this.id = id
- }
- elements.forEachIndexed { index, (title, builder) ->
- val headerID = "${id}-${index}-heading"
- val collapseID = "${id}-${index}-collapse"
- div("card p-0 m-0") {
- div("card-header") {
- attrs {
- this.id = headerID
- }
- h5("mb-0") {
- button(classes = "btn btn-link collapsed", type = ButtonType.button) {
- attrs {
- attributes["data-toggle"] = "collapse"
- attributes["data-target"] = "#$collapseID"
- attributes["aria-expanded"] = "false"
- attributes["aria-controls"] = collapseID
- }
- +title
- }
- }
- }
- div("collapse") {
- attrs {
- this.id = collapseID
- attributes["aria-labelledby"] = headerID
- attributes["data-parent"] = "#$id"
- }
- styledDiv {
- css {
- +"card-body"
- }
- builder()
- }
- }
- }
- }
-}
-
-
-public fun RBuilder.nameCrumbs(name: Name?, rootTitle: String, link: (Name) -> Unit): Unit = styledNav {
- css {
- +"p-0"
- }
- attrs {
- attributes["aria-label"] = "breadcrumb"
- }
- ol("breadcrumb") {
- li("breadcrumb-item") {
- button(classes = "btn btn-link p-0") {
- +rootTitle
- attrs {
- onClickFunction = {
- link(Name.EMPTY)
- }
- }
- }
- }
- if (name != null) {
- val tokens = ArrayList(name.length)
- name.tokens.forEach { token ->
- tokens.add(token)
- val fullName = Name(tokens.toList())
- li("breadcrumb-item") {
- button(classes = "btn btn-link p-0") {
- +token.toString()
- attrs {
- onClickFunction = {
- console.log("Selected = $fullName")
- link(fullName)
- }
- }
- }
- }
- }
- }
- }
-}
-
-public typealias RSectionsBuilder = MutableList.() -> Unit>>
-
-public fun RSectionsBuilder.entry(title: String, builder: StyledDOMBuilder.() -> Unit) {
- add(title to builder)
-}
-
-public fun RBuilder.accordion(id: String, builder: RSectionsBuilder.() -> Unit): Unit {
- val list = ArrayList
.() -> Unit>>().apply(builder)
- accordion(id, list)
-}
-
-public enum class ContainerSize(public val suffix: String) {
- DEFAULT(""),
- SM("-sm"),
- MD("-md"),
- LG("-lg"),
- XL("-xl"),
- FLUID("-fluid")
-}
-
-public inline fun RBuilder.container(
- size: ContainerSize = ContainerSize.FLUID,
- block: StyledDOMBuilder.() -> Unit,
-): Unit = styledDiv {
- css {
- classes.add("container${size.suffix}")
- }
- block()
-}
-
-
-public enum class GridMaxSize(public val suffix: String) {
- NONE(""),
- SM("-sm"),
- MD("-md"),
- LG("-lg"),
- XL("-xl")
-}
-
-public inline fun RBuilder.gridColumn(
- weight: Int? = null,
- maxSize: GridMaxSize = GridMaxSize.NONE,
- block: StyledDOMBuilder
.() -> Unit,
-): Unit = styledDiv {
- val weightSuffix = weight?.let { "-$it" } ?: ""
- css {
- classes.add("col${maxSize.suffix}$weightSuffix")
- }
- block()
-}
-
-public inline fun RBuilder.gridRow(
- block: StyledDOMBuilder
.() -> Unit,
-): Unit = styledDiv {
- css {
- classes.add("row")
- }
- block()
-}
\ No newline at end of file
diff --git a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/tabComponent.kt b/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/tabComponent.kt
deleted file mode 100644
index 23b5071b..00000000
--- a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/tabComponent.kt
+++ /dev/null
@@ -1,86 +0,0 @@
-package space.kscience.visionforge.bootstrap
-
-import kotlinx.html.DIV
-import kotlinx.html.classes
-import kotlinx.html.js.onClickFunction
-import react.*
-import react.dom.attrs
-import react.dom.button
-import react.dom.li
-import react.dom.ul
-import space.kscience.visionforge.react.flexColumn
-import styled.StyledDOMBuilder
-import styled.styledDiv
-
-public external interface TabProps : PropsWithChildren {
- public var id: String
- public var title: String?
-}
-
-@JsExport
-public val Tab: FC
= fc { props ->
- props.children()
-}
-
-public external interface TabPaneProps : PropsWithChildren {
- public var activeTab: String?
-}
-
-@JsExport
-public val TabPane: FC = fc("TabPane") { props ->
- var activeTab: String? by useState(props.activeTab)
-
- val children: Array?> = Children.map(props.children) {
- it.asElementOrNull()
- } ?: emptyArray()
-
- val childrenProps = children.mapNotNull {
- it?.props?.unsafeCast()
- }
-
- flexColumn {
- ul("nav nav-tabs") {
- childrenProps.forEach { cp ->
- li("nav-item") {
- button(classes = "nav-link") {
- +(cp.title ?: cp.id)
- attrs {
- if (cp.id == activeTab) {
- classes = classes + "active"
- }
- onClickFunction = {
- activeTab = cp.id
- }
- }
- }
- }
- }
- }
- children.find { (it?.props?.unsafeCast())?.id == activeTab }?.let {
- child(it)
- }
- }
-}
-
-public class TabBuilder(internal val parentBuilder: RBuilder) {
- public fun tab(id: String, title: String? = null, builder: StyledDOMBuilder.() -> Unit) {
- parentBuilder.child(Tab) {
- attrs {
- this.id = id
- this.title = title
- }
- styledDiv {
- builder()
- }
- }
- }
-}
-
-public inline fun RBuilder.tabPane(activeTab: String? = null, crossinline builder: TabBuilder.() -> Unit) {
- child(TabPane) {
- attrs {
- this.activeTab = activeTab
- }
- TabBuilder(this).builder()
- }
-}
diff --git a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/threeControls.kt b/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/threeControls.kt
deleted file mode 100644
index 0d5578a7..00000000
--- a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/threeControls.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package space.kscience.visionforge.bootstrap
-
-import kotlinx.css.*
-import react.FC
-import react.PropsWithChildren
-import react.RBuilder
-import react.dom.h2
-import react.fc
-import space.kscience.dataforge.names.Name
-import space.kscience.dataforge.names.isEmpty
-import space.kscience.visionforge.Vision
-import space.kscience.visionforge.react.visionTree
-import space.kscience.visionforge.solid.SolidGroup
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-import styled.css
-import styled.styledDiv
-
-public external interface ThreeControlsProps : PropsWithChildren {
- public var canvasOptions: Canvas3DOptions
- public var vision: Vision?
- public var selected: Name?
- public var onSelect: (Name) -> Unit
-}
-
-@JsExport
-public val ThreeControls: FC
= fc { props ->
- tabPane(if (props.selected != null) "Properties" else null) {
- tab("Canvas") {
- card("Canvas configuration") {
- canvasControls(props.canvasOptions, props.vision)
- }
- }
- tab("Tree") {
- css {
- border = Border(1.px, BorderStyle.solid, Color.lightGray)
- padding = Padding(10.px)
- }
- h2 { +"Object tree" }
- styledDiv {
- css {
- flex = Flex(1.0, 1.0, FlexBasis.inherit)
- }
- props.vision?.let {
- visionTree(it, props.selected, props.onSelect)
- }
- }
- }
- tab("Properties") {
- props.selected.let { selected ->
- val selectedObject: Vision? = when {
- selected == null -> null
- selected.isEmpty() -> props.vision
- else -> (props.vision as? SolidGroup)?.get(selected)
- }
- if (selectedObject != null) {
- visionPropertyEditor(selectedObject, key = selected)
- }
- }
- }
- this.parentBuilder.run {
- props.children()
- }
- }
-}
-
-public fun RBuilder.threeControls(
- canvasOptions: Canvas3DOptions,
- vision: Vision?,
- selected: Name?,
- onSelect: (Name) -> Unit = {},
- builder: TabBuilder.() -> Unit = {},
-): Unit = child(ThreeControls) {
- attrs {
- this.canvasOptions = canvasOptions
- this.vision = vision
- this.selected = selected
- this.onSelect = onSelect
- }
- TabBuilder(this).builder()
-}
\ No newline at end of file
diff --git a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/visionPropertyEditor.kt b/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/visionPropertyEditor.kt
deleted file mode 100644
index 8e7e1208..00000000
--- a/ui/bootstrap/src/jsMain/kotlin/space/kscience/visionforge/bootstrap/visionPropertyEditor.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-package space.kscience.visionforge.bootstrap
-
-import org.w3c.dom.Element
-import react.RBuilder
-import space.kscience.dataforge.meta.descriptors.MetaDescriptor
-import space.kscience.dataforge.meta.isEmpty
-import space.kscience.visionforge.Vision
-import space.kscience.visionforge.getStyle
-import space.kscience.visionforge.react.EditorPropertyState
-import space.kscience.visionforge.react.PropertyEditor
-import space.kscience.visionforge.react.metaViewer
-import space.kscience.visionforge.react.render
-import space.kscience.visionforge.root
-import space.kscience.visionforge.solid.SolidReference
-import space.kscience.visionforge.styles
-
-public fun RBuilder.visionPropertyEditor(
- vision: Vision,
- descriptor: MetaDescriptor? = vision.descriptor,
- key: Any? = null,
-) {
-
- card("Properties") {
- child(PropertyEditor) {
- attrs {
- this.key = key?.toString()
- this.meta = vision.properties.root()
- this.updates = vision.properties.changes
- this.descriptor = descriptor
- this.scope = vision.manager?.context ?: error("Orphan vision could not be observed")
- this.getPropertyState = { name ->
- val ownMeta = vision.properties.own?.getMeta(name)
- if (ownMeta != null && !ownMeta.isEmpty()) {
- EditorPropertyState.Defined
- } else if (vision.properties.root().getValue(name) != null) {
- // TODO differentiate
- EditorPropertyState.Default()
- } else {
- EditorPropertyState.Undefined
- }
- }
- }
- }
- }
- val styles = if (vision is SolidReference) {
- (vision.styles + vision.prototype.styles).distinct()
- } else {
- vision.styles
- }
- if (styles.isNotEmpty()) {
- card("Styles") {
- accordion("styles") {
- styles.forEach { styleName ->
- val style = vision.getStyle(styleName)
- if (style != null) {
- entry(styleName) {
- metaViewer(style)
- }
- }
- }
- }
- }
- }
-}
-
-public fun Element.visionPropertyEditor(
- item: Vision,
- descriptor: MetaDescriptor? = item.descriptor,
-): Unit = space.kscience.visionforge.react.createRoot(this).render {
- visionPropertyEditor(item, descriptor = descriptor)
-}
\ No newline at end of file
diff --git a/ui/bootstrap/src/jsMain/resources/css/custom-bootstrap.css b/ui/bootstrap/src/jsMain/resources/css/custom-bootstrap.css
deleted file mode 100644
index ecb7ee5f..00000000
--- a/ui/bootstrap/src/jsMain/resources/css/custom-bootstrap.css
+++ /dev/null
@@ -1,56 +0,0 @@
-/*full height*/
-html, body {
- height: 100%;
- width: 100%;
-}
-
-.container-fluid { height: inherit; }
-
-/* Remove default bullets */
-ul, .tree {
- list-style-type: none;
-}
-
-/* Style the caret/arrow */
-.tree-caret {
- cursor: pointer;
- user-select: none; /* Prevent text selection */
-}
-
-/* Create the caret/arrow with a unicode, and style it */
-.tree-caret::before {
- content: "\25B6";
- color: black;
- display: inline-block;
- margin-right: 6px;
-}
-
-.tree-leaf{
- user-select: none;
- display: inline-block;
-}
-
-.tree-leaf::before {
- content: "\25C6";
- color: black;
- display: inline-block;
- margin-right: 6px;
-}
-
-
-/* Rotate the caret/arrow icon when clicked on (using JavaScript) */
-.tree-caret-down::before {
- transform: rotate(90deg);
-}
-
-.tree-label-inactive {
- color: lightgrey;
-}
-
-.tree-label-selected{
- background-color: lightblue;
-}
-
-.no-padding{
- padding: 0;
-}
\ No newline at end of file
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/Tabs.kt b/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/Tabs.kt
deleted file mode 100644
index cae4e797..00000000
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/Tabs.kt
+++ /dev/null
@@ -1,102 +0,0 @@
-package space.kscience.visionforge.compose
-
-import androidx.compose.runtime.*
-import org.jetbrains.compose.web.dom.*
-import org.w3c.dom.HTMLDivElement
-import org.w3c.dom.HTMLLIElement
-
-
-public class ComposeTab(
- public val key: String,
- public val title: String,
- public val content: ContentBuilder,
- public val disabled: Boolean,
- public val titleExt: ContentBuilder,
-)
-
-@Composable
-public fun Tabs(tabs: List, activeKey: String) {
- var active by remember(activeKey) { mutableStateOf(activeKey) }
-
- Div({ classes("card", "text-center") }) {
- Div({ classes("card-header") }) {
-
- Ul({ classes("nav", "nav-tabs", "card-header-tabs") }) {
- tabs.forEach { tab ->
- Li({
- classes("nav-item")
- }) {
- A(attrs = {
- classes("nav-link")
- if (active == tab.key) {
- classes("active")
- }
- if (tab.disabled) {
- classes("disabled")
- }
- onClick {
- active = tab.key
- }
- }) {
- Text(tab.title)
- }
- tab.titleExt.invoke(this)
- }
- }
- }
- }
- tabs.find { it.key == active }?.let { tab ->
- Div({ classes("card-body") }) {
- tab.content.invoke(this)
- }
- }
- }
-
-
-}
-
-public class TabBuilder internal constructor(public val key: String) {
- private var title: String = key
- public var disabled: Boolean = false
- private var content: ContentBuilder = {}
- private var titleExt: ContentBuilder = {}
-
- @Composable
- public fun Content(content: ContentBuilder) {
- this.content = content
- }
-
- @Composable
- public fun Title(title: String, titleExt: ContentBuilder = {}) {
- this.title = title
- this.titleExt = titleExt
- }
-
- internal fun build(): ComposeTab = ComposeTab(
- key,
- title,
- content,
- disabled,
- titleExt
- )
-}
-
-public class TabsBuilder {
- public var active: String = ""
- internal val tabs: MutableList = mutableListOf()
-
- @Composable
- public fun Tab(key: String, builder: @Composable TabBuilder.() -> Unit) {
- tabs.add(TabBuilder(key).apply { builder() }.build())
- }
-
- public fun addTab(tab: ComposeTab) {
- tabs.add(tab)
- }
-}
-
-@Composable
-public fun Tabs(builder: @Composable TabsBuilder.() -> Unit) {
- val result = TabsBuilder().apply { builder() }
- Tabs(result.tabs, result.active)
-}
\ No newline at end of file
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeCanvas.kt b/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeCanvas.kt
deleted file mode 100644
index 9816b5c2..00000000
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeCanvas.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package space.kscience.visionforge.compose
-
-import androidx.compose.runtime.*
-import kotlinx.dom.clear
-import org.jetbrains.compose.web.css.*
-import org.jetbrains.compose.web.dom.Div
-import space.kscience.dataforge.context.Context
-import space.kscience.dataforge.context.request
-import space.kscience.dataforge.names.Name
-import space.kscience.visionforge.solid.Solid
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-import space.kscience.visionforge.solid.three.ThreeCanvas
-import space.kscience.visionforge.solid.three.ThreePlugin
-
-@Composable
-public fun ThreeCanvas(
- context: Context,
- options: Canvas3DOptions?,
- solid: Solid?,
- selected: Name?,
-) {
-
- val three: ThreePlugin by derivedStateOf { context.request(ThreePlugin) }
-
- Div({
- style {
- maxWidth(100.vw)
- maxHeight(100.vh)
- width(100.percent)
- height(100.percent)
- }
- }) {
- var canvas: ThreeCanvas? = null
- DisposableEffect(options) {
- canvas = ThreeCanvas(three, scopeElement, options ?: Canvas3DOptions())
- onDispose {
- scopeElement.clear()
- canvas = null
- }
- }
- LaunchedEffect(solid) {
- if (solid != null) {
- canvas?.render(solid)
- } else {
- canvas?.clear()
- }
- }
- LaunchedEffect(selected) {
- canvas?.select(selected)
- }
- }
-}
\ No newline at end of file
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeControls.kt b/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeControls.kt
deleted file mode 100644
index c559b946..00000000
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeControls.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-package space.kscience.visionforge.compose
-
-import androidx.compose.runtime.Composable
-import org.jetbrains.compose.web.css.*
-import org.jetbrains.compose.web.dom.Button
-import org.jetbrains.compose.web.dom.Text
-import org.w3c.files.Blob
-import org.w3c.files.BlobPropertyBag
-import space.kscience.dataforge.context.Global
-import space.kscience.dataforge.names.Name
-import space.kscience.visionforge.Vision
-import space.kscience.visionforge.encodeToString
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-
-@Composable
-internal fun CanvasControls(
- vision: Vision?,
- options: Canvas3DOptions,
-) {
- FlexColumn {
- FlexRow({
- style {
- border {
- width(1.px)
- style(LineStyle.Solid)
- color(Color("blue"))
- }
- padding(4.px)
- }
- }) {
- vision?.let { vision ->
- Button({
- onClick { event ->
- val json = vision.encodeToString()
- event.stopPropagation();
- event.preventDefault();
-
- val fileSaver = kotlinext.js.require("file-saver")
- val blob = Blob(arrayOf(json), BlobPropertyBag("text/json;charset=utf-8"))
- fileSaver.saveAs(blob, "object.json") as Unit
- }
- }) {
- Text("Export")
- }
- }
- }
- PropertyEditor(
- scope = vision?.manager?.context ?: Global,
- properties = options.meta,
- descriptor = Canvas3DOptions.descriptor,
- expanded = false
- )
-
- }
-}
-
-
-@Composable
-public fun ThreeControls(
- vision: Vision?,
- canvasOptions: Canvas3DOptions,
- selected: Name?,
- onSelect: (Name?) -> Unit,
- tabBuilder: @Composable TabsBuilder.() -> Unit = {},
-) {
- Tabs {
- active = "Tree"
- vision?.let { vision ->
- Tab("Tree") {
- CardTitle("Vision tree")
- VisionTree(vision, Name.EMPTY, selected, onSelect)
- }
- }
- Tab("Settings") {
- CardTitle("Canvas configuration")
- CanvasControls(vision, canvasOptions)
- }
- tabBuilder()
- }
-}
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeViewWithControls.kt b/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeViewWithControls.kt
deleted file mode 100644
index 7a347110..00000000
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/ThreeViewWithControls.kt
+++ /dev/null
@@ -1,169 +0,0 @@
-@file:OptIn(ExperimentalComposeWebApi::class)
-
-package space.kscience.visionforge.compose
-
-import androidx.compose.runtime.*
-import app.softwork.bootstrapcompose.Card
-import kotlinx.coroutines.Deferred
-import kotlinx.coroutines.launch
-import org.jetbrains.compose.web.ExperimentalComposeWebApi
-import org.jetbrains.compose.web.css.*
-import org.jetbrains.compose.web.dom.*
-import space.kscience.dataforge.meta.get
-import space.kscience.dataforge.names.Name
-import space.kscience.dataforge.names.isEmpty
-import space.kscience.visionforge.*
-import space.kscience.visionforge.solid.Solid
-import space.kscience.visionforge.solid.SolidGroup
-import space.kscience.visionforge.solid.Solids
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-
-@Composable
-public fun ThreeCanvasWithControls(
- solids: Solids,
- builderOfSolid: Deferred,
- initialSelected: Name?,
- options: Canvas3DOptions?,
- tabBuilder: @Composable TabsBuilder.() -> Unit = {},
-) {
- var selected: Name? by remember { mutableStateOf(initialSelected) }
- var solid: Solid? by remember { mutableStateOf(null) }
-
- LaunchedEffect(builderOfSolid) {
- solids.context.launch {
- solid = builderOfSolid.await()
- //ensure that the solid is properly rooted
- if (solid?.parent == null) {
- solid?.setAsRoot(solids.context.visionManager)
- }
- }
- }
-
- val optionsWithSelector = remember(options) {
- (options ?: Canvas3DOptions()).apply {
- this.onSelect = {
- selected = it
- }
- }
- }
-
- val selectedVision: Vision? = remember(builderOfSolid, selected) {
- selected?.let {
- when {
- it.isEmpty() -> solid
- else -> (solid as? SolidGroup)?.get(it)
- }
- }
- }
-
-
- FlexRow({
- style {
- height(100.percent)
- width(100.percent)
- flexWrap(FlexWrap.Wrap)
- alignItems(AlignItems.Stretch)
- alignContent(AlignContent.Stretch)
- }
- }) {
- FlexColumn({
- style {
- height(100.percent)
- minWidth(600.px)
- flex(10, 1, 600.px)
- position(Position.Relative)
- }
- }) {
- if (solid == null) {
- Div({
- style {
- position(Position.Fixed)
- width(100.percent)
- height(100.percent)
- zIndex(1000)
- top(40.percent)
- left(0.px)
- opacity(0.5)
- filter {
- opacity(50.percent)
- }
- }
- }) {
- Div({ classes("d-flex", " justify-content-center") }) {
- Div({
- classes("spinner-grow", "text-primary")
- style {
- width(3.cssRem)
- height(3.cssRem)
- zIndex(20)
- }
- attr("role", "status")
- }) {
- Span({ classes("sr-only") }) { Text("Loading 3D vision") }
- }
- }
- }
- } else {
- ThreeCanvas(solids.context, optionsWithSelector, solid, selected)
- }
-
- selectedVision?.let { vision ->
- Div({
- style {
- position(Position.Absolute)
- top(5.px)
- right(5.px)
- width(450.px)
- }
- }) {
- Card(
- headerAttrs = {
- // border = true
- },
- header = {
- NameCrumbs(selected) { selected = it }
- }
- ) {
- PropertyEditor(
- scope = solids.context,
- meta = vision.properties.root(),
- getPropertyState = { name ->
- if (vision.properties.own?.get(name) != null) {
- EditorPropertyState.Defined
- } else if (vision.properties.root()[name] != null) {
- // TODO differentiate
- EditorPropertyState.Default()
- } else {
- EditorPropertyState.Undefined
- }
- },
- updates = vision.properties.changes,
- rootDescriptor = vision.descriptor
- )
-
- }
-
- vision.styles.takeIf { it.isNotEmpty() }?.let { styles ->
- P {
- B { Text("Styles: ") }
- Text(styles.joinToString(separator = ", "))
- }
- }
- }
- }
- }
- }
- FlexColumn({
- style {
- paddingAll(4.px)
- minWidth(400.px)
- height(100.percent)
- overflowY("auto")
- flex(1, 10, 300.px)
- }
- }) {
- ThreeControls(solid, optionsWithSelector, selected, onSelect = { selected = it }, tabBuilder = tabBuilder)
- }
-}
-
-
diff --git a/ui/react/README.md b/ui/react/README.md
deleted file mode 100644
index 9f862213..00000000
--- a/ui/react/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Module react
-
-
-
diff --git a/ui/react/build.gradle.kts b/ui/react/build.gradle.kts
deleted file mode 100644
index 1770feeb..00000000
--- a/ui/react/build.gradle.kts
+++ /dev/null
@@ -1,16 +0,0 @@
-plugins {
- id("space.kscience.gradle.mpp")
-}
-
-kscience {
- js()
- jsMain {
- dependencies {
- api(projects.visionforgeSolid)
- api("org.jetbrains.kotlin-wrappers:kotlin-styled")
- api("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
-// implementation(npm("react-select","4.3.0"))
- api(projects.visionforgeThreejs)
- }
- }
-}
\ No newline at end of file
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/MetaViewer.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/MetaViewer.kt
deleted file mode 100644
index 651c9d31..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/MetaViewer.kt
+++ /dev/null
@@ -1,149 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.css.Align
-import kotlinx.css.alignItems
-import kotlinx.html.js.onClickFunction
-import org.w3c.dom.events.Event
-import react.*
-import react.dom.a
-import react.dom.attrs
-import space.kscience.dataforge.meta.Meta
-import space.kscience.dataforge.meta.descriptors.MetaDescriptor
-import space.kscience.dataforge.meta.descriptors.get
-import space.kscience.dataforge.meta.get
-import space.kscience.dataforge.meta.isLeaf
-import space.kscience.dataforge.names.Name
-import space.kscience.dataforge.names.NameToken
-import space.kscience.dataforge.names.lastOrNull
-import space.kscience.dataforge.names.plus
-import styled.css
-import styled.styledDiv
-import styled.styledSpan
-
-public external interface MetaViewerProps : Props {
- /**
- * Root meta
- */
- public var root: Meta
-
- /**
- * The title of root node
- */
- public var rootName: String?
-
- /**
- * Full path to the displayed node in [root]. Could be empty
- */
- public var name: Name
-
- /**
- * Root descriptor
- */
- public var descriptor: MetaDescriptor?
-}
-
-private val MetaViewerItem: FC = fc("MetaViewerItem") { props ->
- metaViewerItem(props)
-}
-
-private fun RBuilder.metaViewerItem(props: MetaViewerProps) {
- var expanded: Boolean by useState { true }
- val item = props.root[props.name]
- val descriptorItem: MetaDescriptor? = props.descriptor?.get(props.name)
- val actualValue = item?.value ?: descriptorItem?.defaultValue
- val actualMeta = item ?: descriptorItem?.defaultNode
-
- val token = props.name.lastOrNull()?.toString() ?: props.rootName ?: ""
-
- val expanderClick: (Event) -> Unit = {
- expanded = !expanded
- }
-
- flexRow {
- css {
- alignItems = Align.center
- }
- if (actualMeta?.isLeaf == false) {
- styledSpan {
- css {
- +TreeStyles.treeCaret
- if (expanded) {
- +TreeStyles.treeCaredDown
- }
- }
- attrs {
- onClickFunction = expanderClick
- }
- }
- }
-
- styledSpan {
- css {
- +TreeStyles.treeLabel
- if (item == null) {
- +TreeStyles.treeLabelInactive
- }
- }
- +token
- }
- styledDiv {
- a {
- +actualValue.toString()
- }
- }
- }
- if (expanded) {
- flexColumn {
- css {
- +TreeStyles.tree
- }
- val keys = buildSet {
- descriptorItem?.children?.keys?.forEach {
- add(NameToken(it))
- }
- actualMeta!!.items.keys.let { addAll(it) }
- }
-
- keys.filter { !it.body.startsWith("@") }.forEach { token ->
- styledDiv {
- css {
- +TreeStyles.treeItem
- }
- child(MetaViewerItem) {
- attrs {
- this.key = props.name.toString()
- this.root = props.root
- this.name = props.name + token
- this.descriptor = props.descriptor
- }
- }
- //configEditor(props.root, props.name + token, props.descriptor, props.default)
- }
- }
- }
- }
-
-
-}
-
-@JsExport
-public val MetaViewer: FC = fc("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: MetaDescriptor? = null, key: Any? = null) {
- child(MetaViewer) {
- attrs {
- this.key = key?.toString() ?: ""
- this.root = meta
- this.descriptor = descriptor
- }
- }
-}
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/MultiSelectChooser.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/MultiSelectChooser.kt
deleted file mode 100644
index fc635d21..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/MultiSelectChooser.kt
+++ /dev/null
@@ -1,38 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.html.js.onChangeFunction
-import org.w3c.dom.HTMLOptionElement
-import org.w3c.dom.HTMLSelectElement
-import org.w3c.dom.asList
-import org.w3c.dom.events.Event
-import react.FC
-import react.dom.attrs
-import react.dom.option
-import react.dom.select
-import react.fc
-import space.kscience.dataforge.meta.asValue
-import space.kscience.dataforge.meta.descriptors.allowedValues
-import space.kscience.dataforge.meta.string
-
-@JsExport
-public val MultiSelectChooser: FC = fc("MultiSelectChooser") { props ->
- val onChange: (Event) -> Unit = { event: Event ->
- val newSelected = (event.target as HTMLSelectElement).selectedOptions.asList()
- .map { (it as HTMLOptionElement).value.asValue() }
- props.onValueChange(newSelected.asValue())
- }
-
- select {
- attrs {
- multiple = true
- values = (props.value?.list ?: emptyList()).mapTo(HashSet()) { it.string }
- onChangeFunction = onChange
- }
- props.descriptor?.allowedValues?.forEach { optionValue ->
- option {
- +optionValue.string
- }
- }
-
- }
-}
\ No newline at end of file
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/PropertyEditor.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/PropertyEditor.kt
deleted file mode 100644
index 58986076..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/PropertyEditor.kt
+++ /dev/null
@@ -1,278 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.callbackFlow
-import kotlinx.coroutines.flow.launchIn
-import kotlinx.coroutines.flow.onEach
-import kotlinx.coroutines.launch
-import kotlinx.css.*
-import kotlinx.css.properties.TextDecoration
-import kotlinx.html.js.onClickFunction
-import org.w3c.dom.events.Event
-import react.*
-import react.dom.attrs
-import space.kscience.dataforge.meta.MutableMeta
-import space.kscience.dataforge.meta.ObservableMutableMeta
-import space.kscience.dataforge.meta.descriptors.MetaDescriptor
-import space.kscience.dataforge.meta.descriptors.ValueRequirement
-import space.kscience.dataforge.meta.descriptors.get
-import space.kscience.dataforge.meta.get
-import space.kscience.dataforge.meta.remove
-import space.kscience.dataforge.names.*
-import space.kscience.visionforge.hidden
-import styled.css
-import styled.styledButton
-import styled.styledDiv
-import styled.styledSpan
-
-/**
- * The display state of a property
- */
-public sealed class EditorPropertyState {
- public object Defined : EditorPropertyState()
- public class Default(public val source: String = "unknown") : EditorPropertyState()
-
- public object Undefined : EditorPropertyState()
-
-}
-
-
-public external interface PropertyEditorProps : Props {
-
- /**
- * Root config object - always non-null
- */
- public var meta: MutableMeta
-
- public var getPropertyState: (Name) -> EditorPropertyState
-
- public var scope: CoroutineScope
-
- public var updates: Flow
-
- /**
- * Full path to the displayed node in [meta]. Could be empty
- */
- public var name: Name
-
- /**
- * Root descriptor
- */
- public var descriptor: MetaDescriptor?
-
- /**
- * Initial expanded state
- */
- public var expanded: Boolean?
-}
-
-private val PropertyEditorItem: FC = fc("PropertyEditorItem") { props ->
- propertyEditorItem(props)
-}
-
-private fun RBuilder.propertyEditorItem(props: PropertyEditorProps) {
- var expanded: Boolean by useState { props.expanded ?: true }
- val descriptor: MetaDescriptor? = useMemo(props.descriptor, props.name) { props.descriptor?.get(props.name) }
- var property: MutableMeta by useState { props.meta.getOrCreate(props.name) }
- var editorPropertyState: EditorPropertyState by useState { props.getPropertyState(props.name) }
-
-
- val keys = useMemo(descriptor) {
- buildSet {
- descriptor?.children?.filterNot {
- it.key.startsWith("@") || it.value.hidden
- }?.forEach {
- add(NameToken(it.key))
- }
- //ownProperty?.items?.keys?.filterNot { it.body.startsWith("@") }?.let { addAll(it) }
- }
- }
-
- val token = props.name.lastOrNull()?.toString() ?: "Properties"
-
- fun update() {
- property = props.meta.getOrCreate(props.name)
- editorPropertyState = props.getPropertyState(props.name)
- }
-
- useEffect(props.meta) {
- val job = props.updates.onEach { updatedName ->
- if (updatedName == props.name) {
- update()
- }
- }.launchIn(props.scope)
-
- cleanup {
- job.cancel()
- }
- }
-
- val expanderClick: (Event) -> Unit = {
- expanded = !expanded
- }
-
- val removeClick: (Event) -> Unit = {
- props.meta.remove(props.name)
- update()
- }
-
-
-
- flexRow {
- css {
- alignItems = Align.center
- }
- if (keys.isNotEmpty()) {
- styledSpan {
- css {
- +TreeStyles.treeCaret
- if (expanded) {
- +TreeStyles.treeCaredDown
- }
- }
- attrs {
- onClickFunction = expanderClick
- }
- }
- }
- styledSpan {
- css {
- +TreeStyles.treeLabel
- if (editorPropertyState != EditorPropertyState.Defined) {
- +TreeStyles.treeLabelInactive
- }
- }
- +token
- }
- if (!props.name.isEmpty() && descriptor?.valueRequirement != ValueRequirement.ABSENT) {
- styledDiv {
- css {
- //+TreeStyles.resizeableInput
- width = 160.px
- margin = Margin(1.px, 5.px)
- }
- ValueChooser {
- attrs {
- this.descriptor = descriptor
- this.state = editorPropertyState
- this.value = property.value
- this.onValueChange = {
- property.value = it
- editorPropertyState = props.getPropertyState(props.name)
- }
- }
- }
- }
-
- styledButton {
- css {
- width = 24.px
- alignSelf = Align.stretch
- margin = Margin(1.px, 5.px)
- backgroundColor = Color.white
- borderStyle = BorderStyle.solid
- borderRadius = 2.px
- textAlign = TextAlign.center
- textDecoration = TextDecoration.none
- cursor = Cursor.pointer
- disabled {
- cursor = Cursor.auto
- borderStyle = BorderStyle.dashed
- color = Color.lightGray
- }
- }
- +"\u00D7"
- attrs {
- if (editorPropertyState!= EditorPropertyState.Defined) {
- disabled = true
- } else {
- onClickFunction = removeClick
- }
- }
- }
- }
- }
- if (expanded) {
- flexColumn {
- css {
- +TreeStyles.tree
- }
- keys.forEach { token ->
- styledDiv {
- css {
- +TreeStyles.treeItem
- }
- child(PropertyEditorItem) {
- attrs {
- this.key = props.name.toString()
- this.meta = props.meta
- this.name = props.name + token
- this.descriptor = props.descriptor
- this.scope = props.scope
- this.getPropertyState = { props.getPropertyState(props.name + token) }
- this.updates = props.updates
- }
- }
- //configEditor(props.root, props.name + token, props.descriptor, props.default)
- }
- }
- }
- }
-}
-
-@JsExport
-public val PropertyEditor: FC = fc("PropertyEditor") { props ->
- child(PropertyEditorItem) {
- attrs {
- this.key = ""
- this.meta = props.meta
- this.name = Name.EMPTY
- this.descriptor = props.descriptor
- this.expanded = props.expanded
- this.scope = props.scope
- this.getPropertyState = props.getPropertyState
- this.updates = props.updates
- }
- }
-}
-
-@OptIn(ExperimentalCoroutinesApi::class)
-public fun RBuilder.propertyEditor(
- scope: CoroutineScope,
- properties: ObservableMutableMeta,
- descriptor: MetaDescriptor? = null,
- key: Any? = null,
- expanded: Boolean? = null,
-) {
- child(PropertyEditor) {
- attrs {
- this.meta = properties
- this.descriptor = descriptor
- this.key = key?.toString() ?: ""
- this.expanded = expanded
- this.scope = scope
- this.getPropertyState = { name ->
- if (properties[name] != null) {
- EditorPropertyState.Defined
- } else if (descriptor?.get(name)?.defaultValue != null) {
- EditorPropertyState.Default("descriptor")
- } else {
- EditorPropertyState.Undefined
- }
- }
- this.updates = callbackFlow {
- properties.onChange(scope) { name ->
- scope.launch {
- send(name)
- }
- }
-
- invokeOnClose {
- properties.removeListener(scope)
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/RangeValueChooser.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/RangeValueChooser.kt
deleted file mode 100644
index 4a82a6e9..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/RangeValueChooser.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.css.pct
-import kotlinx.css.width
-import kotlinx.html.InputType
-import kotlinx.html.js.onChangeFunction
-import kotlinx.html.js.onInputFunction
-import org.w3c.dom.HTMLInputElement
-import org.w3c.dom.events.Event
-import react.FC
-import react.dom.attrs
-import react.fc
-import react.useState
-import space.kscience.dataforge.meta.asValue
-import space.kscience.dataforge.meta.descriptors.ValueRequirement
-import space.kscience.dataforge.meta.double
-import space.kscience.dataforge.meta.get
-import space.kscience.dataforge.meta.string
-import styled.css
-import styled.styledInput
-
-@JsExport
-public val RangeValueChooser: FC = fc("RangeValueChooser") { props ->
- var innerValue by useState(props.value?.double)
- var rangeDisabled: Boolean by useState(props.state != EditorPropertyState.Defined)
-
- val handleDisable: (Event) -> Unit = {
- val checkBoxValue = (it.target as HTMLInputElement).checked
- rangeDisabled = !checkBoxValue
- props.onValueChange(
- if (!checkBoxValue) {
- null
- } else {
- innerValue?.asValue()
- }
- )
- }
-
- val handleChange: (Event) -> Unit = {
- val newValue = (it.target as HTMLInputElement).value
- props.onValueChange(newValue.toDoubleOrNull()?.asValue())
- innerValue = newValue.toDoubleOrNull()
- }
-
- flexRow {
- if (props.descriptor?.valueRequirement != ValueRequirement.REQUIRED) {
- styledInput(type = InputType.checkBox) {
- attrs {
- defaultChecked = rangeDisabled.not()
- onChangeFunction = handleDisable
- }
- }
- }
-
- styledInput(type = InputType.range) {
- css {
- width = 100.pct
- }
- attrs {
- disabled = rangeDisabled
- value = innerValue?.toString() ?: ""
-// onChangeFunction = handleChange
- onInputFunction = handleChange
- val minValue = props.descriptor?.attributes?.get("min").string
- minValue?.let {
- min = it
- }
- val maxValue = props.descriptor?.attributes?.get("max").string
- maxValue?.let {
- max = it
- }
- props.descriptor?.attributes?.get("step").string?.let {
- step = it
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/ThreeCanvasComponent.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/ThreeCanvasComponent.kt
deleted file mode 100644
index 8cfa515d..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/ThreeCanvasComponent.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.css.*
-import org.w3c.dom.Element
-import react.*
-import space.kscience.dataforge.context.Context
-import space.kscience.dataforge.context.request
-import space.kscience.dataforge.names.Name
-import space.kscience.visionforge.solid.Solid
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-import space.kscience.visionforge.solid.three.ThreeCanvas
-import space.kscience.visionforge.solid.three.ThreePlugin
-import styled.css
-import styled.styledDiv
-
-public external interface ThreeCanvasProps : Props {
- public var context: Context
- public var options: Canvas3DOptions?
- public var solid: Solid?
- public var selected: Name?
-}
-
-public val ThreeCanvasComponent: FC = fc("ThreeCanvasComponent") { props ->
- val elementRef = useRef(null)
- var canvas by useState(null)
-
- val three: ThreePlugin = useMemo(props.context) { props.context.request(ThreePlugin) }
-
- useEffect(props.solid, props.options, elementRef) {
- if (canvas == null) {
- val element = elementRef.current ?: error("Canvas element not found")
- canvas = ThreeCanvas(three, element, props.options ?: Canvas3DOptions())
- }
- }
-
- useEffect(canvas, props.solid) {
- props.solid?.let { obj ->
- canvas?.render(obj)
- }
- }
-
- useEffect(canvas, props.selected) {
- canvas?.select(props.selected)
- }
-
- styledDiv {
- css {
- maxWidth = 100.vw
- maxHeight = 100.vh
- width = 100.pct
- height = 100.pct
- }
- ref = elementRef
- }
-}
\ No newline at end of file
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/TreeStyles.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/TreeStyles.kt
deleted file mode 100644
index 109d0256..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/TreeStyles.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.css.*
-import kotlinx.css.properties.deg
-import kotlinx.css.properties.rotate
-import styled.StyleSheet
-
-public object TreeStyles : StyleSheet("treeStyles", true) {
- /**
- * Remove default bullets
- */
- public val tree: RuleSet by css {
- paddingLeft = 5.px
- marginLeft = 0.px
- listStyleType = ListStyleType.none
- }
-
- /**
- * Style the caret/arrow
- */
- public val treeCaret: RuleSet by css {
- cursor = Cursor.pointer
- userSelect = UserSelect.none
- /* Create the caret/arrow with a unicode, and style it */
- before {
- content = "\u25B6".quoted
- color = Color.black
- display = Display.inlineBlock
- marginRight = 6.px
- }
- }
-
- /**
- * Rotate the caret/arrow icon when clicked on (using JavaScript)
- */
- public val treeCaredDown:RuleSet by css {
- before {
- content = "\u25B6".quoted
- color = Color.black
- display = Display.inlineBlock
- marginRight = 6.px
- transform.rotate(90.deg)
- }
- }
-
- public val treeItem:RuleSet by css {
- alignItems = Align.center
- paddingLeft = 10.px
- borderLeftStyle = BorderStyle.dashed
- borderLeftWidth = 1.px
- borderLeftColor = Color.lightGray
- }
-
- public val treeLabel:RuleSet by css {
- border = Border.none
- padding = Padding(left = 4.pt, right = 4.pt, top = 0.pt, bottom = 0.pt)
- textAlign = TextAlign.left
- flex = Flex(1.0)
- }
-
- public val treeLabelInactive: RuleSet by css {
- color = Color.lightGray
- }
-
- public val treeLabelSelected:RuleSet by css {
- backgroundColor = Color.lightBlue
- }
-
-}
\ No newline at end of file
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/VisionTree.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/VisionTree.kt
deleted file mode 100644
index 6212a456..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/VisionTree.kt
+++ /dev/null
@@ -1,126 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.css.*
-import kotlinx.css.properties.TextDecoration
-import kotlinx.css.properties.TextDecorationLine
-import kotlinx.html.js.onClickFunction
-import org.w3c.dom.events.Event
-import react.*
-import react.dom.attrs
-import space.kscience.dataforge.names.Name
-import space.kscience.dataforge.names.lastOrNull
-import space.kscience.dataforge.names.plus
-import space.kscience.dataforge.names.startsWith
-import space.kscience.visionforge.Vision
-import space.kscience.visionforge.VisionGroup
-import space.kscience.visionforge.asSequence
-import space.kscience.visionforge.isEmpty
-import styled.css
-import styled.styledDiv
-import styled.styledSpan
-
-public external interface ObjectTreeProps : Props {
- public var name: Name
- public var selected: Name?
- public var obj: Vision
- public var clickCallback: (Name) -> Unit
-}
-
-private val TreeLabel = fc { props ->
- val token = useMemo(props.name) { props.name.lastOrNull()?.toString() ?: "World" }
- styledSpan {
- css {
- +TreeStyles.treeLabel
- color = Color("#069")
- cursor = Cursor.pointer
- hover {
- textDecoration = TextDecoration(setOf(TextDecorationLine.underline))
- }
- if (props.name == props.selected) {
- +TreeStyles.treeLabelSelected
- }
- }
- +token
- attrs {
- onClickFunction = { props.clickCallback(props.name) }
- }
- }
-}
-
-private fun RBuilder.visionTree(props: ObjectTreeProps): Unit {
- var expanded: Boolean by useState { props.selected?.startsWith(props.name) ?: false }
-
- val onClick: (Event) -> Unit = {
- expanded = !expanded
- }
-
- val obj = props.obj
-
- //display as node if any child is visible
- if (obj is VisionGroup) {
- flexRow {
- if (obj.children.keys.any { !it.body.startsWith("@") }) {
- styledSpan {
- css {
- +TreeStyles.treeCaret
- if (expanded) {
- +TreeStyles.treeCaredDown
- }
- }
- attrs {
- onClickFunction = onClick
- }
- }
- }
- child(TreeLabel, props = props)
- }
- if (expanded) {
- flexColumn {
- css {
- +TreeStyles.tree
- }
- obj.children.asSequence()
- .filter { !it.first.toString().startsWith("@") } // ignore statics and other hidden children
- .sortedBy { (it.second as? VisionGroup)?.children?.isEmpty() ?: true } // ignore empty groups
- .forEach { (childToken, child) ->
- styledDiv {
- css {
- +TreeStyles.treeItem
- }
- child(ObjectTree) {
- attrs {
- this.name = props.name + childToken
- this.obj = child
- this.selected = props.selected
- this.clickCallback = props.clickCallback
- }
- }
- }
- }
- }
- }
- } else {
- child(TreeLabel, props = props)
- }
-}
-
-@JsExport
-public val ObjectTree: FC = fc("ObjectTree") { props ->
- visionTree(props)
-}
-
-public fun RBuilder.visionTree(
- vision: Vision,
- selected: Name? = null,
- clickCallback: (Name) -> Unit = {},
-) {
- child(ObjectTree) {
- attrs {
- this.name = Name.EMPTY
- this.obj = vision
- this.selected = selected
- this.clickCallback = clickCallback
- }
- }
-}
-
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/createRoot.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/createRoot.kt
deleted file mode 100644
index fec86770..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/createRoot.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-
-@file:JsModule("react-dom/client")
-@file:JsNonModule
-
-package space.kscience.visionforge.react
-
-import org.w3c.dom.Element
-import react.dom.client.Root
-import react.dom.client.RootOptions
-
-/**
- * Compatibility method to work with old browser API
- */
-public external fun createRoot(
- container: Element,
- options: RootOptions = definedExternally,
-): Root
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/ext.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/ext.kt
deleted file mode 100644
index ae47fa65..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/ext.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package space.kscience.visionforge.react
-
-import react.Props
-import react.RBuilder
-import react.createElement
-import react.dom.client.Root
-
-public fun Root.render(block: RBuilder.() -> Unit) {
- render(createElement(block))
-}
\ No newline at end of file
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/layout.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/layout.kt
deleted file mode 100644
index 11a13561..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/layout.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.css.Display
-import kotlinx.css.FlexDirection
-import kotlinx.css.display
-import kotlinx.css.flexDirection
-import kotlinx.html.DIV
-import react.RBuilder
-import styled.StyledDOMBuilder
-import styled.css
-import styled.styledDiv
-
-public inline fun RBuilder.flexColumn(
- block: StyledDOMBuilder.() -> Unit
-): Unit = styledDiv {
- css {
- display = Display.flex
- flexDirection = FlexDirection.column
- }
- block()
-}
-
-public inline fun RBuilder.flexRow(
- block: StyledDOMBuilder
.() -> Unit
-): Unit = styledDiv {
- css {
- display = Display.flex
- flexDirection = FlexDirection.row
- }
- block()
-}
\ No newline at end of file
diff --git a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/valueChooser.kt b/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/valueChooser.kt
deleted file mode 100644
index 5d0c7c3d..00000000
--- a/ui/react/src/jsMain/kotlin/space/kscience/visionforge/react/valueChooser.kt
+++ /dev/null
@@ -1,175 +0,0 @@
-package space.kscience.visionforge.react
-
-import kotlinx.css.*
-import kotlinx.html.InputType
-import kotlinx.html.js.onChangeFunction
-import kotlinx.html.js.onKeyDownFunction
-import org.w3c.dom.HTMLInputElement
-import org.w3c.dom.HTMLSelectElement
-import org.w3c.dom.events.Event
-import react.FC
-import react.Props
-import react.dom.attrs
-import react.dom.option
-import react.fc
-import react.useState
-import space.kscience.dataforge.meta.*
-import space.kscience.dataforge.meta.descriptors.MetaDescriptor
-import space.kscience.dataforge.meta.descriptors.allowedValues
-import space.kscience.visionforge.Colors
-import space.kscience.visionforge.widgetType
-import styled.css
-import styled.styledInput
-import styled.styledSelect
-import three.math.Color
-
-public external interface ValueChooserProps : Props {
- public var descriptor: MetaDescriptor?
- public var state: EditorPropertyState
- public var value: Value?
- public var onValueChange: (Value?) -> Unit
-}
-
-@JsExport
-public val StringValueChooser: FC
= fc("StringValueChooser") { props ->
- var value by useState(props.value?.string ?: "")
- val keyDown: (Event) -> Unit = { event ->
- if (event.type == "keydown" && event.asDynamic().key == "Enter") {
- value = (event.target as HTMLInputElement).value
- props.onValueChange(value.asValue())
- }
- }
- val handleChange: (Event) -> Unit = {
- value = (it.target as HTMLInputElement).value
- }
- styledInput(type = InputType.text) {
- css {
- width = 100.pct
- }
- attrs {
- this.value = value
- onKeyDownFunction = keyDown
- onChangeFunction = handleChange
- }
- }
-}
-
-@JsExport
-public val BooleanValueChooser: FC = fc("BooleanValueChooser") { props ->
- val handleChange: (Event) -> Unit = {
- val newValue = (it.target as HTMLInputElement).checked
- props.onValueChange(newValue.asValue())
- }
- styledInput(type = InputType.checkBox) {
- css {
- width = 100.pct
- }
- attrs {
- //this.attributes["indeterminate"] = (props.item == null).toString()
- checked = props.value?.boolean ?: false
- onChangeFunction = handleChange
- }
- }
-}
-
-@JsExport
-public val NumberValueChooser: FC = fc("NumberValueChooser") { props ->
- var innerValue by useState(props.value?.string ?: "")
- val keyDown: (Event) -> Unit = { event ->
- if (event.type == "keydown" && event.asDynamic().key == "Enter") {
- innerValue = (event.target as HTMLInputElement).value
- val number = innerValue.toDoubleOrNull()
- if (number == null) {
- console.error("The input value $innerValue is not a number")
- } else {
- props.onValueChange(number.asValue())
- }
- }
- }
- val handleChange: (Event) -> Unit = {
- innerValue = (it.target as HTMLInputElement).value
- }
- styledInput(type = InputType.number) {
- css {
- width = 100.pct
- }
- attrs {
- value = innerValue
- onKeyDownFunction = keyDown
- onChangeFunction = handleChange
- props.descriptor?.attributes?.get("step").string?.let {
- step = it
- }
- props.descriptor?.attributes?.get("min").string?.let {
- min = it
- }
- props.descriptor?.attributes?.get("max").string?.let {
- max = it
- }
- }
- }
-}
-
-@JsExport
-public val ComboValueChooser: FC = fc("ComboValueChooser") { props ->
- var selected by useState(props.value?.string ?: "")
- val handleChange: (Event) -> Unit = {
- selected = (it.target as HTMLSelectElement).value
- props.onValueChange(selected.asValue())
- }
- styledSelect {
- css {
- width = 100.pct
- }
- props.descriptor?.allowedValues?.forEach {
- option {
- +it.string
- }
- }
- attrs {
- this.value = props.value?.string ?: ""
- multiple = false
- onChangeFunction = handleChange
- }
- }
-}
-
-@JsExport
-public val ColorValueChooser: FC = fc("ColorValueChooser") { props ->
- val handleChange: (Event) -> Unit = {
- props.onValueChange((it.target as HTMLInputElement).value.asValue())
- }
- styledInput(type = InputType.color) {
- css {
- width = 100.pct
- margin = Margin(0.px)
- }
- attrs {
- this.value = props.value?.let { value ->
- if (value.type == ValueType.NUMBER) Colors.rgbToString(value.int)
- else "#" + Color(value.string).getHexString()
- } ?: "#000000"
- onChangeFunction = handleChange
- }
- }
-}
-
-@JsExport
-public val ValueChooser: FC = fc("ValueChooser") { props ->
- val rawInput by useState(false)
-
- val descriptor = props.descriptor
- val type = descriptor?.valueTypes?.firstOrNull()
-
- when {
- rawInput -> child(StringValueChooser, props)
- descriptor?.widgetType == "color" -> child(ColorValueChooser, props)
- descriptor?.widgetType == "multiSelect" -> child(MultiSelectChooser, props)
- descriptor?.widgetType == "range" -> child(RangeValueChooser, props)
- type == ValueType.BOOLEAN -> child(BooleanValueChooser, props)
- type == ValueType.NUMBER -> child(NumberValueChooser, props)
- descriptor?.allowedValues?.isNotEmpty() ?: false -> child(ComboValueChooser, props)
- //TODO handle lists
- else -> child(StringValueChooser, props)
- }
-}
diff --git a/ui/ring/README.md b/ui/ring/README.md
deleted file mode 100644
index 6cdcbb60..00000000
--- a/ui/ring/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# Module ring
-
-
-
diff --git a/ui/ring/build.gradle.kts b/ui/ring/build.gradle.kts
deleted file mode 100644
index d1f2ff72..00000000
--- a/ui/ring/build.gradle.kts
+++ /dev/null
@@ -1,25 +0,0 @@
-plugins {
- id("space.kscience.gradle.mpp")
-}
-
-val dataforgeVersion: String by rootProject.extra
-
-kscience{
- js{
- useCommonJs()
- browser {
- commonWebpackConfig {
- cssSupport{
- enabled.set(false)
- }
- }
- }
- }
- jsMain{
- api(projects.ui.react)
- api("org.jetbrains.kotlin-wrappers:kotlin-ring-ui")
-
- implementation(npm("core-js","3.12.1"))
- implementation(npm("file-saver", "2.0.2"))
- }
-}
\ No newline at end of file
diff --git a/ui/ring/src/jsMain/kotlin/ringui/Loader.kt b/ui/ring/src/jsMain/kotlin/ringui/Loader.kt
deleted file mode 100644
index b7bc63a9..00000000
--- a/ui/ring/src/jsMain/kotlin/ringui/Loader.kt
+++ /dev/null
@@ -1,20 +0,0 @@
-@file:JsModule("@jetbrains/ring-ui/components/loader/loader")
-@file:JsNonModule
-
-package ringui
-
-import react.ComponentClass
-import react.PropsWithClassName
-
-
-// https://github.com/JetBrains/ring-ui/blob/master/components/loader/loader.js
-public external interface LoaderProps : PropsWithClassName {
- public var size: Number
- public var colors: Array
- public var message: String
- public var stop: Boolean
- public var deterministic: Boolean
-}
-
-@JsName("default")
-public external val Loader: ComponentClass
\ No newline at end of file
diff --git a/ui/ring/src/jsMain/kotlin/ringui/LoaderScreen.kt b/ui/ring/src/jsMain/kotlin/ringui/LoaderScreen.kt
deleted file mode 100644
index d662ee2b..00000000
--- a/ui/ring/src/jsMain/kotlin/ringui/LoaderScreen.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-@file:JsModule("@jetbrains/ring-ui/components/loader-screen/loader-screen")
-@file:JsNonModule
-
-package ringui
-
-import react.ComponentClass
-import react.PropsWithClassName
-
-// https://github.com/JetBrains/ring-ui/blob/master/components/loader-screen/loader-screen.js
-public external interface LoaderScreenProps : PropsWithClassName {
- public var containerClassName: String
- public var message: String
-}
-
-@JsName("default")
-public external val LoaderScreen: ComponentClass
\ No newline at end of file
diff --git a/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ThreeViewWithControls.kt b/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ThreeViewWithControls.kt
deleted file mode 100644
index 6ae2ec62..00000000
--- a/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ThreeViewWithControls.kt
+++ /dev/null
@@ -1,212 +0,0 @@
-package space.kscience.visionforge.ring
-
-import kotlinx.coroutines.Deferred
-import kotlinx.coroutines.async
-import kotlinx.coroutines.launch
-import kotlinx.css.*
-import react.*
-import react.dom.b
-import react.dom.div
-import react.dom.p
-import react.dom.span
-import ringui.*
-import space.kscience.dataforge.meta.get
-import space.kscience.dataforge.names.Name
-import space.kscience.dataforge.names.NameToken
-import space.kscience.dataforge.names.isEmpty
-import space.kscience.dataforge.names.length
-import space.kscience.visionforge.*
-import space.kscience.visionforge.react.*
-import space.kscience.visionforge.solid.Solid
-import space.kscience.visionforge.solid.SolidGroup
-import space.kscience.visionforge.solid.Solids
-import space.kscience.visionforge.solid.solidGroup
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-import styled.css
-import styled.styledDiv
-
-public external interface ThreeCanvasWithControlsProps : Props {
- public var solids: Solids
- public var builderOfSolid: Deferred
- public var selected: Name?
- public var options: Canvas3DOptions?
- public var additionalTabs: Map Unit>?
-}
-
-private val ThreeCanvasWithControlsProps.context get() = solids.context
-
-public fun ThreeCanvasWithControlsProps.solid(block: SolidGroup.() -> Unit) {
- builderOfSolid = context.async {
- solids.solidGroup(null, block)
- }
-}
-
-public fun ThreeCanvasWithControlsProps.options(block: Canvas3DOptions.() -> Unit) {
- options = Canvas3DOptions(block)
-}
-
-public fun ThreeCanvasWithControlsProps.tab(title: String, block: RBuilder.() -> Unit) {
- additionalTabs = (additionalTabs ?: emptyMap()) + (title to block)
-}
-
-
-public fun RBuilder.nameCrumbs(name: Name?, link: (Name) -> Unit): Unit = styledDiv {
- div {
- Link {
- attrs {
- onClick = {
- link(Name.EMPTY)
- }
- }
- +"\u2302"
- }
-
- if (name != null) {
- val tokens = ArrayList(name.length)
- name.tokens.forEach { token ->
- tokens.add(token)
- val fullName = Name(tokens.toList())
- span { +"." }
- Link {
- +token.toString()
- attrs {
- onClick = {
- console.log("Selected = $fullName")
- link(fullName)
- }
- }
- }
- }
- }
- }
-
-}
-
-@JsExport
-public val ThreeCanvasWithControls: FC = fc("ThreeViewWithControls") { props ->
- var selected: Name? by useState { props.selected }
- var solid: Solid? by useState(null)
-
- useEffect {
- props.context.launch {
- solid = props.builderOfSolid.await()
- //ensure that the solid is properly rooted
- if (solid?.parent == null) {
- solid?.setAsRoot(props.context.visionManager)
- }
- }
- }
-
- val onSelect: (Name?) -> Unit = {
- selected = it
- }
-
- val options = useMemo(props.options) {
- (props.options ?: Canvas3DOptions()).apply {
- this.onSelect = onSelect
- }
- }
-
- val selectedVision: Vision? = useMemo(props.builderOfSolid, selected) {
- selected?.let {
- when {
- it.isEmpty() -> solid
- else -> (solid as? SolidGroup)?.get(it)
- }
- }
- }
-
-
- flexRow {
- css {
- height = 100.pct
- width = 100.pct
- flexWrap = FlexWrap.wrap
- alignItems = Align.stretch
- alignContent = Align.stretch
- }
-
- flexColumn {
- css {
- height = 100.pct
- minWidth = 600.px
- flex = Flex(10.0, 1.0, FlexBasis("600px"))
- position = Position.relative
- }
-
- if (solid == null) {
- LoaderScreen {
- attrs {
- message = "Loading Three vision"
- }
- }
- } else {
- child(ThreeCanvasComponent) {
- attrs {
- this.context = props.context
- this.solid = solid
- this.selected = selected
- this.options = options
- }
- }
- }
-
- selectedVision?.let { vision ->
- styledDiv {
- css {
- position = Position.absolute
- top = 5.px
- right = 5.px
- width = 450.px
- }
- Island {
- IslandHeader {
- attrs {
- border = true
- }
- nameCrumbs(selected) { selected = it }
- }
- IslandContent {
- child(PropertyEditor) {
- attrs {
- this.key = selected.toString()
- this.meta = vision.properties.root()
- this.updates = vision.properties.changes
- this.descriptor = vision.descriptor
- this.scope = props.context
- this.getPropertyState = { name ->
- if (vision.properties.own?.get(name) != null) {
- EditorPropertyState.Defined
- } else if (vision.properties.root()[name] != null) {
- // TODO differentiate
- EditorPropertyState.Default()
- } else {
- EditorPropertyState.Undefined
- }
- }
- }
- }
- vision.styles.takeIf { it.isNotEmpty() }?.let { styles ->
- p {
- b { +"Styles: " }
- +styles.joinToString(separator = ", ")
- }
- }
- }
- }
- }
- }
- }
- flexColumn {
- css {
- padding = Padding(4.px)
- minWidth = 400.px
- height = 100.pct
- overflowY = Overflow.auto
- flex = Flex(1.0, 10.0, FlexBasis("300px"))
- }
- ringThreeControls(options, solid, selected, onSelect, additionalTabs = props.additionalTabs)
- }
- }
-}
-
diff --git a/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ThreeWithControlsPlugin.kt b/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ThreeWithControlsPlugin.kt
deleted file mode 100644
index 94259b2f..00000000
--- a/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ThreeWithControlsPlugin.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package space.kscience.visionforge.ring
-
-import kotlinx.coroutines.async
-import org.w3c.dom.Element
-import space.kscience.dataforge.context.AbstractPlugin
-import space.kscience.dataforge.context.Context
-import space.kscience.dataforge.context.PluginFactory
-import space.kscience.dataforge.context.PluginTag
-import space.kscience.dataforge.meta.Meta
-import space.kscience.dataforge.meta.boolean
-import space.kscience.dataforge.meta.get
-import space.kscience.dataforge.names.Name
-import space.kscience.dataforge.names.asName
-import space.kscience.visionforge.ElementVisionRenderer
-import space.kscience.visionforge.Vision
-import space.kscience.visionforge.react.render
-import space.kscience.visionforge.solid.Solid
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-import space.kscience.visionforge.solid.three.ThreePlugin
-
-public class ThreeWithControlsPlugin : AbstractPlugin(), ElementVisionRenderer {
- public val three: ThreePlugin by require(ThreePlugin)
-
- override val tag: PluginTag get() = Companion.tag
-
- override fun rateVision(vision: Vision): Int =
- if (vision is Solid) ElementVisionRenderer.DEFAULT_RATING * 2 else ElementVisionRenderer.ZERO_RATING
-
- override fun render(element: Element, name: Name, vision: Vision, meta: Meta) {
- if(meta["controls.enabled"].boolean == false){
- three.render(element, name, vision, meta)
- } else {
- space.kscience.visionforge.react.createRoot(element).render {
- child(ThreeCanvasWithControls) {
- attrs {
- this.solids = three.solids
- this.options = Canvas3DOptions.read(meta)
- this.builderOfSolid = context.async { vision as Solid }
- }
- }
- }
- }
- }
-
- override fun content(target: String): Map {
- return when (target) {
- ElementVisionRenderer.TYPE -> mapOf("three.withControls".asName() to this)
- else -> super.content(target)
- }
- }
-
- public companion object : PluginFactory {
- override val tag: PluginTag = PluginTag("vision.threejs.withControls", PluginTag.DATAFORGE_GROUP)
-
- override fun build(context: Context, meta: Meta): ThreeWithControlsPlugin = ThreeWithControlsPlugin()
- }
-}
\ No newline at end of file
diff --git a/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ringPropertyEditor.kt b/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ringPropertyEditor.kt
deleted file mode 100644
index 83529d28..00000000
--- a/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ringPropertyEditor.kt
+++ /dev/null
@@ -1,88 +0,0 @@
-package space.kscience.visionforge.ring
-
-import org.w3c.dom.Element
-import react.RBuilder
-import react.dom.p
-import ringui.Island
-import ringui.SmartTabs
-import ringui.Tab
-import space.kscience.dataforge.meta.descriptors.MetaDescriptor
-import space.kscience.dataforge.meta.get
-import space.kscience.visionforge.Vision
-import space.kscience.visionforge.getStyle
-import space.kscience.visionforge.react.*
-import space.kscience.visionforge.root
-import space.kscience.visionforge.solid.SolidReference
-import space.kscience.visionforge.styles
-
-public fun RBuilder.ringPropertyEditor(
- vision: Vision,
- descriptor: MetaDescriptor? = vision.descriptor,
- key: Any? = null,
-) {
- val styles = if (vision is SolidReference) {
- (vision.styles + vision.prototype.styles).distinct()
- } else {
- vision.styles
- }
-
- flexColumn {
- Island("Properties") {
- child(PropertyEditor) {
- attrs {
- this.key = key?.toString()
- this.meta = vision.properties.root()
- this.updates = vision.properties.changes
- this.descriptor = descriptor
- this.scope = vision.manager?.context ?: error("Orphan vision could not be observed")
- this.getPropertyState = {name->
- if(vision.properties.own?.get(name)!= null){
- EditorPropertyState.Defined
- } else if(vision.properties.root()[name] != null){
- // TODO differentiate
- EditorPropertyState.Default()
- } else {
- EditorPropertyState.Undefined
- }
- }
- }
- }
- }
-
- if (styles.isNotEmpty()) {
- Island("Styles") {
- if (styles.size == 1) {
- val styleName = styles.first()
- p {
- +styleName
- }
- val style = vision.getStyle(styleName)
- if (style != null) {
- Tab(styleName, id = styleName) {
- metaViewer(style)
- }
- }
- } else {
- SmartTabs {
- styles.forEach { styleName ->
- val style = vision.getStyle(styleName)
- if (style != null) {
- Tab(styleName, id = styleName) {
- metaViewer(style)
- }
- }
- }
- }
- }
- }
- }
- }
-}
-
-
-public fun Element.ringPropertyEditor(
- item: Vision,
- descriptor: MetaDescriptor? = item.descriptor,
-): Unit = createRoot(this).render {
- ringPropertyEditor(item, descriptor = descriptor)
-}
\ No newline at end of file
diff --git a/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ringThreeControls.kt b/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ringThreeControls.kt
deleted file mode 100644
index 6cdc0707..00000000
--- a/ui/ring/src/jsMain/kotlin/space.kscience.visionforge.ring/ringThreeControls.kt
+++ /dev/null
@@ -1,131 +0,0 @@
-package space.kscience.visionforge.ring
-
-import kotlinx.coroutines.DelicateCoroutinesApi
-import kotlinx.coroutines.GlobalScope
-import kotlinx.css.*
-import kotlinx.html.js.onClickFunction
-import org.w3c.dom.events.Event
-import org.w3c.files.Blob
-import org.w3c.files.BlobPropertyBag
-import react.FC
-import react.Props
-import react.RBuilder
-import react.dom.attrs
-import react.dom.button
-import react.fc
-import ringui.Island
-import ringui.SmartTabs
-import ringui.Tab
-import space.kscience.dataforge.names.Name
-import space.kscience.visionforge.Vision
-import space.kscience.visionforge.encodeToString
-import space.kscience.visionforge.react.flexColumn
-import space.kscience.visionforge.react.flexRow
-import space.kscience.visionforge.react.propertyEditor
-import space.kscience.visionforge.react.visionTree
-import space.kscience.visionforge.solid.specifications.Canvas3DOptions
-import styled.css
-
-internal fun saveData(event: Event, fileName: String, mimeType: String = "text/plain", dataBuilder: () -> String) {
- event.stopPropagation();
- event.preventDefault();
-
- val fileSaver = kotlinext.js.require("file-saver")
- val blob = Blob(arrayOf(dataBuilder()), BlobPropertyBag("$mimeType;charset=utf-8"))
- fileSaver.saveAs(blob, fileName)
-}
-
-internal fun RBuilder.canvasControls(options: Canvas3DOptions, vision: Vision?): Unit {
- child(CanvasControls) {
- attrs {
- this.options = options
- this.vision = vision
- }
- }
-}
-
-internal external interface CanvasControlsProps : Props {
- public var options: Canvas3DOptions
- public var vision: Vision?
-}
-
-@OptIn(DelicateCoroutinesApi::class)
-internal val CanvasControls: FC = fc("CanvasControls") { props ->
- flexColumn {
- flexRow {
- css {
- border = Border(1.px, BorderStyle.solid, Color.blue)
- padding = Padding(4.px)
- }
- props.vision?.let { vision ->
- button {
- +"Export"
- attrs {
- onClickFunction = {
- val json = vision.encodeToString()
- saveData(it, "object.json", "text/json") {
- json
- }
-
- }
- }
- }
- }
- }
- propertyEditor(
- scope = props.vision?.manager?.context ?: GlobalScope,
- properties = props.options.meta,
- descriptor = Canvas3DOptions.descriptor,
- expanded = false
- )
-
- }
-}
-
-
-public external interface ThreeControlsProps : Props {
- public var canvasOptions: Canvas3DOptions
- public var vision: Vision?
- public var selected: Name?
- public var onSelect: (Name?) -> Unit
- public var additionalTabs: Map Unit>
-}
-
-@JsExport
-public val ThreeControls: FC = fc { props ->
- SmartTabs("Tree") {
- props.vision?.let {
- Tab("Tree") {
- Island("Vision tree") {
- visionTree(it, props.selected, props.onSelect)
- }
- }
- }
- Tab("Settings") {
- Island("Canvas configuration") {
- canvasControls(props.canvasOptions, props.vision)
- }
- }
- props.additionalTabs.forEach { (name, handler) ->
- Tab(name) {
- handler()
- }
- }
- }
-}
-
-public fun RBuilder.ringThreeControls(
- canvasOptions: Canvas3DOptions,
- vision: Vision?,
- selected: Name?,
- onSelect: (Name?) -> Unit = {},
- additionalTabs: Map Unit>? = null
-): Unit = child(ThreeControls) {
- attrs {
- this.canvasOptions = canvasOptions
- this.vision = vision
- this.selected = selected
- this.onSelect = onSelect
- this.additionalTabs = additionalTabs ?: emptyMap()
- }
-}
\ No newline at end of file
diff --git a/ui/ring/webpack.config.d/01.ring.js b/ui/ring/webpack.config.d/01.ring.js
deleted file mode 100644
index 41da041c..00000000
--- a/ui/ring/webpack.config.d/01.ring.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const ringConfig = require('@jetbrains/ring-ui/webpack.config').config;
-
-config.module.rules.push(...ringConfig.module.rules)
\ No newline at end of file
diff --git a/ui/compose/build.gradle.kts b/visionforge-compose-html/build.gradle.kts
similarity index 54%
rename from ui/compose/build.gradle.kts
rename to visionforge-compose-html/build.gradle.kts
index 77a8cfcf..89d7c329 100644
--- a/ui/compose/build.gradle.kts
+++ b/visionforge-compose-html/build.gradle.kts
@@ -1,40 +1,31 @@
-
plugins {
id("space.kscience.gradle.mpp")
alias(spclibs.plugins.compose)
-// id("com.android.library")
}
-kscience{
- jvm()
+kscience {
js()
-// wasm()
+ jvm()
}
kotlin {
// android()
sourceSets {
- val commonMain by getting {
- dependencies {
-
- }
- }
-
- val jvmMain by getting {
+ commonMain {
dependencies {
+ api(projects.visionforgeCore)
+ //need this to placate compose compiler in MPP applications
api(compose.runtime)
- api(compose.foundation)
- api(compose.material)
- api(compose.preview)
}
}
- val jsMain by getting{
+ jsMain{
dependencies {
- api(compose.html.core)
api("app.softwork:bootstrap-compose:0.1.15")
api("app.softwork:bootstrap-compose-icons:0.1.15")
- api(projects.visionforge.visionforgeThreejs)
+ implementation(compose.html.svg)
+
+ api(compose.html.core)
}
}
}
diff --git a/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/ComposeHtmlVisionRenderer.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/ComposeHtmlVisionRenderer.kt
new file mode 100644
index 00000000..5a54292d
--- /dev/null
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/ComposeHtmlVisionRenderer.kt
@@ -0,0 +1,28 @@
+package space.kscience.visionforge.html
+
+import androidx.compose.runtime.Composable
+import org.jetbrains.compose.web.css.Style
+import org.jetbrains.compose.web.dom.DOMScope
+import org.jetbrains.compose.web.renderComposable
+import org.w3c.dom.Element
+import space.kscience.dataforge.meta.Meta
+import space.kscience.dataforge.names.Name
+import space.kscience.visionforge.Vision
+
+/**
+ * An [ElementVisionRenderer] that could be used directly in Compose-html as well as a stand-alone renderer
+ */
+public interface ComposeHtmlVisionRenderer : ElementVisionRenderer {
+
+ @Composable
+ public fun DOMScope.render(name: Name, vision: Vision, meta: Meta)
+
+ override fun render(element: Element, name: Name, vision: Vision, meta: Meta) {
+ renderComposable(element) {
+ Style(VisionForgeStyles)
+ render(name, vision, meta)
+ }
+ }
+
+ public companion object
+}
\ No newline at end of file
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/MetaViewer.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/MetaViewer.kt
similarity index 94%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/MetaViewer.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/MetaViewer.kt
index 5aaf4140..3f85fd9f 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/MetaViewer.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/MetaViewer.kt
@@ -1,4 +1,4 @@
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import androidx.compose.runtime.*
import org.jetbrains.compose.web.css.AlignItems
@@ -10,7 +10,6 @@ import org.jetbrains.compose.web.dom.Text
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
import space.kscience.dataforge.meta.descriptors.get
-import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.isLeaf
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.NameToken
@@ -64,7 +63,7 @@ private fun MetaViewerItem(root: Meta, name: Name, rootDescriptor: MetaDescripto
classes(TreeStyles.tree)
}) {
val keys = buildSet {
- descriptorItem?.children?.keys?.forEach {
+ descriptorItem?.nodes?.keys?.forEach {
add(NameToken(it))
}
actualMeta!!.items.keys.let { addAll(it) }
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/NameCrumbs.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/NameCrumbs.kt
similarity index 61%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/NameCrumbs.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/NameCrumbs.kt
index 2becdbb6..787a45fa 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/NameCrumbs.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/NameCrumbs.kt
@@ -1,26 +1,31 @@
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import androidx.compose.runtime.Composable
-import org.jetbrains.compose.web.dom.Li
-import org.jetbrains.compose.web.dom.Nav
-import org.jetbrains.compose.web.dom.Ol
-import org.jetbrains.compose.web.dom.Text
+import org.jetbrains.compose.web.dom.*
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.NameToken
import space.kscience.dataforge.names.length
@Composable
public fun NameCrumbs(name: Name?, link: (Name) -> Unit): Unit = Nav({
- attr("aria-label","breadcrumb")
+ attr("aria-label", "breadcrumb")
}) {
- Ol({classes("breadcrumb")}) {
+ Ol({
+ classes("breadcrumb")
+ style {
+ property("--bs-breadcrumb-divider", "'.'")
+ property("--bs-breadcrumb-item-padding-x", ".1rem")
+ }
+ }) {
Li({
classes("breadcrumb-item")
onClick {
link(Name.EMPTY)
}
}) {
- Text("\u2302")
+ A("#") {
+ Text("\u2302")
+ }
}
if (name != null) {
@@ -28,15 +33,16 @@ public fun NameCrumbs(name: Name?, link: (Name) -> Unit): Unit = Nav({
name.tokens.forEach { token ->
tokens.add(token)
val fullName = Name(tokens.toList())
- Text(".")
Li({
classes("breadcrumb-item")
- if(tokens.size == name.length) classes("active")
+ if (tokens.size == name.length) classes("active")
onClick {
link(fullName)
}
}) {
- Text(token.toString())
+ A("#") {
+ Text(token.toString())
+ }
}
}
}
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/PropertyEditor.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/PropertyEditor.kt
similarity index 62%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/PropertyEditor.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/PropertyEditor.kt
index d919cd77..04329625 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/PropertyEditor.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/PropertyEditor.kt
@@ -1,25 +1,23 @@
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import androidx.compose.runtime.*
-import kotlinx.coroutines.CoroutineScope
+import app.softwork.bootstrapcompose.CloseButton
+import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.launch
-import org.jetbrains.compose.web.attributes.disabled
import org.jetbrains.compose.web.css.AlignItems
import org.jetbrains.compose.web.css.alignItems
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.width
-import org.jetbrains.compose.web.dom.Button
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.Span
import org.jetbrains.compose.web.dom.Text
import space.kscience.dataforge.meta.MutableMeta
import space.kscience.dataforge.meta.ObservableMutableMeta
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
-import space.kscience.dataforge.meta.descriptors.ValueRequirement
+import space.kscience.dataforge.meta.descriptors.ValueRestriction
import space.kscience.dataforge.meta.descriptors.get
-import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.remove
import space.kscience.dataforge.names.*
import space.kscience.visionforge.hidden
@@ -29,35 +27,33 @@ import space.kscience.visionforge.hidden
* The display state of a property
*/
public sealed class EditorPropertyState {
- public object Defined : EditorPropertyState()
- public class Default(public val source: String = "unknown") : EditorPropertyState()
- public object Undefined : EditorPropertyState()
-
+ public data object Defined : EditorPropertyState()
+ public data class Default(public val source: String = "unknown") : EditorPropertyState()
+ public data object Undefined : EditorPropertyState()
}
/**
- * @param meta Root config object - always non-null
- * @param rootDescriptor Full path to the displayed node in [meta]. Could be empty
+ * @param rootMeta Root config object - always non-null
+ * @param rootDescriptor Full path to the displayed node in [rootMeta]. Could be empty
*/
@Composable
public fun PropertyEditor(
- scope: CoroutineScope,
- meta: MutableMeta,
+ rootMeta: MutableMeta,
getPropertyState: (Name) -> EditorPropertyState,
updates: Flow,
- name: Name = Name.EMPTY,
- rootDescriptor: MetaDescriptor? = null,
+ name: Name,
+ rootDescriptor: MetaDescriptor?,
initialExpanded: Boolean? = null,
) {
var expanded: Boolean by remember { mutableStateOf(initialExpanded ?: true) }
- val descriptor: MetaDescriptor? = remember(rootDescriptor, name) { rootDescriptor?.get(name) }
- var property: MutableMeta by remember { mutableStateOf(meta.getOrCreate(name)) }
+ val descriptor: MetaDescriptor? by derivedStateOf { rootDescriptor?.get(name) }
+ var displayedValue by remember { mutableStateOf(rootMeta.getValue(name)) }
var editorPropertyState: EditorPropertyState by remember { mutableStateOf(getPropertyState(name)) }
- val keys = remember(descriptor) {
+ val keys by derivedStateOf {
buildSet {
- descriptor?.children?.filterNot {
+ descriptor?.nodes?.filterNot {
it.key.startsWith("@") || it.value.hidden
}?.forEach {
add(NameToken(it.key))
@@ -69,13 +65,13 @@ public fun PropertyEditor(
val token = name.lastOrNull()?.toString() ?: "Properties"
fun update() {
- property = meta.getOrCreate(name)
+ displayedValue = rootMeta.getValue(name)
editorPropertyState = getPropertyState(name)
}
- LaunchedEffect(meta) {
+ LaunchedEffect(rootMeta) {
updates.collect { updatedName ->
- if (updatedName == name) {
+ if (name.startsWith(updatedName)) {
update()
}
}
@@ -86,6 +82,7 @@ public fun PropertyEditor(
alignItems(AlignItems.Center)
}
}) {
+ //if node has children
if (keys.isNotEmpty()) {
Span({
classes(TreeStyles.treeCaret)
@@ -97,38 +94,35 @@ public fun PropertyEditor(
}
Span({
classes(TreeStyles.treeLabel)
- if (editorPropertyState != EditorPropertyState.Defined) {
- classes(TreeStyles.treeLabelInactive)
+ when (editorPropertyState) {
+ is EditorPropertyState.Default, EditorPropertyState.Undefined -> {
+ classes(TreeStyles.treeLabelInactive)
+ }
+
+ EditorPropertyState.Defined -> {}
}
}) {
Text(token)
}
- if (!name.isEmpty() && descriptor?.valueRequirement != ValueRequirement.ABSENT) {
+ if (!name.isEmpty() && descriptor?.valueRestriction != ValueRestriction.ABSENT) {
Div({
style {
width(160.px)
marginAll(1.px, 5.px)
}
}) {
- ValueChooser(descriptor, editorPropertyState, property.value) {
- property.value = it
- editorPropertyState = getPropertyState(name)
+ ValueChooser(descriptor, editorPropertyState, displayedValue) {
+ rootMeta.setValue(name, it)
+ update()
}
}
- Button({
- classes(TreeStyles.propertyEditorButton)
- if (editorPropertyState != EditorPropertyState.Defined) {
- disabled()
- } else {
- onClick {
- meta.remove(name)
- update()
- }
- }
- }) {
- Text("\u00D7")
+ }
+ if (!name.isEmpty()) {
+ CloseButton(editorPropertyState != EditorPropertyState.Defined) {
+ rootMeta.remove(name)
+ update()
}
}
}
@@ -140,7 +134,7 @@ public fun PropertyEditor(
Div({
classes(TreeStyles.treeItem)
}) {
- PropertyEditor(scope, meta, getPropertyState, updates, name + token, descriptor, expanded)
+ PropertyEditor(rootMeta, getPropertyState, updates, name + token, rootDescriptor, expanded)
}
}
}
@@ -149,14 +143,13 @@ public fun PropertyEditor(
@Composable
public fun PropertyEditor(
- scope: CoroutineScope,
properties: ObservableMutableMeta,
descriptor: MetaDescriptor? = null,
expanded: Boolean? = null,
) {
+ val scope = rememberCoroutineScope()
PropertyEditor(
- scope = scope,
- meta = properties,
+ rootMeta = properties,
getPropertyState = { name ->
if (properties[name] != null) {
EditorPropertyState.Defined
@@ -173,9 +166,7 @@ public fun PropertyEditor(
}
}
- invokeOnClose {
- properties.removeListener(scope)
- }
+ awaitClose { properties.removeListener(scope) }
},
name = Name.EMPTY,
rootDescriptor = descriptor,
diff --git a/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/Tabs.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/Tabs.kt
new file mode 100644
index 00000000..36504cf4
--- /dev/null
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/Tabs.kt
@@ -0,0 +1,94 @@
+package space.kscience.visionforge.html
+
+import androidx.compose.runtime.*
+import app.softwork.bootstrapcompose.Card
+import app.softwork.bootstrapcompose.NavbarLink
+import app.softwork.bootstrapcompose.Styling
+import org.jetbrains.compose.web.css.overflowY
+import org.jetbrains.compose.web.dom.*
+import org.w3c.dom.HTMLAnchorElement
+import org.w3c.dom.HTMLDivElement
+
+
+public class ComposeTab(
+ public val key: String,
+ public val title: ContentBuilder,
+ public val disabled: Boolean,
+ public val content: ContentBuilder,
+)
+
+@Composable
+public fun Tabs(
+ tabs: List,
+ activeKey: String,
+ styling: (Styling.() -> Unit)? = null,
+ attrs: AttrBuilderContext? = null,
+) {
+ var active by remember(activeKey) { mutableStateOf(activeKey) }
+
+ val activeTab by derivedStateOf { tabs.find { it.key == active } }
+
+ Card(
+ styling,
+ attrs,
+ header = {
+ Ul({ classes("nav", "nav-tabs", "card-header-tabs") }) {
+ tabs.forEach { tab ->
+ Li({
+ classes("nav-item")
+ }) {
+ NavbarLink(
+ active = active == tab.key,
+ disabled = tab.disabled,
+ attrs = {
+ onClick { event ->
+ event.preventDefault()
+ active = tab.key
+ }
+ }
+ ) {
+ tab.title.invoke(this)
+ }
+ }
+ }
+ }
+ },
+ bodyAttrs = {
+ style {
+ overflowY("auto")
+ }
+ }
+ ) {
+ activeTab?.content?.invoke(this)
+ }
+}
+
+public class TabsBuilder {
+ internal val tabs: MutableList = mutableListOf()
+
+ @Composable
+ public fun Tab(
+ key: String,
+ label: ContentBuilder = { A("#") { Text(key) } },
+ disabled: Boolean = false,
+ content: ContentBuilder,
+ ) {
+ tabs.add(ComposeTab(key, label, disabled, content))
+ }
+
+ public fun addTab(tab: ComposeTab) {
+ tabs.add(tab)
+ }
+}
+
+@Composable
+public fun Tabs(
+ activeKey: String? = null,
+ styling: (Styling.() -> Unit)? = null,
+ attrs: AttrBuilderContext? = null,
+ builder: @Composable TabsBuilder.() -> Unit,
+) {
+ val result = TabsBuilder().apply { builder() }
+
+ Tabs(result.tabs, activeKey ?: result.tabs.firstOrNull()?.key ?: "", styling, attrs)
+}
\ No newline at end of file
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/TreeStyles.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/TreeStyles.kt
similarity index 65%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/TreeStyles.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/TreeStyles.kt
index de9001ba..4d8406ad 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/TreeStyles.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/TreeStyles.kt
@@ -1,16 +1,16 @@
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import org.jetbrains.compose.web.ExperimentalComposeWebApi
import org.jetbrains.compose.web.css.*
@OptIn(ExperimentalComposeWebApi::class)
-public object TreeStyles : StyleSheet() {
+public object TreeStyles : StyleSheet(VisionForgeStyles) {
/**
* Remove default bullets
*/
public val tree: String by style {
- paddingLeft(5.px)
+ paddingLeft(10.px)
marginLeft(0.px)
listStyleType("none")
}
@@ -22,7 +22,7 @@ public object TreeStyles : StyleSheet() {
cursor("pointer")
userSelect(UserSelect.none)
/* Create the caret/arrow with a unicode, and style it */
- before {
+ (self + before) {
content("\u25B6")
color(Color.black)
display(DisplayStyle.InlineBlock)
@@ -34,7 +34,7 @@ public object TreeStyles : StyleSheet() {
* Rotate the caret/arrow icon when clicked on (using JavaScript)
*/
public val treeCaretDown: String by style {
- before {
+ (self + before) {
content("\u25B6")
color(Color.black)
display(DisplayStyle.InlineBlock)
@@ -46,13 +46,11 @@ public object TreeStyles : StyleSheet() {
public val treeItem: String by style {
alignItems(AlignItems.Center)
paddingLeft(10.px)
- border {
- left {
- width(1.px)
- color(Color.lightgray)
- style = LineStyle.Dashed
- }
- }
+ property("border-left", CSSBorder().apply{
+ width(1.px)
+ color(Color.lightgray)
+ style = LineStyle.Dashed
+ })
}
public val treeLabel: String by style {
@@ -69,26 +67,4 @@ public object TreeStyles : StyleSheet() {
public val treeLabelSelected: String by style {
backgroundColor(Color.lightblue)
}
-
- public val propertyEditorButton: String by style {
- width(24.px)
- alignSelf(AlignSelf.Stretch)
- marginAll(1.px, 5.px)
- backgroundColor(Color.white)
- border{
- style(LineStyle.Solid)
- }
- borderRadius(2.px)
- textAlign("center")
- textDecoration("none")
- cursor("pointer")
- disabled {
- cursor("auto")
- border{
- style(LineStyle.Dashed)
- }
- color(Color.lightgray)
- }
- }
-
}
\ No newline at end of file
diff --git a/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/VisionForgeStyles.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/VisionForgeStyles.kt
new file mode 100644
index 00000000..311f41b2
--- /dev/null
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/VisionForgeStyles.kt
@@ -0,0 +1,28 @@
+package space.kscience.visionforge.html
+
+import org.jetbrains.compose.web.css.*
+
+public object VisionForgeStyles: StyleSheet() {
+
+ public val propertyEditorButton: String by style {
+ width(24.px)
+ alignSelf(AlignSelf.Stretch)
+ marginAll(1.px, 5.px)
+ backgroundColor(Color.white)
+ border {
+ style(LineStyle.Solid)
+ }
+ borderRadius(2.px)
+ textAlign("center")
+ textDecoration("none")
+ cursor("pointer")
+ (self + disabled) {
+ cursor("auto")
+ border {
+ style(LineStyle.Dashed)
+ }
+ color(Color.lightgray)
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/VisionTree.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/VisionTree.kt
similarity index 90%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/VisionTree.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/VisionTree.kt
index 2de59f90..b714fb71 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/VisionTree.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/VisionTree.kt
@@ -1,10 +1,9 @@
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import androidx.compose.runtime.*
import org.jetbrains.compose.web.css.Color
import org.jetbrains.compose.web.css.color
import org.jetbrains.compose.web.css.cursor
-import org.jetbrains.compose.web.css.textDecorationLine
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.Span
import org.jetbrains.compose.web.dom.Text
@@ -15,8 +14,6 @@ import space.kscience.dataforge.names.startsWith
import space.kscience.visionforge.Vision
import space.kscience.visionforge.VisionGroup
import space.kscience.visionforge.asSequence
-import space.kscience.visionforge.compose.TreeStyles.hover
-import space.kscience.visionforge.compose.TreeStyles.invoke
import space.kscience.visionforge.isEmpty
@@ -35,10 +32,6 @@ private fun TreeLabel(
style {
color(Color("#069"))
cursor("pointer")
- hover.invoke {
- textDecorationLine("underline")
- }
-
}
onClick { clickCallback(name) }
}) {
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/bootstrap.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/bootstrap.kt
similarity index 74%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/bootstrap.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/bootstrap.kt
index 8b0ee5b5..ce27653b 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/bootstrap.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/bootstrap.kt
@@ -1,4 +1,4 @@
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import androidx.compose.runtime.Composable
import org.jetbrains.compose.web.dom.H5
diff --git a/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/composeHtmlVision.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/composeHtmlVision.kt
new file mode 100644
index 00000000..9c8b6c8c
--- /dev/null
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/composeHtmlVision.kt
@@ -0,0 +1,56 @@
+package space.kscience.visionforge.html
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.derivedStateOf
+import androidx.compose.runtime.getValue
+import kotlinx.dom.clear
+import org.jetbrains.compose.web.dom.AttrBuilderContext
+import org.jetbrains.compose.web.dom.Div
+import org.w3c.dom.HTMLDivElement
+import space.kscience.dataforge.context.Context
+import space.kscience.dataforge.context.gather
+import space.kscience.dataforge.context.request
+import space.kscience.dataforge.meta.Meta
+import space.kscience.dataforge.names.Name
+import space.kscience.dataforge.names.asName
+import space.kscience.visionforge.*
+
+
+/**
+ * Render an Element vision via injected vision renderer inside compose-html
+ */
+@Composable
+public fun Vision(
+ context: Context,
+ vision: Vision,
+ name: Name = "@vision[${vision.hashCode().toString(16)}]".asName(),
+ meta: Meta = Meta.EMPTY,
+ attrs: AttrBuilderContext? = null,
+): Unit = Div(attrs) {
+
+ val client: VisionClient = context.request(JsVisionClient)
+
+ // set vision root if necessary
+ if (vision.manager == null) {
+ vision.setAsRoot(client.visionManager)
+ }
+
+ val renderer by derivedStateOf {
+ client.context.gather(ElementVisionRenderer.TYPE).values.mapNotNull {
+ val rating = it.rateVision(vision)
+ if (rating > 0) {
+ rating to it
+ } else {
+ null
+ }
+ }.maxBy { it.first }.second
+ }
+
+ DisposableEffect(vision, name, renderer, meta) {
+ renderer.render(scopeElement, name, vision, meta)
+ onDispose {
+ scopeElement.clear()
+ }
+ }
+}
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/css.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/css.kt
similarity index 95%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/css.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/css.kt
index 0bf8f7c2..9ae652cf 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/css.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/css.kt
@@ -1,4 +1,4 @@
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import org.jetbrains.compose.web.css.*
import org.jetbrains.compose.web.css.keywords.CSSAutoKeyword
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/layouts.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/layouts.kt
similarity index 96%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/layouts.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/layouts.kt
index 882f1f1c..ecdfbb1c 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/layouts.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/layouts.kt
@@ -1,4 +1,4 @@
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import androidx.compose.runtime.Composable
import org.jetbrains.compose.web.css.DisplayStyle
diff --git a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/valueChooser.kt b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/valueChooser.kt
similarity index 59%
rename from ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/valueChooser.kt
rename to visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/valueChooser.kt
index 0be879ad..fdec8c3f 100644
--- a/ui/compose/src/jsMain/kotlin/space/kscience/visionforge/compose/valueChooser.kt
+++ b/visionforge-compose-html/src/jsMain/kotlin/space/kscience/visionforge/html/valueChooser.kt
@@ -1,26 +1,19 @@
@file:Suppress("UNUSED_PARAMETER")
-package space.kscience.visionforge.compose
+package space.kscience.visionforge.html
import androidx.compose.runtime.*
+import kotlinx.uuid.UUID
+import kotlinx.uuid.generateUUID
import org.jetbrains.compose.web.attributes.*
-import org.jetbrains.compose.web.css.percent
-import org.jetbrains.compose.web.css.px
-import org.jetbrains.compose.web.css.width
-import org.jetbrains.compose.web.dom.Input
-import org.jetbrains.compose.web.dom.Option
-import org.jetbrains.compose.web.dom.Select
-import org.jetbrains.compose.web.dom.Text
-import org.w3c.dom.HTMLInputElement
+import org.jetbrains.compose.web.dom.*
import org.w3c.dom.HTMLOptionElement
import org.w3c.dom.asList
import space.kscience.dataforge.meta.*
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
-import space.kscience.dataforge.meta.descriptors.ValueRequirement
import space.kscience.dataforge.meta.descriptors.allowedValues
import space.kscience.visionforge.Colors
import space.kscience.visionforge.widgetType
-import three.math.Color
@Composable
@@ -30,20 +23,16 @@ public fun StringValueChooser(
value: Value?,
onValueChange: (Value?) -> Unit,
) {
- var stringValue by remember { mutableStateOf(value?.string ?: "") }
+ var stringValue by remember(value, descriptor) { mutableStateOf(value?.string ?: "") }
Input(type = InputType.Text) {
- style {
- width(100.percent)
- }
+ classes("w-100")
value(stringValue)
- onKeyDown { event ->
- if (event.type == "keydown" && event.asDynamic().key == "Enter") {
- stringValue = (event.target as HTMLInputElement).value
- onValueChange(stringValue.asValue())
- }
+ onChange { event ->
+ stringValue = event.value
}
- onChange {
- stringValue = it.target.value
+ onInput { event ->
+ stringValue = event.value
+ onValueChange(event.value.asValue())
}
}
}
@@ -56,16 +45,29 @@ public fun BooleanValueChooser(
value: Value?,
onValueChange: (Value?) -> Unit,
) {
- Input(type = InputType.Checkbox) {
- style {
- width(100.percent)
- }
- //this.attributes["indeterminate"] = (props.item == null).toString()
- checked(value?.boolean ?: false)
+ val uid = remember { "checkbox[${UUID.generateUUID().toString(false)}]" }
+ var innerValue by remember(value, descriptor) {
+ mutableStateOf(
+ value?.boolean ?: descriptor?.defaultValue?.boolean
+ )
+ }
- onChange {
- val newValue = it.target.checked
- onValueChange(newValue.asValue())
+ Input(type = InputType.Checkbox) {
+ classes("btn-check")
+ checked(innerValue ?: false)
+ autoComplete(AutoComplete.off)
+ id(uid)
+
+ onInput { event ->
+ innerValue = event.value
+ onValueChange(event.value.asValue())
+ }
+ }
+ Label(uid, attrs = { classes("btn", "btn-sm", "btn-outline-secondary", "w-100") }) {
+ if (innerValue == true) {
+ Text("On")
+ } else {
+ Text("Off")
}
}
}
@@ -77,25 +79,18 @@ public fun NumberValueChooser(
value: Value?,
onValueChange: (Value?) -> Unit,
) {
- var innerValue by remember { mutableStateOf(value?.string ?: "") }
+ var innerValue by remember(value, descriptor) { mutableStateOf(value?.number ?: descriptor?.defaultValue?.number) }
Input(type = InputType.Number) {
- style {
- width(100.percent)
+ classes("w-100")
+
+ value(innerValue ?: descriptor?.defaultValue?.number ?: 0.0)
+
+ onChange { event ->
+ innerValue = event.value
}
- value(innerValue)
- onKeyDown { event ->
- if (event.type == "keydown" && event.asDynamic().key == "Enter") {
- innerValue = (event.target as HTMLInputElement).value
- val number = innerValue.toDoubleOrNull()
- if (number == null) {
- console.error("The input value $innerValue is not a number")
- } else {
- onValueChange(number.asValue())
- }
- }
- }
- onChange {
- innerValue = it.target.value
+ onInput { event ->
+ innerValue = event.value
+ onValueChange(event.value?.asValue())
}
descriptor?.attributes?.get("step").number?.let {
step(it)
@@ -117,11 +112,10 @@ public fun ComboValueChooser(
value: Value?,
onValueChange: (Value?) -> Unit,
) {
- var selected by remember { mutableStateOf(value?.string ?: "") }
+ var selected by remember(value, descriptor) { mutableStateOf(value?.string ?: "") }
Select({
- style {
- width(100.percent)
- }
+ classes("w-100")
+
onChange {
selected = it.target.value
onValueChange(selected.asValue())
@@ -143,19 +137,24 @@ public fun ColorValueChooser(
value: Value?,
onValueChange: (Value?) -> Unit,
) {
+ var innerValue by remember { mutableStateOf(value?.string ?: descriptor?.defaultValue?.string) }
+
Input(type = InputType.Color) {
- style {
- width(100.percent)
- marginAll(0.px)
- }
+ classes("w-100")
+
value(
value?.let { value ->
if (value.type == ValueType.NUMBER) Colors.rgbToString(value.int)
- else "#" + Color(value.string).getHexString()
+ else value.string
+ //else "#" + Color(value.string).getHexString()
} ?: "#000000"
)
- onChange {
- onValueChange(it.target.value.asValue())
+ onChange { event ->
+ innerValue = event.value
+ }
+ onInput { event ->
+ innerValue = event.value
+ onValueChange(event.value.asValue())
}
}
}
@@ -169,6 +168,7 @@ public fun MultiSelectChooser(
onValueChange: (Value?) -> Unit,
) {
Select({
+ classes("w-100","form-select")
onChange { event ->
val newSelected = event.target.selectedOptions.asList()
.map { (it as HTMLOptionElement).value.asValue() }
@@ -194,40 +194,18 @@ public fun RangeValueChooser(
value: Value?,
onValueChange: (Value?) -> Unit,
) {
- var innerValue by remember { mutableStateOf(value?.double) }
- var rangeDisabled: Boolean by remember { mutableStateOf(state != EditorPropertyState.Defined) }
-
-
- FlexRow {
- if (descriptor?.valueRequirement != ValueRequirement.REQUIRED) {
- Input(type = InputType.Checkbox) {
- if (!rangeDisabled) defaultChecked()
-
- onChange {
- val checkBoxValue = it.target.checked
- rangeDisabled = !checkBoxValue
- onValueChange(
- if (!checkBoxValue) {
- null
- } else {
- innerValue?.asValue()
- }
- )
- }
- }
- }
- }
+ var innerValue by remember(value, descriptor) { mutableStateOf(value?.number ?: descriptor?.defaultValue?.number) }
Input(type = InputType.Range) {
- style {
- width(100.percent)
- }
- if (rangeDisabled) disabled()
+ classes("w-100", "form-range")
+
value(innerValue?.toString() ?: "")
- onChange {
- val newValue = it.target.value
- onValueChange(newValue.toDoubleOrNull()?.asValue())
- innerValue = newValue.toDoubleOrNull()
+ onInput { event ->
+ innerValue = event.value
+ }
+ onChange { event ->
+ innerValue = event.value
+ onValueChange(innerValue?.asValue())
}
descriptor?.attributes?.get("min").string?.let {
min(it)
diff --git a/visionforge-compose-multiplatform/README.md b/visionforge-compose-multiplatform/README.md
new file mode 100644
index 00000000..aef4ef10
--- /dev/null
+++ b/visionforge-compose-multiplatform/README.md
@@ -0,0 +1,21 @@
+# Module visionforge-compose-multiplatform
+
+
+
+## Usage
+
+## Artifact:
+
+The Maven coordinates of this project are `space.kscience:visionforge-compose-multiplatform:0.4.1`.
+
+**Gradle Kotlin DSL:**
+```kotlin
+repositories {
+ maven("https://repo.kotlin.link")
+ mavenCentral()
+}
+
+dependencies {
+ implementation("space.kscience:visionforge-compose-multiplatform:0.4.1")
+}
+```
diff --git a/visionforge-compose-multiplatform/build.gradle.kts b/visionforge-compose-multiplatform/build.gradle.kts
new file mode 100644
index 00000000..b3175b38
--- /dev/null
+++ b/visionforge-compose-multiplatform/build.gradle.kts
@@ -0,0 +1,35 @@
+import space.kscience.gradle.Maturity
+
+plugins {
+ id("space.kscience.gradle.mpp")
+ alias(spclibs.plugins.compose)
+}
+
+kscience {
+ jvm()
+// wasm()
+}
+
+kotlin {
+// android()
+ sourceSets {
+ commonMain {
+ dependencies {
+ api(projects.visionforgeCore)
+ api(compose.foundation)
+ api(compose.runtime)
+ api(compose.material)
+ api(compose.materialIconsExtended)
+ }
+ }
+ jvmMain {
+ dependencies {
+ implementation("com.eygraber:compose-color-picker:0.0.17")
+ }
+ }
+ }
+}
+
+readme {
+ maturity = Maturity.EXPERIMENTAL
+}
\ No newline at end of file
diff --git a/visionforge-compose-multiplatform/src/commonMain/kotlin/space/kscience/visionforge/compose/ComposeVisionClient.kt b/visionforge-compose-multiplatform/src/commonMain/kotlin/space/kscience/visionforge/compose/ComposeVisionClient.kt
new file mode 100644
index 00000000..29bca480
--- /dev/null
+++ b/visionforge-compose-multiplatform/src/commonMain/kotlin/space/kscience/visionforge/compose/ComposeVisionClient.kt
@@ -0,0 +1,134 @@
+package space.kscience.visionforge.compose
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.key
+import androidx.compose.runtime.remember
+import kotlinx.coroutines.flow.MutableSharedFlow
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.sync.Mutex
+import kotlinx.coroutines.sync.withLock
+import space.kscience.dataforge.context.*
+import space.kscience.dataforge.meta.Meta
+import space.kscience.dataforge.meta.get
+import space.kscience.dataforge.meta.int
+import space.kscience.dataforge.names.Name
+import space.kscience.dataforge.names.NameToken
+import space.kscience.dataforge.names.asName
+import space.kscience.visionforge.*
+import space.kscience.visionforge.html.VisionOutput
+import space.kscience.visionforge.html.VisionTagConsumer
+
+/**
+ * A Kotlin-browser plugin that renders visions based on provided renderers and governs communication with the server.
+ */
+public class ComposeVisionClient : AbstractPlugin(), VisionClient {
+ override val tag: PluginTag get() = Companion.tag
+ override val visionManager: VisionManager by require(VisionManager)
+
+
+ private val renderers by lazy { context.gather(ComposeVisionRenderer.TYPE).values }
+
+ private fun findRendererFor(vision: Vision): ComposeVisionRenderer? = renderers.mapNotNull {
+ val rating = it.rateVision(vision)
+ if (rating > 0) {
+ rating to it
+ } else {
+ null
+ }
+ }.maxByOrNull { it.first }?.second
+
+
+ private val mutex = Mutex()
+
+
+ private val rootChangeCollector = VisionChangeBuilder()
+
+ /**
+ * Communicate vision property changed from rendering engine to model
+ */
+ override fun notifyPropertyChanged(visionName: Name, propertyName: Name, item: Meta?) {
+ context.launch {
+ mutex.withLock {
+ rootChangeCollector.propertyChanged(visionName, propertyName, item)
+ }
+ }
+ }
+
+ private val eventCollector = MutableSharedFlow>(meta["feedback.eventCache"].int ?: 100)
+
+ /**
+ * Send a custom feedback event
+ */
+ override suspend fun sendEvent(targetName: Name, event: VisionEvent) {
+ eventCollector.emit(targetName to event)
+ }
+
+ @Composable
+ public fun renderVision(name: Name, vision: Vision, outputMeta: Meta) {
+ val renderer: ComposeVisionRenderer = remember(vision) {
+ findRendererFor(vision) ?: error("Could not find renderer for ${vision::class}")
+ }
+
+ key(vision) {
+ vision.setAsRoot(visionManager)
+ }
+ //subscribe to a backwards events propagation for control visions
+ if (vision is ControlVision) {
+ LaunchedEffect(vision) {
+ vision.controlEventFlow.collect {
+ sendEvent(name, it)
+ }
+ }
+ }
+
+ renderer.render(name, vision, outputMeta)
+ }
+
+
+// override fun content(target: String): Map = if (target == ComposeVisionRenderer.TYPE) {
+// listOf(
+// htmlVisionRenderer,
+// inputVisionRenderer,
+// checkboxVisionRenderer,
+// numberVisionRenderer,
+// textVisionRenderer,
+// rangeVisionRenderer,
+// formVisionRenderer,
+// buttonVisionRenderer
+// ).associateBy { it.toString().asName() }
+// } else super.content(target)
+
+ public companion object : PluginFactory {
+ override fun build(context: Context, meta: Meta): ComposeVisionClient = ComposeVisionClient()
+
+ override val tag: PluginTag = PluginTag(name = "vision.client.compose", group = PluginTag.DATAFORGE_GROUP)
+ }
+}
+
+/**
+ * Render an Element vision via injected vision renderer inside compose-html
+ */
+@Composable
+public fun Vision(
+ context: Context,
+ vision: Vision,
+ name: Name? = null,
+ meta: Meta = Meta.EMPTY,
+) {
+ val actualName = name ?: NameToken(VisionTagConsumer.DEFAULT_VISION_NAME, vision.hashCode().toUInt().toString()).asName()
+ context.request(ComposeVisionClient).renderVision(actualName, vision, meta)
+}
+
+@Composable
+public fun Vision(
+ context: Context,
+ name: Name? = null,
+ meta: Meta = Meta.EMPTY,
+ buildOutput: VisionOutput.() -> Vision,
+) {
+ val actualName = name ?: NameToken(VisionTagConsumer.DEFAULT_VISION_NAME, buildOutput.hashCode().toUInt().toString()).asName()
+ val output = VisionOutput(context, actualName)
+ val vision = output.buildOutput()
+ context.request(ComposeVisionClient).renderVision(actualName, vision, meta)
+}
\ No newline at end of file
diff --git a/visionforge-compose-multiplatform/src/commonMain/kotlin/space/kscience/visionforge/compose/ComposeVisionRenderer.kt b/visionforge-compose-multiplatform/src/commonMain/kotlin/space/kscience/visionforge/compose/ComposeVisionRenderer.kt
new file mode 100644
index 00000000..a7abee3f
--- /dev/null
+++ b/visionforge-compose-multiplatform/src/commonMain/kotlin/space/kscience/visionforge/compose/ComposeVisionRenderer.kt
@@ -0,0 +1,47 @@
+package space.kscience.visionforge.compose
+
+import androidx.compose.runtime.Composable
+import space.kscience.dataforge.meta.Meta
+import space.kscience.dataforge.misc.DfType
+import space.kscience.dataforge.names.Name
+import space.kscience.visionforge.Vision
+import kotlin.reflect.KClass
+import kotlin.reflect.cast
+
+@DfType(ComposeVisionRenderer.TYPE)
+public interface ComposeVisionRenderer {
+ public fun rateVision(vision: Vision): Int
+
+ @Composable
+ public fun render(name: Name, vision: Vision, meta: Meta)
+
+ public companion object {
+ public const val TYPE: String = "composeVisionRenderer"
+ public const val ZERO_RATING: Int = 0
+ public const val DEFAULT_RATING: Int = 10
+ }
+}
+
+public class SingleTypeComposeRenderer(
+ public val kClass: KClass,
+ private val acceptRating: Int = ComposeVisionRenderer.DEFAULT_RATING,
+ private val renderFunction: @Composable (name: Name, vision: T, meta: Meta) -> Unit,
+) : ComposeVisionRenderer {
+
+ override fun rateVision(vision: Vision): Int =
+ if (vision::class == kClass) acceptRating else ComposeVisionRenderer.ZERO_RATING
+
+ @Composable
+ override fun render(
+ name: Name,
+ vision: Vision,
+ meta: Meta,
+ ) {
+ renderFunction(name, kClass.cast(vision), meta)
+ }
+}
+
+public inline fun ComposeVisionRenderer(
+ acceptRating: Int = ComposeVisionRenderer.DEFAULT_RATING,
+ noinline renderFunction: @Composable (name: Name, vision: T, meta: Meta) -> Unit,
+): ComposeVisionRenderer = SingleTypeComposeRenderer(T::class, acceptRating, renderFunction)
diff --git a/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/MetaViewer.kt b/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/MetaViewer.kt
new file mode 100644
index 00000000..d6578c73
--- /dev/null
+++ b/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/MetaViewer.kt
@@ -0,0 +1,69 @@
+package space.kscience.visionforge.compose
+
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.material.Icon
+import androidx.compose.material.Text
+import androidx.compose.material.TextButton
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.ExpandLess
+import androidx.compose.material.icons.filled.ExpandMore
+import androidx.compose.runtime.*
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import space.kscience.dataforge.meta.Meta
+import space.kscience.dataforge.meta.descriptors.MetaDescriptor
+import space.kscience.dataforge.meta.descriptors.get
+import space.kscience.dataforge.meta.isLeaf
+import space.kscience.dataforge.names.Name
+import space.kscience.dataforge.names.NameToken
+import space.kscience.dataforge.names.lastOrNull
+import space.kscience.dataforge.names.plus
+
+
+@Composable
+private fun MetaViewerItem(root: Meta, name: Name, rootDescriptor: MetaDescriptor? = null) {
+ var expanded: Boolean by remember { mutableStateOf(true) }
+ val item: Meta? = root[name]
+ val descriptorItem: MetaDescriptor? = rootDescriptor?.get(name)
+ val actualValue = item?.value ?: descriptorItem?.defaultValue
+ val actualMeta = item ?: descriptorItem?.defaultNode
+
+ val token = name.lastOrNull()?.toString() ?: ""
+
+ Row(modifier = Modifier.fillMaxWidth()) {
+ if (actualMeta?.isLeaf == false) {
+ TextButton({ expanded = !expanded }) {
+ if (expanded) {
+ Icon(Icons.Filled.ExpandLess, "collapse")
+ } else {
+ Icon(Icons.Filled.ExpandMore, "expand")
+ }
+ }
+ }
+ Text(token, color = if (item == null) Color.Gray else Color.Unspecified)
+ Spacer(Modifier.weight(1f))
+ Text(actualValue.toString())
+ }
+ if (expanded) {
+ Column {
+ val keys = buildSet {
+ descriptorItem?.nodes?.keys?.forEach {
+ add(NameToken(it))
+ }
+ actualMeta!!.items.keys.let { addAll(it) }
+ }
+
+ keys.filter { !it.body.startsWith("@") }.forEach { token ->
+ MetaViewerItem(root, name + token, rootDescriptor)
+ }
+ }
+ }
+}
+
+@Composable
+public fun MetaViewer(meta: Meta, descriptor: MetaDescriptor? = null) {
+ MetaViewerItem(meta, Name.EMPTY, descriptor)
+}
diff --git a/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/PropertyEditor.kt b/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/PropertyEditor.kt
new file mode 100644
index 00000000..f2088c61
--- /dev/null
+++ b/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/PropertyEditor.kt
@@ -0,0 +1,174 @@
+package space.kscience.visionforge.compose
+
+import androidx.compose.foundation.layout.*
+import androidx.compose.material.Icon
+import androidx.compose.material.Text
+import androidx.compose.material.TextButton
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.Clear
+import androidx.compose.material.icons.filled.ExpandLess
+import androidx.compose.material.icons.filled.ExpandMore
+import androidx.compose.runtime.*
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.unit.dp
+import kotlinx.coroutines.channels.awaitClose
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.callbackFlow
+import kotlinx.coroutines.launch
+import space.kscience.dataforge.meta.MutableMeta
+import space.kscience.dataforge.meta.ObservableMutableMeta
+import space.kscience.dataforge.meta.descriptors.MetaDescriptor
+import space.kscience.dataforge.meta.descriptors.ValueRestriction
+import space.kscience.dataforge.meta.descriptors.get
+import space.kscience.dataforge.meta.remove
+import space.kscience.dataforge.names.*
+import space.kscience.visionforge.hidden
+
+
+/**
+ * The display state of a property
+ */
+public sealed class EditorPropertyState {
+ public data object Defined : EditorPropertyState()
+ public data class Default(public val source: String = "unknown") : EditorPropertyState()
+ public data object Undefined : EditorPropertyState()
+}
+
+/**
+ * @param rootMeta Root config object - always non-null
+ * @param rootDescriptor Full path to the displayed node in [rootMeta]. Could be empty
+ */
+@Composable
+public fun PropertyEditor(
+ rootMeta: MutableMeta,
+ getPropertyState: (Name) -> EditorPropertyState,
+ updates: Flow,
+ name: Name,
+ rootDescriptor: MetaDescriptor?,
+ initialExpanded: Boolean? = null,
+) {
+ var expanded: Boolean by remember { mutableStateOf(initialExpanded ?: true) }
+ val descriptor: MetaDescriptor? by derivedStateOf { rootDescriptor?.get(name) }
+ var displayedValue by remember { mutableStateOf(rootMeta.getValue(name)) }
+ var editorPropertyState: EditorPropertyState by remember { mutableStateOf(getPropertyState(name)) }
+
+ fun buildKeys() = buildSet {
+ descriptor?.nodes?.filterNot {
+ it.key.startsWith("@") || it.value.hidden
+ }?.forEach {
+ add(NameToken(it.key))
+ }
+ rootMeta[name]?.items?.keys?.filterNot { it.body.startsWith("@") }?.let { addAll(it) }
+ }
+
+ var keys by remember { mutableStateOf(buildKeys()) }
+
+ val token = name.lastOrNull()?.toString() ?: "Properties"
+
+ fun update() {
+ displayedValue = rootMeta.getValue(name)
+ editorPropertyState = getPropertyState(name)
+ keys = buildKeys()
+ }
+
+ LaunchedEffect(rootMeta) {
+ updates.collect { updatedName ->
+ if (name.startsWith(updatedName)) {
+ update()
+ }
+ }
+ }
+ Column(modifier = Modifier.fillMaxWidth().padding(start = 20.dp)) {
+ Row(modifier = Modifier.fillMaxWidth().padding(start = 20.dp)) {
+ //if node has children
+ if (keys.isNotEmpty()) {
+ TextButton(
+ { expanded = !expanded },
+ modifier = Modifier.align(Alignment.CenterVertically).width(40.dp)
+ ) {
+ if (expanded) {
+ Icon(Icons.Filled.ExpandLess, "collapse")
+ } else {
+ Icon(Icons.Filled.ExpandMore, "expand")
+ }
+ }
+ }
+ Text(
+ token,
+ color = when (editorPropertyState) {
+ is EditorPropertyState.Default, EditorPropertyState.Undefined -> Color.Gray
+ else -> Color.Unspecified
+ },
+ modifier = Modifier.align(Alignment.CenterVertically)
+ )
+ Spacer(modifier = Modifier.weight(1f))
+
+ if (!name.isEmpty() && descriptor?.valueRestriction != ValueRestriction.ABSENT) {
+ Box(modifier = Modifier.padding(1.dp, 5.dp).width(160.dp)) {
+ ValueChooser(descriptor, editorPropertyState, displayedValue) {
+ rootMeta.setValue(name, it)
+ update()
+ }
+ }
+
+ }
+ if (!name.isEmpty()) {
+ TextButton(
+ onClick = {
+ rootMeta.remove(name)
+ update()
+ },
+ enabled = editorPropertyState == EditorPropertyState.Defined,
+ modifier = Modifier.align(Alignment.CenterVertically).width(50.dp)
+ ) {
+ if (editorPropertyState == EditorPropertyState.Defined) {
+ Icon(Icons.Filled.Clear, "Reset")
+ }
+ }
+ }
+ }
+ if (expanded) {
+ Column(modifier = Modifier.fillMaxWidth()) {
+ keys.forEach { token ->
+ PropertyEditor(rootMeta, getPropertyState, updates, name + token, rootDescriptor, expanded)
+ }
+ }
+ }
+ }
+}
+
+
+@Composable
+public fun PropertyEditor(
+ properties: ObservableMutableMeta,
+ descriptor: MetaDescriptor? = null,
+ expanded: Boolean? = null,
+) {
+ val scope = rememberCoroutineScope()
+ PropertyEditor(
+ rootMeta = properties,
+ getPropertyState = { name ->
+ if (properties[name] != null) {
+ EditorPropertyState.Defined
+ } else if (descriptor?.get(name)?.defaultValue != null) {
+ EditorPropertyState.Default("descriptor")
+ } else {
+ EditorPropertyState.Undefined
+ }
+ },
+ updates = callbackFlow {
+ properties.onChange(scope) { name ->
+ scope.launch {
+ send(name)
+ }
+ }
+
+ awaitClose { properties.removeListener(scope) }
+ },
+ name = Name.EMPTY,
+ rootDescriptor = descriptor,
+ initialExpanded = expanded,
+ )
+}
\ No newline at end of file
diff --git a/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/valueChooser.kt b/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/valueChooser.kt
new file mode 100644
index 00000000..cfecc54e
--- /dev/null
+++ b/visionforge-compose-multiplatform/src/jvmMain/kotlin/space/kscience/visionforge/compose/valueChooser.kt
@@ -0,0 +1,270 @@
+@file:Suppress("UNUSED_PARAMETER")
+
+package space.kscience.visionforge.compose
+
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.text.KeyboardOptions
+import androidx.compose.material.*
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.CheckBox
+import androidx.compose.material.icons.filled.CheckBoxOutlineBlank
+import androidx.compose.runtime.*
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.isSpecified
+import androidx.compose.ui.graphics.toArgb
+import androidx.compose.ui.text.input.KeyboardType
+import com.eygraber.compose.colorpicker.ColorPicker
+import space.kscience.dataforge.meta.*
+import space.kscience.dataforge.meta.descriptors.MetaDescriptor
+import space.kscience.dataforge.meta.descriptors.allowedValues
+import space.kscience.visionforge.widgetType
+import kotlin.math.roundToInt
+
+
+@Composable
+public fun StringValueChooser(
+ descriptor: MetaDescriptor?,
+ state: EditorPropertyState,
+ value: Value?,
+ onValueChange: (Value?) -> Unit,
+) {
+ var stringValue by remember(value, descriptor) { mutableStateOf(value?.string ?: "") }
+ TextField(
+ value = stringValue,
+ onValueChange = {
+ stringValue = it
+ onValueChange(it.asValue())
+ },
+ modifier = Modifier.fillMaxWidth()
+ )
+}
+
+
+@Composable
+public fun BooleanValueChooser(
+ descriptor: MetaDescriptor?,
+ state: EditorPropertyState,
+ value: Value?,
+ onValueChange: (Value?) -> Unit,
+) {
+ var innerValue by remember(value, descriptor) {
+ mutableStateOf(
+ value?.boolean ?: descriptor?.defaultValue?.boolean ?: false
+ )
+ }
+
+ Button(
+ onClick = {
+ innerValue = !innerValue
+ onValueChange(innerValue.asValue())
+ },
+ colors = if (innerValue) ButtonDefaults.buttonColors(Color.Green) else ButtonDefaults.buttonColors(Color.Gray)
+ ) {
+ if (innerValue) {
+ Text("On")
+ } else {
+ Text("Off")
+ }
+ }
+}
+
+@Composable
+public fun NumberValueChooser(
+ descriptor: MetaDescriptor?,
+ state: EditorPropertyState,
+ value: Value?,
+ onValueChange: (Value?) -> Unit,
+) {
+ var stringValue by remember(value, descriptor) { mutableStateOf(value?.string ?: descriptor?.defaultValue?.string) }
+
+ TextField(
+ value = stringValue ?: "",
+ onValueChange = { newValue ->
+ stringValue = newValue
+ newValue.toDoubleOrNull()?.let { onValueChange(it.asValue()) }
+ },
+ isError = stringValue?.toDoubleOrNull() != null,
+ modifier = Modifier.fillMaxWidth(),
+ keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number)
+ )
+}
+
+
+@OptIn(ExperimentalMaterialApi::class)
+@Composable
+public fun ComboValueChooser(
+ descriptor: MetaDescriptor?,
+ state: EditorPropertyState,
+ value: Value?,
+ onValueChange: (Value?) -> Unit,
+) {
+ var expanded by remember { mutableStateOf(false) }
+ var selected by remember(value, descriptor) { mutableStateOf(value?.string ?: "") }
+
+ ExposedDropdownMenuBox(
+ expanded = expanded,
+ onExpandedChange = {
+ expanded = !expanded
+ },
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ TextField(
+ value = selected,
+ onValueChange = {},
+ readOnly = true,
+ trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
+ )
+
+ ExposedDropdownMenu(
+ expanded = expanded,
+ onDismissRequest = { expanded = false }
+ ) {
+ descriptor?.allowedValues?.forEach { item: Value ->
+ DropdownMenuItem(
+ onClick = {
+ selected = item.string
+ expanded = false
+ onValueChange(selected.asValue())
+ }
+ ) {
+ Text(item.string)
+ }
+ }
+ }
+ }
+}
+
+
+@Composable
+public fun ColorValueChooser(
+ descriptor: MetaDescriptor?,
+ state: EditorPropertyState,
+ value: Value?,
+ onValueChange: (Value?) -> Unit,
+) {
+ //var innerValue by remember { mutableStateOf(value ?: descriptor?.defaultValue) }
+
+ Box(Modifier.fillMaxWidth()) {
+ ColorPicker(Modifier.fillMaxWidth()) {
+ if (it.isSpecified) {
+ onValueChange(it.toArgb().asValue())
+ }
+ }
+ }
+}
+
+
+@OptIn(ExperimentalMaterialApi::class)
+@Composable
+public fun MultiSelectChooser(
+ descriptor: MetaDescriptor?,
+ state: EditorPropertyState,
+ value: Value?,
+ onValueChange: (Value?) -> Unit,
+) {
+ var expanded by remember { mutableStateOf(false) }
+ var selected: Set by remember(value) {
+ mutableStateOf(value?.list?.toSet() ?: emptySet())
+ }
+
+ ExposedDropdownMenuBox(
+ expanded = expanded,
+ onExpandedChange = {
+ expanded = !expanded
+ },
+ modifier = Modifier.fillMaxWidth()
+ ) {
+ TextField(
+ value = selected.joinToString(prefix = "[", postfix = "]"),
+ onValueChange = {},
+ readOnly = true,
+ trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) },
+ )
+
+ ExposedDropdownMenu(
+ expanded = expanded,
+ onDismissRequest = { expanded = false }
+ ) {
+ descriptor?.allowedValues?.forEach { item: Value ->
+ val currentlySelected = item in selected
+
+ DropdownMenuItem(
+ onClick = {
+ selected = if (currentlySelected) {
+ selected - item
+ } else {
+ selected + item
+ }
+ onValueChange(selected.asValue())
+ }
+ ) {
+ if (currentlySelected) {
+ Icon(Icons.Default.CheckBox, "checked")
+ } else {
+ Icon(Icons.Default.CheckBoxOutlineBlank, "checked")
+ }
+ Text(item.string)
+ }
+ }
+ }
+ }
+}
+
+
+@Composable
+public fun RangeValueChooser(
+ descriptor: MetaDescriptor?,
+ state: EditorPropertyState,
+ value: Value?,
+ onValueChange: (Value?) -> Unit,
+) {
+ var innerValue by remember(value, descriptor) { mutableStateOf(value?.number ?: descriptor?.defaultValue?.number) }
+ val min by derivedStateOf {
+ descriptor?.attributes?.get("min").float ?: 0f
+ }
+
+ val max by derivedStateOf {
+ descriptor?.attributes?.get("max").float ?: 0f
+ }
+
+ val step by derivedStateOf {
+ descriptor?.attributes?.get("step").float ?: 0.1f
+ }
+
+ Slider(
+ value = innerValue?.toFloat() ?: 0f,
+ onValueChange = {
+ innerValue = it
+ onValueChange(it.asValue())
+ },
+ valueRange = min..max,
+ steps = ((max - min) / step).roundToInt(),
+ modifier = Modifier.fillMaxWidth()
+ )
+}
+
+@Composable
+public fun ValueChooser(
+ descriptor: MetaDescriptor?,
+ state: EditorPropertyState,
+ value: Value?,
+ onValueChange: (Value?) -> Unit,
+) {
+ val rawInput by remember { mutableStateOf(false) }
+
+ val type = descriptor?.valueTypes?.firstOrNull()
+
+ when {
+ rawInput -> StringValueChooser(descriptor, state, value, onValueChange)
+ descriptor?.widgetType == "color" -> ColorValueChooser(descriptor, state, value, onValueChange)
+ descriptor?.widgetType == "multiSelect" -> MultiSelectChooser(descriptor, state, value, onValueChange)
+ descriptor?.widgetType == "range" -> RangeValueChooser(descriptor, state, value, onValueChange)
+ type == ValueType.BOOLEAN -> BooleanValueChooser(descriptor, state, value, onValueChange)
+ type == ValueType.NUMBER -> NumberValueChooser(descriptor, state, value, onValueChange)
+ descriptor?.allowedValues?.isNotEmpty() ?: false -> ComboValueChooser(descriptor, state, value, onValueChange)
+ //TODO handle lists
+ else -> StringValueChooser(descriptor, state, value, onValueChange)
+ }
+}
\ No newline at end of file
diff --git a/visionforge-core/README.md b/visionforge-core/README.md
index 2f9e6889..ebd092d8 100644
--- a/visionforge-core/README.md
+++ b/visionforge-core/README.md
@@ -6,19 +6,8 @@
## Artifact:
-The Maven coordinates of this project are `space.kscience:visionforge-core:0.2.0`.
+The Maven coordinates of this project are `space.kscience:visionforge-core:0.4.1`.
-**Gradle Groovy:**
-```groovy
-repositories {
- maven { url 'https://repo.kotlin.link' }
- mavenCentral()
-}
-
-dependencies {
- implementation 'space.kscience:visionforge-core:0.2.0'
-}
-```
**Gradle Kotlin DSL:**
```kotlin
repositories {
@@ -27,6 +16,6 @@ repositories {
}
dependencies {
- implementation("space.kscience:visionforge-core:0.2.0")
+ implementation("space.kscience:visionforge-core:0.4.1")
}
```
diff --git a/visionforge-core/api/visionforge-core.api b/visionforge-core/api/visionforge-core.api
index f9099a99..9586823b 100644
--- a/visionforge-core/api/visionforge-core.api
+++ b/visionforge-core/api/visionforge-core.api
@@ -1,3 +1,66 @@
+public abstract class space/kscience/visionforge/AbstractControlVision : space/kscience/visionforge/AbstractVision, space/kscience/visionforge/ControlVision {
+ public static final field Companion Lspace/kscience/visionforge/AbstractControlVision$Companion;
+ public fun ()V
+ public synthetic fun (ILspace/kscience/dataforge/meta/MutableMeta;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
+ public fun dispatchControlEvent (Lspace/kscience/visionforge/VisionControlEvent;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
+ public fun getControlEventFlow ()Lkotlinx/coroutines/flow/SharedFlow;
+ public static final synthetic fun write$Self (Lspace/kscience/visionforge/AbstractControlVision;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+}
+
+public final class space/kscience/visionforge/AbstractControlVision$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public abstract class space/kscience/visionforge/AbstractVision : space/kscience/visionforge/Vision {
+ public static final field Companion Lspace/kscience/visionforge/AbstractVision$Companion;
+ public fun ()V
+ public synthetic fun (ILspace/kscience/dataforge/meta/MutableMeta;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
+ public fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
+ public fun getParent ()Lspace/kscience/visionforge/Vision;
+ public final fun getProperties ()Lspace/kscience/visionforge/MutableVisionProperties;
+ protected final fun getPropertiesInternal ()Lspace/kscience/dataforge/meta/MutableMeta;
+ public fun setParent (Lspace/kscience/visionforge/Vision;)V
+ protected final fun setPropertiesInternal (Lspace/kscience/dataforge/meta/MutableMeta;)V
+ public static final synthetic fun write$Self (Lspace/kscience/visionforge/AbstractVision;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+}
+
+public final class space/kscience/visionforge/AbstractVision$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+}
+
+public abstract class space/kscience/visionforge/AbstractVisionGroup : space/kscience/visionforge/AbstractVision, space/kscience/visionforge/MutableVisionGroup {
+ public static final field Companion Lspace/kscience/visionforge/AbstractVisionGroup$Companion;
+ public fun ()V
+ public synthetic fun (ILspace/kscience/dataforge/meta/MutableMeta;Ljava/util/Map;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
+ public abstract fun createGroup ()Lspace/kscience/visionforge/AbstractVisionGroup;
+ public fun getChildren ()Lspace/kscience/visionforge/MutableVisionChildren;
+ public synthetic fun getChildren ()Lspace/kscience/visionforge/VisionChildren;
+ protected final fun getChildrenInternal ()Ljava/util/Map;
+ protected final fun setChildrenInternal (Ljava/util/Map;)V
+ public static final synthetic fun write$Self (Lspace/kscience/visionforge/AbstractVisionGroup;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
+}
+
+public final class space/kscience/visionforge/AbstractVisionGroup$Companion {
+ public final fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+ public final fun updateProperties (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Lspace/kscience/dataforge/names/Name;)V
+ public static synthetic fun updateProperties$default (Lspace/kscience/visionforge/AbstractVisionGroup$Companion;Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Lspace/kscience/dataforge/names/Name;ILjava/lang/Object;)V
+}
+
+public class space/kscience/visionforge/AbstractVisionProperties : space/kscience/visionforge/MutableVisionProperties {
+ public fun (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/MutableMeta;)V
+ public fun getChanges ()Lkotlinx/coroutines/flow/Flow;
+ protected final fun getChangesInternal ()Lkotlinx/coroutines/flow/MutableSharedFlow;
+ public fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
+ public synthetic fun getOwn ()Lspace/kscience/dataforge/meta/Meta;
+ public final fun getOwn ()Lspace/kscience/dataforge/meta/MutableMeta;
+ public fun getValue (Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lspace/kscience/dataforge/meta/Value;
+ public final fun getVision ()Lspace/kscience/visionforge/Vision;
+ public fun invalidate (Lspace/kscience/dataforge/names/Name;)V
+ public fun set (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Meta;Z)V
+ public fun setValue (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Value;Z)V
+}
+
public final class space/kscience/visionforge/Colors {
public static final field BLUE_KEY Ljava/lang/String;
public static final field GREEN_KEY Ljava/lang/String;
@@ -156,68 +219,144 @@ public final class space/kscience/visionforge/Colors {
public final fun rgbToString-8NGXxBw (BBB)Ljava/lang/String;
}
-public final class space/kscience/visionforge/ComputedVisionPropertiesKt {
- public static final fun computeProperties (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;)Lspace/kscience/dataforge/meta/Meta;
- public static synthetic fun computeProperties$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;ILjava/lang/Object;)Lspace/kscience/dataforge/meta/Meta;
- public static final fun computeProperty (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;)Lspace/kscience/dataforge/values/Value;
- public static synthetic fun computeProperty$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;ILjava/lang/Object;)Lspace/kscience/dataforge/values/Value;
- public static final fun computePropertyNode (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;)Lspace/kscience/dataforge/meta/Meta;
- public static synthetic fun computePropertyNode$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;ILjava/lang/Object;)Lspace/kscience/dataforge/meta/Meta;
- public static final fun computePropertyValues (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;)Lspace/kscience/dataforge/values/MutableValueProvider;
- public static synthetic fun computePropertyValues$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;ILjava/lang/Object;)Lspace/kscience/dataforge/values/MutableValueProvider;
+public abstract interface class space/kscience/visionforge/ControlVision : space/kscience/visionforge/Vision {
+ public abstract fun dispatchControlEvent (Lspace/kscience/visionforge/VisionControlEvent;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
+ public abstract fun getControlEventFlow ()Lkotlinx/coroutines/flow/SharedFlow;
+ public fun receiveEvent (Lspace/kscience/visionforge/VisionEvent;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
+ public static synthetic fun receiveEvent$suspendImpl (Lspace/kscience/visionforge/ControlVision;Lspace/kscience/visionforge/VisionEvent;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
-public final class space/kscience/visionforge/HtmlExportKt {
- public static final fun makeFile (Lspace/kscience/visionforge/html/Page;Ljava/nio/file/Path;Lkotlin/jvm/functions/Function1;)Ljava/nio/file/Path;
- public static synthetic fun makeFile$default (Lspace/kscience/visionforge/html/Page;Ljava/nio/file/Path;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/nio/file/Path;
- public static final fun show (Lspace/kscience/visionforge/html/Page;Ljava/nio/file/Path;)V
- public static synthetic fun show$default (Lspace/kscience/visionforge/html/Page;Ljava/nio/file/Path;ILjava/lang/Object;)V
+public final class space/kscience/visionforge/ControlVisionKt {
+ public static final fun VisionInputEvent (Lspace/kscience/dataforge/meta/Value;Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/VisionInputEvent;
+ public static synthetic fun VisionInputEvent$default (Lspace/kscience/dataforge/meta/Value;Lspace/kscience/dataforge/names/Name;ILjava/lang/Object;)Lspace/kscience/visionforge/VisionInputEvent;
+ public static final fun VisionSubmitEvent (Lspace/kscience/dataforge/meta/Meta;Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/VisionSubmitEvent;
+ public static synthetic fun VisionSubmitEvent$default (Lspace/kscience/dataforge/meta/Meta;Lspace/kscience/dataforge/names/Name;ILjava/lang/Object;)Lspace/kscience/visionforge/VisionSubmitEvent;
+ public static final fun VisionValueChangeEvent (Lspace/kscience/dataforge/meta/Value;Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/VisionValueChangeEvent;
+ public static synthetic fun VisionValueChangeEvent$default (Lspace/kscience/dataforge/meta/Value;Lspace/kscience/dataforge/names/Name;ILjava/lang/Object;)Lspace/kscience/visionforge/VisionValueChangeEvent;
+ public static final fun asyncControlEvent (Lspace/kscience/visionforge/ControlVision;Lspace/kscience/visionforge/VisionControlEvent;Lkotlinx/coroutines/CoroutineScope;)V
+ public static synthetic fun asyncControlEvent$default (Lspace/kscience/visionforge/ControlVision;Lspace/kscience/visionforge/VisionControlEvent;Lkotlinx/coroutines/CoroutineScope;ILjava/lang/Object;)V
+ public static final fun onSubmit (Lspace/kscience/visionforge/DataControl;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/Job;
}
-public abstract interface class space/kscience/visionforge/MutableVisionGroup : space/kscience/visionforge/VisionContainerBuilder, space/kscience/visionforge/VisionGroup {
- public abstract fun onStructureChanged (Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)V
- public abstract fun removeStructureListener (Ljava/lang/Object;)V
+public abstract interface class space/kscience/visionforge/DataControl : space/kscience/visionforge/ControlVision {
+ public fun submit (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
+ public static synthetic fun submit$default (Lspace/kscience/visionforge/DataControl;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
+ public static synthetic fun submit$suspendImpl (Lspace/kscience/visionforge/DataControl;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
-public class space/kscience/visionforge/SimpleVisionPropertyContainer : space/kscience/dataforge/meta/Configurable, space/kscience/visionforge/VisionPropertyContainer {
- public fun (Lspace/kscience/dataforge/meta/ObservableMutableMeta;)V
- public synthetic fun getMeta ()Lspace/kscience/dataforge/meta/MutableMeta;
- public fun getMeta ()Lspace/kscience/dataforge/meta/ObservableMutableMeta;
- public fun getProperty (Lspace/kscience/dataforge/names/Name;ZZZ)Lspace/kscience/dataforge/values/Value;
+public final class space/kscience/visionforge/FlowPropertyKt {
+ public static final fun flowProperty (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lkotlinx/coroutines/flow/Flow;
+ public static final fun flowProperty (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lkotlinx/coroutines/flow/Flow;
+ public static synthetic fun flowProperty$default (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
+ public static synthetic fun flowProperty$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
+ public static final fun flowPropertyValue (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lkotlinx/coroutines/flow/Flow;
+ public static final fun flowPropertyValue (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lkotlinx/coroutines/flow/Flow;
+ public static synthetic fun flowPropertyValue$default (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
+ public static synthetic fun flowPropertyValue$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
+}
+
+public abstract interface class space/kscience/visionforge/MutableVisionChildren : space/kscience/visionforge/MutableVisionContainer, space/kscience/visionforge/VisionChildren {
+ public abstract fun clear ()V
+ public abstract fun getParent ()Lspace/kscience/visionforge/MutableVisionGroup;
+ public abstract fun set (Lspace/kscience/dataforge/names/NameToken;Lspace/kscience/visionforge/Vision;)V
+ public fun setChild (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;)V
+}
+
+public abstract interface class space/kscience/visionforge/MutableVisionContainer {
+ public abstract fun setChild (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;)V
+}
+
+public abstract interface class space/kscience/visionforge/MutableVisionGroup : space/kscience/visionforge/VisionGroup {
+ public abstract fun createGroup ()Lspace/kscience/visionforge/MutableVisionGroup;
+ public abstract fun getChildren ()Lspace/kscience/visionforge/MutableVisionChildren;
+ public fun update (Lspace/kscience/visionforge/VisionChange;)V
+}
+
+public abstract interface class space/kscience/visionforge/MutableVisionProperties : space/kscience/dataforge/meta/MutableMetaProvider, space/kscience/visionforge/VisionProperties {
+ public synthetic fun get (Lspace/kscience/dataforge/names/Name;)Lspace/kscience/dataforge/meta/Meta;
+ public fun get (Lspace/kscience/dataforge/names/Name;)Lspace/kscience/dataforge/meta/MutableMeta;
+ public synthetic fun get (Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lspace/kscience/dataforge/meta/Meta;
+ public fun get (Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;)Lspace/kscience/dataforge/meta/MutableMeta;
+ public fun set (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Meta;)V
+ public abstract fun set (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Meta;Z)V
+ public fun setValue (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Value;)V
+ public abstract fun setValue (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Value;Z)V
+}
+
+public final class space/kscience/visionforge/NullVision : space/kscience/visionforge/Vision {
+ public static final field INSTANCE Lspace/kscience/visionforge/NullVision;
+ public fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
+ public fun getParent ()Lspace/kscience/visionforge/Vision;
+ public fun getProperties ()Lspace/kscience/visionforge/MutableVisionProperties;
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
+ public fun setParent (Lspace/kscience/visionforge/Vision;)V
+}
+
+public final class space/kscience/visionforge/RootVision : space/kscience/visionforge/AbstractVisionGroup {
+ public fun (Lspace/kscience/visionforge/VisionManager;)V
+ public synthetic fun createGroup ()Lspace/kscience/visionforge/AbstractVisionGroup;
+ public synthetic fun createGroup ()Lspace/kscience/visionforge/MutableVisionGroup;
+ public fun createGroup ()Lspace/kscience/visionforge/SimpleVisionGroup;
+ public fun getManager ()Lspace/kscience/visionforge/VisionManager;
+}
+
+public final class space/kscience/visionforge/SimpleVisionGroup : space/kscience/visionforge/AbstractVisionGroup, space/kscience/visionforge/MutableVisionContainer {
+ public static final field Companion Lspace/kscience/visionforge/SimpleVisionGroup$Companion;
+ public fun ()V
+ public synthetic fun createGroup ()Lspace/kscience/visionforge/AbstractVisionGroup;
+ public synthetic fun createGroup ()Lspace/kscience/visionforge/MutableVisionGroup;
+ public fun createGroup ()Lspace/kscience/visionforge/SimpleVisionGroup;
+ public fun setChild (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;)V
+}
+
+public final class space/kscience/visionforge/SimpleVisionGroup$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
+ public static final field INSTANCE Lspace/kscience/visionforge/SimpleVisionGroup$$serializer;
+ public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
+ public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
+ public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lspace/kscience/visionforge/SimpleVisionGroup;
+ public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
+ public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
+ public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lspace/kscience/visionforge/SimpleVisionGroup;)V
+ public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
+}
+
+public final class space/kscience/visionforge/SimpleVisionGroup$Companion {
+ public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
public final class space/kscience/visionforge/StyleReference {
- public fun (Lspace/kscience/visionforge/VisionGroup;Ljava/lang/String;)V
+ public fun (Lspace/kscience/visionforge/Vision;Ljava/lang/String;)V
public final fun getName ()Ljava/lang/String;
- public final fun getOwner ()Lspace/kscience/visionforge/VisionGroup;
+ public final fun getOwner ()Lspace/kscience/visionforge/Vision;
}
public final class space/kscience/visionforge/StyleReferenceKt {
- public static final fun style (Lspace/kscience/visionforge/VisionGroup;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lkotlin/properties/ReadOnlyProperty;
- public static final fun style (Lspace/kscience/visionforge/VisionGroup;Lspace/kscience/dataforge/meta/Specification;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lkotlin/properties/ReadOnlyProperty;
- public static synthetic fun style$default (Lspace/kscience/visionforge/VisionGroup;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlin/properties/ReadOnlyProperty;
- public static synthetic fun style$default (Lspace/kscience/visionforge/VisionGroup;Lspace/kscience/dataforge/meta/Specification;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlin/properties/ReadOnlyProperty;
- public static final fun useStyle (Lspace/kscience/visionforge/Vision;Lspace/kscience/visionforge/StyleReference;)V
+ public static final fun style (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lkotlin/properties/ReadOnlyProperty;
+ public static final fun style (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/SchemeSpec;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lkotlin/properties/ReadOnlyProperty;
+ public static synthetic fun style$default (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlin/properties/ReadOnlyProperty;
+ public static synthetic fun style$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/SchemeSpec;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlin/properties/ReadOnlyProperty;
+ public static final fun useStyle (Lspace/kscience/visionforge/Vision;Lspace/kscience/visionforge/StyleReference;Z)V
+ public static synthetic fun useStyle$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/visionforge/StyleReference;ZILjava/lang/Object;)V
}
public final class space/kscience/visionforge/StyleSheet {
public static final field Companion Lspace/kscience/visionforge/StyleSheet$Companion;
- public static final synthetic fun box-impl (Lspace/kscience/visionforge/VisionGroup;)Lspace/kscience/visionforge/StyleSheet;
- public static fun constructor-impl (Lspace/kscience/visionforge/VisionGroup;)Lspace/kscience/visionforge/VisionGroup;
- public static final fun define-impl (Lspace/kscience/visionforge/VisionGroup;Ljava/lang/String;Lspace/kscience/dataforge/meta/Meta;)V
+ public static final synthetic fun box-impl (Lspace/kscience/visionforge/Vision;)Lspace/kscience/visionforge/StyleSheet;
+ public static fun constructor-impl (Lspace/kscience/visionforge/Vision;)Lspace/kscience/visionforge/Vision;
+ public static final fun define-impl (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Lspace/kscience/dataforge/meta/Meta;)V
public fun equals (Ljava/lang/Object;)Z
- public static fun equals-impl (Lspace/kscience/visionforge/VisionGroup;Ljava/lang/Object;)Z
- public static final fun equals-impl0 (Lspace/kscience/visionforge/VisionGroup;Lspace/kscience/visionforge/VisionGroup;)Z
- public static final fun get-impl (Lspace/kscience/visionforge/VisionGroup;Ljava/lang/String;)Lspace/kscience/dataforge/meta/Meta;
- public static final fun getItems-impl (Lspace/kscience/visionforge/VisionGroup;)Ljava/util/Map;
+ public static fun equals-impl (Lspace/kscience/visionforge/Vision;Ljava/lang/Object;)Z
+ public static final fun equals-impl0 (Lspace/kscience/visionforge/Vision;Lspace/kscience/visionforge/Vision;)Z
+ public static final fun get-impl (Lspace/kscience/visionforge/Vision;Ljava/lang/String;)Lspace/kscience/dataforge/meta/Meta;
+ public static final fun getItems-impl (Lspace/kscience/visionforge/Vision;)Ljava/util/Map;
public fun hashCode ()I
- public static fun hashCode-impl (Lspace/kscience/visionforge/VisionGroup;)I
- public static final fun invoke-impl (Lspace/kscience/visionforge/VisionGroup;Lkotlin/jvm/functions/Function1;)V
- public static final fun set-impl (Lspace/kscience/visionforge/VisionGroup;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
- public static final fun set-impl (Lspace/kscience/visionforge/VisionGroup;Ljava/lang/String;Lspace/kscience/dataforge/meta/Meta;)V
+ public static fun hashCode-impl (Lspace/kscience/visionforge/Vision;)I
+ public static final fun invoke-impl (Lspace/kscience/visionforge/Vision;Lkotlin/jvm/functions/Function1;)V
+ public static final fun set-impl (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Lspace/kscience/dataforge/meta/Meta;)V
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lspace/kscience/visionforge/VisionGroup;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lspace/kscience/visionforge/VisionGroup;
+ public static fun toString-impl (Lspace/kscience/visionforge/Vision;)Ljava/lang/String;
+ public final synthetic fun unbox-impl ()Lspace/kscience/visionforge/Vision;
+ public static final fun update-impl (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V
}
public final class space/kscience/visionforge/StyleSheet$Companion {
@@ -227,99 +366,71 @@ public final class space/kscience/visionforge/StyleSheet$Companion {
public final class space/kscience/visionforge/StyleSheetKt {
public static final fun getStyle (Lspace/kscience/visionforge/Vision;Ljava/lang/String;)Lspace/kscience/dataforge/meta/Meta;
public static final fun getStyleNodes (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;)Ljava/util/List;
- public static final fun getStyleProperty (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;)Lspace/kscience/dataforge/values/Value;
- public static final fun getStyleSheet (Lspace/kscience/visionforge/VisionGroup;)Lspace/kscience/visionforge/VisionGroup;
+ public static final fun getStyleProperty (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;)Lspace/kscience/dataforge/meta/Meta;
+ public static final fun getStyleSheet (Lspace/kscience/visionforge/Vision;)Lspace/kscience/visionforge/Vision;
public static final fun getStyles (Lspace/kscience/visionforge/Vision;)Ljava/util/List;
public static final fun setStyles (Lspace/kscience/visionforge/Vision;Ljava/util/List;)V
- public static final fun useStyle (Lspace/kscience/visionforge/Vision;Ljava/lang/String;)V
+ public static final fun useStyle (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Z)V
+ public static synthetic fun useStyle$default (Lspace/kscience/visionforge/Vision;Ljava/lang/String;ZILjava/lang/Object;)V
}
-public abstract interface class space/kscience/visionforge/Vision : space/kscience/dataforge/meta/Configurable, space/kscience/dataforge/meta/descriptors/Described {
+public final class space/kscience/visionforge/UsePropertyKt {
+ public static final fun onPropertyChange (Lspace/kscience/visionforge/Vision;Lkotlin/reflect/KProperty1;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
+ public static final fun onPropertyChange (Lspace/kscience/visionforge/Vision;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/Job;
+ public static synthetic fun onPropertyChange$default (Lspace/kscience/visionforge/Vision;Lkotlin/reflect/KProperty1;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
+ public static synthetic fun onPropertyChange$default (Lspace/kscience/visionforge/Vision;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
+ public static final fun useProperty (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/Job;
+ public static final fun useProperty (Lspace/kscience/visionforge/Vision;Lkotlin/reflect/KProperty1;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/Job;
+ public static final fun useProperty (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/Job;
+ public static synthetic fun useProperty$default (Lspace/kscience/visionforge/Vision;Ljava/lang/String;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
+ public static synthetic fun useProperty$default (Lspace/kscience/visionforge/Vision;Lkotlin/reflect/KProperty1;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
+ public static synthetic fun useProperty$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Ljava/lang/Boolean;Ljava/lang/Boolean;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
+}
+
+public abstract interface class space/kscience/visionforge/Vision : space/kscience/dataforge/meta/descriptors/Described {
public static final field Companion Lspace/kscience/visionforge/Vision$Companion;
+ public static final field STYLE_TARGET Ljava/lang/String;
public static final field TYPE Ljava/lang/String;
public abstract fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
public fun getManager ()Lspace/kscience/visionforge/VisionManager;
- public abstract fun getMeta ()Lspace/kscience/dataforge/meta/ObservableMutableMeta;
- public abstract fun getParent ()Lspace/kscience/visionforge/VisionGroup;
- public abstract fun getProperty (Lspace/kscience/dataforge/names/Name;ZZZ)Lspace/kscience/dataforge/values/Value;
- public static synthetic fun getProperty$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZILjava/lang/Object;)Lspace/kscience/dataforge/values/Value;
- public abstract fun invalidateProperty (Lspace/kscience/dataforge/names/Name;)V
- public abstract fun setParent (Lspace/kscience/visionforge/VisionGroup;)V
- public abstract fun update (Lspace/kscience/visionforge/VisionChange;)V
+ public abstract fun getParent ()Lspace/kscience/visionforge/Vision;
+ public abstract fun getProperties ()Lspace/kscience/visionforge/MutableVisionProperties;
+ public fun receiveEvent (Lspace/kscience/visionforge/VisionEvent;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
+ public static synthetic fun receiveEvent$suspendImpl (Lspace/kscience/visionforge/Vision;Lspace/kscience/visionforge/VisionEvent;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
+ public abstract fun setParent (Lspace/kscience/visionforge/Vision;)V
+ public fun update (Lspace/kscience/visionforge/VisionChange;)V
}
public final class space/kscience/visionforge/Vision$Companion {
+ public static final field STYLE_TARGET Ljava/lang/String;
public static final field TYPE Ljava/lang/String;
public final fun getSTYLE_KEY ()Lspace/kscience/dataforge/names/Name;
public final fun getVISIBLE_KEY ()Lspace/kscience/dataforge/names/Name;
}
-public class space/kscience/visionforge/VisionBase : space/kscience/visionforge/Vision {
- public static final field Companion Lspace/kscience/visionforge/VisionBase$Companion;
- public fun ()V
- public synthetic fun (ILspace/kscience/dataforge/meta/MutableMeta;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
- public fun (Lspace/kscience/visionforge/VisionGroup;Lspace/kscience/dataforge/meta/MutableMeta;)V
- public synthetic fun (Lspace/kscience/visionforge/VisionGroup;Lspace/kscience/dataforge/meta/MutableMeta;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
- public fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
- public synthetic fun getMeta ()Lspace/kscience/dataforge/meta/MutableMeta;
- public final fun getMeta ()Lspace/kscience/dataforge/meta/ObservableMutableMeta;
- protected final fun getOrCreateProperties ()Lspace/kscience/dataforge/meta/MutableMeta;
- public fun getParent ()Lspace/kscience/visionforge/VisionGroup;
- protected final fun getProperties ()Lspace/kscience/dataforge/meta/MutableMeta;
- public fun getProperty (Lspace/kscience/dataforge/names/Name;ZZZ)Lspace/kscience/dataforge/values/Value;
- public fun invalidateProperty (Lspace/kscience/dataforge/names/Name;)V
- public fun setParent (Lspace/kscience/visionforge/VisionGroup;)V
- protected final fun setProperties (Lspace/kscience/dataforge/meta/MutableMeta;)V
- public fun update (Lspace/kscience/visionforge/VisionChange;)V
- public static final fun write$Self (Lspace/kscience/visionforge/VisionBase;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
-}
-
-public final class space/kscience/visionforge/VisionBase$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
- public static final field INSTANCE Lspace/kscience/visionforge/VisionBase$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
- public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
- public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
- public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lspace/kscience/visionforge/VisionBase;
- public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor;
- public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V
- public fun serialize (Lkotlinx/serialization/encoding/Encoder;Lspace/kscience/visionforge/VisionBase;)V
- public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer;
-}
-
-public final class space/kscience/visionforge/VisionBase$Companion {
- public final fun getDescriptor ()Lspace/kscience/dataforge/meta/descriptors/MetaDescriptor;
- public final fun serializer ()Lkotlinx/serialization/KSerializer;
- public final fun updateProperties (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Meta;)V
-}
-
public abstract interface annotation class space/kscience/visionforge/VisionBuilder : java/lang/annotation/Annotation {
}
-public final class space/kscience/visionforge/VisionChange {
+public final class space/kscience/visionforge/VisionChange : space/kscience/visionforge/VisionEvent {
public static final field Companion Lspace/kscience/visionforge/VisionChange$Companion;
public fun ()V
- public synthetic fun (IZLspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;Lkotlinx/serialization/internal/SerializationConstructorMarker;)V
- public fun (ZLspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;)V
- public synthetic fun (ZLspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
- public final fun component1 ()Z
- public final fun component2 ()Lspace/kscience/visionforge/Vision;
- public final fun component3 ()Lspace/kscience/dataforge/meta/Meta;
- public final fun component4 ()Ljava/util/Map;
- public final fun copy (ZLspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;)Lspace/kscience/visionforge/VisionChange;
- public static synthetic fun copy$default (Lspace/kscience/visionforge/VisionChange;ZLspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;ILjava/lang/Object;)Lspace/kscience/visionforge/VisionChange;
+ public fun (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;)V
+ public synthetic fun (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
+ public final fun component1 ()Lspace/kscience/visionforge/Vision;
+ public final fun component2 ()Lspace/kscience/dataforge/meta/Meta;
+ public final fun component3 ()Ljava/util/Map;
+ public final fun copy (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;)Lspace/kscience/visionforge/VisionChange;
+ public static synthetic fun copy$default (Lspace/kscience/visionforge/VisionChange;Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/meta/Meta;Ljava/util/Map;ILjava/lang/Object;)Lspace/kscience/visionforge/VisionChange;
public fun equals (Ljava/lang/Object;)Z
public final fun getChildren ()Ljava/util/Map;
- public final fun getDelete ()Z
public final fun getProperties ()Lspace/kscience/dataforge/meta/Meta;
public final fun getVision ()Lspace/kscience/visionforge/Vision;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
- public static final fun write$Self (Lspace/kscience/visionforge/VisionChange;Lkotlinx/serialization/encoding/CompositeEncoder;Lkotlinx/serialization/descriptors/SerialDescriptor;)V
}
public final class space/kscience/visionforge/VisionChange$$serializer : kotlinx/serialization/internal/GeneratedSerializer {
public static final field INSTANCE Lspace/kscience/visionforge/VisionChange$$serializer;
- public static final synthetic field descriptor Lkotlinx/serialization/descriptors/SerialDescriptor;
public fun childSerializers ()[Lkotlinx/serialization/KSerializer;
public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object;
public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Lspace/kscience/visionforge/VisionChange;
@@ -333,36 +444,75 @@ public final class space/kscience/visionforge/VisionChange$Companion {
public final fun serializer ()Lkotlinx/serialization/KSerializer;
}
-public final class space/kscience/visionforge/VisionChangeBuilder : space/kscience/visionforge/VisionContainerBuilder {
+public final class space/kscience/visionforge/VisionChangeBuilder : space/kscience/visionforge/MutableVisionContainer {
public fun ()V
- public final fun deepCopy ()Lspace/kscience/visionforge/VisionChange;
+ public final fun deepCopy (Lspace/kscience/visionforge/VisionManager;)Lspace/kscience/visionforge/VisionChange;
+ public final fun get (Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/VisionChangeBuilder;
public final fun isEmpty ()Z
public final fun propertyChanged (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Meta;)V
- public fun set (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;)V
+ public fun setChild (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;)V
+ public final fun toJsonString (Lspace/kscience/visionforge/VisionManager;)Ljava/lang/String;
}
public final class space/kscience/visionforge/VisionChangeKt {
- public static final fun VisionChange (Lkotlin/jvm/functions/Function1;)Lspace/kscience/visionforge/VisionChange;
- public static final fun flowChanges-HG0u8IE (Lspace/kscience/visionforge/Vision;J)Lkotlinx/coroutines/flow/Flow;
+ public static final fun VisionChange (Lspace/kscience/visionforge/VisionManager;Lkotlin/jvm/functions/Function1;)Lspace/kscience/visionforge/VisionChange;
+ public static final fun flowChanges-8Mi8wO0 (Lspace/kscience/visionforge/Vision;JZ)Lkotlinx/coroutines/flow/Flow;
+ public static synthetic fun flowChanges-8Mi8wO0$default (Lspace/kscience/visionforge/Vision;JZILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
+}
+
+public abstract interface class space/kscience/visionforge/VisionChildren : space/kscience/visionforge/VisionContainer {
+ public static final field Companion Lspace/kscience/visionforge/VisionChildren$Companion;
+ public static final field STATIC_TOKEN_BODY Ljava/lang/String;
+ public abstract fun get (Lspace/kscience/dataforge/names/NameToken;)Lspace/kscience/visionforge/Vision;
+ public abstract fun getChanges ()Lkotlinx/coroutines/flow/Flow;
+ public fun getChild (Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/Vision;
+ public abstract fun getKeys ()Ljava/util/Set;
+ public abstract fun getParent ()Lspace/kscience/visionforge/Vision;
+ public fun getValues ()Ljava/lang/Iterable;
+}
+
+public final class space/kscience/visionforge/VisionChildren$Companion {
+ public static final field STATIC_TOKEN_BODY Ljava/lang/String;
+ public final fun empty (Lspace/kscience/visionforge/Vision;)Lspace/kscience/visionforge/VisionChildren;
+}
+
+public abstract interface class space/kscience/visionforge/VisionClient : space/kscience/dataforge/context/Plugin {
+ public abstract fun getVisionManager ()Lspace/kscience/visionforge/VisionManager;
+ public abstract fun notifyPropertyChanged (Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/names/Name;Lspace/kscience/dataforge/meta/Meta;)V
+ public abstract fun sendEvent (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/VisionEvent;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
+}
+
+public final class space/kscience/visionforge/VisionClientKt {
+ public static final fun notifyPropertyChanged (Lspace/kscience/visionforge/VisionClient;Lspace/kscience/dataforge/names/Name;Ljava/lang/String;Ljava/lang/Number;)V
+ public static final fun notifyPropertyChanged (Lspace/kscience/visionforge/VisionClient;Lspace/kscience/dataforge/names/Name;Ljava/lang/String;Ljava/lang/String;)V
+ public static final fun notifyPropertyChanged (Lspace/kscience/visionforge/VisionClient;Lspace/kscience/dataforge/names/Name;Ljava/lang/String;Lspace/kscience/dataforge/meta/Meta;)V
+ public static final fun notifyPropertyChanged (Lspace/kscience/visionforge/VisionClient;Lspace/kscience/dataforge/names/Name;Ljava/lang/String;Z)V
+ public static final fun sendEventAsync (Lspace/kscience/visionforge/VisionClient;Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/VisionEvent;)Lkotlinx/coroutines/Job;
}
public abstract interface class space/kscience/visionforge/VisionContainer {
- public abstract fun get (Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/Vision;
+ public abstract fun getChild (Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/Vision;
}
-public abstract interface class space/kscience/visionforge/VisionContainerBuilder {
- public abstract fun set (Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;)V
+public final class space/kscience/visionforge/VisionContainerKt {
+ public static final fun asSequence (Lspace/kscience/visionforge/VisionChildren;)Lkotlin/sequences/Sequence;
+ public static final fun forEach (Lspace/kscience/visionforge/VisionChildren;Lkotlin/jvm/functions/Function2;)V
+ public static final fun get (Lspace/kscience/visionforge/VisionChildren;Ljava/lang/String;)Lspace/kscience/visionforge/Vision;
+ public static final fun get (Lspace/kscience/visionforge/VisionChildren;Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/Vision;
+ public static final fun getChild (Lspace/kscience/visionforge/VisionContainer;Ljava/lang/String;)Lspace/kscience/visionforge/Vision;
+ public static final fun isEmpty (Lspace/kscience/visionforge/VisionChildren;)Z
+ public static final fun iterator (Lspace/kscience/visionforge/VisionChildren;)Ljava/util/Iterator;
+ public static final fun set (Lspace/kscience/visionforge/MutableVisionChildren;Ljava/lang/String;Lspace/kscience/visionforge/Vision;)V
+ public static final fun set (Lspace/kscience/visionforge/MutableVisionChildren;Lspace/kscience/dataforge/names/Name;Lspace/kscience/visionforge/Vision;)V
+ public static final fun setChild (Lspace/kscience/visionforge/MutableVisionContainer;Ljava/lang/String;Lspace/kscience/visionforge/Vision;)V
+ public static final fun static (Lspace/kscience/visionforge/MutableVisionChildren;Lspace/kscience/visionforge/Vision;)V
}
-public final class space/kscience/visionforge/VisionDelegatesKt {
- public static final fun numberProperty (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZ)Lkotlin/properties/ReadWriteProperty;
- public static final fun numberProperty (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZLkotlin/jvm/functions/Function0;)Lkotlin/properties/ReadWriteProperty;
- public static synthetic fun numberProperty$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
- public static synthetic fun numberProperty$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZLkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
- public static final fun propertyValue (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZ)Lkotlin/properties/ReadWriteProperty;
- public static final fun propertyValue (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Lkotlin/properties/ReadWriteProperty;
- public static synthetic fun propertyValue$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
- public static synthetic fun propertyValue$default (Lspace/kscience/visionforge/Vision;Lspace/kscience/dataforge/names/Name;ZZZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlin/properties/ReadWriteProperty;
+public abstract class space/kscience/visionforge/VisionControlEvent : space/kscience/dataforge/meta/MetaRepr, space/kscience/visionforge/VisionEvent {
+ public fun ()V
+ public abstract fun getMeta ()Lspace/kscience/dataforge/meta/Meta;
+ public fun toMeta ()Lspace/kscience/dataforge/meta/Meta;
+ public fun toString ()Ljava/lang/String;
}
public final class space/kscience/visionforge/VisionDescriptorKt {
@@ -382,82 +532,57 @@ public final class space/kscience/visionforge/VisionDescriptorKt {
public static final fun setWidgetType (Lspace/kscience/dataforge/meta/descriptors/MetaDescriptorBuilder;Ljava/lang/String;)V
}
-public abstract interface class space/kscience/visionforge/VisionGroup : space/kscience/dataforge/provider/Provider, space/kscience/visionforge/Vision, space/kscience/visionforge/VisionContainer {
- public static final field Companion Lspace/kscience/visionforge/VisionGroup$Companion;
- public static final field STYLE_TARGET Ljava/lang/String;
- public fun content (Ljava/lang/String;)Ljava/util/Map;
- public fun get (Lspace/kscience/dataforge/names/Name;)Lspace/kscience/visionforge/Vision;
- public abstract fun getChildren ()Ljava/util/Map;
- public fun getDefaultTarget ()Ljava/lang/String;
+public abstract interface class space/kscience/visionforge/VisionEvent {
+ public static final field Companion Lspace/kscience/visionforge/VisionEvent$Companion;
}
-public final class space/kscience/visionforge/VisionGroup$Companion {
- public static final field STYLE_TARGET Ljava/lang/String;
+public final class space/kscience/visionforge/VisionEvent$Companion {
+ public final fun getCLICK_EVENT_KEY ()Lspace/kscience/dataforge/names/Name;
}
-public class space/kscience/visionforge/VisionGroupBase : space/kscience/visionforge/VisionBase, space/kscience/visionforge/MutableVisionGroup {
- public static final field Companion Lspace/kscience/visionforge/VisionGroupBase$Companion;
- public fun