Code Monkey home page Code Monkey logo

gxi's Introduction

GXI

A Declarative Cross-Platform Native UI-Framework

Tests Crates.io

โš ๏ธ Early Stage

Using proc-macros, the gxi transpiler transpile a component tree into a stateful self-managed n-binary tree using observable sync/async state pattern, for maximum efficiency and lowest possible overhead, with close to no runtime cost. Inherently, eliminating the use of a virtual dom or a diffing algorithm. The component system is platform-agnostic, which allows the system to produce platform-dependent and independent components, merging them for code reuse and maintainability.

Platforms

  • Web wasm32-unknown-unknown
  • Desktop (GTK) Windows, Mac and Linux
  • Platform Independent (Web and GTK)
  • Android
  • Ios

Examples

use gxi::{gxi, set_state, State, StrongNodeType, Text};

pub fn cat_fact() -> StrongNodeType {
    let cat_fact = State::new(String::new());

    let fetch_cat_fact = set_state!(
        async || {
            let resp = reqwest::get("https://catfact.ninja/fact?max_length=140")
                .await
                .unwrap();
            *(*cat_fact).borrow_mut() = resp.text().await.unwrap();
        },
        [cat_fact]
    );

    // pre fetch cat memes
    fetch_cat_fact();

    return gxi! {
        div [
            button ( on_click = move |_| fetch_cat_fact() ) [
                Text ( value = "fetch cat memes!" )
            ],
            p [
                Text ( value = &cat_fact[..])
            ],
        ]
    };
}

Full src here

Code of conduct

Code of conduct can be found at CODE_OF_CONDUCT.md

Contributing

Make sure to read Contribution Guidelines before contributing.

License & Copyright

Copyright (C) 2021 Aniket Prajapati

Licensed under the MIT LICENSE

Contributors

gxi's People

Contributors

aniketfuryrocks avatar restyled-commits 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

Watchers

 avatar  avatar  avatar

gxi's Issues

[BUG] Unexpected Expression

Some if expressions may not work with the current Expr implementation.
Therefore it is advised to wrap them in ().

if a==b {
    a
}

panics

Change to

if (a == b) {
   a
}

works

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.