All Projects → anowell → Quasar

anowell / Quasar

Licence: mit
An experimental rust-to-{wasm,asmjs} frontend framework.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Quasar

Awesome Seed Rs
A curated list of awesome things related to Seed
Stars: ✭ 101 (-43.89%)
Mutual labels:  framework, wasm, frontend
Front End Web Development Resources
This repository contains content which will be helpful in your journey as a front-end Web Developer
Stars: ✭ 3,452 (+1817.78%)
Mutual labels:  framework, frontend, frontend-framework
Tko
🥊 Technical Knockout – The Monorepo for Knockout.js (4.0+)
Stars: ✭ 227 (+26.11%)
Mutual labels:  framework, frontend, frontend-framework
Displayjs
A simple JavaScript framework for building ambitious UIs 😊
Stars: ✭ 590 (+227.78%)
Mutual labels:  framework, frontend, frontend-framework
Squark
Rust frontend framework, for web browser and more.
Stars: ✭ 162 (-10%)
Mutual labels:  wasm, asmjs, frontend-framework
Seed Rs Realworld
Exemplary real world application built with Seed
Stars: ✭ 77 (-57.22%)
Mutual labels:  framework, wasm, frontend
Ionic Framework
A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
Stars: ✭ 45,802 (+25345.56%)
Mutual labels:  framework, frontend
Bulmaswatch
Themes for Bulma
Stars: ✭ 1,525 (+747.22%)
Mutual labels:  framework, frontend
Percy
Build frontend browser apps with Rust + WebAssembly. Supports server side rendering.
Stars: ✭ 1,856 (+931.11%)
Mutual labels:  wasm, frontend
Modern Wasm Starter
🛸 Run C++ code on web and create blazingly fast websites! A starter template to easily create WebAssembly packages using type-safe C++ bindings with automatic TypeScript declarations.
Stars: ✭ 140 (-22.22%)
Mutual labels:  wasm, asmjs
Material Design For Bootstrap
Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
Stars: ✭ 9,463 (+5157.22%)
Mutual labels:  framework, frontend
Spasm
Write single page applications in D that compile to webassembly
Stars: ✭ 129 (-28.33%)
Mutual labels:  framework, wasm
Lazy
Kule Lazy4 / CSS Framework
Stars: ✭ 147 (-18.33%)
Mutual labels:  framework, frontend
Cyclow
A reactive frontend framework for JavaScript
Stars: ✭ 105 (-41.67%)
Mutual labels:  framework, frontend
Wasmplay
WASM Web "Framework" Playground
Stars: ✭ 105 (-41.67%)
Mutual labels:  wasm, frontend
Javascript Code Challenges
A collection of JavaScript modern interview code challenges for beginners to experts
Stars: ✭ 2,710 (+1405.56%)
Mutual labels:  frontend, frontend-framework
Portfolio Generator
JS framework to dynamically generate a portfolio site from a JSON file
Stars: ✭ 135 (-25%)
Mutual labels:  framework, frontend
Uibench
UI Benchmark
Stars: ✭ 163 (-9.44%)
Mutual labels:  framework, frontend
Tawian Frontend
A markdowny CSS framework
Stars: ✭ 167 (-7.22%)
Mutual labels:  framework, frontend
Fe
前端热门文章阅读
Stars: ✭ 174 (-3.33%)
Mutual labels:  framework, frontend

Quasar

An experimental rust-to-{wasm,asmjs} frontend framework.


Supermassive black holes exist at the center of most observed galaxies, but there is much about them that remains a mystery. It is believed that rapidly adding sufficient matter to a supermassive black hole's accretion disk results in becoming a quasar that emits enormous amounts of electromagnetic energy as matter via astrophysical jets perpendicular to the black hole's spin. These jets can emit matter at nearly lightspeed and stretch hundreds of thousands of light years across a galaxy.

WASM is at the center of an upcoming shift in web development, but there is still much about that shift that remains a mystery. Some believe Rust, as an early mover, and with zero-cost abstractions is well-positioned to invest in bytecode that spins up on the event loop. It may be possible for Rust to power the fastest applications on the web, becoming highly visible across the frontend ecosystem for years to come.

Oh, and black hole's form from the collapse of a core of iron.. you know, the only element that rusts.


Everything is experimental, half-baked, full of caveats, regularly broken, and subject to change. But some basic principles are beginning to emerge. With Quasar...

  • your component and state types propogate into event handlers (no need to guess the type or structure of state).
  • mutating state updates views that rely on that state (unless you update your state via interior mutability)
  • bring your own templating engine and reuse it for server rendering (though quasar will provide a default OOB engine - TBD)

How it works

Currently, Quasar combines some basic JQuery-like semantics with state and component management while ensuring that state modifications trigger rerendering of components that depend on that data.

  • Template engines are swappable. There are examples using bart, mustache and maud. But replacing the template engine is just a matter of implementing the Renderable trait.
  • Components are the combination of data with a template or other rendering process - really anything that implements Renderable. Quasar takes ownership of your components when binding them to the DOM and makes the data available to your event handlers via data() and data_mut() methods. In general, methods that mutate the component will result in re-rendering it at the end of the event handler. Note, component data is local to the component and not shareable outside your component.
  • Views are the result of one-way binding of a component to the DOM. You can also attach event listeners to views. Note, that currently rendering a view uses the destructive innerHtml = ... approach, which kills DOM state like input focus, so eventually some sort of DOM diffing/patching or virtual DOM solution will become pretty important.
  • App Data is shared state that is also available to event handlers. It is partitioned by a key (and by TypeId), and any attempt to read a shared data partition (calling data(key)) automatically registers your view as an observer of that data partion. Any attempt to write to an app data partition (calling data_mut(key)) will automatically add all observer views for that data partition to the re-render queue process at the end of the event handler.

A basic example might include an HTML file like this:

<html>
  <body>
    <div id="counter"></div>
  </body>
</html>

You can bind and update data with a snippet like this:

#[derive(Default, BartDisplay)]
#[template_string = "<p>Count: {{count}}</p><button>+1</button>"]
struct CounterData { count: u32 }

impl Component for CounterData {
    fn onload(view: &View<Self>) {
        view.on_each(EventType::Click, "button", |mut evt| {
              evt.binding.data_mut().count += 1;
        });
    }
}

fn main() {
    let mut app = quasar::init();
    app.bind("#counter", CounterData::default());
    app.spin();
}

And every such framework needs a To Do app; Quasar has two: Mustache To Do, and Maud To Do.

Goals

Quasar is still exploring some ideas and working to better understand what works and what's missing in webplatform. Here are some overarching questions that are guiding this experimentation right now:

  • Can Quasar achieve a level of abstractions that feel comparable to modern Javascript frameworks? (Probably with the help of macros eventually after some dust settles.)
  • What might it look like to have "isomorphic" rust, where the same rendering code can run both client and server side?
  • How can I leverage the type system to achieve more flexible and/or more robust frontend development? (e.g. trait-based templating, leveraging immutable vs mutable access as a gate for identifying views that observer or mutate specific data.)

Admittedly Quasar is absent any perf goals at this time.

Building

You'll need emscripten setup and activated (see brson's post), and then to add a couple compilation targets:

rustup target add asmjs-unknown-emscripten
rustup target add wasm32-unknown-emscripten

Now you can build quasar with:

cargo build --target=asmjs-unknown-emscripten

# or using cargo-web
cargo install cargo-web
cargo-web build

And you can run the various examples by running cargo-web start from their directory:

cd www
cargo-web start
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].