Coder Social home page Coder Social logo

popovanton0 / kira Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 0.0 4.24 MB

🎛️ Automatically generates UI which allows users to call any function (including composable ones) with any parameter values. Useful for building demo screens in playground apps of design systems

License: Apache License 2.0

Kotlin 100.00%
android code-generation demo-app design-system jetpack-compose kotlin ksp playground-app annotation-processor

kira's Introduction

Kira

Project Status: Suspended – Initial development has started, but there has not yet been a stable, usable release; work has been stopped for the time being but the author(s) intend on resuming work. Compatible with Compose — 1.2.0

Kira is an Android library that defines a Kotlin DSL (similar to androidx.preference) for creating UI that allows users to call any function (including @Composable ones) with any parameter values.

Kira also includes annotation-processor kira-processor that ✨automagically✨ generates UI for functions using the DSL.

Library is particularly useful for building demo screens for UI components in playground apps of various design systems.

Example

@Kira
@Composable
fun TextCard(
    text: String,
    isRed: Boolean,
    skill: Skill?,
    food: Food,
) = TODO()

Generated code (only a portion):

kira(TextCardScope()) {
    text = string(paramName = "text", defaultValue = "Lorem")
    isRed = boolean(paramName = "isRed", defaultValue = false)
    skill = nullableEnum(paramName = "skill", defaultValue = null)
    food = enum(paramName = "food")
    injector {
        TextCard(
            text = text.currentValue(),
            isRed = isRed.currentValue(),
            skill = skill.currentValue(),
            food = food.currentValue(),
        )
    }
}

Screenshot of the UI demo screen:

Horizontal ListItems present for each function argument that allow user to provide any value of the argument's type to the function's arguments

Horizontal ListItems present for each function argument that allow user to provide any value of the argument's type to the function's arguments

Demo Video

Kira — Early Demo on YouTube

Getting Started

Release

Add the following code to your project's root build.gradle file:

repositories {
    maven { url "https://jitpack.io" }
}

Next, add the dependency below to your module's build.gradle file:

dependencies {
    implementation "com.github.popovanton0:kira:LATEST_VERSION"
    ksp "com.github.popovanton0.kira:kira-processor:LATEST_VERSION"
}

Usage

Examples are in the source code .

Basic

TODO()

kira's People

Contributors

popovanton0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.