42 Commits

Author SHA1 Message Date
Allan
b3f8ca1920
Replace Model with App or MyComponent (#2336)
`Model` is ambiguous and not a user-friendly name.
Some of the newer docs are already referring to the root component as
`App`.

This PR follows this naming scheme:
 - `App` for a root component
 - `MyComponent` for an arbitrary component

This naming is inspired by the React docs.

i18n references were not changed. They need a larger rewrite which will
go in a separate PR.
2022-01-07 20:50:21 +05:00
mc1098
e503c9acda
Remove web_sys re-export (#2084)
* Remove `web_sys` re-export

Removes re-exporting the `web_sys` dependency from the yew crate and
removes some `web_sys` features that were only enabled for re-exporting.

* re-export events through yew::events
2021-09-27 02:07:38 +02:00
mc1098
4e974dad92
Remove ShouldRender type alias (#2011)
Remove `ShouldRender` type alias for bool. In the Component trait an
extra comment has been added to explain what the returned bool
represents.
2021-08-25 17:52:09 +02:00
Muhammad Hamza
f50c8c3cba
Components v2 (2) (#1961)
* Start rewrite

* Rc > cloning props

* fmt + rm useless file

* move props inside `Context`

* router compiles

* fix boids example

* fix counter example

* fix crm example

* fix dyn_create_destroy_apps example

* fix file_upload example

* fix futures example

* fix game_of_life example

* fix inner_html example

* fix js_callback example

* fix mount_point example

* fix keyed_list example

* fix web_gl example

* fix two_apps example

* fix todomvc example

* fix timer example

* fix store example

* fix nested_list example

* fix node_refs example

* fix pub_sub example

* fix multi_thread example

* don't call `changed` if props weren't changed

* formatting

* fix doc tests, remove neq_assign

* update router example, fix neq_assign compile errors

* fix macro/rest of doc tests

* start updating documentation

* `Component`'s documentation

* Apply suggestions from code review

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>

* Apply suggestions from code review (part 2)

* Apply suggestions from code review (part 3)

* fix context

* clippy

* post merge fixes

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-08-25 13:11:39 +01:00
mc1098
c6099cf875
Remove InputData & ChangeData (#2000) 2021-08-16 18:02:14 +02:00
Xavientois
4a14d0f0a4
Add requirement for braces around most props (#1939)
* Limit the properties to literals and brace-enclosed expressions

* Update examples with new syntax

* Update packages/yew-macro/src/props/prop.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Fix lints and strip braces around single expressions

* Update docs with new prop syntax

* Add some test cases for new syntax

* Ensure all tests are passing

* Clean up missed code

* Update tests

* Update reverted docs

* Revert versioned docs

* Fix optional attributes paragraph

* Remove accidentally added files

* Remove accidentally added french docs

* Update packages/yew-macro/src/props/prop.rs

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>

* Fix forgotten braces and test cases

* Revert i18n old docs

* Revert translated docs

* Remove suggested fix in favour of more succinct error message

* Update errors after rebase

* Remove files accidentally added while rebasing

* Fix merge conflicts

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-07-18 18:54:21 +02:00
Muhammad Hamza
2412a68bee
Refactor and cleanup codebase (#1842)
* remove yew-dsl

* remove yew-components

* remove yew-services

* remove yew::format

* fix CI

* move yew::agent to yew-agent crate

* move yew-functional to yew

plus a couple of misc fixes

* move futures and neqassign out of yewtil

* move yewtil::store to yew_agent, remove yewtil

* formatting

* fix tests

* update docs

* use `rustwasm` gloo repo instead of mine

* add docs

* use rustwasm/gloo repo

* remove unused file

* fix Makefile.toml

* Fix issues after rebase

* Apply suggestions from code review (part 1)

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>

* Apply suggestions from code review (part 2)

* move `#[function_component(_)]` tests

missed those before

* Apply suggestions from code review

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-07-18 15:57:09 +02:00
Simon
f17d370217 Implicit optional attributes (#1637) 2021-06-05 23:00:58 +02:00
Jasper
c51ab7f094
Added missing licenses to Cargo.toml files and updated to use SPDX syntax (#1822) 2021-04-25 23:24:14 +02:00
Muhammad Hamza
ab76a446f1
Move yew/services to yew-services crate (#1693)
* move yew/services to yew-services crate

* fix stdweb examples

* remove services feature usage from workflow

* attempt at making CI pass

* remove unused feature

* add feature i missed during merge

* okay, it should compile now

* apply review

* fix yew-stdweb & aplease fmt

* misc fixes

Co-authored-by: Justin Starry <justin.starry@icloud.com>
2021-01-23 22:49:00 +08:00
Philip Peterson
e6a3ae7301
Move top-level crates to packages/<crate> (#1680)
* Move crates to packages/*

* Update Cargo.toml

* Update links

* Fix pull-request.yml

* Update examples Cargo.toml

* Update relative paths

* Update tests

* Fix path
2021-01-12 11:32:48 +08:00
Simon
a959796794
Update to Trunk 0.7 (#1614)
* install trunk from brew

* update examples

* prepare multi_thread (even tho it's still WIP)
2020-10-10 23:58:34 +02:00
Simon
66d506e133
Update documentation for the new examples (#1586)
* fix todomvc example

* update READMEs now that we're hosting the examples

* update documentation

* add trunk template

* Improve wording
2020-09-23 03:47:28 +02:00
Simon
c946b99610
Overhaul examples (#1559)
* remove old files

* update counter

* update crm example

* Add readme for counter

* update custom_components

* update webgl example

* update two_apps

* update todomvc

* mark special case multithread

* update dashboard

* update examples readme

* file_upload example

* fragments example

* futures example

* game_of_life example

* inner_html example

* js_callback example

* keyed_list example

* remove large_table

* remove minimal

* mount_point example

* I can't count apparently

* nested_list example

* node_refs example

* timer example

* store example

* pub_sub example

* rip npm_and_my_sanity

* use a title™️

* clean up multi_thread

* fix format

* boids part 1

* boids part 2

* add workflow

See: <https://github.com/siku2/yew/pull/13>

* remove my little scratchpad again

* add boids to examples table

* runtime-generated list in  nested_list example

* update workflow

* first batch of yewtil examples

* clippy "futures"

* remove old yew-router examples

* add a new router example to the main examples

* remove remaining yewtil examples

* more progress

* update for testing purposes

* author list

* improve content generation

* revert this mistake

I thought it would be great to use `unimplemented!()` in case the component doesn't have any properties.
This helps avoid the mistake of forgetting to update the change method when adding props later on.
What I didn't consider is that just because the props are () that doesn't mean that Yew isn't going to call it...
So yeah, it's still a good idea for update, but certainly not for change.

* missed a few

* turn router switch example into test

* seems to be working

* make it possible to host the router example on a sub-path

* create a 404 file for SPA

* remove the three examples and update table

* remove the 404 file because it isn't working anyway

* fix small router issue relating to the sub-path hack
2020-09-22 00:17:48 +02:00
Justin Starry
80b31b9396
Fix doctest spell check (#1570) 2020-09-20 12:29:56 +08:00
Philip Peterson
309dbcba00
Update main yew examples (remove static dir) (#1417)
* remove static directory, move script to run_example.sh

* gitignore

* server infra

* Support --build-only

* fix npm_and_rest example

* Fix various static index.html's

* Fix spacing

* newlines at the end

* Cleanup

* tabs -> spaces

* line ending

* remove build_examples.sh

* Apply suggestions from code review

Co-authored-by: Simon <simon@siku2.io>

* format file and improve EXIT trap

Co-authored-by: Simon <simon@siku2.io>
2020-07-22 13:29:55 +02:00
Stig Johan Berggren
41a661fc12
Add README for Custom components example (#1170)
* Add readme for custom_components

* Markdown link and consistent header style

* Remove trailing space, consistent file name
2020-05-03 12:19:38 +08:00
fbucek
528ec66fbc
updated examples, added build script (#1165)
* script for building examples

minimal example updated to work with wasm-pack
minimal_wb exampel to be used with wasm-bindgen directly

* minimal is wasm-bindgen as default ( wp wasm-pack )

* examples updated to work with wasm-bindgen

* script to run all yew/examples

* upated example doc, added script to multi-thread

* cargo fmt, disabled build_examples.sh

* one build.sh for examples, updated doc

* removed build size optimalization

* wasm-pack requirement info in lib.rs

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/build.sh

Co-Authored-By: Justin Starry <justin.m.starry@gmail.com>

* Update examples/build.sh exit trap

Co-Authored-By: Justin Starry <justin.m.starry@gmail.com>

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
2020-04-29 22:57:55 +08:00
Justin Starry
fa8a1d9f00
Reorganize examples and general repo layout (#1092)
* Reorganize crates

* Remove symlink

* Check examples

* Cleanup CI scripts

* nits

* cleanup

* cargo fmt

* Fix yew-stdweb

* cargo clippy --all

* stdweb-examples

* run_emscripten_checks.sh

* Fix typo

* fix typo

* yew-stdweb

* Run tests from yew-stdweb

* fix webgl script
2020-04-20 22:22:24 +08:00
Justin Starry
d38ce422f9
Add support for building with web-sys (#961)
* Enable travis

* `web-sys` general conversion (#826)

* Moved patches from different PRs.

* Add bits & pieces and some services.

* Rename `stdweb` feature to `std_web`.

* Move tests and examples to different PR.

* Revert some `cargo_web` handling removal.

* Missed something.

* Implement `console_error_panic_hook`.

* Update Cargo.toml

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Move document creation to util convenience method (#855)

* `web-sys` listener conversion (#813)

* `web-sys` listener initial try.

* Improve macros?

* Remove generic from `EventListenerHandle`.

* Fix build.

* A cleaner solution?

* Even cleaner.

* Fix `build.rs`.

* Minor improvements.

* Following the yew toml style.

* Fixing visibility.

* Fix `rustfmt`.

* Add `web-sys` re-exports.

* Move general changes to different PR.

* Remove compat.

* Actually remove `compat.rs`.

* Rename `stdweb` feature to `std_web`.

* Move to gloo's `EventListener` and some polish.

* Remove outdated comment.

* Change `EventHandler` to be cancelled on drop.

* `web-sys` html conversion (#817)

* Converting all `html` parts.

* Format.

* Move general changes to different PR.

* Removed compat.

* Rename `stdweb` feature to `std_web`.

* Remove redudant function copy.

* Some polish.

* Move to gloo's `EventListener`.

* Replace `unwrap`s with `expect`s.

* `web-sys` agent conversion (#818)

* Converting `agent`.

* Remove wrong `cfg` in imports.

* Move general changes to different PR.

* Some optimisations.

* Rename `stdweb` feature to `std_web`.

* Fix `ArrayBuffer` to `Uint8Array` conversions.

* Add js module worker.

* Use `cfg-if`` and `cfg-match` to make things clearer.

* Fix `std_web` build.

* Add some polish.

* Add build guards for invalid build configs (#866)

* `web_sys` cfg conversion (#862)

* Use `cfg-if` and `cfg-match` and some polish.

* Mistakes were made.

* Missed line during rebasing.

* Mistakes were undone.

* Remove global.

* Remove part of `global!`.

* `web-sys` services conversion (#827)

* Convert `console`.

* Finish services.

* Some polish.

* Fix `ArrayBuffer` to `Uint8Array` conversions.

* Fix aborting fetch leading to error and some polish.

* Replaced some `unwrap`s with `expect`s.

* Use `cfg_if` and `cfg_match` and do some polish.

* Proper scoping.

* Some fixes.

* Move fetch and reader services to different PR.

* Revert split.

* Fix CI builds (#877)

* Fix derive_props_test

* Move tests (#897) (#898)

* `web-sys` fetch service conversion (#867)

* Split implementation.

* Import global.

* Import global.

* Revert split.

* Make fetch available again.

* Revert "Revert split."

This reverts commit 6e3f101dbedde2142f041467a8ae40ef5e3920c5.

* Re-revert split.

* Some polish.

* Move to `wasm_bindgen_futures`.

* Switch to `thiserror`.

* wip

* Update src/services/fetch/web_sys.rs

Co-Authored-By: daxpedda <daxpedda@gmail.com>

* Some more polish.

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* `web-sys` reader service conversion (#868)

* Split reader implementation.

* Revert split.

* Remove leftover files.

* Make reader available again.

* Revert "Revert split."

This reverts commit 8abdc9cf2b014ab61fef2c48d1af8927d9a5a330.

* Revert "Remove leftover files."

This reverts commit 188c6eb9693881c9987061de8deb29c6f4c613a4.

* Re-revert split.

* Polish.

* Forgot some part.

* Some polish.

* Some polish.

* `web-sys` examples/tests conversion (#841)

* Fix examples/tests to work with `web_sys`.

* Update `StorageService` usage.

* Split `stdweb` and `web-sys` examples.

* Fixing the shell script.

* Trying to reset file permissions.

* Update to new reader API.

* Update to new fetch API.

* Update to new fetch API.

* Re-enable examples CI.

* Deleted duplicate example.

* Some fixes.

* Fix rand build.

* Fix spawning workers in combination with `wasm-bindgen`. (#901)

* Fix component rendering process (#913)

* wip

* Fix component rendering process

* Simplify yew-macro a bit (#902)

* yew-macro: Simplify Properties validation

* Fix most clippy warnings

* Fix clippy warnings (#912)

* Import Task trait in dashboard example

* Remove duplicate vtag tests

* Fix prevent_default() by non-passive (#958)

* Fix prevent_default() by non-passive

* Fix cargo fmt

* Remove `Option` from most services.

* Remove `Option` from resize service.

* Apply fetch changes.

* Apply reader service changes.

* Fix `node_refs` example.

* Remove web-sys travis branch

Co-authored-by: daxpedda <daxpedda@gmail.com>
Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
Co-authored-by: Jet Li <jing.i.qin@icloud.com>
2020-02-29 17:25:42 +08:00
Justin Starry
99220f542f
Update wasm-bindgen and fix cargo config (#853)
* Update wasm-bindgen and fix cargo config

* clippy
2020-01-08 15:08:32 +08:00
Justin Starry
8a4684fcf2
Bump wasm-bindgen version from 0.2.56 to 0.2.57 (#848) 2020-01-07 09:16:18 +08:00
daxpedda
eaf5125018 Fix js_callback example. (#838)
* Fix `js_callback` example.

-  Add `#[allow(unused_imports)]` for `js` macro.
-  Add `self.link.callback` to `oninput`.

* Fix missing type annotation.
2020-01-04 13:38:13 -05:00
Justin Starry
8df15fdef8
Update wasm-bindgen to 0.2.56 (#821) 2019-12-24 11:46:14 -06:00
Justin Starry
f61667be97
Remove generics from virtual dom (#783)
* Fix tests

* Remove generics from virtual dom

* Prep for degenerify

* Fix examples

* Remove props cloning

* Fix tests
2019-12-08 10:47:51 -08:00
Justin Starry
f48bc90edb
Use callbacks in examples (#781) 2019-12-07 16:56:26 -08:00
Justin Starry
ffbb9e0ac3
Rename methods and loosen mutability for component link and agent (#780)
* Rename methods and loosen mutability for component link and agent

* Update send_back to callback

* mut link -> link
2019-12-07 18:18:33 -05:00
Justin Starry
1218c1de33
Update wasm-bindgen (#753) 2019-11-23 16:51:16 -05:00
Justin Starry
6ba83fc061
Update min rust version to 1.39.0 (#730)
* Update min rustc to 1.39.0

* Bump wasm-bindgen to 0.2.54

* always install wasm-bindgen-cli
2019-11-10 20:19:34 -05:00
Justin Starry
0c6b9d32f8
Bump wasm bindgen to 0.2.50 (#695)
* Bump wasm-bindgen to 0.2.50

* Update Cargo.toml

* Update Cargo.toml
2019-10-11 10:49:55 -04:00
Justin Starry
4f31997968
Bump stdweb to 0.4.20 (#694) 2019-10-11 00:09:55 -04:00
Cameron Taggart
c24ee3e6e1 bump to stdweb 0.4.19 (#683) 2019-10-07 12:44:08 -04:00
Justin Starry
43e9347269
Add render method to Component and auto implement Renderable (#563)
* Add render method to Component and auto implement Renderable

* More cleanup

* Rename Renderable method from view to render

* Doc fixes

* fix

* Update CHANGELOG.md
2019-09-30 22:23:25 -04:00
Denis Kolodin
c4fa17004b Change org to YewStack 2019-09-01 00:02:24 +09:00
Justin Starry
00ac8edc58 Fix CI wasm tests 2019-08-03 08:50:29 -04:00
Justin Starry
3fed651b42 Add support for required props 2019-07-20 22:38:50 -04:00
Justin Starry
fe3d6249d3 Use updated jsx syntax in examples and documentation 2019-07-05 21:49:12 -04:00
Justin Starry
3963dc3dea Remove old html macro, default to new proc macro 2019-07-02 14:38:35 -04:00
NaokiM03
3023aaa511 Fix script src of examples 2019-02-16 10:32:57 +03:00
Denis Kolodin
2a1903cb4d Update all examples to Rust 2018 2019-02-02 16:03:07 +03:00
Denis Kolodin
fc7f7a97ea Add start_app method 2019-02-02 01:26:04 +03:00
Denis Kolodin
9eb6822f07 Use the common style for js_callback example 2018-07-14 10:14:38 +03:00