diff --git a/README.md b/README.md index 1373cc9..848aa8c 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Each component is splited in two parts, the logical yew component and its sass m however, it is not necessary to worry about the sass module only it needs to be include in the project ### How install it 1. Install the sass module: `npm install yew-styles` -2. Add the yew_style crate in Cargo.toml file: `yew_styles = "0.3.0"` +2. Add the yew_style crate in Cargo.toml file: `yew_styles = "0.3.1"` 3. Import the main.css file in you main javascript/typescript file project: ```typescript import 'node_modules/yew-styles/main.css'; diff --git a/app/index.ts b/app/index.ts index 5cc719b..01c2b8e 100644 --- a/app/index.ts +++ b/app/index.ts @@ -1,7 +1,5 @@ import './yew-styles/main.sass'; import './page-styles/main.sass'; +import 'prismjs'; import 'prismjs/themes/prism.css'; import 'prismjs/components/prism-rust'; - -import module from '../crate/Cargo.toml'; -module.run(); diff --git a/crate/Cargo.lock b/crate/Cargo.lock index 497a597..f6dc717 100644 --- a/crate/Cargo.lock +++ b/crate/Cargo.lock @@ -761,7 +761,7 @@ dependencies = [ [[package]] name = "yew" -version = "0.15.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "anyhow 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -790,12 +790,12 @@ dependencies = [ "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-futures 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.36 (registry+https://github.com/rust-lang/crates.io-index)", - "yew-macro 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew-macro 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "yew-macro" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -808,7 +808,7 @@ dependencies = [ [[package]] name = "yew-router" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -821,25 +821,25 @@ dependencies = [ "serde_json 1.0.48 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.36 (registry+https://github.com/rust-lang/crates.io-index)", - "yew 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "yew-router-macro 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "yew-router-route-parser 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", + "yew-router-macro 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew-router-route-parser 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "yew-router-macro" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)", - "yew-router-route-parser 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew-router-route-parser 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "yew-router-route-parser" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -847,18 +847,17 @@ dependencies = [ [[package]] name = "yew_prism" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-test 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.36 (registry+https://github.com/rust-lang/crates.io-index)", - "yew 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "yew_style_page" -version = "0.3.0" +version = "0.3.1" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -869,22 +868,22 @@ dependencies = [ "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.36 (registry+https://github.com/rust-lang/crates.io-index)", "wee_alloc 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "yew 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "yew-router 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", - "yew_prism 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "yew_styles 0.3.0", + "yew 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", + "yew-router 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew_prism 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew_styles 0.3.1", ] [[package]] name = "yew_styles" -version = "0.3.0" +version = "0.3.1" dependencies = [ "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-test 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.36 (registry+https://github.com/rust-lang/crates.io-index)", - "yew 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] @@ -985,9 +984,9 @@ dependencies = [ "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" -"checksum yew 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7532a83ec6c2173cd72888bb3ac0e3656d0dd152476f71631f4b465481855391" -"checksum yew-macro 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28cf0535e956932124a66721a0f91a1f65a1654ab509c43c3b5d71eb10f20089" -"checksum yew-router 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30c14c320554af8f6c9412606daca46e9fdac686b6be6f3563e7f4073c628f8e" -"checksum yew-router-macro 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "88820ce667e8b1b17750c2294e69dc93932bdcfd76a7fec5b7b573131f3421c1" -"checksum yew-router-route-parser 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c4708315d2325182b9c3d8c9805e4f5293baf6e6103f9cd4f989ddedca192a" -"checksum yew_prism 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "18729acde7cdb3dea9acb4ef2e3610035f69c2795d0172f8def81718a85199de" +"checksum yew 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fc1e1b60b090bf29758c6c42da2d2d6d54aa97dc73e3ccd1cd99d664b4c754cf" +"checksum yew-macro 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d2fe46d7922ecd99af4e5b4eddcab58c70ec741e31de6e1b910d5873a3095f" +"checksum yew-router 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c2d29986e07f8aab66507dd659f826062fb5ca434387cc44d4574a116ac52712" +"checksum yew-router-macro 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a8b72c6e6b40c5180e5b0fff9f5a9e67937f662c595cad87301fc480e50e347" +"checksum yew-router-route-parser 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9662dbe5f703fa5458cba3a7a000faf232dc124214f9c33e06d05d50805fd9ca" +"checksum yew_prism 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aefe5d5eadbcbbbbb1dce3eaf80549f0aced3285107e8ec56804f5eec160a6c5" diff --git a/crate/Cargo.toml b/crate/Cargo.toml index afd438e..bf81dbb 100644 --- a/crate/Cargo.toml +++ b/crate/Cargo.toml @@ -1,12 +1,12 @@ [package] -authors = ["The RustWasm Developers"] +authors = ["Francisco Jesus Navarro Cortes"] categories = ["wasm"] description = "My awesome Yew with Yew-Router and Parcel application!" license = "MIT" name = "yew_style_page" readme = "./README.md" repository = "https://github.com/spielrs/yew-styles-page.git" -version = "0.3.0" +version = "0.3.1" [lib] crate-type = ["cdylib"] @@ -20,8 +20,8 @@ serde = "1.0" serde_derive = "1.0" dotenv = "0.15" failure = "0.1" -yew = { version="0.15", features = ["toml", "yaml", "msgpack", "cbor", "web_sys"]} -yew-router = {version="0.12", features = ["web_sys"] } +yew = { version="0.16", features = ["toml", "yaml", "msgpack", "cbor", "web_sys"]} +yew-router = {version="0.13", features = ["web_sys"] } web-sys = "0.3" -yew_prism = {version="0.2"} +yew_prism = {version="0.3"} yew_styles= {path= "./yew_styles"} diff --git a/crate/assets/spielrs_logo.png b/crate/assets/spielrs_logo.png new file mode 100644 index 0000000..c097952 Binary files /dev/null and b/crate/assets/spielrs_logo.png differ diff --git a/crate/src/page/navbar_page.rs b/crate/src/page/navbar_page.rs index f942589..0ea58ae 100644 --- a/crate/src/page/navbar_page.rs +++ b/crate/src/page/navbar_page.rs @@ -194,7 +194,7 @@ fn get_navbar_type( fixed=Fixed::None navbar_style=style.style.clone() navbar_type=navbar_type.navbar_type - branch=html!{} + branch=html!{} > {get_menus(link.clone(), navbar_type_rendered)} diff --git a/crate/yew_styles/.gitignore b/crate/yew_styles/.gitignore new file mode 100644 index 0000000..1de5659 --- /dev/null +++ b/crate/yew_styles/.gitignore @@ -0,0 +1 @@ +target \ No newline at end of file diff --git a/crate/yew_styles/Cargo.lock b/crate/yew_styles/Cargo.lock index c8b0c70..e8ebb50 100644 --- a/crate/yew_styles/Cargo.lock +++ b/crate/yew_styles/Cargo.lock @@ -60,7 +60,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -163,7 +163,7 @@ dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -190,7 +190,7 @@ name = "gloo-events" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -201,7 +201,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gloo-events 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -211,7 +211,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -248,7 +248,7 @@ name = "js-sys" version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -490,16 +490,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.60" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.60" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -508,7 +508,7 @@ dependencies = [ "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -518,34 +518,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.60" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.60" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.60" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -556,7 +556,7 @@ dependencies = [ "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-futures 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-test-macro 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -576,7 +576,7 @@ version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -589,7 +589,7 @@ dependencies = [ [[package]] name = "yew" -version = "0.15.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "anyhow 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", @@ -615,15 +615,15 @@ dependencies = [ "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-futures 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", - "yew-macro 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew-macro 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "yew-macro" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -636,14 +636,14 @@ dependencies = [ [[package]] name = "yew_styles" -version = "0.3.0" +version = "0.3.1" dependencies = [ "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-test 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", - "yew 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "yew 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] @@ -712,15 +712,15 @@ dependencies = [ "checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" -"checksum wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" +"checksum wasm-bindgen 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "e3c7d40d09cdbf0f4895ae58cf57d92e1e57a9dd8ed2e8390514b54a47cc5551" +"checksum wasm-bindgen-backend 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "c3972e137ebf830900db522d6c8fd74d1900dcfc733462e9a12e942b00b4ac94" "checksum wasm-bindgen-futures 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" -"checksum wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" -"checksum wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" -"checksum wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" +"checksum wasm-bindgen-macro 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd85aa2c579e8892442954685f0d801f9129de24fa2136b2c6a539c76b65776" +"checksum wasm-bindgen-macro-support 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "8eb197bd3a47553334907ffd2f16507b4f4f01bbec3ac921a7719e0decdfe72a" +"checksum wasm-bindgen-shared 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "a91c2916119c17a8e316507afaaa2dd94b47646048014bbdf6bef098c1bb58ad" "checksum wasm-bindgen-test 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)" = "648da3460c6d2aa04b715a936329e2e311180efe650b2127d6267f4193ccac14" "checksum wasm-bindgen-test-macro 0.3.10 (registry+https://github.com/rust-lang/crates.io-index)" = "cf2f86cd78a2aa7b1fb4bb6ed854eccb7f9263089c79542dca1576a1518a8467" "checksum web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" "checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" -"checksum yew 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7532a83ec6c2173cd72888bb3ac0e3656d0dd152476f71631f4b465481855391" -"checksum yew-macro 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28cf0535e956932124a66721a0f91a1f65a1654ab509c43c3b5d71eb10f20089" +"checksum yew 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fc1e1b60b090bf29758c6c42da2d2d6d54aa97dc73e3ccd1cd99d664b4c754cf" +"checksum yew-macro 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d2fe46d7922ecd99af4e5b4eddcab58c70ec741e31de6e1b910d5873a3095f" diff --git a/crate/yew_styles/Cargo.toml b/crate/yew_styles/Cargo.toml index 488c432..9d856a9 100644 --- a/crate/yew_styles/Cargo.toml +++ b/crate/yew_styles/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "yew_styles" -version = "0.3.0" +version = "0.3.1" description = "Framework styles for yew" -documentation = "https://docs.rs/crate/yew_styles/0.3.0" +documentation = "https://docs.rs/crate/yew_styles/0.3.1" authors = ["Francisco Jesus Navarro Cortes "] edition = "2018" license = "MIT" @@ -15,8 +15,8 @@ readme = "README.md" crate-type = ["cdylib", "rlib"] [dependencies] -wasm-bindgen = "0.2.60" -yew = { version="0.15", features = ["toml", "yaml", "msgpack", "cbor", "web_sys"] } +wasm-bindgen = "0.2" +yew = { version="0.16", features = ["toml", "yaml", "msgpack", "cbor", "web_sys"] } web-sys = {version = "0.3.36", features = ["HtmlDocument", "HtmlCollection", "CssStyleDeclaration", "HtmlElement", "Node"]} rand = {version="0.7", features = ["getrandom"]} getrandom = {version = "0.1", features= ["wasm-bindgen"]} diff --git a/crate/yew_styles/README.md b/crate/yew_styles/README.md index f52007b..38f636c 100644 --- a/crate/yew_styles/README.md +++ b/crate/yew_styles/README.md @@ -14,7 +14,7 @@ however, it is not necessary to worry about the sass module only it needs to be ### How install it 1. Install the sass module: `npm install yew-styles` -2. Add the yew_style crate in Cargo.toml file: `yew_styles = "0.3.0"` +2. Add the yew_style crate in Cargo.toml file: `yew_styles = "0.3.1"` 3. Import the main.css file in you main javascript/typescript file project: ```typescript import 'node_modules/yew-styles/main.css'; diff --git a/crate/yew_styles/src/components/button.rs b/crate/yew_styles/src/components/button.rs index 6e75030..c395b7d 100644 --- a/crate/yew_styles/src/components/button.rs +++ b/crate/yew_styles/src/components/button.rs @@ -2,6 +2,7 @@ use crate::styles::{get_pallete, get_style, Palette, Style}; use wasm_bindgen_test::*; use web_sys::window; use yew::prelude::*; +use yew::{utils, App}; /// The standard sizes for button #[derive(Clone)] @@ -206,14 +207,8 @@ fn should_trigger_action_when_button_clicked() { children: Children::new(vec![html! {}]), }; - let link = ComponentLink::new(); - - let mut button = Button::create(props.clone(), link); - props.onsignal.emit(()); - button.change(props); - let updated_content = window() .unwrap() .document() @@ -228,49 +223,28 @@ fn should_trigger_action_when_button_clicked() { #[wasm_bindgen_test] fn should_create_button_component() { - let on_add_child = Callback::from(|_| { - let body = window().unwrap().document().unwrap().body().unwrap(); - - let child_element = window() - .unwrap() - .document() - .unwrap() - .create_element("div") - .unwrap(); - - child_element.set_text_content(Some("child")); - child_element.set_id("child"); - body.append_child(&child_element).unwrap(); - }); - let props = Props { class_name: String::from("test-button"), size: Size::Medium, button_style: Style::Regular, - onsignal: on_add_child, + onsignal: Callback::noop(), button_type: Palette::Standard, - children: Children::new(vec![html! {
{"parent"}
}]), + children: Children::new(vec![html! {
{"result"}
}]), }; - let link = ComponentLink::new(); - - let mut button = Button::create(props.clone(), link.clone()); - - props.onsignal.emit(()); - - button.change(props); + let button: App - }; + let child = button_element.first_element_child().unwrap(); - assert_eq!(button_vnode, vnode_expected); + assert_eq!(button_element.tag_name(), "BUTTON"); + assert_eq!(child.id(), "result"); } diff --git a/crate/yew_styles/src/components/layouts/container.rs b/crate/yew_styles/src/components/layouts/container.rs index 5a17d68..41103e2 100644 --- a/crate/yew_styles/src/components/layouts/container.rs +++ b/crate/yew_styles/src/components/layouts/container.rs @@ -1,6 +1,7 @@ use crate::utils::{create_style, get_random_string}; use wasm_bindgen_test::*; use yew::prelude::*; +use yew::{utils, App}; /// # Container component /// @@ -319,19 +320,16 @@ fn should_create_a_container() { }]), }; - let link = ComponentLink::new(); + let container: App = App::new(); + container.mount_with_props( + utils::document().get_element_by_id("output").unwrap(), + props_container, + ); - let container = Container::create(props_container, link); + let container_element = utils::document().get_element_by_id("container").unwrap(); - let container_vnode = container.render(); - - let vnode_expected = html! { -
- <> -
{"Container"}
- -
- }; - - assert_eq!(container_vnode, vnode_expected); + assert_eq!( + container_element.text_content().unwrap(), + "Container".to_string() + ); } diff --git a/crate/yew_styles/src/components/layouts/item.rs b/crate/yew_styles/src/components/layouts/item.rs index dd5536f..d2df9bc 100644 --- a/crate/yew_styles/src/components/layouts/item.rs +++ b/crate/yew_styles/src/components/layouts/item.rs @@ -2,6 +2,7 @@ use crate::utils::{create_style, get_random_string}; use wasm_bindgen_test::*; use web_sys::window; use yew::prelude::*; +use yew::{utils, App}; /// Percent of the layout that will take the item. #[derive(Clone)] @@ -224,23 +225,16 @@ fn should_create_item() { }]), }; - let link = ComponentLink::new(); + let item: App = App::new(); - let item = Item::create(props_item, link); + item.mount_with_props( + utils::document().get_element_by_id("output").unwrap(), + props_item, + ); - let item_vnode = item.render(); + let item_element = utils::document().get_element_by_id("item").unwrap(); - let vnode_expected = html! { -
- <> -
{"Item"}
- -
- }; - - assert_eq!(item_vnode, vnode_expected); + assert_eq!(item_element.text_content().unwrap(), "Item".to_string()); } #[wasm_bindgen_test] diff --git a/crate/yew_styles/src/components/navbar/navbar_item.rs b/crate/yew_styles/src/components/navbar/navbar_item.rs index f17d077..5caa8a1 100644 --- a/crate/yew_styles/src/components/navbar/navbar_item.rs +++ b/crate/yew_styles/src/components/navbar/navbar_item.rs @@ -1,6 +1,7 @@ use wasm_bindgen_test::*; use web_sys::window; use yew::prelude::*; +use yew::{utils, App}; pub enum Msg { Clicked, @@ -157,23 +158,16 @@ fn should_create_navbar_item() { }]), }; - let link = ComponentLink::new(); - let navbar_item = NavbarItem::create(navbar_item_props, link); - let navbar_item_vnode = navbar_item.render(); - - let vnode_expected = html! { - - }; + let navbar_item: App = App::new(); + + navbar_item.mount_with_props( + utils::document().get_element_by_id("output").unwrap(), + navbar_item_props, + ); + + let item_element = utils::document().get_element_by_id("item").unwrap(); - assert_eq!(navbar_item_vnode, vnode_expected); + assert_eq!(item_element.text_content().unwrap(), "Item".to_string()); } #[wasm_bindgen_test] diff --git a/crate/yew_styles/src/lib.rs b/crate/yew_styles/src/lib.rs index cc90152..8a6d8d5 100644 --- a/crate/yew_styles/src/lib.rs +++ b/crate/yew_styles/src/lib.rs @@ -18,7 +18,7 @@ //! ### How install it //! //! 1. Install the sass module: `npm install yew-styles` -//! 2. Add the yew_style crate in Cargo.toml file: `yew_styles = "0.3.0"` +//! 2. Add the yew_style crate in Cargo.toml file: `yew_styles = "0.3.1"` //! 3. Import the main.css file in you main javascript/typescript file project: //! ```typescript //! import 'node_modules/yew-styles/main.css'; diff --git a/index.html b/index.html index 5eb4999..9f0df2d 100644 --- a/index.html +++ b/index.html @@ -6,6 +6,15 @@ Yew Styles Page + diff --git a/package-lock.json b/package-lock.json index 55dc963..a0d47c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "yewstyle-page", - "version": "0.2.0", + "name": "create-yew-parcel", + "version": "0.15.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -922,6 +922,82 @@ "requires": { "@parcel/utils": "^1.11.0", "chokidar": "^2.1.5" + }, + "dependencies": { + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "binary-extensions": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", + "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "dev": true + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, + "optional": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + } + } } }, "@parcel/workers": { @@ -1019,24 +1095,13 @@ } }, "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", "dev": true, "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" } }, "argparse": { @@ -1308,9 +1373,9 @@ } }, "binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", + "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", "dev": true }, "bindings": { @@ -1602,23 +1667,63 @@ } }, "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz", + "integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.4.0" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } } }, "cipher-base": { @@ -1673,7 +1778,6 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz", "integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==", - "dev": true, "optional": true, "requires": { "good-listener": "^1.2.2", @@ -2393,7 +2497,6 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz", "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==", - "dev": true, "optional": true }, "depd": { @@ -2503,9 +2606,9 @@ } }, "dotenv": { - "version": "5.0.1", - "resolved": "http://registry.npmjs.org/dotenv/-/dotenv-5.0.1.tgz", - "integrity": "sha512-4As8uPrjfwb7VXC+WnLCbXK7y+Ueb2B3zgNCePYfhxS1PYeaO1YTeplffTEcbfLhvFNGLAz90VvJs9yomG7bow==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", + "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", "dev": true }, "dotenv-expand": { @@ -2895,6 +2998,25 @@ "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==", "dev": true }, + "file-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/file-match/-/file-match-1.0.2.tgz", + "integrity": "sha1-ycrSZdLIrfOoFHWw30dYWQafrvc=", + "dev": true, + "requires": { + "utils-extend": "^1.0.6" + } + }, + "file-system": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/file-system/-/file-system-2.2.2.tgz", + "integrity": "sha1-fWWDPjojR9zZVqgTxncVPtPt2Yc=", + "dev": true, + "requires": { + "file-match": "^1.0.1", + "utils-extend": "^1.0.4" + } + }, "filesize": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz", @@ -2975,552 +3097,11 @@ "dev": true }, "fsevents": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz", - "integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", "dev": true, - "optional": true, - "requires": { - "nan": "^2.12.1", - "node-pre-gyp": "^0.12.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "aproba": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "brace-expansion": { - "version": "1.1.11", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "concat-map": { - "version": "0.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "console-control-strings": { - "version": "1.1.0", - "bundled": true, - "dev": true, - "optional": true - }, - "core-util-is": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "debug": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ms": "^2.1.1" - } - }, - "deep-extend": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.24", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-walk": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "bundled": true, - "dev": true, - "optional": true - }, - "ini": { - "version": "1.3.5", - "bundled": true, - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true, - "optional": true - }, - "minipass": { - "version": "2.3.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "needle": { - "version": "2.3.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^4.1.0", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.12.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, - "nopt": { - "version": "4.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.6", - "bundled": true, - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.4.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "object-assign": { - "version": "4.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "safer-buffer": { - "version": "2.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "bundled": true, - "dev": true, - "optional": true - }, - "semver": { - "version": "5.7.0", - "bundled": true, - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.3", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "yallist": { - "version": "3.0.3", - "bundled": true, - "dev": true, - "optional": true - } - } + "optional": true }, "function-bind": { "version": "1.1.1", @@ -3600,16 +3181,15 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz", "integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=", - "dev": true, "optional": true, "requires": { "delegate": "^3.1.2" } }, "graceful-fs": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", - "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==", + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "dev": true }, "grapheme-breaker": { @@ -3959,12 +3539,12 @@ "dev": true }, "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, "requires": { - "binary-extensions": "^1.0.0" + "binary-extensions": "^2.0.0" } }, "is-buffer": { @@ -4598,13 +4178,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true, - "optional": true - }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -4979,16 +4552,25 @@ "terser": "^3.7.3", "v8-compile-cache": "^2.0.0", "ws": "^5.1.1" + }, + "dependencies": { + "dotenv": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-5.0.1.tgz", + "integrity": "sha512-4As8uPrjfwb7VXC+WnLCbXK7y+Ueb2B3zgNCePYfhxS1PYeaO1YTeplffTEcbfLhvFNGLAz90VvJs9yomG7bow==", + "dev": true + } } }, - "parcel-plugin-wasm.rs": { - "version": "1.2.15", - "resolved": "https://registry.npmjs.org/parcel-plugin-wasm.rs/-/parcel-plugin-wasm.rs-1.2.15.tgz", - "integrity": "sha512-fbkOlsy2gkLAUjJ6mlRzJoULrCNoJXrDFnwuGzPw6g0edr4jm+cRvkj0UB9neDOGar/FA0fOx7a6K4iUg6qpRA==", + "parcel-plugin-static-files-copy": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/parcel-plugin-static-files-copy/-/parcel-plugin-static-files-copy-2.3.1.tgz", + "integrity": "sha512-yqB1bhSK+hbfxSjc1y/gBc+Fm6bedNrofx75wgnI0sP+6oEBqjyN51tlJVLu6pZhBLi11ZFwAM2XubCUh2G0+A==", "dev": true, "requires": { - "@iarna/toml": "^2.2.0", - "command-exists": "^1.2.7" + "file-system": "2.2.2", + "minimatch": "3.0.4", + "path": "0.12.7" } }, "parse-asn1": { @@ -5033,6 +4615,33 @@ "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", "dev": true }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", + "dev": true, + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + } + } + }, "path-browserify": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", @@ -5088,6 +4697,12 @@ "integrity": "sha1-GN4vl+S/epVRrXURlCtUlverpmA=", "dev": true }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, "pn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", @@ -5602,7 +5217,6 @@ "version": "1.20.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.20.0.tgz", "integrity": "sha512-AEDjSrVNkynnw6A+B1DsFkd6AVdTnp+/WoUixFRULlCLZVRZlVQMVWio/16jv7G1FscUxQxOQhWwApgbnxr6kQ==", - "dev": true, "requires": { "clipboard": "^2.0.0" } @@ -5727,14 +5341,12 @@ } }, "readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", + "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", "dev": true, "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" + "picomatch": "^2.2.1" } }, "regenerate": { @@ -6015,7 +5627,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz", "integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0=", - "dev": true, "optional": true }, "semver": { @@ -6603,7 +6214,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", - "dev": true, "optional": true }, "tiny-inflate": { @@ -6961,6 +6571,12 @@ "object.getownpropertydescriptors": "^2.0.3" } }, + "utils-extend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/utils-extend/-/utils-extend-1.0.8.tgz", + "integrity": "sha1-zP17ZFQPjpDuIe7Fd2nQZRyril8=", + "dev": true + }, "uuid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", @@ -7110,6 +6726,12 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true + }, + "yew-styles": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/yew-styles/-/yew-styles-0.2.0.tgz", + "integrity": "sha512-xnQQlT07upGF+H3ypSpWegfPaQTHdSBQ3Zpm8xVCR3vvHIb/QMHHhPCArVTEEaZcTPWiPMfZt7j+/NG/Vo1ehQ==", + "dev": true } } } diff --git a/package.json b/package.json index 42fd773..6077048 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,34 @@ { "author": "Francisco Jesus Navarro Cortes", "repository": { - "url": "https://github.com/spielrs/yew-styles-page.git" + "url": "https://github.com/spielrs/yew-parcel-template" }, - "name": "yewstyle-page", - "version": "0.2.0", - "license": "Apache-2.0/MIT", + "name": "create-yew-parcel", + "version": "0.16.0", + "license": "MIT", "scripts": { - "start": "parcel index.html", - "build": "parcel build index.html" + "start": "node wasm-builder.js", + "build": "node wasm-builder.js production", + "debug": "NODE_ENV=dev node --nolazy --inspect-brk=9229 wasm-builder.js" }, "bin": { "create-yew-parcel": ".bin/create-yew-parcel.js" }, "devDependencies": { + "chokidar": "^3.4.0", + "dotenv": "^8.2.0", "parcel-bundler": "^1.12.4", - "parcel-plugin-wasm.rs": "^1.2.15", - "prismjs": "^1.20.0", + "parcel-plugin-static-files-copy": "^2.3.1", "sass": "^1.26.5", "typescript": "^3.8.3", - "minimist": "1.2.3", - "kind-of": "6.0.3" + "yew-styles": "0.2.0", + "prismjs": "^1.20.0" }, - "dependencies": {} + "dependencies": { + "prismjs": "^1.20.0" + }, + "staticFiles": { + "staticPath": ["./crate/pkg", "./crate/assets"], + "watcherGlob": false + } } diff --git a/wasm-builder.js b/wasm-builder.js new file mode 100644 index 0000000..55daa40 --- /dev/null +++ b/wasm-builder.js @@ -0,0 +1,41 @@ +const { execSync } = require('child_process'); +const Bundler = require('parcel-bundler'); +const Path = require('path'); +const chokidar = require('chokidar'); +const dotenv = require('dotenv'); +dotenv.config(); + +const entryFiles = Path.join(__dirname, 'index.html'); + +const buildType = process.argv[2]; + +const options = { + outDir: './dist', + outFile: 'index.html', + publicUrl: '/', + watch: true, + minify: buildType === 'production', + }; + +(async () => { + const bundler = new Bundler(entryFiles, options); + + chokidar.watch(['./crate/src', './crate/Cargo.toml']).on('change', async (event, path) => { + console.log(`there are new changes in '${path}'. Start to rebuild rustwasm sources`); + + bundler.bundle(); + + bundler.hmr.broadcast({ + type: 'reload' + }); + }); + + bundler.on('buildStart', () => { + const prevtBuildFile = Path.join(__dirname, './wasm_pack_cmd'); + console.log(`running: ${prevtBuildFile}`); + execSync(`${prevtBuildFile} ${buildType === 'production' ? '' : '--dev'}`, {stdio: 'inherit'}); + }); + + await bundler.serve(process.env.SERVER_ADDRESS || 1234); +})(); + diff --git a/wasm_pack_cmd b/wasm_pack_cmd new file mode 100755 index 0000000..aea00ee --- /dev/null +++ b/wasm_pack_cmd @@ -0,0 +1 @@ +exec wasm-pack build $1 --target web crate \ No newline at end of file