diff --git a/build.gradle.kts b/build.gradle.kts index bc20d61f..25d9f4b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,7 @@ plugins { val dataforgeVersion by extra("0.2.0-dev-4") val ktorVersion by extra("1.4.1") +val kotlinWrappersVersion by extra("pre.129-kotlin-1.4.10") allprojects { repositories { @@ -15,7 +16,7 @@ allprojects { } group = "hep.dataforge" - version = "0.2.0-dev-1" + version = "0.2.0-dev-2" } val githubProject by extra("visionforge") diff --git a/settings.gradle.kts b/settings.gradle.kts index 65690060..8ab3e4e4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -39,6 +39,7 @@ include( ":visionforge-core", ":visionforge-solid", ":visionforge-gdml", + ":visionforge-server", ":demo:spatial-showcase", ":demo:gdml", ":demo:muon-monitor", diff --git a/ui/bootstrap/build.gradle.kts b/ui/bootstrap/build.gradle.kts index 1cdd834d..8d404277 100644 --- a/ui/bootstrap/build.gradle.kts +++ b/ui/bootstrap/build.gradle.kts @@ -4,7 +4,8 @@ plugins { val dataforgeVersion: String by rootProject.extra -dependencies{ +dependencies { api(project(":visionforge-solid")) api(project(":ui:react")) + implementation(npm("file-saver", "2.0.2")) } \ No newline at end of file diff --git a/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/outputConfig.kt b/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/outputConfig.kt index b6326979..9e5e1a4b 100644 --- a/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/outputConfig.kt +++ b/ui/bootstrap/src/main/kotlin/hep/dataforge/vision/bootstrap/outputConfig.kt @@ -17,6 +17,7 @@ import org.w3c.dom.events.Event import org.w3c.files.Blob import org.w3c.files.BlobPropertyBag import react.RBuilder +import react.ReactElement import react.dom.button import react.dom.div import react.dom.input @@ -32,7 +33,7 @@ private fun saveData(event: Event, fileName: String, mimeType: String = "text/pl } @OptIn(DFExperimental::class) -fun RBuilder.canvasControls(canvas: ThreeCanvas) = accordion("controls") { +public fun RBuilder.canvasControls(canvas: ThreeCanvas): ReactElement = accordion("controls") { entry("Settings") { div("row") { div("col-2") { @@ -96,7 +97,7 @@ fun RBuilder.canvasControls(canvas: ThreeCanvas) = accordion("controls") { } -fun Element.displayCanvasControls(canvas: ThreeCanvas, block: TagConsumer.() -> Unit = {}) { +public fun Element.displayCanvasControls(canvas: ThreeCanvas, block: TagConsumer.() -> Unit = {}) { clear() append { accordion("controls") { diff --git a/ui/react/build.gradle.kts b/ui/react/build.gradle.kts index 8d541ffd..9389bd35 100644 --- a/ui/react/build.gradle.kts +++ b/ui/react/build.gradle.kts @@ -3,14 +3,9 @@ plugins { } val reactVersion by extra("17.0.0") +val kotlinWrappersVersion: String by rootProject.extra dependencies{ api(project(":visionforge-core")) - - //api("org.jetbrains:kotlin-react:16.13.1-pre.104-kotlin-1.3.72") - api("org.jetbrains:kotlin-react-dom:$reactVersion-pre.126-kotlin-1.4.10") - - api(npm("react", reactVersion)) - api(npm("react-dom", reactVersion)) - api(npm("react-is", reactVersion)) + api("org.jetbrains:kotlin-react-dom:$reactVersion-$kotlinWrappersVersion") } \ No newline at end of file diff --git a/visionforge-core/build.gradle.kts b/visionforge-core/build.gradle.kts index 2bf0b6e0..6e59b5da 100644 --- a/visionforge-core/build.gradle.kts +++ b/visionforge-core/build.gradle.kts @@ -3,6 +3,8 @@ plugins { } val dataforgeVersion: String by rootProject.extra +val kotlinWrappersVersion: String by rootProject.extra + kotlin { @@ -27,16 +29,8 @@ kotlin { jsMain { dependencies { api("hep.dataforge:dataforge-output-html:$dataforgeVersion") - api("org.jetbrains.kotlinx:kotlinx-html:0.7.2") - - //api("org.jetbrains:kotlin-extensions:1.0.1-pre.105-kotlin-1.3.72") - //api("org.jetbrains:kotlin-css-js:1.0.0-pre.105-kotlin-1.3.72") - api("org.jetbrains:kotlin-styled:5.2.0-pre.126-kotlin-1.4.10") - - api(npm("core-js", "2.6.5")) - api(npm("inline-style-prefixer", "5.1.0")) - api(npm("styled-components", "5.2.0")) - //api(project(":ringui-wrapper")) + api("org.jetbrains:kotlin-styled:5.2.0-$kotlinWrappersVersion") + api("org.jetbrains:kotlin-extensions:1.0.1-$kotlinWrappersVersion") } } } diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Colors.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Colors.kt index 4918b6c5..1b3d4763 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Colors.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/Colors.kt @@ -12,7 +12,8 @@ import kotlin.math.max * Definitions of common colors. Taken from * https://github.com/markaren/three.kt/blob/master/threejs-wrapper/src/main/kotlin/info/laht/threekt/math/ColorConstants.kt */ -object Colors { +@Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING", "NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING") +public object Colors { const val aliceblue = 0xF0F8FF const val antiquewhite = 0xFAEBD7 const val aqua = 0x00FFFF diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/visitor/StatisticsVisitor.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/visitor/StatisticsVisitor.kt index 89877fe6..e4a027c9 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/visitor/StatisticsVisitor.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/visitor/StatisticsVisitor.kt @@ -12,7 +12,7 @@ import kotlin.reflect.KClass @OptIn(ExperimentalCoroutinesApi::class) -suspend fun Vision.flowStatistics(statistics: (Name, Vision) -> T): Flow = callbackFlow { +public suspend fun Vision.flowStatistics(statistics: (Name, Vision) -> T): Flow = callbackFlow { val visitor = object : VisionVisitor { override suspend fun visit(name: Name, vision: Vision){ send(statistics(name, vision)) @@ -27,10 +27,10 @@ suspend fun Vision.flowStatistics(statistics: (Name, Vision) -> T): Flow } } -data class DefaultVisionStatistics(val name: Name, val type: KClass) { - val depth get() = name.length +public data class DefaultVisionStatistics(val name: Name, val type: KClass) { + val depth: Int get() = name.length } -suspend fun Vision.flowStatistics(): Flow = flowStatistics { name, vision -> +public suspend fun Vision.flowStatistics(): Flow = flowStatistics { name, vision -> DefaultVisionStatistics(name, vision::class) } \ No newline at end of file diff --git a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/visitor/VisionVisitor.kt b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/visitor/VisionVisitor.kt index 192e36a0..4b6e480e 100644 --- a/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/visitor/VisionVisitor.kt +++ b/visionforge-core/src/commonMain/kotlin/hep/dataforge/vision/visitor/VisionVisitor.kt @@ -8,24 +8,24 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.launch -interface VisionVisitor { +public interface VisionVisitor { /** * Visit a vision possibly mutating in in the process. Should not rearrange children. * @param name full name of a [Vision] being visited * @param vision the visited [Vision] */ - suspend fun visit(name: Name, vision: Vision) + public suspend fun visit(name: Name, vision: Vision) /** * Rearrange children of given group */ - suspend fun visitChildren(name: Name, group: VisionGroup) { + public suspend fun visitChildren(name: Name, group: VisionGroup) { //Do nothing by default } - fun skip(name: Name, vision: Vision): Boolean = false + public fun skip(name: Name, vision: Vision): Boolean = false - companion object{ + public companion object{ private fun CoroutineScope.visitTreeAsync( visionVisitor: VisionVisitor, name: Name, @@ -46,7 +46,7 @@ interface VisionVisitor { /** * Recursively visit this [Vision] and all children */ - fun visitTree(visionVisitor: VisionVisitor, scope: CoroutineScope, root: Vision): Job = + public fun visitTree(visionVisitor: VisionVisitor, scope: CoroutineScope, root: Vision): Job = scope.visitTreeAsync(visionVisitor, Name.EMPTY, root) diff --git a/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/FXPlugin.kt b/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/FXPlugin.kt index 91d1f0c1..11176bf6 100644 --- a/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/FXPlugin.kt +++ b/visionforge-core/src/jvmMain/kotlin/hep/dataforge/vision/FXPlugin.kt @@ -19,12 +19,12 @@ import kotlin.reflect.KClass /** * Plugin holding JavaFX application instance and its root stage */ -class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) { +public class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) { override val tag: PluginTag get() = Companion.tag private val stages: ObservableSet = FXCollections.observableSet() - val consoleMode: Boolean by meta.boolean(true) + public val consoleMode: Boolean by meta.boolean(true) init { if (consoleMode) { @@ -65,7 +65,7 @@ class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) { /** * Define an application to use in this context */ - fun setApp(app: Application, stage: Stage) { + public fun setApp(app: Application, stage: Stage) { FX.registerApplication(FX.defaultScope, app, stage) } @@ -74,7 +74,7 @@ class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) { * * @param cons */ - fun display(action: Stage.() -> Unit) { + public fun display(action: Stage.() -> Unit) { runLater { val stage = Stage() stage.initOwner(FX.primaryStage) @@ -85,14 +85,14 @@ class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) { } } - fun display(component: UIComponent, width: Double = 800.0, height: Double = 600.0) { + public fun display(component: UIComponent, width: Double = 800.0, height: Double = 600.0) { display { scene = Scene(component.root, width, height) title = component.title } } - companion object : PluginFactory { + public companion object : PluginFactory { override val type: KClass = FXPlugin::class override val tag: PluginTag = PluginTag("vis.fx", group = PluginTag.DATAFORGE_GROUP) override fun invoke(meta: Meta, context: Context): FXPlugin = @@ -101,19 +101,19 @@ class FXPlugin(meta: Meta = Meta.EMPTY) : AbstractPlugin(meta) { } -val dfIcon: Image = Image(Global::class.java.getResourceAsStream("/img/df.png")) -val dfIconView = ImageView(dfIcon) +public val dfIcon: Image = Image(Global::class.java.getResourceAsStream("/img/df.png")) +public val dfIconView: ImageView = ImageView(dfIcon) /** * An application surrogate without any visible primary stage */ -class ApplicationSurrogate : App() { +public class ApplicationSurrogate : App() { override fun start(stage: Stage) { FX.registerApplication(this, stage) FX.initialized.value = true } } -fun Context.display(width: Double = 800.0, height: Double = 600.0, component: () -> UIComponent) { +public fun Context.display(width: Double = 800.0, height: Double = 600.0, component: () -> UIComponent) { plugins.fetch(FXPlugin).display(component(), width, height) } \ No newline at end of file diff --git a/visionforge-server/build.gradle.kts b/visionforge-server/build.gradle.kts new file mode 100644 index 00000000..0eec3285 --- /dev/null +++ b/visionforge-server/build.gradle.kts @@ -0,0 +1,66 @@ +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.Companion.MAIN_COMPILATION_NAME + +plugins { + id("ru.mipt.npm.mpp") + application +} + +val ktorVersion: String by rootProject.extra + +kscience { + application() +} + +kotlin { + afterEvaluate { + val jsBrowserDistribution by tasks.getting + + jvm { + withJava() + compilations[MAIN_COMPILATION_NAME]?.apply { + tasks.getByName(processResourcesTaskName) { + dependsOn(jsBrowserDistribution) + afterEvaluate { + from(jsBrowserDistribution) + } + } + } + + } + } + + sourceSets { + commonMain { + dependencies { + implementation(project(":visionforge-solid")) + } + } + jvmMain { + dependencies { + implementation("io.ktor:ktor-server-cio:$ktorVersion") + implementation("io.ktor:ktor-serialization:$ktorVersion") + } + } + jsMain { + dependencies { + implementation("io.ktor:ktor-client-js:$ktorVersion") + implementation("io.ktor:ktor-client-serialization-js:$ktorVersion") + } + } + } +} + +application { + mainClass.set("ru.mipt.npm.muon.monitor.server.MMServerKt") +} + +//distributions { +// main { +// contents { +// from("$buildDir/libs") { +// rename("${rootProject.name}-jvm", rootProject.name) +// into("lib") +// } +// } +// } +//} \ No newline at end of file diff --git a/visionforge-solid/build.gradle.kts b/visionforge-solid/build.gradle.kts index aab7e547..3f7ac5dc 100644 --- a/visionforge-solid/build.gradle.kts +++ b/visionforge-solid/build.gradle.kts @@ -31,7 +31,6 @@ kotlin { dependencies { implementation(npm("three", "0.114.0")) implementation(npm("three-csg-ts", "1.0.1")) - api(npm("file-saver", "2.0.2")) } } } diff --git a/wrappers/build.gradle.kts b/wrappers/build.gradle.kts deleted file mode 100644 index 6baa876c..00000000 --- a/wrappers/build.gradle.kts +++ /dev/null @@ -1,23 +0,0 @@ -plugins { - id("scientifik.js") - //id("kotlin-dce-js") -} - -dependencies { - api(project(":visionforge-common")) - - testCompile(kotlin("test-js")) -} - -kotlin{ - sourceSets["main"].apply{ - dependencies{ - api(npm("style-loader")) -// api(npm("inspire-tree","6.0.1")) -// api(npm("inspire-tree-dom","4.0.6")) - api(npm("jsoneditor")) - api(npm("dat.gui")) - //api("org.jetbrains:kotlin-extensions:1.0.1-pre.83-kotlin-1.3.50") - } - } -} diff --git a/wrappers/src/main/kotlin/dat.kt b/wrappers/src/main/kotlin/dat.kt deleted file mode 100644 index 7c56c20a..00000000 --- a/wrappers/src/main/kotlin/dat.kt +++ /dev/null @@ -1,102 +0,0 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", - "EXTERNAL_DELEGATION" -) -@file:JsModule("dat.gui") -@file:JsNonModule - -package hep.dataforge.vis.spatial.editor - -import org.w3c.dom.HTMLElement - -external interface GUIParams { - var autoPlace: Boolean? get() = definedExternally; set(value) = definedExternally - var closed: Boolean? get() = definedExternally; set(value) = definedExternally - var closeOnTop: Boolean? get() = definedExternally; set(value) = definedExternally - var hideable: Boolean? get() = definedExternally; set(value) = definedExternally - var load: Any? get() = definedExternally; set(value) = definedExternally - var name: String? get() = definedExternally; set(value) = definedExternally - var preset: String? get() = definedExternally; set(value) = definedExternally - var width: Number? get() = definedExternally; set(value) = definedExternally -} - -external open class GUI(option: GUIParams? = definedExternally /* null */) { - open var __controllers: Array - open var __folders: Array - open var domElement: HTMLElement - open fun add( - target: Any, - propName: String, - min: Number? = definedExternally /* null */, - max: Number? = definedExternally /* null */, - step: Number? = definedExternally /* null */ - ): GUIController - - open fun add(target: Any, propName: String, status: Boolean): GUIController - open fun add(target: Any, propName: String, items: Array): GUIController - open fun add(target: Any, propName: String, items: Array): GUIController - open fun add(target: Any, propName: String, items: Any): GUIController - open fun addColor(target: Any, propName: String): GUIController - open fun remove(controller: GUIController) - open fun destroy() - open fun addFolder(propName: String): GUI - open fun removeFolder(subFolder: GUI) - open fun open() - open fun close() - open fun hide() - open fun show() - open fun remember(target: Any, vararg additionalTargets: Any) - open fun getRoot(): GUI - open fun getSaveObject(): Any - open fun save() - open fun saveAs(presetName: String) - open fun revert(gui: GUI) - open fun listen(controller: GUIController) - open fun updateDisplay() - open var parent: GUI - open var scrollable: Boolean - open var autoPlace: Boolean - open var preset: String - open var width: Number - open var name: String - open var closed: Boolean - open var load: Any - open var useLocalStorage: Boolean - - companion object { - var CLASS_AUTO_PLACE: String - var CLASS_AUTO_PLACE_CONTAINER: String - var CLASS_MAIN: String - var CLASS_CONTROLLER_ROW: String - var CLASS_TOO_TALL: String - var CLASS_CLOSED: String - var CLASS_CLOSE_BUTTON: String - var CLASS_CLOSE_TOP: String - var CLASS_CLOSE_BOTTOM: String - var CLASS_DRAG: String - var DEFAULT_WIDTH: Number - var TEXT_CLOSED: String - var TEXT_OPEN: String - } -} - -external open class GUIController { - open fun destroy() - open var onChange: (value: Any? /* = null */) -> GUIController - open var onFinishChange: (value: Any? /* = null */) -> GUIController - open fun setValue(value: Any): GUIController - open fun getValue(): Any - open fun updateDisplay(): GUIController - open fun isModified(): Boolean - open fun min(n: Number): GUIController - open fun max(n: Number): GUIController - open fun step(n: Number): GUIController - open fun fire(): GUIController - open fun options(option: Any): GUIController - open fun name(s: String): GUIController - open fun listen(): GUIController - open fun remove(): GUIController -} \ No newline at end of file diff --git a/wrappers/src/main/kotlin/eventemitter2.kt b/wrappers/src/main/kotlin/eventemitter2.kt deleted file mode 100644 index 36b925f2..00000000 --- a/wrappers/src/main/kotlin/eventemitter2.kt +++ /dev/null @@ -1,65 +0,0 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", - "EXTERNAL_DELEGATION" -) -@file:JsModule("eventemitter2") -@file: JsNonModule - -package hep.dataforge.vis.spatial.editor - -import kotlin.js.Promise - -//typealias eventNS = Array - -external interface ConstructorOptions { - var wildcard: Boolean? get() = definedExternally; set(value) = definedExternally - var delimiter: String? get() = definedExternally; set(value) = definedExternally - var newListener: Boolean? get() = definedExternally; set(value) = definedExternally - var maxListeners: Number? get() = definedExternally; set(value) = definedExternally - var verboseMemoryLeak: Boolean? get() = definedExternally; set(value) = definedExternally -} - -external interface EventAndListener { - @nativeInvoke - operator fun invoke(event: String, vararg values: Any) - - @nativeInvoke - operator fun invoke(event: Array, vararg values: Any) -} - -external open class EventEmitter2(options: ConstructorOptions? = definedExternally /* null */) { - open fun emit(event: String, vararg values: Any): Boolean - open fun emit(event: Array, vararg values: Any): Boolean - open fun emitAsync(event: String, vararg values: Any): Promise> - open fun emitAsync(event: Array, vararg values: Any): Promise> - open fun addListener(event: String, listener: Function<*>): EventEmitter2 /* this */ - open fun on(event: String, listener: Function<*>): EventEmitter2 /* this */ - open fun on(event: Array, listener: Function<*>): EventEmitter2 /* this */ - open fun prependListener(event: String, listener: Function<*>): EventEmitter2 /* this */ - open fun prependListener(event: Array, listener: Function<*>): EventEmitter2 /* this */ - open fun once(event: String, listener: Function<*>): EventEmitter2 /* this */ - open fun once(event: Array, listener: Function<*>): EventEmitter2 /* this */ - open fun prependOnceListener(event: String, listener: Function<*>): EventEmitter2 /* this */ - open fun prependOnceListener(event: Array, listener: Function<*>): EventEmitter2 /* this */ - open fun many(event: String, timesToListen: Number, listener: Function<*>): EventEmitter2 /* this */ - open fun many(event: Array, timesToListen: Number, listener: Function<*>): EventEmitter2 /* this */ - open fun prependMany(event: String, timesToListen: Number, listener: Function<*>): EventEmitter2 /* this */ - open fun prependMany(event: Array, timesToListen: Number, listener: Function<*>): EventEmitter2 /* this */ - open fun onAny(listener: EventAndListener): EventEmitter2 /* this */ - open fun prependAny(listener: EventAndListener): EventEmitter2 /* this */ - open fun offAny(listener: Function<*>): EventEmitter2 /* this */ - open fun removeListener(event: String, listener: Function<*>): EventEmitter2 /* this */ - open fun removeListener(event: Array, listener: Function<*>): EventEmitter2 /* this */ - open fun off(event: String, listener: Function<*>): EventEmitter2 /* this */ - open fun removeAllListeners(event: String? = definedExternally /* null */): EventEmitter2 /* this */ - open fun removeAllListeners(event: Array? = definedExternally /* null */): EventEmitter2 /* this */ - open fun setMaxListeners(n: Number) - open fun eventNames(): Array - open fun listeners(event: String): Array> - open fun listeners(event: Array): Array> - open fun listenersAny(): Array> - open fun removeAllListeners(): EventEmitter2 /* this */ -} \ No newline at end of file diff --git a/wrappers/src/main/kotlin/inspire-tree-dom.kt b/wrappers/src/main/kotlin/inspire-tree-dom.kt deleted file mode 100644 index f3e00d08..00000000 --- a/wrappers/src/main/kotlin/inspire-tree-dom.kt +++ /dev/null @@ -1,38 +0,0 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", - "EXTERNAL_DELEGATION" -) - -package hep.dataforge.vis.spatial.editor - -import org.w3c.dom.HTMLElement - -external interface DropTargetValidator { - @nativeInvoke - operator fun invoke(dragNode: TreeNode, targetNode: TreeNode): Boolean -} - -external interface DragAndDrop { - var enabled: Boolean? get() = definedExternally; set(value) = definedExternally - var validateOn: String? get() = definedExternally; set(value) = definedExternally - var validate: DropTargetValidator -} - -external interface DomConfig { - var autoLoadMore: Boolean? get() = definedExternally; set(value) = definedExternally - var deferredRendering: Boolean? get() = definedExternally; set(value) = definedExternally - var dragAndDrop: DragAndDrop? get() = definedExternally; set(value) = definedExternally - var nodeHeight: Number? get() = definedExternally; set(value) = definedExternally - var showCheckboxes: Boolean? get() = definedExternally; set(value) = definedExternally - var dragTargets: Array? get() = definedExternally; set(value) = definedExternally - var tabindex: Number? get() = definedExternally; set(value) = definedExternally - var target: HTMLElement -} - - -@JsModule("inspire-tree-dom") -@JsNonModule -open external class InspireTreeDOM(tree: Any, opts: DomConfig) \ No newline at end of file diff --git a/wrappers/src/main/kotlin/inspire-tree.kt b/wrappers/src/main/kotlin/inspire-tree.kt deleted file mode 100644 index 74887be7..00000000 --- a/wrappers/src/main/kotlin/inspire-tree.kt +++ /dev/null @@ -1,417 +0,0 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", - "EXTERNAL_DELEGATION", - "unused" -) - -package hep.dataforge.vis.spatial.editor - -import kotlin.js.Promise -import kotlin.js.RegExp - -external interface NodeIteratee { - @nativeInvoke - operator fun invoke(node: TreeNode): Any -} - -external interface MatchProcessor { - @nativeInvoke - operator fun invoke(matches: TreeNodes): Any -} - -external interface SearchMatcher { - @nativeInvoke - operator fun invoke(query: String, resolve: Any, reject: Any): Any -} - -external interface `T$0` { - var add: Boolean? get() = definedExternally; set(value) = definedExternally - var edit: Boolean? get() = definedExternally; set(value) = definedExternally - var remove: Boolean? get() = definedExternally; set(value) = definedExternally -} - -external interface `T$1` { - var resetStateOnRestore: Boolean? get() = definedExternally; set(value) = definedExternally -} - -external interface `T$2` { - var limit: Number? get() = definedExternally; set(value) = definedExternally -} - -external interface `T$3` { - var matcher: SearchMatcher - var matchProcess: MatchProcessor -} - -external interface Selection { - var allow: NodeIteratee? get() = definedExternally; set(value) = definedExternally - var autoDeselect: Boolean? get() = definedExternally; set(value) = definedExternally - var autoSelectChildren: Boolean? get() = definedExternally; set(value) = definedExternally - var disableDirectDeselection: Boolean? get() = definedExternally; set(value) = definedExternally - var mode: String? get() = definedExternally; set(value) = definedExternally - var multiple: Boolean? get() = definedExternally; set(value) = definedExternally - var require: Boolean? get() = definedExternally; set(value) = definedExternally -} - -external interface Config { - var allowLoadEvents: Array? get() = definedExternally; set(value) = definedExternally -// var checkbox: dynamic get() = definedExternally; set(value) = definedExternally - var contextMenu: Boolean? get() = definedExternally; set(value) = definedExternally - val data: ((node: TreeNode, resolve: (nodes: Array) -> Any, reject: (err: Error) -> Any) -> dynamic)? get() = definedExternally - var deferredLoading: Boolean? get() = definedExternally; set(value) = definedExternally - var editable: Boolean? get() = definedExternally; set(value) = definedExternally - var editing: `T$0`? get() = definedExternally; set(value) = definedExternally - var nodes: `T$1`? get() = definedExternally; set(value) = definedExternally - var pagination: `T$2`? get() = definedExternally; set(value) = definedExternally - var renderer: Any? get() = definedExternally; set(value) = definedExternally - var search: `T$3`? get() = definedExternally; set(value) = definedExternally - var selection: Selection? get() = definedExternally; set(value) = definedExternally - var sort: String? get() = definedExternally; set(value) = definedExternally - var multiselect: Boolean? get() = definedExternally; set(value) = definedExternally -} - -external interface State { - var checked: Boolean? get() = definedExternally; set(value) = definedExternally - var collapsed: Boolean? get() = definedExternally; set(value) = definedExternally - var draggable: Boolean? get() = definedExternally; set(value) = definedExternally - //var `drop-target`: Boolean? get() = definedExternally; set(value) = definedExternally - var editable: Boolean? get() = definedExternally; set(value) = definedExternally - var focused: Boolean? get() = definedExternally; set(value) = definedExternally - var hidden: Boolean? get() = definedExternally; set(value) = definedExternally - var indeterminate: Boolean? get() = definedExternally; set(value) = definedExternally - var loading: Boolean? get() = definedExternally; set(value) = definedExternally - var matched: Boolean? get() = definedExternally; set(value) = definedExternally - var removed: Boolean? get() = definedExternally; set(value) = definedExternally - var rendered: Boolean? get() = definedExternally; set(value) = definedExternally - var selectable: Boolean? get() = definedExternally; set(value) = definedExternally - var selected: Boolean? get() = definedExternally; set(value) = definedExternally -} - -external interface InspireTag { - var attributes: Any? get() = definedExternally; set(value) = definedExternally -} - -external interface ITree { - var a: InspireTag? get() = definedExternally; set(value) = definedExternally - var icon: String? get() = definedExternally; set(value) = definedExternally - var li: InspireTag? get() = definedExternally; set(value) = definedExternally - var state: State? get() = definedExternally; set(value) = definedExternally -} - -external interface NodeConfig { - var children: dynamic /* Array | true */ - var id: String? get() = definedExternally; set(value) = definedExternally - var text: String - @JsName("itree") - var itree: ITree? get() = definedExternally; set(value) = definedExternally -} - -external interface Pagination { - var limit: Number - var total: Number -} - -@JsModule("inspire-tree") -@JsNonModule -open external class InspireTree(opts: Config) : EventEmitter2 { - constructor(tree: InspireTree) - constructor(tree: InspireTree, array: Array) - constructor(tree: InspireTree, array: TreeNodes) - - open fun addNode(node: NodeConfig): TreeNode - open fun addNodes(node: Array): TreeNodes - open fun available(): TreeNodes - open fun blur(): TreeNodes - open fun blurDeep(): TreeNodes - open fun boundingNodes(): Array - open fun canAutoDeselect(): Boolean - open fun checked(): TreeNodes - open fun clean(): TreeNodes - open fun clearSearch(): InspireTree - open fun clone(): TreeNodes - open fun collapse(): TreeNodes - open fun collapsed(full: Boolean? = definedExternally /* null */): TreeNodes - open fun collapseDeep(): TreeNodes - open fun context(): TreeNode - open fun copy( - dest: InspireTree, - hierarchy: Boolean? = definedExternally /* null */, - includeState: Boolean? = definedExternally /* null */ - ): TreeNodes - - open fun createNode(obj: Any): TreeNode - open fun deepest(): TreeNodes - open fun deselect(): TreeNodes - open fun deselectDeep(): TreeNodes - open fun disableDeselection(): InspireTree - open fun each(iteratee: NodeIteratee): TreeNodes - open fun editable(full: Boolean? = definedExternally /* null */): TreeNodes - open fun editing(full: Boolean? = definedExternally /* null */): TreeNodes - open fun enableDeselection(): InspireTree - open fun expand(): Promise - open fun expandDeep(): TreeNodes - open fun expanded(full: Boolean? = definedExternally /* null */): TreeNodes - open fun expandParents(): TreeNodes - open fun extract(predicate: String): TreeNodes - open fun extract(predicate: NodeIteratee): TreeNodes - open fun filterBy(predicate: String): TreeNodes - open fun filterBy(predicate: NodeIteratee): TreeNodes - open fun find( - predicate: (node: TreeNode, index: Number? /* = null */, obj: Array? /* = null */) -> Boolean, - thisArg: Any? = definedExternally /* null */ - ): TreeNode - - open fun first(predicate: (node: TreeNode) -> Boolean): TreeNode - open fun flatten(predicate: String): TreeNodes - open fun flatten(predicate: NodeIteratee): TreeNodes - open fun focused(full: Boolean? = definedExternally /* null */): TreeNodes - open fun get(index: Number): TreeNode - open fun hidden(full: Boolean? = definedExternally /* null */): TreeNodes - open fun hide(): TreeNodes - open fun hideDeep(): TreeNodes - open var id: dynamic /* String | Number */ - open var config: Config - open var preventDeselection: Boolean - open fun indeterminate(full: Boolean? = definedExternally /* null */): TreeNodes - open fun insertAt(index: Number, `object`: Any): TreeNode - open fun invoke(methods: String): TreeNodes - open fun invoke(methods: Array): TreeNodes - open fun invokeDeep(methods: String): TreeNodes - open fun invokeDeep(methods: Array): TreeNodes - open fun isEventMuted(eventName: String): Boolean - open fun last(predicate: (node: TreeNode) -> Boolean): TreeNode - open fun lastSelectedNode(): TreeNode - open fun load(loader: Promise): Promise - open fun loading(full: Boolean? = definedExternally /* null */): TreeNodes - open fun matched(full: Boolean? = definedExternally /* null */): TreeNodes - open fun move(index: Number, newIndex: Number, target: TreeNodes): TreeNode - open fun mute(events: Array): InspireTree - open fun muted(): Boolean - open fun node(id: String): TreeNode - open fun node(id: Number): TreeNode - open fun nodes(ids: Array? = definedExternally /* null */): TreeNodes - open fun nodes(ids: Array? = definedExternally /* null */): TreeNodes - open fun pagination(): Pagination - open fun recurseDown(iteratee: NodeIteratee): TreeNodes - open fun reload(): Promise - open fun removeAll(): InspireTree - open fun removed(full: Boolean? = definedExternally /* null */): TreeNodes - open fun restore(): TreeNodes - open fun restoreDeep(): TreeNodes - open fun search(query: String): Promise - open fun search(query: RegExp): Promise - open fun search(query: NodeIteratee): Promise - open fun select(): TreeNodes - open fun selectable(full: Boolean? = definedExternally /* null */): TreeNodes - open fun selectBetween(start: TreeNode, end: TreeNode): InspireTree - open fun selectDeep(): TreeNodes - open fun selected(full: Boolean? = definedExternally /* null */): TreeNodes - open fun selectFirstAvailableNode(): TreeNode - open fun show(): TreeNodes - open fun showDeep(): TreeNodes - open fun softRemove(): TreeNodes - open fun sortBy(sorter: String): TreeNodes - open fun sortBy(sorter: NodeIteratee): TreeNodes - open fun state(key: String, `val`: Boolean): TreeNodes - open fun stateDeep(key: String, `val`: Boolean): TreeNodes - open fun swap(node1: TreeNode, node2: TreeNode): TreeNodes - open fun toArray(): Array - open fun toArray(): Array - open fun tree(): InspireTree - open fun unmute(events: Array): InspireTree - open fun visible(full: Boolean? = definedExternally /* null */): TreeNodes - open fun nodes(): TreeNodes - - companion object { - fun isTreeNode(`object`: Any): Boolean - fun isTreeNodes(`object`: Any): Boolean - } -} - -open external class TreeNodes(tree: InspireTree) { - constructor(tree: InspireTree, array: Array) - constructor(tree: InspireTree, array: TreeNodes) - - open fun addNode(node: NodeConfig): TreeNode - open fun available(): TreeNodes - open fun blur(): TreeNodes - open fun blurDeep(): TreeNodes - open fun checked(): TreeNodes - open fun clean(): TreeNodes - open fun clone(): TreeNodes - open fun collapse(): TreeNodes - open fun collapsed(full: Boolean? = definedExternally /* null */): TreeNodes - open fun collapseDeep(): TreeNodes - open fun context(): TreeNode - open fun copy( - dest: InspireTree, - hierarchy: Boolean? = definedExternally /* null */, - includeState: Boolean? = definedExternally /* null */ - ): TreeNodes - - open fun deepest(): TreeNodes - open fun deselect(): TreeNodes - open fun deselectDeep(): TreeNodes - open fun each(iteratee: NodeIteratee): TreeNodes - open fun editable(full: Boolean? = definedExternally /* null */): TreeNodes - open fun editing(full: Boolean? = definedExternally /* null */): TreeNodes - open fun expand(): TreeNodes - open fun expandDeep(): Promise - open fun expanded(full: Boolean? = definedExternally /* null */): TreeNodes - open fun expandParents(): TreeNodes - open fun extract(predicate: String): TreeNodes - open fun extract(predicate: NodeIteratee): TreeNodes - open fun filterBy(predicate: String): TreeNodes - open fun filterBy(predicate: NodeIteratee): TreeNodes - open fun find( - predicate: (node: TreeNode, index: Number? /* = null */, obj: Array? /* = null */) -> Boolean, - thisArg: Any? = definedExternally /* null */ - ): TreeNode - - open fun flatten(predicate: String): TreeNodes - open fun flatten(predicate: NodeIteratee): TreeNodes - open fun focused(full: Boolean? = definedExternally /* null */): TreeNodes - operator fun get(index: Number): TreeNode - open fun hidden(full: Boolean? = definedExternally /* null */): TreeNodes - open fun hide(): TreeNodes - open fun hideDeep(): TreeNodes - open fun indeterminate(full: Boolean? = definedExternally /* null */): TreeNodes - open fun insertAt(index: Number, `object`: Any): TreeNode - open fun invoke(methods: String): TreeNodes - open fun invoke(methods: Array): TreeNodes - open fun invokeDeep(methods: String): TreeNodes - open fun invokeDeep(methods: Array): TreeNodes - open fun loading(full: Boolean? = definedExternally /* null */): TreeNodes - open fun matched(full: Boolean? = definedExternally /* null */): TreeNodes - open fun move(index: Number, newIndex: Number, target: TreeNodes): TreeNode - open fun node(id: String): TreeNode - open fun node(id: Number): TreeNode - open fun nodes(ids: Array? = definedExternally /* null */): TreeNodes - open fun nodes(ids: Array? = definedExternally /* null */): TreeNodes - open fun pagination(): Pagination - open fun recurseDown(iteratee: NodeIteratee): TreeNodes - open fun removed(full: Boolean? = definedExternally /* null */): TreeNodes - open fun restore(): TreeNodes - open fun restoreDeep(): TreeNodes - open fun select(): TreeNodes - open fun selectable(full: Boolean? = definedExternally /* null */): TreeNodes - open fun selectBetween(start: TreeNode, end: TreeNode): InspireTree - open fun selectDeep(): TreeNodes - open fun selected(full: Boolean? = definedExternally /* null */): TreeNodes - open fun show(): TreeNodes - open fun showDeep(): TreeNodes - open fun softRemove(): TreeNodes - open fun sortBy(sorter: String): TreeNodes - open fun sortBy(sorter: NodeIteratee): TreeNodes - open fun state(key: String, `val`: Boolean): TreeNodes - open fun stateDeep(key: String, `val`: Boolean): TreeNodes - open fun swap(node1: TreeNode, node2: TreeNode): TreeNodes - open fun toArray(): Array - open fun tree(): InspireTree - open fun visible(full: Boolean? = definedExternally /* null */): TreeNodes - open fun nodes(): TreeNodes -} - -open external class TreeNode(tree: InspireTree) { - constructor(tree: InspireTree, source: Any, excludeKeys: Array) - constructor(tree: InspireTree, source: TreeNode, excludeKeys: Array) - constructor(tree: InspireTree, source: Any) - constructor(tree: InspireTree, source: TreeNode) - - open fun addChild(node: NodeConfig): TreeNode - open fun addChildren(nodes: Array): TreeNodes - open fun assign(vararg sources: Any?): TreeNode - open fun available(): Boolean - open fun blur(): TreeNode - open fun check(shallow: Boolean? = definedExternally /* null */): TreeNode - open fun checked(): Boolean - open fun clean(): TreeNode - open fun clone(excludeKeys: Array? = definedExternally /* null */): TreeNode - open fun collapse(): TreeNode - open fun collapsed(): Boolean - open var text: String - open var id: String - open var itree: Any - open fun context(): TreeNodes - open fun copy( - dest: InspireTree, - hierarchy: Boolean? = definedExternally /* null */, - includeState: Boolean? = definedExternally /* null */ - ): TreeNode - - open fun copyHierarchy( - excludeNode: Boolean? = definedExternally /* null */, - includeState: Boolean? = definedExternally /* null */ - ): TreeNode - - open fun deselect(shallow: Boolean? = definedExternally /* null */): TreeNode - open fun editable(): Boolean - open fun editing(): Boolean - open fun expand(): Promise - open fun expanded(): Boolean - open fun expandParents(): TreeNode - open fun focus(): TreeNode - open fun focused(): Boolean - open fun getChildren(): TreeNodes - open fun getParent(): TreeNode - open fun getParents(): TreeNodes - open fun getTextualHierarchy(): Array - open fun hasAncestor(): Boolean - open fun hasChildren(): Boolean - open fun hasOrWillHaveChildren(): Boolean - open fun hasParent(): Boolean - open fun hasVisibleChildren(): Boolean - open fun hidden(): Boolean - open fun hide(): TreeNode - open fun indeterminate(): Boolean - open fun indexPath(): String - open fun isFirstRenderable(): Boolean - open fun isLastRenderable(): Boolean - open fun lastDeepestVisibleChild(): TreeNode - open fun loadChildren(): Promise - open fun loading(): Boolean - open fun markDirty(): TreeNode - open fun matched(): TreeNodes - open fun nextVisibleAncestralSiblingNode(): TreeNode - open fun nextVisibleChildNode(): TreeNode - open fun nextVisibleNode(): TreeNode - open fun nextVisibleSiblingNode(): TreeNode - open fun pagination(): Pagination - open fun previousVisibleNode(): TreeNode - open fun previousVisibleSiblingNode(): TreeNode - open fun recurseDown(iteratee: NodeIteratee): TreeNode - open fun recurseUp(iteratee: NodeIteratee): TreeNode - open fun refreshIndeterminateState(): TreeNode - open fun reload(): Promise - open fun remove(includeState: Boolean? = definedExternally /* null */): Any - open fun removed(): Boolean - open fun renderable(): Boolean - open fun rendered(): Boolean - open fun restore(): TreeNode - open fun select(shallow: Boolean? = definedExternally /* null */): TreeNode - open fun selectable(): Boolean - open fun selected(): Boolean - open fun set(key: Number, `val`: Any): TreeNode - open fun set(key: String, `val`: Any): TreeNode - open fun show(): TreeNode - open fun softRemove(): TreeNode - open fun state(key: Any?, `val`: Boolean? = definedExternally /* null */): dynamic /* Boolean | Any? */ - open fun state(key: String, `val`: Boolean? = definedExternally /* null */): dynamic /* Boolean | Any? */ - open fun states(keys: Array, `val`: Boolean): Boolean - open fun toggleCheck(): TreeNode - open fun toggleCollapse(): TreeNode - open fun toggleEditing(): TreeNode - open fun toggleSelect(): TreeNode - open fun toObject( - excludeChildren: Boolean? = definedExternally /* null */, - includeState: Boolean? = definedExternally /* null */ - ): Any - - override fun toString(): String - open fun tree(): InspireTree - open fun uncheck(shallow: Boolean? = definedExternally /* null */): TreeNode - open fun visible(): Boolean -} \ No newline at end of file diff --git a/wrappers/src/main/kotlin/jsoneditor.kt b/wrappers/src/main/kotlin/jsoneditor.kt deleted file mode 100644 index a83f4b87..00000000 --- a/wrappers/src/main/kotlin/jsoneditor.kt +++ /dev/null @@ -1,185 +0,0 @@ -@file:Suppress( - "INTERFACE_WITH_SUPERCLASS", - "OVERRIDING_FINAL_MEMBER", - "RETURN_TYPE_MISMATCH_ON_OVERRIDE", - "CONFLICTING_OVERLOADS", - "EXTERNAL_DELEGATION" -) - -package hep.dataforge.vis.spatial.editor - -import org.w3c.dom.HTMLElement - -external interface Node { - var field: String - var value: String? get() = definedExternally; set(value) = definedExternally - var path: dynamic -} - -external interface NodeName { - var path: Array - var type: dynamic /* 'object' | 'array' */ - var size: Number -} - -external interface ValidationError { - var path: dynamic - var message: String -} - -external interface Template { - var text: String - var title: String - var className: String? get() = definedExternally; set(value) = definedExternally - var field: String - var value: Any -} - -external interface `T$6` { - var startFrom: Number - var options: Array -} - -external interface AutoCompleteOptions { - var confirmKeys: Array? get() = definedExternally; set(value) = definedExternally - var caseSensitive: Boolean? get() = definedExternally; set(value) = definedExternally -// var getOptions: AutoCompleteOptionsGetter? get() = definedExternally; set(value) = definedExternally -} - -external interface SelectionPosition { - var row: Number - var column: Number -} - -external interface SerializableNode { - var value: Any - var path: dynamic -} - -external interface Color { - var rgba: Array - var hsla: Array - var rgbString: String - var rgbaString: String - var hslString: String - var hslaString: String - var hex: String -} - -//external interface `T$0` { -// var field: Boolean -// var value: Boolean -//} -// -//external interface `T$1` { -// @nativeGetter -// operator fun get(key: String): String? -// -// @nativeSetter -// operator fun set(key: String, value: String) -//} - -//external interface Languages { -// @nativeGetter -// operator fun get(lang: String): `T$1`? -// -// @nativeSetter -// operator fun set(lang: String, value: `T$1`) -//} - -external interface JSONEditorOptions { -// var ace: AceAjax.Ace? get() = definedExternally; set(value) = definedExternally -// var ajv: Ajv? get() = definedExternally; set(value) = definedExternally - var onChange: (() -> Unit)? get() = definedExternally; set(value) = definedExternally - var onChangeJSON: ((json: Any) -> Unit)? get() = definedExternally; set(value) = definedExternally - var onChangeText: ((jsonString: String) -> Unit)? get() = definedExternally; set(value) = definedExternally - var onEditable: ((node: Node) -> dynamic)? get() = definedExternally; set(value) = definedExternally - var onError: ((error: Error) -> Unit)? get() = definedExternally; set(value) = definedExternally - var onModeChange: ((newMode: dynamic /* 'tree' | 'view' | 'form' | 'code' | 'text' */, oldMode: dynamic /* 'tree' | 'view' | 'form' | 'code' | 'text' */) -> Unit)? get() = definedExternally; set(value) = definedExternally - var onNodeName: ((nodeName: NodeName) -> String?)? get() = definedExternally; set(value) = definedExternally - var onValidate: ((json: Any) -> dynamic)? get() = definedExternally; set(value) = definedExternally - var escapeUnicode: Boolean? get() = definedExternally; set(value) = definedExternally - var sortObjectKeys: Boolean? get() = definedExternally; set(value) = definedExternally - var history: Boolean? get() = definedExternally; set(value) = definedExternally - var mode: dynamic /* 'tree' | 'view' | 'form' | 'code' | 'text' */ - var modes: Array? get() = definedExternally; set(value) = definedExternally - var name: String? get() = definedExternally; set(value) = definedExternally - var schema: Any? get() = definedExternally; set(value) = definedExternally - var schemaRefs: Any? get() = definedExternally; set(value) = definedExternally - var search: Boolean? get() = definedExternally; set(value) = definedExternally - var indentation: Number? get() = definedExternally; set(value) = definedExternally - var theme: String? get() = definedExternally; set(value) = definedExternally - var templates: Array