"#);
80 | set_html(&self.element, r#"Richard"#);
81 | }
82 | }
83 | ```
84 |
85 | See demo [here](https://richardanaya.github.io/webcomponent/examples/shadowdom/)
86 |
87 | # Observable Attributes
88 |
89 | ```rust
90 | struct HelloPerson {
91 | element: HTMLElement
92 | }
93 |
94 | impl CustomElement for HelloPerson {
95 | fn new(element: HTMLElement) -> Self {
96 | HelloPerson(element)
97 | }
98 |
99 | fn observed_attributes() -> Vec<&'static str> {
100 | vec!["first_name"]
101 | }
102 |
103 | fn connected(&mut self) {
104 | self.render();
105 | }
106 |
107 | fn attribute_changed(&mut self, _name: String, _old_value: Option, _new_value: Option) {
108 | self.render();
109 | }
110 | }
111 |
112 | impl HelloPerson {
113 | fn render(&mut self){
114 | let first_name = get_attribute(&self.element, "first_name").unwrap_or("human".to_string());
115 | let msg = "Hello ".to_string() + &first_name;
116 | set_html(&self.element, &msg);
117 | }
118 | }
119 | ```
120 |
121 | See demo [here](https://richardanaya.github.io/webcomponent/examples/observable_attributes/)
122 |
123 | # What about the rest of Javscript?
124 |
125 | With `webcomponent` you have a handle to an html element, this is simply a reference to your component that exists in the DOM. With it we can use [`js_ffi`](https://github.com/richardanaya/js_ffi) ( or any [`js_ffi` based library](https://github.com/richardanaya/js_ffi#standard-web-libraries) ) to do whatever we want to do.
126 |
127 | ```rust
128 | use webcomponent::*;
129 | use js_ffi::*;
130 |
131 | struct LoudButton {
132 | element: HTMLElement
133 | }
134 |
135 | impl CustomElement for LoudButton {
136 | fn new(element:HTMLElement) -> Self {
137 | LoudButton(element)
138 | }
139 | fn connected(&mut self){
140 | set_html(&self.element,r#""#);
141 | js!(Node.prototype.addEventListener).call_2(
142 | &self.element,
143 | "click",
144 | create_callback_0(|| {
145 | js!(window.alert).invoke_1("I was clicked!");
146 | }),
147 | );
148 | }
149 | }
150 | ```
151 |
152 | # License
153 |
154 | This project is licensed under either of
155 |
156 | * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
157 | http://www.apache.org/licenses/LICENSE-2.0)
158 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or
159 | http://opensource.org/licenses/MIT)
160 |
161 | at your option.
162 |
163 | ### Contribution
164 |
165 | Unless you explicitly state otherwise, any contribution intentionally submitted
166 | for inclusion in `webcomponent` by you, as defined in the Apache-2.0 license, shall be
167 | dual licensed as above, without any additional terms or conditions.
168 |
169 |
--------------------------------------------------------------------------------
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | [[package]]
4 | name = "anystring"
5 | version = "0.0.2"
6 | source = "registry+https://github.com/rust-lang/crates.io-index"
7 | dependencies = [
8 | "anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
9 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
10 | ]
11 |
12 | [[package]]
13 | name = "anystring_macro"
14 | version = "0.0.1"
15 | source = "registry+https://github.com/rust-lang/crates.io-index"
16 | dependencies = [
17 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
18 | ]
19 |
20 | [[package]]
21 | name = "cstring"
22 | version = "0.0.4"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | dependencies = [
25 | "cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
26 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
27 | ]
28 |
29 | [[package]]
30 | name = "cty"
31 | version = "0.2.1"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 |
34 | [[package]]
35 | name = "globals"
36 | version = "1.0.1"
37 | source = "registry+https://github.com/rust-lang/crates.io-index"
38 | dependencies = [
39 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
40 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
41 | ]
42 |
43 | [[package]]
44 | name = "js_ffi"
45 | version = "0.6.8"
46 | source = "registry+https://github.com/rust-lang/crates.io-index"
47 | dependencies = [
48 | "anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
49 | "cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
50 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
51 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
52 | ]
53 |
54 | [[package]]
55 | name = "lazy_static"
56 | version = "1.4.0"
57 | source = "registry+https://github.com/rust-lang/crates.io-index"
58 | dependencies = [
59 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
60 | ]
61 |
62 | [[package]]
63 | name = "memchr"
64 | version = "2.2.1"
65 | source = "registry+https://github.com/rust-lang/crates.io-index"
66 |
67 | [[package]]
68 | name = "proc-macro-hack"
69 | version = "0.5.11"
70 | source = "registry+https://github.com/rust-lang/crates.io-index"
71 | dependencies = [
72 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
73 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
74 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
75 | ]
76 |
77 | [[package]]
78 | name = "proc-macro2"
79 | version = "1.0.6"
80 | source = "registry+https://github.com/rust-lang/crates.io-index"
81 | dependencies = [
82 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
83 | ]
84 |
85 | [[package]]
86 | name = "quote"
87 | version = "1.0.2"
88 | source = "registry+https://github.com/rust-lang/crates.io-index"
89 | dependencies = [
90 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
91 | ]
92 |
93 | [[package]]
94 | name = "spin"
95 | version = "0.5.2"
96 | source = "registry+https://github.com/rust-lang/crates.io-index"
97 |
98 | [[package]]
99 | name = "syn"
100 | version = "1.0.11"
101 | source = "registry+https://github.com/rust-lang/crates.io-index"
102 | dependencies = [
103 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
104 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
105 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
106 | ]
107 |
108 | [[package]]
109 | name = "unicode-xid"
110 | version = "0.2.0"
111 | source = "registry+https://github.com/rust-lang/crates.io-index"
112 |
113 | [[package]]
114 | name = "webcomponent"
115 | version = "0.6.0"
116 | dependencies = [
117 | "globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
118 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
119 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
120 | ]
121 |
122 | [metadata]
123 | "checksum anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "273fdc712cfa78d37e882d7ead8985d33a9f671460ea17754bfec15c20bc0fa3"
124 | "checksum anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "017b7ab0dd69075acb48c5a697748033218fdc40f2f10d3ad2e52600075f2bd0"
125 | "checksum cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f59de94c81f8ba8b78c997112fa1efdff7d52829e026ce2671bf6ad9b738a29f"
126 | "checksum cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3"
127 | "checksum globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c403f89ae945dabf67e74b6d8b533034035f08f045ce841d93bcf99c0d084b"
128 | "checksum js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "45e84b977eb8aa2e3d6a3e6ddde05e54721a3cb251b3bfb7ed87439e7a584340"
129 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
130 | "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
131 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
132 | "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
133 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
134 | "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
135 | "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
136 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
137 |
--------------------------------------------------------------------------------
/examples/helloworld/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | [[package]]
4 | name = "anystring"
5 | version = "0.0.2"
6 | source = "registry+https://github.com/rust-lang/crates.io-index"
7 | dependencies = [
8 | "anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
9 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
10 | ]
11 |
12 | [[package]]
13 | name = "anystring_macro"
14 | version = "0.0.1"
15 | source = "registry+https://github.com/rust-lang/crates.io-index"
16 | dependencies = [
17 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
18 | ]
19 |
20 | [[package]]
21 | name = "cstring"
22 | version = "0.0.4"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | dependencies = [
25 | "cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
26 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
27 | ]
28 |
29 | [[package]]
30 | name = "cty"
31 | version = "0.2.1"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 |
34 | [[package]]
35 | name = "example"
36 | version = "0.1.0"
37 | dependencies = [
38 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
39 | "webcomponent 0.5.2",
40 | ]
41 |
42 | [[package]]
43 | name = "globals"
44 | version = "1.0.1"
45 | source = "registry+https://github.com/rust-lang/crates.io-index"
46 | dependencies = [
47 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
48 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
49 | ]
50 |
51 | [[package]]
52 | name = "js_ffi"
53 | version = "0.6.8"
54 | source = "registry+https://github.com/rust-lang/crates.io-index"
55 | dependencies = [
56 | "anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
57 | "cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
58 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
59 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
60 | ]
61 |
62 | [[package]]
63 | name = "lazy_static"
64 | version = "1.4.0"
65 | source = "registry+https://github.com/rust-lang/crates.io-index"
66 | dependencies = [
67 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
68 | ]
69 |
70 | [[package]]
71 | name = "memchr"
72 | version = "2.2.1"
73 | source = "registry+https://github.com/rust-lang/crates.io-index"
74 |
75 | [[package]]
76 | name = "proc-macro-hack"
77 | version = "0.5.11"
78 | source = "registry+https://github.com/rust-lang/crates.io-index"
79 | dependencies = [
80 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
81 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
82 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
83 | ]
84 |
85 | [[package]]
86 | name = "proc-macro2"
87 | version = "1.0.6"
88 | source = "registry+https://github.com/rust-lang/crates.io-index"
89 | dependencies = [
90 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
91 | ]
92 |
93 | [[package]]
94 | name = "quote"
95 | version = "1.0.2"
96 | source = "registry+https://github.com/rust-lang/crates.io-index"
97 | dependencies = [
98 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
99 | ]
100 |
101 | [[package]]
102 | name = "spin"
103 | version = "0.5.2"
104 | source = "registry+https://github.com/rust-lang/crates.io-index"
105 |
106 | [[package]]
107 | name = "syn"
108 | version = "1.0.11"
109 | source = "registry+https://github.com/rust-lang/crates.io-index"
110 | dependencies = [
111 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
112 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
113 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
114 | ]
115 |
116 | [[package]]
117 | name = "unicode-xid"
118 | version = "0.2.0"
119 | source = "registry+https://github.com/rust-lang/crates.io-index"
120 |
121 | [[package]]
122 | name = "webcomponent"
123 | version = "0.5.2"
124 | dependencies = [
125 | "globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
126 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
127 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
128 | ]
129 |
130 | [metadata]
131 | "checksum anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "273fdc712cfa78d37e882d7ead8985d33a9f671460ea17754bfec15c20bc0fa3"
132 | "checksum anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "017b7ab0dd69075acb48c5a697748033218fdc40f2f10d3ad2e52600075f2bd0"
133 | "checksum cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f59de94c81f8ba8b78c997112fa1efdff7d52829e026ce2671bf6ad9b738a29f"
134 | "checksum cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3"
135 | "checksum globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c403f89ae945dabf67e74b6d8b533034035f08f045ce841d93bcf99c0d084b"
136 | "checksum js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "45e84b977eb8aa2e3d6a3e6ddde05e54721a3cb251b3bfb7ed87439e7a584340"
137 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
138 | "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
139 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
140 | "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
141 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
142 | "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
143 | "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
144 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
145 |
--------------------------------------------------------------------------------
/examples/shadowdom/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | [[package]]
4 | name = "anystring"
5 | version = "0.0.2"
6 | source = "registry+https://github.com/rust-lang/crates.io-index"
7 | dependencies = [
8 | "anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
9 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
10 | ]
11 |
12 | [[package]]
13 | name = "anystring_macro"
14 | version = "0.0.1"
15 | source = "registry+https://github.com/rust-lang/crates.io-index"
16 | dependencies = [
17 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
18 | ]
19 |
20 | [[package]]
21 | name = "cstring"
22 | version = "0.0.4"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | dependencies = [
25 | "cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
26 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
27 | ]
28 |
29 | [[package]]
30 | name = "cty"
31 | version = "0.2.1"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 |
34 | [[package]]
35 | name = "example"
36 | version = "0.1.0"
37 | dependencies = [
38 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
39 | "webcomponent 0.6.0",
40 | ]
41 |
42 | [[package]]
43 | name = "globals"
44 | version = "1.0.1"
45 | source = "registry+https://github.com/rust-lang/crates.io-index"
46 | dependencies = [
47 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
48 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
49 | ]
50 |
51 | [[package]]
52 | name = "js_ffi"
53 | version = "0.6.8"
54 | source = "registry+https://github.com/rust-lang/crates.io-index"
55 | dependencies = [
56 | "anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
57 | "cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
58 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
59 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
60 | ]
61 |
62 | [[package]]
63 | name = "lazy_static"
64 | version = "1.4.0"
65 | source = "registry+https://github.com/rust-lang/crates.io-index"
66 | dependencies = [
67 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
68 | ]
69 |
70 | [[package]]
71 | name = "memchr"
72 | version = "2.2.1"
73 | source = "registry+https://github.com/rust-lang/crates.io-index"
74 |
75 | [[package]]
76 | name = "proc-macro-hack"
77 | version = "0.5.11"
78 | source = "registry+https://github.com/rust-lang/crates.io-index"
79 | dependencies = [
80 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
81 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
82 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
83 | ]
84 |
85 | [[package]]
86 | name = "proc-macro2"
87 | version = "1.0.6"
88 | source = "registry+https://github.com/rust-lang/crates.io-index"
89 | dependencies = [
90 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
91 | ]
92 |
93 | [[package]]
94 | name = "quote"
95 | version = "1.0.2"
96 | source = "registry+https://github.com/rust-lang/crates.io-index"
97 | dependencies = [
98 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
99 | ]
100 |
101 | [[package]]
102 | name = "spin"
103 | version = "0.5.2"
104 | source = "registry+https://github.com/rust-lang/crates.io-index"
105 |
106 | [[package]]
107 | name = "syn"
108 | version = "1.0.11"
109 | source = "registry+https://github.com/rust-lang/crates.io-index"
110 | dependencies = [
111 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
112 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
113 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
114 | ]
115 |
116 | [[package]]
117 | name = "unicode-xid"
118 | version = "0.2.0"
119 | source = "registry+https://github.com/rust-lang/crates.io-index"
120 |
121 | [[package]]
122 | name = "webcomponent"
123 | version = "0.6.0"
124 | dependencies = [
125 | "globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
126 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
127 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
128 | ]
129 |
130 | [metadata]
131 | "checksum anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "273fdc712cfa78d37e882d7ead8985d33a9f671460ea17754bfec15c20bc0fa3"
132 | "checksum anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "017b7ab0dd69075acb48c5a697748033218fdc40f2f10d3ad2e52600075f2bd0"
133 | "checksum cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f59de94c81f8ba8b78c997112fa1efdff7d52829e026ce2671bf6ad9b738a29f"
134 | "checksum cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3"
135 | "checksum globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c403f89ae945dabf67e74b6d8b533034035f08f045ce841d93bcf99c0d084b"
136 | "checksum js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "45e84b977eb8aa2e3d6a3e6ddde05e54721a3cb251b3bfb7ed87439e7a584340"
137 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
138 | "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
139 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
140 | "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
141 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
142 | "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
143 | "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
144 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
145 |
--------------------------------------------------------------------------------
/src/lib.rs:
--------------------------------------------------------------------------------
1 | #![no_std]
2 | use js_ffi::*;
3 | #[macro_use]
4 | extern crate alloc;
5 | use alloc::string::String;
6 | use alloc::sync::Arc;
7 | use alloc::vec::Vec;
8 | use spin::Mutex;
9 |
10 | pub struct JSNoDrop(pub JSValue);
11 |
12 | pub type HTMLElement = js_ffi::JSObject;
13 |
14 | impl ToJSValue for JSNoDrop {
15 | #[inline]
16 | fn to_js_value(&self) -> JSValue {
17 | self.0
18 | }
19 |
20 | #[inline]
21 | fn to_js_type(&self) -> JSType {
22 | TYPE_OBJECT
23 | }
24 | }
25 |
26 | #[derive(Copy, Clone)]
27 | struct Destructable {
28 | function: Option,
29 | }
30 |
31 | pub trait CustomElement {
32 | fn new(element: JSObject) -> Self
33 | where
34 | Self: core::marker::Sized + core::marker::Sync + core::marker::Send + 'static;
35 | fn register(name: &str)
36 | where
37 | Self: core::marker::Sized + core::marker::Sync + core::marker::Send + 'static,
38 | {
39 | let construct = create_callback_1(|element| {
40 | let el = Arc::new(Mutex::new(Self::new(JSObject(element))));
41 | let el1 = el.clone();
42 | let el2 = el.clone();
43 | let el3 = el.clone();
44 |
45 | let destruct_connect = Arc::new(Mutex::new(Destructable { function: None }));
46 | let connect = create_callback_0(move || {
47 | el1.lock().connected();
48 | });
49 | destruct_connect.lock().function = Some(connect);
50 |
51 | let destruct_attribute_change = Arc::new(Mutex::new(Destructable { function: None }));
52 | let attribute_change = create_callback_3(move |name_obj, old_obj, new_obj| {
53 | let name = name_obj.as_string();
54 | let old = if old_obj.is_null() {
55 | None
56 | } else {
57 | Some(old_obj.as_string())
58 | };
59 | let new = if new_obj.is_null() {
60 | None
61 | } else {
62 | Some(new_obj.as_string())
63 | };
64 | el3.lock().attribute_changed(name, old, new);
65 | });
66 | destruct_attribute_change.lock().function = Some(connect);
67 |
68 | let destruct_disconnect = Arc::new(Mutex::new(Destructable { function: None }));
69 | let destruct_disconnect2 = destruct_disconnect.clone();
70 | let disconnect = create_callback_0(move || {
71 | el2.lock().disconnected();
72 | remove_callback(destruct_connect.lock().function.unwrap());
73 | remove_callback(destruct_disconnect.lock().function.unwrap());
74 | remove_callback(destruct_attribute_change.lock().function.unwrap());
75 | });
76 | destruct_disconnect2.lock().function = Some(disconnect);
77 |
78 | js!((e,a,b,c)=>{
79 | e.addHooks(a,b,c);
80 | })
81 | .invoke_4(JSNoDrop(element), connect, disconnect, attribute_change);
82 | });
83 | js!(
84 | (construct,elementName,attrNames)=>{
85 | let attrs = attrNames.split(",");
86 | class GeneratedCustomElement extends HTMLElement {
87 | constructor() {
88 | super();
89 | construct(this);
90 | }
91 |
92 | static get observedAttributes() {
93 | return attrs;
94 | }
95 |
96 | connectedCallback() {
97 | self.connect();
98 | }
99 |
100 | disconnectedCallback() {
101 | self.disconnect();
102 | }
103 |
104 | attributeChangedCallback(attributeName, oldValue, newValue) {
105 | self.attributeChange(attributeName,oldValue,newValue)
106 | }
107 |
108 | addHooks(connect,disconnect,attributeChange){
109 | self.connect = connect;
110 | self.disconnect = disconnect;
111 | self.attributeChange = attributeChange;
112 | }
113 | }
114 |
115 | // tell the dom to associate it with an html tag name
116 | customElements.define(elementName, GeneratedCustomElement);
117 | }
118 | )
119 | .invoke_3(construct, name, &Self::observed_attributes().join(","));
120 | }
121 |
122 | fn observed_attributes() -> Vec<&'static str> {
123 | vec![]
124 | }
125 |
126 | fn created(&mut self) {}
127 | fn connected(&mut self) {}
128 | fn disconnected(&mut self) {}
129 | fn attribute_changed(
130 | &mut self,
131 | _name: String,
132 | _old_value: Option,
133 | _new_value: Option,
134 | ) {
135 | }
136 | }
137 |
138 | pub fn attach_shadow(el: impl ToJSValue, open: bool) -> HTMLElement {
139 | let shadow_dom = globals::get::();
140 | shadow_dom.attach_shadow(el, open)
141 | }
142 |
143 | pub fn set_html(el: impl ToJSValue, html: &str) {
144 | let shadow_dom = globals::get::();
145 | shadow_dom.set_html(el, html);
146 | }
147 |
148 | pub fn get_attribute(el: impl ToJSValue, name: &str) -> Option {
149 | let shadow_dom = globals::get::();
150 | shadow_dom.get_attribute(el, name)
151 | }
152 |
153 | struct ShadowDom {
154 | fn_attach_shadow: JSInvoker,
155 | fn_set_html: JSInvoker,
156 | fn_get_attribute: JSInvoker,
157 | }
158 |
159 | impl Default for ShadowDom {
160 | fn default() -> Self {
161 | ShadowDom {
162 | fn_attach_shadow: js!((el,is_open)=> {
163 | el.attachShadow({mode:is_open?"open":"closed"});
164 | return el.shadowRoot;
165 | }),
166 | fn_set_html: js!((el,html)=>{
167 | el.innerHTML = html
168 | }),
169 | fn_get_attribute: js!((el,name)=>el.getAttribute(name)),
170 | }
171 | }
172 | }
173 |
174 | impl ShadowDom {
175 | pub fn attach_shadow(&self, el: impl ToJSValue, is_open: bool) -> HTMLElement {
176 | self.fn_attach_shadow.invoke_2(el, is_open).as_owned()
177 | }
178 |
179 | pub fn set_html(&self, el: impl ToJSValue, html: &str) {
180 | self.fn_set_html.invoke_2(el, html);
181 | }
182 |
183 | pub fn get_attribute(&self, el: impl ToJSValue, name: &str) -> Option {
184 | let result = self.fn_get_attribute.invoke_2(el, name);
185 | if result.is_null() {
186 | None
187 | } else {
188 | Some(result.as_string())
189 | }
190 | }
191 | }
192 |
--------------------------------------------------------------------------------
/examples/loudbutton/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | [[package]]
4 | name = "anystring"
5 | version = "0.0.2"
6 | source = "registry+https://github.com/rust-lang/crates.io-index"
7 | dependencies = [
8 | "anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
9 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
10 | ]
11 |
12 | [[package]]
13 | name = "anystring_macro"
14 | version = "0.0.1"
15 | source = "registry+https://github.com/rust-lang/crates.io-index"
16 | dependencies = [
17 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
18 | ]
19 |
20 | [[package]]
21 | name = "cstring"
22 | version = "0.0.4"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | dependencies = [
25 | "cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
26 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
27 | ]
28 |
29 | [[package]]
30 | name = "cty"
31 | version = "0.2.1"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 |
34 | [[package]]
35 | name = "example"
36 | version = "0.1.0"
37 | dependencies = [
38 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
39 | "webcomponent 0.5.1",
40 | ]
41 |
42 | [[package]]
43 | name = "globals"
44 | version = "1.0.1"
45 | source = "registry+https://github.com/rust-lang/crates.io-index"
46 | dependencies = [
47 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
48 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
49 | ]
50 |
51 | [[package]]
52 | name = "highlight"
53 | version = "0.0.3"
54 | source = "registry+https://github.com/rust-lang/crates.io-index"
55 | dependencies = [
56 | "anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
57 | ]
58 |
59 | [[package]]
60 | name = "js_ffi"
61 | version = "0.6.8"
62 | source = "registry+https://github.com/rust-lang/crates.io-index"
63 | dependencies = [
64 | "anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
65 | "cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
66 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
67 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
68 | ]
69 |
70 | [[package]]
71 | name = "lazy_static"
72 | version = "1.4.0"
73 | source = "registry+https://github.com/rust-lang/crates.io-index"
74 | dependencies = [
75 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
76 | ]
77 |
78 | [[package]]
79 | name = "memchr"
80 | version = "2.2.1"
81 | source = "registry+https://github.com/rust-lang/crates.io-index"
82 |
83 | [[package]]
84 | name = "proc-macro-hack"
85 | version = "0.5.11"
86 | source = "registry+https://github.com/rust-lang/crates.io-index"
87 | dependencies = [
88 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
89 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
90 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
91 | ]
92 |
93 | [[package]]
94 | name = "proc-macro2"
95 | version = "1.0.6"
96 | source = "registry+https://github.com/rust-lang/crates.io-index"
97 | dependencies = [
98 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
99 | ]
100 |
101 | [[package]]
102 | name = "quote"
103 | version = "1.0.2"
104 | source = "registry+https://github.com/rust-lang/crates.io-index"
105 | dependencies = [
106 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
107 | ]
108 |
109 | [[package]]
110 | name = "spin"
111 | version = "0.5.2"
112 | source = "registry+https://github.com/rust-lang/crates.io-index"
113 |
114 | [[package]]
115 | name = "syn"
116 | version = "1.0.11"
117 | source = "registry+https://github.com/rust-lang/crates.io-index"
118 | dependencies = [
119 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
120 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
121 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
122 | ]
123 |
124 | [[package]]
125 | name = "unicode-xid"
126 | version = "0.2.0"
127 | source = "registry+https://github.com/rust-lang/crates.io-index"
128 |
129 | [[package]]
130 | name = "webcomponent"
131 | version = "0.5.1"
132 | dependencies = [
133 | "globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
134 | "highlight 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
135 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
136 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
137 | ]
138 |
139 | [metadata]
140 | "checksum anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "273fdc712cfa78d37e882d7ead8985d33a9f671460ea17754bfec15c20bc0fa3"
141 | "checksum anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "017b7ab0dd69075acb48c5a697748033218fdc40f2f10d3ad2e52600075f2bd0"
142 | "checksum cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f59de94c81f8ba8b78c997112fa1efdff7d52829e026ce2671bf6ad9b738a29f"
143 | "checksum cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3"
144 | "checksum globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c403f89ae945dabf67e74b6d8b533034035f08f045ce841d93bcf99c0d084b"
145 | "checksum highlight 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b10592252fa144776e66dfba5e20c129b5220a327b1ca633cbd0538b481bf2"
146 | "checksum js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "45e84b977eb8aa2e3d6a3e6ddde05e54721a3cb251b3bfb7ed87439e7a584340"
147 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
148 | "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
149 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
150 | "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
151 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
152 | "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
153 | "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
154 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
155 |
--------------------------------------------------------------------------------
/examples/observable_attributes/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | [[package]]
4 | name = "anystring"
5 | version = "0.0.2"
6 | source = "registry+https://github.com/rust-lang/crates.io-index"
7 | dependencies = [
8 | "anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
9 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
10 | ]
11 |
12 | [[package]]
13 | name = "anystring_macro"
14 | version = "0.0.1"
15 | source = "registry+https://github.com/rust-lang/crates.io-index"
16 | dependencies = [
17 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
18 | ]
19 |
20 | [[package]]
21 | name = "cstring"
22 | version = "0.0.4"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | dependencies = [
25 | "cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
26 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
27 | ]
28 |
29 | [[package]]
30 | name = "cty"
31 | version = "0.2.1"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 |
34 | [[package]]
35 | name = "example"
36 | version = "0.1.0"
37 | dependencies = [
38 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
39 | "webcomponent 0.5.1",
40 | ]
41 |
42 | [[package]]
43 | name = "globals"
44 | version = "1.0.1"
45 | source = "registry+https://github.com/rust-lang/crates.io-index"
46 | dependencies = [
47 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
48 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
49 | ]
50 |
51 | [[package]]
52 | name = "highlight"
53 | version = "0.0.3"
54 | source = "registry+https://github.com/rust-lang/crates.io-index"
55 | dependencies = [
56 | "anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
57 | ]
58 |
59 | [[package]]
60 | name = "js_ffi"
61 | version = "0.6.8"
62 | source = "registry+https://github.com/rust-lang/crates.io-index"
63 | dependencies = [
64 | "anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
65 | "cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
66 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
67 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
68 | ]
69 |
70 | [[package]]
71 | name = "lazy_static"
72 | version = "1.4.0"
73 | source = "registry+https://github.com/rust-lang/crates.io-index"
74 | dependencies = [
75 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
76 | ]
77 |
78 | [[package]]
79 | name = "memchr"
80 | version = "2.2.1"
81 | source = "registry+https://github.com/rust-lang/crates.io-index"
82 |
83 | [[package]]
84 | name = "proc-macro-hack"
85 | version = "0.5.11"
86 | source = "registry+https://github.com/rust-lang/crates.io-index"
87 | dependencies = [
88 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
89 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
90 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
91 | ]
92 |
93 | [[package]]
94 | name = "proc-macro2"
95 | version = "1.0.6"
96 | source = "registry+https://github.com/rust-lang/crates.io-index"
97 | dependencies = [
98 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
99 | ]
100 |
101 | [[package]]
102 | name = "quote"
103 | version = "1.0.2"
104 | source = "registry+https://github.com/rust-lang/crates.io-index"
105 | dependencies = [
106 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
107 | ]
108 |
109 | [[package]]
110 | name = "spin"
111 | version = "0.5.2"
112 | source = "registry+https://github.com/rust-lang/crates.io-index"
113 |
114 | [[package]]
115 | name = "syn"
116 | version = "1.0.11"
117 | source = "registry+https://github.com/rust-lang/crates.io-index"
118 | dependencies = [
119 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
120 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
121 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
122 | ]
123 |
124 | [[package]]
125 | name = "unicode-xid"
126 | version = "0.2.0"
127 | source = "registry+https://github.com/rust-lang/crates.io-index"
128 |
129 | [[package]]
130 | name = "webcomponent"
131 | version = "0.5.1"
132 | dependencies = [
133 | "globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
134 | "highlight 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
135 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
136 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
137 | ]
138 |
139 | [metadata]
140 | "checksum anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "273fdc712cfa78d37e882d7ead8985d33a9f671460ea17754bfec15c20bc0fa3"
141 | "checksum anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "017b7ab0dd69075acb48c5a697748033218fdc40f2f10d3ad2e52600075f2bd0"
142 | "checksum cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f59de94c81f8ba8b78c997112fa1efdff7d52829e026ce2671bf6ad9b738a29f"
143 | "checksum cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3"
144 | "checksum globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c403f89ae945dabf67e74b6d8b533034035f08f045ce841d93bcf99c0d084b"
145 | "checksum highlight 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b10592252fa144776e66dfba5e20c129b5220a327b1ca633cbd0538b481bf2"
146 | "checksum js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "45e84b977eb8aa2e3d6a3e6ddde05e54721a3cb251b3bfb7ed87439e7a584340"
147 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
148 | "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
149 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
150 | "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
151 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
152 | "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
153 | "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
154 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
155 |
--------------------------------------------------------------------------------
/examples/todo/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | [[package]]
4 | name = "anystring"
5 | version = "0.0.2"
6 | source = "registry+https://github.com/rust-lang/crates.io-index"
7 | dependencies = [
8 | "anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
9 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
10 | ]
11 |
12 | [[package]]
13 | name = "anystring_macro"
14 | version = "0.0.1"
15 | source = "registry+https://github.com/rust-lang/crates.io-index"
16 | dependencies = [
17 | "proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)",
18 | ]
19 |
20 | [[package]]
21 | name = "cstring"
22 | version = "0.0.4"
23 | source = "registry+https://github.com/rust-lang/crates.io-index"
24 | dependencies = [
25 | "cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
26 | "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
27 | ]
28 |
29 | [[package]]
30 | name = "cty"
31 | version = "0.2.1"
32 | source = "registry+https://github.com/rust-lang/crates.io-index"
33 |
34 | [[package]]
35 | name = "example"
36 | version = "0.1.0"
37 | dependencies = [
38 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
39 | "web_console 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
40 | "webcomponent 0.5.2",
41 | ]
42 |
43 | [[package]]
44 | name = "globals"
45 | version = "1.0.1"
46 | source = "registry+https://github.com/rust-lang/crates.io-index"
47 | dependencies = [
48 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
49 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
50 | ]
51 |
52 | [[package]]
53 | name = "js_ffi"
54 | version = "0.6.8"
55 | source = "registry+https://github.com/rust-lang/crates.io-index"
56 | dependencies = [
57 | "anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
58 | "cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
59 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
60 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
61 | ]
62 |
63 | [[package]]
64 | name = "lazy_static"
65 | version = "1.4.0"
66 | source = "registry+https://github.com/rust-lang/crates.io-index"
67 | dependencies = [
68 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
69 | ]
70 |
71 | [[package]]
72 | name = "memchr"
73 | version = "2.2.1"
74 | source = "registry+https://github.com/rust-lang/crates.io-index"
75 |
76 | [[package]]
77 | name = "proc-macro-hack"
78 | version = "0.5.11"
79 | source = "registry+https://github.com/rust-lang/crates.io-index"
80 | dependencies = [
81 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
82 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
83 | "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
84 | ]
85 |
86 | [[package]]
87 | name = "proc-macro2"
88 | version = "1.0.6"
89 | source = "registry+https://github.com/rust-lang/crates.io-index"
90 | dependencies = [
91 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
92 | ]
93 |
94 | [[package]]
95 | name = "quote"
96 | version = "1.0.2"
97 | source = "registry+https://github.com/rust-lang/crates.io-index"
98 | dependencies = [
99 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
100 | ]
101 |
102 | [[package]]
103 | name = "spin"
104 | version = "0.5.2"
105 | source = "registry+https://github.com/rust-lang/crates.io-index"
106 |
107 | [[package]]
108 | name = "syn"
109 | version = "1.0.11"
110 | source = "registry+https://github.com/rust-lang/crates.io-index"
111 | dependencies = [
112 | "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
113 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
114 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
115 | ]
116 |
117 | [[package]]
118 | name = "unicode-xid"
119 | version = "0.2.0"
120 | source = "registry+https://github.com/rust-lang/crates.io-index"
121 |
122 | [[package]]
123 | name = "web_console"
124 | version = "0.1.0"
125 | source = "registry+https://github.com/rust-lang/crates.io-index"
126 | dependencies = [
127 | "globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
128 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
129 | ]
130 |
131 | [[package]]
132 | name = "webcomponent"
133 | version = "0.5.2"
134 | dependencies = [
135 | "globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
136 | "js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
137 | "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
138 | ]
139 |
140 | [metadata]
141 | "checksum anystring 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "273fdc712cfa78d37e882d7ead8985d33a9f671460ea17754bfec15c20bc0fa3"
142 | "checksum anystring_macro 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "017b7ab0dd69075acb48c5a697748033218fdc40f2f10d3ad2e52600075f2bd0"
143 | "checksum cstring 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f59de94c81f8ba8b78c997112fa1efdff7d52829e026ce2671bf6ad9b738a29f"
144 | "checksum cty 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7313c0d620d0cb4dbd9d019e461a4beb501071ff46ec0ab933efb4daa76d73e3"
145 | "checksum globals 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c403f89ae945dabf67e74b6d8b533034035f08f045ce841d93bcf99c0d084b"
146 | "checksum js_ffi 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "45e84b977eb8aa2e3d6a3e6ddde05e54721a3cb251b3bfb7ed87439e7a584340"
147 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
148 | "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
149 | "checksum proc-macro-hack 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd45702f76d6d3c75a80564378ae228a85f0b59d2f3ed43c91b4a69eb2ebfc5"
150 | "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
151 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
152 | "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
153 | "checksum syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
154 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
155 | "checksum web_console 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17921325446de72db239a1ab930a12d51ed39af1d054dd97064fded500316206"
156 |
--------------------------------------------------------------------------------
/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright (c) 2019 Richard Anaya
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
--------------------------------------------------------------------------------
/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright (c) 2019 Richard Anaya
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
--------------------------------------------------------------------------------