Giter VIP home page Giter VIP logo

hirola's Introduction

Hirola

Latest Version Browser Tests Unit Tests MIT licensed

Hirola is an un-opinionated webf ramework that is focused on simplicity and predictability.

Goals

  1. Keep it simple. A simple and declarative way to build web UIs in rust with a small learning curve.
  2. Make it easy to read, extend and share code. Mixins and components are kept simple and macro-free.
  3. No context, you can choose passing props down, and/or use the global-state.
  4. Familiality. Uses rsx which is very similar to jsx.

Example

We are going to create a simple counter program.

cargo new counter

With a new project, we need to create an index file which is the entry point and required by trunk

cd counter

Create an index.html in the root of counter. Add the contents below

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Hirola Counter</title>
    <body></body>
  </head>
</html>

Lets add some code to src/main.rs

use hirola::prelude::*;

fn counter(app: &HirolaApp) -> Dom {
    let count = Signal::new(0);
    let increment = count.mut_callback(|c, _| c + 1)
    html! {
        <div>
            <button on:click=increment>"Increment"</button>
            <span>{count.get()}</span>
        </div>
    }
}
fn main() {
    let window = web_sys::window().unwrap();
    let document = window.document().unwrap();
    let body = document.body().unwrap();

    let app = HirolaApp::new();
    app.mount(&body, counter);
}

Now lets run our project

trunk serve

You should be able to get counter running: Live Example

Ecosystem

Check out Hirola Docs written with Hirola itself!

Here are some extensions for hirola:

  1. Form
  2. Router
  3. State

Milestones

Status Goal Labels
โœ” Write code that is declarative and easy to follow ready
โœ” Allow extensibility via mixins ready
๐Ÿš€ Standardize Components ready
๐Ÿš€ SSR ready
๐Ÿš€ Hydration todo
๐Ÿš€ Serverside integrations todo

Inspiration

  • Sycamore
  • Alpine.js
  • React.js
  • Yew

Demo examples

This API will certainly change.

Go to examples and use trunk

$  trunk serve

Prerequisite:

You need need to have rust, cargo and trunk installed.

License: MIT

hirola's People

Contributors

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