Commit Graph

54 Commits

Author SHA1 Message Date
GitHub Action 4d96d3d87d (cargo-release) version yew-macro-v0.19.3 2021-12-11 19:44:22 +00:00
Julius Lungys 457e98682d
Fix failed release (#2261)
* Revert "(cargo-release) version yew-v0.19.2"

This reverts commit feb45d81bc.

* (cargo-release) version yew-macro-v0.19.2

* remove publish = false
2021-12-11 21:31:34 +02:00
Cecile Tonglet 63eb95ca44 (cargo-release) version yew-macro-v0.19.1 2021-12-07 19:23:47 +01:00
Julius Lungys d3d4b1dae6
(cargo-release) version yew-macro-v0.19.0 (#2245) 2021-12-06 15:33:32 +01:00
Julius Lungys 1c49e89450
Automatic publishing actions v2 (#2241) 2021-12-06 11:47:47 +01:00
Cecile Tonglet 3858aededd
Add the ability to add child nodes conditionally in `html!` (#1609)
* Initial commit

Forked at: 66d506e133
Parent branch: origin/master

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

* WIP

Forked at: 66d506e133
Parent branch: origin/master

* CLEANUP

Forked at: 66d506e133
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 75b1a85c28.

* 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
Matt 4c3d6934a8
Remove extra braces in html_nested macro (#2169)
* removed unused braces from html_nested marco

* allow specifying test name

* also fix for html! macro

* also fix for html! macro

* remove misplaced #[allow(unused_braces)]
2021-11-21 17:09:30 +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
Jonas Platte 39886d4675
Allow Classes properties to be created from string literals (#2141)
* Allow Classes properties to be created from string literals

* Update test output
2021-11-11 22:02:05 +02:00
Muhammad Hamza 2f47b09da4
Add custom type for attribute values (#1994)
* Add custom type for attribute values

* fix tests/example

* Remove `PartialEq<String>` and it's usage

* `ReferenceCounted` -> `Rc`

* fucking fake

* please CI, just turn green
2021-11-08 18:11:22 +01:00
mc1098 77b46bfa40
Fix trybuild (#2103) 2021-10-08 01:57:24 +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
Xavientois 97498cdfcd
Use into_prop_value to convert str prop to Option<String> (#2080) 2021-09-24 09:00:39 +02:00
mc1098 adb3fcfce1
Update dependencies (#2064)
General review of dependencies, removing ones that are not used and
bumping up minor versions to avoid breakage.

Consistent use of caret so that we use the most recent minor/patch
version of a dependency when building Yew crates.
2021-09-19 11:14:08 +02:00
mc1098 c4dee74e4a
Add support for missing boolean attributes (#2051) 2021-09-12 20:03:03 +01:00
mc1098 4c6da9aab3
Add fully qualified primitives in proc macro (#2037)
* Add primitive shadowing in macro tests

* Fix primitive types to be fully qualified
2021-09-07 09:40:09 +02: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
mc1098 58753d9607
Add `no_implicit_prelude` to proc macro tests (#2033)
* Add no_implicit_prelude to derive_props test

* Add no_implicit_prelude to html_macro tests

* Fix function_component macro tests

function_component macro tests weren't being run by try build due to
change in dir name. Imports corrected now that function_component is now
in yew.

Adds no_implicit_prelude to *-pass tests

* Add no_implicit_prelude to props_macro tests

* fix typo in comment
2021-09-05 23:33:30 +01:00
mc1098 c307f07fb8
Fix IntoEventCallback over IntoPropValue (#2025)
PR #1542 didn't merge in the changes from #1989 correctly, this is fixed
in this commit.
2021-08-31 12:10:28 +01:00
Janis Petersons 68d2fdbc59
Dev/listener multiplexer (#1542)
* yew: partial event listener multiplexer

web_sys implementaion compiles but the std_web implementation is unfinished. Keeping this only to commit curretn progress before reverting std_web.

* yew: partial event listener multiplexer

Feature parity with master, except for bubbling.

* yew/listener: fix and test synchronous listeners

* yew/listener: add placeholder comments

* yew/listener: passive listener test

* yew: extend and fix APIs and docs

* yew/listener: event bubbling

* clippy: ignore warning

* Update yew/src/callback.rs

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

* Update yew/src/html/listener/listener_stdweb.rs

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

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* yew/listner: remove redundant function

* yew/listner: restore delibarate formatting

* yew/callback: make Flags a newtype

* yew/listener: use utility function

* yew/listener: deferred listeners

* yew/listner: input and change tests

* yew/listener: optimize listener registration

* yew/listener: remove benchmark placeholders

Seems easybench-wasm does not support specifying a module path.

* yew/callback: revert CallbackOnce -> Once

* yew: convert listener_tests to a build flag

* Apply suggestions from code review

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

* yew: fix doc comments

* yew: simplify iteration

* yew/remove unneeded default passive listeners

* yew/listeners: DRY some more

* yew/listener: fix clippy warnings

* yew/listeners: remove legacy comment

* yew/listeners: document stopping propagation

* yew/listeners: update tests

* ci: see how test run on stable

* ci: let's find the new MSRV

* ci: try to run integration tests only on stable

* yew/test: clean up residual dirty state

* yew/listeners: minor doc string and inline fixes

* yew/listener: document reasonning for function

Co-authored-by: Simon <simon@siku2.io>
2021-08-28 18:56:03 +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 f574c2fce3
Fix onsubmit handler to take Event (#2009)
onsubmit takes a `SubmitEvent` which is not available in web_sys.
`SubmitEvent` does not inherit from `FocusEvent` so
`FocusEvent::related_target` panics too!

As with onformdata onsubmit will use `Event` to remain safe and requires
users to define their own type or use Reflect api.

Trybuild change because of the new comment.
2021-08-22 00:16:28 +02:00
Karlitos 855de12313
Fix rust-analyzer #[derive(Properties)] warnings (#2007)
Fix #2006
2021-08-18 19:57:15 +02:00
mc1098 c6099cf875
Remove InputData & ChangeData (#2000) 2021-08-16 18:02:14 +02:00
Muhammad Hamza c6458f124a
Allow taking `Fn(EVENT)` for callbacks too (#1989)
* Allow taking `Fn(EVENT)` for callbacks too

* fix bad test

* fmt

* add tests
2021-08-09 17:53:49 +02:00
Maciej Hirsz 47550292d5
Support const generics in `#[derive(Properties)]` (#1978)
* Support const generics in #[derive(Properties)]

* Test and tweak comment
2021-07-31 23:09:57 +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
bakape 8fbb1a24cc
Static attribute lists (#1962)
* 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/attributes: static attribute keys and values

* yew/attributes: use boxed slices and inline dynamic class construction

* Update packages/yew/src/virtual_dom/vtag.rs

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

* yew/vnode: revert mismerge

* yew/classes: add safety explanation comment

* Update packages/yew/src/utils/mod.rs

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

Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-07-31 23:00:10 +02:00
Xavientois c9deba05f1
Fix clippy lints from 1.54.0 (#1976)
* Fix clippy lints from 1.54.0

* Format fixed code
2021-07-30 17:21:45 +02:00
Xavientois 26d42ba2a9
Remove unused punct field from props (#1969) 2021-07-25 14:52:04 +02:00
bakape f2504f4a97
yew/vlist: optimize diffing and patching (#1555)
* yew/vlist: optimize diffing and patching

* yew/vlist: fix key difference point detection

* yew-macro: update stderr

* vlist: store on the list, if all the children are keyed

* yew/vlist: simplify iterators

* yew/vlist: more short-circuiting during diff

* yew/vlist: clone Rcs instead of referencing

* yew/vlist: remove redundant branching

* yew/vlist: remove newline

* yew/vlist: remove false comment

* yew: partial vector deconstruction

* Apply suggestions from code review

Co-authored-by: Teymour Aldridge <notifications@reasoning.page>
Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com>

* yew: use links in doc comments

* Update packages/yew/src/virtual_dom/mod.rs

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

* yew: update insert_node() calls

Co-authored-by: Teymour Aldridge <notifications@reasoning.page>
Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com>
Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
2021-07-18 21:20:49 +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
nitnelave 2e8f52c73f
Fix case warning on derived properties (#1929)
When deriving `Properties`, the compiler sometimes complains of the
non-Camel-case `Foo_build`. This fixes the issue.
2021-06-26 17:11:09 +02:00
Jens Reimann b03f02f624
Bring back &str assignment to optional properties (#1895)
This drops the "optional" conversion concept in favor of directly
converting to `Option<T>`.

fixes #1888
2021-06-07 17:15:59 +02:00
Hamza 8fc81b47ee Fix issues after cherry-picking 2021-06-05 23:00:58 +02:00
bakape e1f093858b yew-macro: fix inability to set the autoplay atribute (#1866) 2021-06-05 23:00:58 +02:00
Cecile Tonglet e1f539a085 (cargo-release) version 0.18.0 2021-06-05 23:00:58 +02:00
Cecile Tonglet e99e83ad37 Helper to build changelog (#1845) 2021-06-05 23:00:58 +02:00
Simon f17d370217 Implicit optional attributes (#1637) 2021-06-05 23:00:58 +02:00
Xavientois 3699dd2bdd
Change match statement to if (#1884) 2021-05-28 09:04:59 +02:00
bakape 7cac4d4756
Optimize vtag construction (#1867)
* yew-macro: optimize VTag construction in html! macro

* vtag: remove inlining suggestions

* vtag: clean up doc comment
2021-05-23 23:33:25 +02:00
Teymour Aldridge 97f67fa77d
Apply Clippy lints. (#1863)
* Apply Clippy lints.

* f

* f
2021-05-21 17:35:30 +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
Hudson Shykowski cc51208a48
Implement .into_inner() for Json (#1816)
* Implement .into_inner() for Json

This allows users to use .into_inner() the same way it would be possible
in the serde crate. Previously, it was only possible via dump.0 (which
looks gross), or Json(dump).

* Fix an error using HtmlBlock

The definition uses {content, brace} but the usage used [brace, content}

* Update packages/yew/src/format/json.rs

Co-authored-by: Simon <simon@siku2.io>
2021-04-12 20:04:38 +02:00
Muhammad Hamza 991abab7e1
Update Rust version for macro tests to 1.51 & enable const generics tests (#1801)
* update rust version for macro test to 1.51

* enable const generic tests

* run integration tests using MSRV

* am blind

* clippy, fmt

* apply suggestion
2021-03-30 22:35:21 +02:00
Simon 37401402a1
Allow the use of Rust keywords for element names (#1772)
* time for more hygiene

* update corresponding tests

* while I'm at it

* now let's fix the actual issue

* fix the publish examples CI while I'm at it

* resolve clippy warnings
2021-02-28 15:49:58 +01:00
Luke Chu bc46062864
Refactor html tag peeking (#1738)
* Fix html macro tests

* Fix generics with lowercase type param

* Satisfy clippy

* Parse generics with multiple type params

* Reorganize tests

* Remove Peek for HtmlTree

* Add additional test

* cargo fmt

* Remove peek_component_type

* Remove failing tests
2021-02-27 15:49:45 +01:00