-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
118 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,53 @@ | ||
//! A tiny framework around a **virtual DOM** library, compiles to WebAssembly, runs in the browser, declarative UI for building interactive web apps. | ||
//! Tiny **virtual DOM** library, compiles to WebAssembly, runs in browser, building interactive web apps with declarative code. | ||
//! | ||
//! Original design was [Respo.cljs](http://respo-mvc.org/), which is heavily influenced by React.js and ClojureScript. | ||
//! This module is experimental since WebAssembly lacks of hot reloading. | ||
//! This library is experimental, heavily influenced by React.js and ClojureScript. | ||
//! Previously implementeded in [ClojureScript](https://github.com/Respo/respo.cljs) and [Calcit](https://github.com/Respo/respo.calcit). | ||
//! | ||
//! It features: | ||
//!  | ||
//! | ||
//! - virtual DOM(however simplified in list diffing) | ||
//! - components declaration with functions | ||
//! - globals states with Store and Actions dispatching | ||
//! - states tree with nested states(inherited from Respo.cljs , might be strange) | ||
//! - CSS with Rust macros | ||
//! - basic component effects of `Mounted, WillUpdate, Updated, WillUnmount` | ||
//! - okay to [memoize](https://crates.io/crates/memoize) component functions | ||
//! To build UI: | ||
//! | ||
//! Meanwhile it does not include features like: | ||
//! - there's Virtual DOM, although simplified, still flexible for declarative UI | ||
//! - CSS with Rust macros, I call it "CSS in Rust" | ||
//! - Effects, flow from data to DOM, for patching DOM manually on data change | ||
//! - `respo::ui` provides basic style. Also try Modal, dialog, drawer components. | ||
//! | ||
//! - ❌ macros for JSX syntax. Respo prefer types over tags | ||
//! - ❌ updating component states in lifecycle. Respo enforces "unidirectional data flow" | ||
//! - ❌ React-like hooks. Respo uses plain functions without tricky internal states | ||
//! - ❌ Hot swapping. Respo.rs reload on edit and loads previous states from local storage. | ||
//! To manage states: | ||
//! | ||
//! - Rust enum and pattern matching it really nice for Elm-style action dispatching | ||
//! - global states tree and cursor to maintain states, may not be familiar but still being handy | ||
//! - you may also write shared component like a "plugin" to manage states. | ||
//! | ||
//! To optimize: | ||
//! | ||
//! - components and elements are in functions, available for [memoize](https://crates.io/crates/memoize) | ||
//! - well, it's Rust, you can do more... | ||
//! | ||
//! Meanwhile it does not support React features such as: | ||
//! | ||
//! - ❌ updating data from render. Respo enforces "unidirectional data flow". That's not allowed | ||
//! - ❌ hooks API and context. Respo uses plain functions without tricky internal states | ||
//! - ...does not have many other advanced features from React | ||
//! | ||
//! Rust and WebAssembly lacks tricks for hot reloading, | ||
//! it's suggested to use [trunk](https://github.com/trunk-rs/trunk) to edit and reload the project during development. | ||
//! App states including components states can be saved to local storage and reloaded. | ||
//! | ||
//! To start project, create your structs to implement traits: | ||
//! | ||
//! - `RespoStore` for global states and states tree, and `RespoAction` for updating | ||
//! - `RespoApp` for MVC overview of the app, and more views, bind events | ||
//! | ||
//! say app is called `app`, you start app with `app.render_loop()`. | ||
//! Check [Workflow](https://github.com/Respo/respo-rust-workflow/tree/c7cc0c0/src) for a working example. | ||
mod app; | ||
pub mod states_tree; | ||
|
||
pub(crate) mod node; | ||
pub mod ui; | ||
|
||
pub use node::css::*; | ||
pub use node::element::alias::*; | ||
pub use node::*; | ||
|
||
pub use app::renderer::*; | ||
|
||
pub use app::{util, RespoApp, RespoStore}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters