Coder Social home page Coder Social logo

nacular / doodle Goto Github PK

View Code? Open in Web Editor NEW
643.0 17.0 27.0 37.24 MB

A pure Kotlin UI framework for the Web and Desktop.

Home Page: https://nacular.github.io/doodle

License: MIT License

Kotlin 100.00%
kotlin kotlin-js webapp object-oriented kotlin-multiplatform javascript web framework kotlin-jvm ui

doodle's Introduction

doodle

A pure Kotlin, UI framework

Kotlin 1.9.23 JS Wasm, JVM Chat: on slack API License: MIT

Doodle helps you create beautiful, modern apps entirely in Kotlin. Its render model is intuitive yet powerful, making it easy to achieve complex UIs with pixel level precision and layouts. This simplicity and power applies to everything from user input to drag and drop. Doodle lets you build and animate anything.

Start creating your app for Web and Desktop; just define your View hierarchy and business logic, and go.

card.mov

Hello World

import io.nacular.doodle.application.Application
import io.nacular.doodle.application.application
import io.nacular.doodle.core.Display
import io.nacular.doodle.core.plusAssign
import io.nacular.doodle.core.view
import io.nacular.doodle.drawing.Color.Companion.Black
import io.nacular.doodle.drawing.text
import org.kodein.di.instance

class HelloWorld(display: Display): Application {
    init {
        display += view {
            size   = display.size
            render = {
                text("Hello, world!", color = Black)
            }
        }
    }

    override fun shutdown() {}
}

fun main() {
    application {
        HelloWorld(display = instance())
    }
}

Examples and Documentation

Check out the documentation site for more details and examples. You can also find helpful tutorials at doodle-tutorials.

Doodle is still under active development, so there are going to be gaps and bugs. Please report issues, and submit feature requests.

You can also join the discussion on the #doodle Kotlin Slack channel. Go to http://slack.kotl.in for instructions on getting an invitation.

Leave a star

Let us know what you think by leaving a comment or a star ⭐️.

doodle's People

Contributors

bodiam avatar drzoddiak avatar hiperbou avatar jacoobes avatar pusolito avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doodle's Issues

Forms example?

Hi, just wondering, but would you have an example with a form + layout? I'm looking for something like this, and I'm not sure if there's a formlayout or tablelayout which I could use for this?

image

HelloWorld not working

Hi there, I've finally started with Doodle, so I setup my project and tried the HelloWorld, but it doesn't compile. Could you please fix it?

There are 2 issues:

  • On line 23, there's a call to application. But there's no such thing as application. Maybe the import to import io.nacular.doodle.application.application is missing? Not sure.
  • Another issue is: HelloWorld(display = instance()). What's instance()? It seems there's no reference to anything like instance(), and I can't find a suitable candidate.

Thanks,
Erik

Search in documentation not working well

I'm not sure how the search works in the documentation, but it seems to not work well. When I search for "Layout", I'm getting a lot of 404 errors:

image

(The Buttons gives a 404, and so does Defining our application, The Application, etc)

Export image of the view

Hello,

Is it possible to export an image of the view as a png? Also Is it also possible to use doodle in conjunction with other libraries e.g. compose with a doodle view? If so can we get examples of these?

Thanks

How to make native window menus?

I'm trying to make an exclusive desktop app to handle some things on my pc, and would like for the app to have a menu bar at the top with some actions.

And I know there is a component called menu, it however draws to the canvas (feature that made me choose this lib over other options that use native API calls to draw components).

And while it is possible to manually draw the bar to the screen, I would like for this bar to specifically use the native menu API.

This way, the elements can appear at my system's top bar instead of being a bar below the system's top bar.

Is that possible? To have the application window to call the native system menu handler to add options?

When running demos: Unable to load '@webpack-cli/serve' command - TypeError: options.forEach is not a function

I cloned the demos from github but I am unable to run them.

When running any of the jsBrowser*Run targets, I get the following error:

