61 Commits

Author SHA1 Message Date
Matt
90b4e55ebc
Docusaurus Overhaul (#2275)
* change suffixes from md to mdx
fix broken links for English locale
tree shake and update docusaurus
add docusaurus ideal image plugin
use svg and themed image
delete unused static asset

* move localized landing page

* change GitLocalize project page

* nit pick

* remove ignore to have the block checked
2021-12-20 12:10:45 +02:00
Kaede Hoshikawa
d8ec50150e
Add HashRouter, basename and use gloo-history (#2239)
* Migrate to gloo-history.

* Fix docs wording.

* Add basename handling to navigator.

* Fix basename handling.

* Add lints and tests.

* Fix wording.

* Fix docs.

* Fix pr-flow.

* Fix some documentation.

* Add Navigator Kind.

* Remove history.rs

* Add documentation for navigator & Concrete Router Props.

* Update website/docs/concepts/router.md

Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>

* Add docs about basename.

* Update documentation.

* Fix docs.

Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>
2021-12-19 20:38:33 +05:00
Leon
5c5642782f
docs: fix functional and struct components links (#2258)
* docs: fix functional and struct components links

* docs: fix link to func comp in rs

Co-authored-by: Leon Minasyan <leon-minasyan@yandex-team.ru>
2021-12-11 19:14:11 +01:00
Julius Lungys
5897eef03b
Fix router cargo version in docs (#2234)
* Fix router cargo version in docs

* Update website/docs/concepts/router.md

* Update website/docs/concepts/router.md

* fix according to comments
2021-12-06 11:48:24 +01:00
Matt
338dcd8869
Router docs about set-only components (#2214)
* Use From<Cow> of AttrValue in Link component

* docs about `BrowserHistory::default()`

* remove unused cow import

* remove unused cow import

* lint

* More accurate `BrowserHistory::default()` tips

* Update website/docs/concepts/router.md

Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>

* Update website/docs/concepts/router.md

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

Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>
Co-authored-by: Simon <simon@siku2.io>
2021-12-05 16:15:37 +02:00
Kaede Hoshikawa
c73c6bb60b
Fix docs hooks naming (#2228)
* Fix hooks naming.

* Fix 0.19 docs as well.
2021-12-04 19:44:50 +05:00
Muhammad Hamza
996bf5b41a
Final documentation touch ups & tag 0.19.0 (#2220)
* some documentation fixes

* more fixes

* why it didn't work before is beyond me

* next redirect

* change 0.18 docs folder structure to make it inline with next

* move docs to /docs

now that home is its own page, docs should be under `/docs/`

* tag 0.19.0 version on website
2021-11-30 00:06:51 +05:00
Julius Lungys
a588f77738
Add migration guide for 0.19 (#2210)
* add migration guide for 0.19

* fix tests

* update 1

* fix tests?

* fix link
2021-11-29 14:15:32 +00:00
Franz Dietrich
2bc47b4882
Those slashes do not work (#2221)
I had an error in my code that was rather cryptic and I finally found that in the router example there are no closing slashes in the "type of Link"
2021-11-29 14:53:31 +02:00
Julius Lungys
399a5e8790
Update docosaurus to v2 beta 9 (#2215)
* Update docosaurus to v2 beta 9
- Also fix tabs
- Add toml language highlighting

* move around introduction files

* fix link
2021-11-29 14:19:29 +05:00
Luis Orbaiceta
48a83641bd
add missing text (#2203)
seems that copying from v0.18 to current some text got missing
2021-11-26 17:17:59 +00:00
Matt
fd92ab8948
Add missing router docs: Redirect, Nested Router, and Path Segament capturing (#2192)
* nested router structure diagram

* add Redirect, nested router documentation.

* add reminder

* fix the comment, duh

* snippets get tested too unless ignored

* fix inconsistent var name in snippet

* Add redirect to nested router example
normal component -> struct component

* Document about acceptable types for path segment
Document about router behaviour at fail to parse

* add missing ignore to snippet

* typo

* normal -> struct

* reformat codeblock and the markdown
functional comp -> function comp
consistent code snippet style
removed two ignores

* add back ignores

* typo, snippet correction. grammar.

* correction

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-11-26 10:00:13 +02:00
Kaede Hoshikawa
c348a2358e
Fix router docs. (#2188) 2021-11-23 21:06:41 +05:00
Kaede Hoshikawa
bb36725dc2
Add stylist to docs. (#2190) 2021-11-23 14:50:13 +02:00
Julius Lungys
8d674c5fda
Add key docs and Move fragments docs (#2178)
* Add key docs

* add frogments to sodebar

* remove duplicate title

* Apply suggestions from code review

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

* Apply suggestions from code review

Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>

* remove html comments

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
2021-11-23 09:01:58 +05:00
Cecile Tonglet
3858aededd
Add the ability to add child nodes conditionally in html! (#1609)
* Initial commit

Forked at: 66d506e13329a06f7dce0b55a9427972b8aad3ff
Parent branch: origin/master

* Add the ability to add child nodes conditionally in html!

* WIP

Forked at: 66d506e13329a06f7dce0b55a9427972b8aad3ff
Parent branch: origin/master

* CLEANUP

Forked at: 66d506e13329a06f7dce0b55a9427972b8aad3ff
Parent branch: origin/master

* Experiment

* Failing test

* More tests

* More tests

* Add new HtmlIterable with syntax `for {...}` instead of `{for ...}`

* Remove HtmlIf from HtmlRoot (already done in HtmlTree)

* WIP

* WIP

* WIP

* WIP

* Revert

* CLEANUP

* WIP

* CLEANUP

* Remove IterableNew

* Renamed HtmlBranch to HtmlRootBraced and moved to mod.rs

* Update yew-macro/tests/html_macro/html-if-pass.rs

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

* Suggestion

* Oops

* Added ToNodeIterator to HtmlIf

* Improve error spans

* More html!()

* Move tests to not use browser

* Multiple children in if-expr

* Clippy fix

* Clippy fix again

* Re-trigger CI

* Apply suggestions from code review

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

* Replacing ParseResult by syn::Result everywhere

* Remove unnecessary &mut

* Attempt to add test on ToNodeIterator

* Clippy fixes

* Still works for some reason

* Revert "Attempt to add test on ToNodeIterator"

This reverts commit 75b1a85c28df36ad8bf61344eef56e06667da3b6.

* fix CI

* add docs on website

* Apply suggestions from code review

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

* apparently I can't hide lines on website

* update stderr file

* will this work?

* fix bug where conditions can't be expressions

* better error message

* clippy & fmt

Co-authored-by: Simon <simon@siku2.io>
Co-authored-by: Hamza <muhammadhamza1311@gmail.com>
Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-11-22 20:13:03 +02:00
Julius Lungys
3e656ddc8c
Fix router docs (#2173) 2021-11-22 07:55:32 +05:00
lausek
f5496482ca
Improve documentation of the router (#2166)
* docs: how to add parameters on route

* docs: how to listen for route changes

* docs: how to link to parameterized routes

* docs: router polish

* docs: make router tests pass
2021-11-21 19:50:28 +02:00
Teymour Aldridge
7e2542cbf8
Add basic lints to the HTML macro. (#1748)
* Add basic lints to the HTML macro.

* f

* Fix the examples.

* Fix nightly warning message tests.

* apply code review suggestions

* update error message

* rebase onto master

* remove unused props

* remove console log

* remove js void

* fix according to PR comments

Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>
2021-11-21 19:54:49 +05:00
mc1098
071f1b28df
Refactor use ref hooks (#2093)
* Refactor use ref hooks

`use_ref` has been renamed to `use_mut_ref` and `use_ref` has become a
similar hook for immutable reference.

This is different from React but I think lines up nicely with Rust as a
reference is immutable unless specified to be a mut ref.

* fix CI

Co-authored-by: Hamza <muhammadhamza1311@gmail.com>
2021-11-21 16:20:19 +02:00
WorldSEnder
aa9b9b266c
Implementation of portals (#2147)
* initial poc implementation of portals

* add new_before

* add portals example

* add shadow dom example

* add english website documentation
2021-11-16 16:48:04 +01:00
Kaede Hoshikawa
fb9c398048
use_bridge hook for agents (#2125)
* Add Redirect Comp.

* Fix router behaviour.

* Fix output.

* Fix pr-flow.

* Remove Redirect.

* Readd 77b46bf.

* Add use_bridge hook.

* Add documentation.
2021-11-12 09:04:03 +01:00
Muhammad Hamza
dd2db93996
Use functions from gloo_utils instead of re-implementing them (#2124)
* Use functions from `gloo_utils` instead of re-implementing them

* Remove `anyhow` dependency

* fix errors

* review + post merge fixes
2021-11-11 16:45:08 +02:00
Muhammad Hamza
20f76e78da
Tidy up documentation (2) (#2137)
* Tidy up documentation.

* Fix spelling (maybe)

* Fix CI

* Update docs/concepts/function-components.md

Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>

* apply review

Co-authored-by: teymour-aldridge <teymour.aldridge@icloud.com>
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2021-11-11 16:25:31 +02:00
Kaede Hoshikawa
706fb48f6e
Reliable use_reducer dispatch and use_state setter (#2126)
* Add Redirect Comp.

* Fix router behaviour.

* Fix output.

* Fix pr-flow.

* Remove Redirect.

* Readd 77b46bf.

* Reliable dispatch for use_reducer.

* Detachable Dispatcher and Setter.

* Update docs wording.

* Update website/docs/concepts/function-components/pre-defined-hooks.md

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

* Update website/docs/concepts/function-components/pre-defined-hooks.md

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

* Update website/docs/concepts/function-components/pre-defined-hooks.md

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

Co-authored-by: Simon <simon@siku2.io>
2021-11-11 12:33:33 +01:00
Kaede Hoshikawa
f43760e3ca
Update Yew Router as per #2113 (#2118)
* Add Redirect Comp.

* Fix router behaviour.

* Fix output.

* Fix pr-flow.

* Remove Redirect.

* Readd 77b46bf.

* Router Context, History and Location.

* Finish Porting.

* Add Switch, Fix example.

* Add state.

* Fix pr-flow.

* Fix pr-flow.

* Fix unstable feature for 1.49.

* Add documentation.

* Error Types & Simplify Implementation.

* Add some tests.

* Update documentation.

* Fix route outside of a Switch.
2021-11-11 13:08:42 +02:00
Jonathan Birk
3ebd866d13
Minor fixup of tutorial files (#2131)
* Make the talk titles consistent

* Add replacing the hardcoded list of talks with the one generated from data

* Update website/docs/tutorial.md

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

* Update website/docs/tutorial.md

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

Co-authored-by: Simon <simon@siku2.io>
2021-11-05 17:49:57 +01:00
Julius Lungys
f2a0d617ce
Add set_if_neq for UseStateHandle (#2109)
* add set_neq for UseStateHandle

* add docs

* update based on PR comments 1
2021-10-16 00:25:16 +01:00
Robin Moussu
799a098841
Use git serve --open in the tutorial (#2108)
The line `server listening at 0.0.0.0:8080` isn’t very visible in the
logs of `trunk serve`, and can be easily be lost if the user does
multiple changes before looking at them. A beginner to web development
may not have the reflex to open this address, or may try to open
`dist/index.html` directly. In both cases he will not be able to see its
application.
2021-10-15 21:35:30 +01:00
mc1098
dbd8545a03
Add documentation for wasm-bindgen (#2082)
* Add documentation for wasm-bindgen

Adds a wasm-bindgen section to docs and gives a high level
description of it's crates and how they are used with Yew.

* Fix typos and formatting

* Expand JS example section

* fix re-export web_sys through yew info

* Add HtmlSelectElement feature

* Fix identing

* Fix code example comment
2021-10-02 19:59:50 +02:00
Jon Cahill
4ab710c0e5
Update tutorial to use use_effect_deps instead of use_effect (#2090) 2021-09-27 13:18:37 +01: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
b04026db59
Fix misleading information on events page (#2046)
The events page made a specific reference to the currentTarget of an
event and provided a link to MDN, however, Yew events have the
currentTarget of `body` when using the `html!` macro because of the global mutliplexer.
2021-09-11 21:33:10 +01:00
mc1098
9035fa5071
Add documentation for infinite loops (#2040)
* Add documentation for possible infinite loops

Explains with an example of how a component could cause an infinite loop
to occur. This applies to both `v0.18` and `master`.

* Capitalize "Yew"

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

Co-authored-by: Simon <simon@siku2.io>
2021-09-08 23:05:57 +02:00
mc1098
282eb1943f
Expand event documentation for next (#2036)
* Expand event documentation

* Add import for code block

* Fix formatting
2021-09-06 21:02:58 +01:00
Xavientois
eeddcb95be
Add "struct update" syntax to pass props to component (..props instead of with props) (#2024)
* Reword to use double-dot syntax instead of "with"

* Implement double-dot syntax for props in components

* Update documentation with new syntax

* Update forgotten doc

* Add descriptive comments

* Check props and base expression

* Make compatible with 1.49.0 by removing then

* Fix website tests

* Update error output

* Implicitly convert string literals to String if they are listed as props

* Remove unused keyword

* Rename function for checking if string literal

* Fix weird formatting

* Update code based on review

* Update website/docs/concepts/html/components.md

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

* Base expression span includes dot2 now

* Improve specificity of error message

* Chain together error messages

* Add an example failure case to illustrate combined error message

* Update based on review comments

* Fix missing clones

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-09-06 06:41:51 +01:00
Matt
df3303f00b
Development tips update: Jetbrains' proc-macro support and functional component template (#2028)
* jetbrains' proc-macro support and functional component template

* fix code fence formatting

* more accurate phrasing

* better template

* better template
2021-09-04 18:28:10 +01:00
mc1098
e1b85b2b80
Move tutorial to next docs (#2032)
Tutorial should be in the docs so that it can be matched to the version
yew that a user is trying to be informed on.

The tutorial now comes under the scope of website testing so had to
tweak the tutorial to pass the tests.
2021-09-04 17:38:17 +02:00
Christian Beier
915abba985
Fix typo in docs listing external libs (#2027) 2021-09-01 13:21:02 +01:00
rjmac
7a55441dae
Add "replace route" call as a companion to "push route" (#2023)
* Add "replace route" call as a companion to "push route"

* Fix test

* Make the yew-router tests run

Co-authored-by: Robert Macomber <robertm@mox>
2021-08-29 23:57:22 +02:00
mc1098
ed2e1ea00e
Add testing for website code blocks (#2014)
* Add doc-test to test website code snippets

Heavily inspired by tokio-rs/website repo.

* Fix code snippets to pass doc tests

Some code snippets are explicitly ignored and some are not run
to avoid having to include dependencies for one liners.

* Add website code snippet tests to CI

* Fix CI

* Remove doc-test from workspace

* Exclude doc-test from workspace

* Refactor code snippets and tests

Code snippets can import types from doc_test crate i.e.:
```rust
use doc_test::agents::EventBus;
```
This allows for moving some boilerplate away from the example and still
checks that the code compiles correctly.

Also some slight changes to some of the examples and the information
about `ComponentLink` which is deprecated.

* Move doc-test to packages

* Rename doc-test crate to website-test

The new name makes it more clear the purpose of this crate.

* fix ci
2021-08-28 13:17:28 +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
Sheldon Young
1474c0a282
Fix instructions in project-setup.md (#2004)
* Fix instructions in project-setup.md

Fix unusual formatting, add missing instructions for wasm-bindgen-cli

* Update project-setup.md

Add Docasaurus markup and abbreviation.

* Update website/docs/getting-started/project-setup.md

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

* Update project-setup.md

* Update project-setup.md

* Update project-setup.md

$'s removed.  I agree that aesthetically it's pleasing it's more important to be easier to copy and paste.  Thank you for the suggestion.

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-08-20 08:05:12 +02:00
mc1098
c6099cf875
Remove InputData & ChangeData (#2000) 2021-08-16 18:02:14 +02:00
Xavientois
c1226a2813
Add shorthand syntax for props (#1970)
* Allow shortened prop syntax

* Use new syntax where appropriate

* Apply suggestions from code review

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

* Add tests to hit newly added error messages

* Fix clippy lints

* Re-trigger CI

* Revert error text

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-07-31 23:01:02 +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
bakape
d89f1ccc5c
Optimize VTag construction, memory footprint and patching (#1947)
* yew-macro: optimize VTag construction in html! macro

* yew/vtag: decrease VTag memory footpting and construction args

* yew,yew-macro: optimize VTag contruction, memory footprint and diffing

* yew/vlist: revert to VTag boxing

* yew-macro: add clippy allow for nightly rust

* yew-macro:  fix allow namespace

* *: bump MSRV to 1.49.0

* yew/vnode: restore == for VTag comparison

* yew/vtag: clean up reference casting

* yew-macro/html_element: fix error span regression
2021-07-18 18:26:52 +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
mc1098
0f92d4878e
Add focusin and focusout event support (#1945)
* Adds focusin and focusout event support

* Update element-fail.stderr file
2021-07-09 19:21:44 +02:00