NOTE: Project is not ready for general use yet! Wa...
# feed
t
NOTE: Project is not ready for general use yet! Want a pure Kotlin WEB framework with SSR(server-side rendering) and hydration support, that allows you to write your code, like this:
Copy code
val welcome: CBlock = {
    tag(::DIV) {
        css {
            classes.add("welcome")
            display = Display.none
        }
        +"Hello, "
        tag(::SPAN) {
            val classes = currentUser.map {
                if (it == null) {
                    setOf("username", "usernameAnonymous")
                } else {
                    setOf("username", "usernameLoggedIn")
                }
            }
            bind(SPAN::classes, classes)
            dynamic(currentUser) { +(it?.username ?: "you") }
        }
        +"."
    }
}
It's coming! Currently I'm looking for people willing to help me with design and development. No code contribution is necessary, advising on API design is not less valuable for me. See live demo: http://tictactoe.demo.carrat.org/ Code: https://github.com/carrat-framework/carrat-demo-tictactoe/blob/master/src/commonMain/kotlin/org/carrat/demo/tictactoe/site/displayGame.kt If you want to help, join #carrat-dev
a
I do not see comparison with existing frameworks like KVision or simple kotlins-html. Without it, I do not think that people will try it.
The DSL seems to be very confusing.
☝️ 3
☝🏼 1
t
@altavir I didn't wanted to write too long post about it here. There are quite a few kotlin web frameworks currently. KVision is component framework. Carrat is low level framework for creating and manipulating DOM. KVision is JS only, carrat can render on both client and server. It can also attach on client to server rendered DOM. kotlinx-html can create DOM, but cannot manipulate it. Carrat CBuilder does implement TagConsumer from kotlinx-html, but without using
tag
method, binding is not possible, as it is not possible to implement it efficiently.
@altavir And thanks for feedback about DSL. It requires some work, but currently achieving proper core API design is a priority. As I mentioned it is not ready for general use yet, I am mostly looking for people who would like to help me shape the API.
a
tag(::DIV) { // . . . } calls out for div { // making this an inline function }