1
1
# squark
2
2
3
- [ ![ crates.io] ( https://img.shields.io/crates/v/squark.svg )] ( https://crates.io/crates/squark )
4
- [ ![ docs.rs] ( https://docs.rs/squark/badge.svg )] ( https://docs.rs/squark/*/squark/ )
3
+ Rust frontend framework, for web browser and more.
4
+
5
+ ** Currently, we depend on ` nightly ` channel**
6
+
7
+ ## Design
8
+
9
+ * Separating runtime definition and implemention
10
+ + ` squark ` crate has no dependency for specific platform
11
+ * Architecture inspired from [ Elm] ( https://elm-lang.org/ ) and [ HyperApp] ( https://github.com/hyperapp/hyperapp/ )
12
+ + Simplicy
13
+ + Elegant
14
+ * Supporting futures-0.1
15
+ + reducer can emit task for async work such as fetch resource
5
16
6
- Virtual DOM implemention and definitions of Application and Runtime.
17
+ ## crates
7
18
8
- ## Fertures
19
+ ### squark
9
20
10
- This repository includes
21
+ [ ![ crates.io] ( https://img.shields.io/crates/v/squark.svg )] ( https://crates.io/crates/squark )
22
+ [ ![ docs.rs] ( https://docs.rs/squark/badge.svg )] ( https://docs.rs/squark/*/squark/ )
23
+
24
+ Core crate.
11
25
12
26
* Pure Rust virtual DOM implemention
13
- * Definition of application inspired from [ HyperApp ] ( https://github.com/hyperapp/hyperapp/ )
27
+ * Definition of GUI application
14
28
* Definition of runtime to handle diffirence of virtual DOM
15
- * Runtime implementions for several platforms
16
- * For web browser by using [ wasm-bindgen] ( https://github.com/rustwasm/wasm-bindgen )
17
- + Server side rendering within Rustic world * (now working)*
18
- * Macros like a JSX to help writing view
19
29
20
- ** Currently, we depend on ` nightly ` channel**
21
-
22
- ## squark-macros
30
+ ### squark-macros
23
31
24
32
[ ![ crates.io] ( https://img.shields.io/crates/v/squark-macros.svg )] ( https://crates.io/crates/squark-macros )
25
33
[ ![ docs.rs] ( https://docs.rs/squark-macros/badge.svg )] ( https://docs.rs/squark-macros/*/squark_macros/ )
26
34
27
- Crate that providing JSX like macro by ` proc_marco ` and [ pest] ( https://github.com/pest-parser/pest ) parser.
35
+ It provides macro like JSX for helping writing view.
36
+ Very thanks to [ pest] ( https://github.com/pest-parser/pest ) parser.
28
37
29
- ### Syntax
38
+ #### Syntax
30
39
31
40
```
32
41
view! {
@@ -38,7 +47,8 @@ view! {
38
47
39
48
We can generate native Rust expression at compile-time.
40
49
41
- ## squark-web
50
+
51
+ ### squark-web
42
52
43
53
[ ![ crates.io] ( https://img.shields.io/crates/v/squark-web.svg )] ( https://crates.io/crates/squark-web )
44
54
[ ![ docs.rs] ( https://docs.rs/squark-web/badge.svg )] ( https://docs.rs/squark-web/*/squark_web/ )
@@ -56,7 +66,7 @@ extern crate squark_web;
56
66
extern crate wasm_bindgen;
57
67
extern crate web_sys;
58
68
59
- use squark :: {App , Runtime , View };
69
+ use squark :: {App , Runtime , View , Task };
60
70
use squark_macros :: view;
61
71
use squark_web :: WebRuntime ;
62
72
use wasm_bindgen :: prelude :: * ;
@@ -84,13 +94,13 @@ impl App for CounterApp {
84
94
type State = State ;
85
95
type Action = Action ;
86
96
87
- fn reducer (& self , mut state : State , action : Action ) -> State {
97
+ fn reducer (& self , mut state : State , action : Action ) -> ( State , Task < Action >) {
88
98
match action {
89
99
Action :: ChangeCount (c ) => {
90
100
state . count = c ;
91
101
}
92
102
};
93
- state
103
+ ( state , Task :: empty ())
94
104
}
95
105
96
106
fn view (& self , state : State ) -> View <Action > {
@@ -133,4 +143,5 @@ pub fn run() {
133
143
134
144
Project dir is located at [ examples/counter] ( ./examples/counter ) .
135
145
136
- There is also available TodoMVC example at [ examples/todomvc] ( ./examples/todomvc ) and working on [ https://rail44.github.io/squark/ ] ( https://rail44.github.io/squark/ ) .
146
+ There are some other examples available on [ examples] ( ./examples ) , most of them use [ rust-webpack-template] ( https://github.com/rustwasm/rust-webpack-template ) .
147
+ TodoMVC is working on [ https://rail44.github.io/squark/ ] ( https://rail44.github.io/squark/ ) .
0 commit comments