GithubHelp home page GithubHelp logo

hhy5277 / kvision Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rjaros/kvision

0.0 1.0 0.0 4.7 MB

Object oriented web framework for Kotlin/JS

License: MIT License

Kotlin 97.15% CSS 0.30% JavaScript 2.43% HTML 0.12%

kvision's Introduction

KVision Logo

KVision

Object oriented web framework for Kotlin/JS.

Travis CI Download License: MIT

KVision allows you to build modern web applications with the Kotlin language, without any use of HTML, CSS or JavaScript.

KVision prefers the imperative style of programming. It's object oriented and supports many well known OOP design patterns. It gives you a hierarchy of many different components, which are used as a builder blocks for the application GUI.

KVision's design is quite similar to many non-web UI programming libraries including Swing, JavaFX, QT, WinForms and Flutter.

KVision contains innovative connectivity interface for Ktor, Jooby and Spring Boot frameworks on the server side, which allows to build full-stack, multiplatform applications with shared common code.

KVision is being actively developed. Please create an issue for any bugs or feature requests.

Features

Examples and documentation

Ready to explore, rich set of KVision examples is available in the separate project.

The comprehensive KVision guide is published on GitBook.

Full API documentation (KDoc) is available at https://rjaros.github.io/kvision/api/.

You can also look at KVision blog posts at dev.to.

Quickstart

Development

  1. Download KVision examples from GitHub:

     git clone https://github.com/rjaros/kvision-examples.git
    
  2. Enter one of the examples directory:

     cd kvision-examples/showcase                        (on Linux)
     cd kvision-examples\showcase                        (on Windows)
    
  3. Run Gradle incremental build with:

     ./gradlew -t run                                    (on Linux)
     gradlew.bat -t run                                  (on Windows)
    
  4. Open http://localhost:8088/ in your browser.

  5. Play with the code and see your changes immediately in the browser.

Production

To build complete application optimized for production run:

    ./gradlew -Pprod=true distZip                       (on Linux)
    gradlew.bat -Pprod=true distZip                     (on Windows)

Application package will be saved as build/distributions/showcase.zip.

Code samples

Hello world

    Root("root") {
        span("Hello world!")
    }

Basic components interactions using type safe DSL builders

    Root("root") {
        hPanel(spacing = 20, alignItems = FlexAlignItems.CENTER) {
            val label = span("Not yet clicked.")
            var count = 0
            button("Click me").onClick {
                label.content = "You clicked the button ${++count} times."
            }
        }
    }

Tab panel with JavaScript routing

    val firstPanel = Div("First")
    val secondPanel = Div("Second")
    val thirdPanel = Div("Third")

    Root("root") {
        tabPanel {
            addTab("First", firstPanel, route = "/first")
            addTab("Second", secondPanel, route = "/second")
            addTab("Third", thirdPanel, route = "/third")
        }
    }

Type safe forms

    @Serializable
    data class Model(val username: String? = null, val password: String? = null)

    Root("root") {
        formPanel {
            add(Model::username, Text(label = "Username"), required = true)
            add(Model::password, Password(label = "Password"), required = true)
            add(Button("OK").onClick {
                val data: Model = [email protected]()
                println("Username: ${data.username}")
                println("Password: ${data.password}")
            })
        }
    }

Data binding with observable data model

    data class Data(val text: String)
    
    val model = observableListOf(
        Data("One"),
        Data("Two"),
        Data("Three")
    )
    Root("root") {
        dataContainer(model, { data, _, _ ->
            Span(data.text)
        }, HPanel(spacing = 10))
    }
    model.reverse()

kvision's People

Contributors

rjaros avatar robert-cronin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.