[webpack-cli] TypeError: options.forEach is not a function
[webpack-cli] TypeError: options.forEach is not a function
    at WebpackCLI.makeCommand (C:\Users\pauls\projects\kforum\build\js\node_modules\webpack-cli\lib\webpack-cli.js:173:21)
    at ServeCommand.apply (C:\Users\pauls\projects\kforum\build\js\node_modules\@webpack-cli\serve\lib\index.js:41:19)
    at loadCommandByName (C:\Users\pauls\projects\kforum\build\js\node_modules\webpack-cli\lib\webpack-cli.js:907:35)
    at async Command.<anonymous> (C:\Users\pauls\projects\kforum\build\js\node_modules\webpack-cli\lib\webpack-cli.js:1462:17)
    at async Promise.all (index 0)
    at async WebpackCLI.run (C:\Users\pauls\projects\kforum\build\js\node_modules\webpack-cli\lib\webpack-cli.js:1500:9)
    at async runCLI (C:\Users\pauls\projects\kforum\build\js\node_modules\webpack-cli\lib\bootstrap.js:11:9)```

I found [this stackoverflow](https://github.com/webpack/webpack/issues/14443) which seems to talk about the issue, but I don't know how to adjust the version of webpack that is being used by kotlin.

Can you guys repro and do you have any suggestions?

Is there a Dropdown component available?

I had a look at the documentation, and I was wondering if a dropdown component was available as an input?

I saw the list item, and input item, but no dropdown. Thanks!

I cannot get the doodle-tutorials working

I am trying to run the CalculatorRunner jvm main instance, but without luck. I keep on getting:

Exception in thread "main" java.lang.ExceptionInInitializerError at org.jetbrains.skiko.SkiaWindow$1.invoke(SkiaWindow.kt:7) at org.jetbrains.skiko.SkiaWindow$1.invoke(SkiaWindow.kt:7) at org.jetbrains.skiko.SkiaWindow.<init>(SkiaWindow.kt:9) at org.jetbrains.skiko.SkiaWindow.<init>(SkiaWindow.kt:5) at io.nacular.doodle.application.ApplicationHolderImpl.<init>(Application.kt:86) at io.nacular.doodle.application.ApplicationHolderImpl.<init>(Application.kt:72) at io.nacular.doodle.application.ApplicationHolderImpl$Companion.invoke(Application.kt:168) at io.nacular.doodle.application.ApplicationKt.createApplication(Application.kt:70) at io.nacular.doodle.examples.MainKt.main(main.kt:21) at io.nacular.doodle.examples.MainKt.main(main.kt) Caused by: org.jetbrains.skiko.LibraryLoadException: Cannot find libskiko-linux-x64.so.sha256, proper native dependency missing. at org.jetbrains.skiko.Library.load(Library.kt:72) at org.jetbrains.skiko.SkiaLayer.<clinit>(SkiaLayer.kt:25) ... 10 more

I saw another issue which was resolved by adding the jetbrains repo, but this one is defined in the tutorials so that is not the problem.

My setup is Ubuntu 21.10 with IntelliJ IDEA 2021.3.1 (Community Edition).
I just cloned the doodle-tutorials repo and tried to run the example app. I also tried to look for this error but could not get any good working solution for my situation.

Really curious what I am doing wrong here.

org.jetbrains.skiko:skiko-jvm-runtime-macos-x64:0.4.7 missing

Hi, I'm still trying to run the HelloWorld class, but I'm failing due this error:

Execution failed for task ':compileKotlin'.
> Error while evaluating property 'filteredArgumentsMap' of task ':compileKotlin'
   > Could not resolve all files for configuration ':compileClasspath'.
      > Could not find org.jetbrains.skiko:skiko-jvm-runtime-macos-x64:0.4.7.
        Searched in the following locations:
          - https://repo.maven.apache.org/maven2/org/jetbrains/skiko/skiko-jvm-runtime-macos-x64/0.4.7/skiko-jvm-runtime-macos-x64-0.4.7.pom
        If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
        Required by:
            project : > io.nacular.doodle:desktop:0.6.0 > io.nacular.doodle:desktop-jvm:0.6.0

My build.gradle.kts looks like this:

plugins {
    id("org.jetbrains.kotlin.jvm") version "1.5.30"
    application
}

version = "1.0.0"
group = "com.my.cool.app"

repositories {
    mavenCentral()
}

kotlin {
    target.compilations.all {
        kotlinOptions {
            jvmTarget = "11"
        }
    }

    val doodleVersion = "0.6.0" // <--- Latest Doodle version

    dependencies {
        implementation("io.nacular.doodle:core:$doodleVersion")
        implementation("io.nacular.doodle:desktop:$doodleVersion")

        // Optional
        implementation("io.nacular.doodle:controls:$doodleVersion")
        implementation("io.nacular.doodle:animation:$doodleVersion")
        implementation("io.nacular.doodle:themes:$doodleVersion")
    }
}

application {
    mainClass.set("HelloWorld")
}

And the only code I have, my HelloWoorld, looks like this:

import io.nacular.doodle.application.Application
import io.nacular.doodle.application.application
import io.nacular.doodle.core.Display
import io.nacular.doodle.core.plusAssign
import io.nacular.doodle.core.view
import io.nacular.doodle.drawing.Color.Companion.Black
import io.nacular.doodle.drawing.text
import org.kodein.di.instance

class HelloWorld(display: Display): Application {
    init {
        display += view {
            size   = display.size
            render = {
                text("Hello, world!", color = Black)
            }
        }
    }

    override fun shutdown() {}
}

fun main() {
    application {
        HelloWorld(display = instance())
    }
}

Example gradle script from documentation is giving errors

I'm using the example script for multi-platform projects with Kotlin Gradle from https://nacular.github.io/doodle/#/installation.

e: /path/to/Doodle/build.gradle.kts:19:20: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public fun Project.dependencies(configuration: DependencyHandlerScope.() -> Unit): Unit defined in org.gradle.kotlin.dsl

Using

plugins {
    id ("org.jetbrains.kotlin.multiplatform") version "1.4.21"
}

version = "1.0.0"
group   = "com.my.cool.app"

repositories {
    jcenter     ()
    mavenCentral()
}

val doodleVersion = "0.5.2" // <--- Latest Doodle version

kotlin {
    js {}

    sourceSets {
        commonMain.dependencies {
            implementation ("org.jetbrains.kotlin:kotlin-stdlib-common")

            implementation ("io.nacular.doodle:core:$doodleVersion")
            implementation ("io.nacular.doodle:browser:$doodleVersion")

            // Optional
            // implementation ("io.nacular.doodle:controls:$doodleVersion")
            // implementation ("io.nacular.doodle:animation:$doodleVersion")
            // implementation ("io.nacular.doodle:themes:$doodleVersion")
        }

        jsMain.dependencies {
            implementation ("org.jetbrains.kotlin:kotlin-stdlib-js")
        }
    }
}

Native dependency missing

Using the sample code in the Application section of the Guide, a pure JVM Kotlin build script and the latest Intellij IDEA (IntelliJ IDEA Community Edition 2021.3.2) I get the following error when attempting to run the main class from Intellij:

Exception in thread "main" java.lang.ExceptionInInitializerError
at org.jetbrains.skiko.SkiaWindow$1.invoke(SkiaWindow.kt:7)
at org.jetbrains.skiko.SkiaWindow$1.invoke(SkiaWindow.kt:7)
at org.jetbrains.skiko.SkiaWindow.(SkiaWindow.kt:9)
at org.jetbrains.skiko.SkiaWindow.(SkiaWindow.kt:5)
at io.nacular.doodle.application.ApplicationHolderImpl.(Application.kt:86)
at io.nacular.doodle.application.ApplicationHolderImpl.(Application.kt:72)
at io.nacular.doodle.application.ApplicationHolderImpl$Companion.invoke(Application.kt:168)
at io.nacular.doodle.application.ApplicationKt.createApplication(Application.kt:70)
at MainKt.main(Main.kt:12)
at MainKt.main(Main.kt)
Caused by: org.jetbrains.skiko.LibraryLoadException: Cannot find skiko-windows-x64.dll.sha256, proper native dependency missing.
at org.jetbrains.skiko.Library.load(Library.kt:72)
at org.jetbrains.skiko.SkiaLayer.(SkiaLayer.kt:25)
... 10 more

Reinstalling Intellij has not fixed the problem.

Installation issue

Hi,

I've just found your project and I want to try it!
Unfortunately I can't install it. Both maven & jcenter are configured in repositories, but your artifacts can't be found.

I will try to install it as a third-party module and it should work.

Regards,

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.