31 Commits

Author SHA1 Message Date
Cecile Tonglet
7f45af3a66
Make Html (VNode) cheap to clone (#3431)
* Make VNode cheap to clone

* Faster clone for list and portal

* Fixes hopefully good

* clippy

* more fixes hopefully good

* rustfmt

* More fixes

* more fixes...

* more fixes

* Update element-fail.stderr

* Macro fixes...

* CLEANUP

* Benchmark with divan

* WIP workflow

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* Use the 2 workflows approach, will fix after merge if not working

* CLEANUP

* can i push that change here pretty please

* Trigger CI
2023-10-27 21:43:03 +05:00
Tim Kurdov
753bafefdd
Remove the dependency on boolinator (#3420)
* removed boolinator from dependencies of yew-macro

* removed boolinator from the dependencies of tools/website-test

* fixed formatting

* removed a lint fix
2023-09-29 20:33:24 +09:00
Muhammad Hamza
3e9e253e66
Keep checked attribute for elements without special handling (#3373)
* Return checked attr for non-input elements

* Add tests

* fine
2023-08-12 02:16:06 +09:00
Xu Shaohua
a9ab085e74
Fix input dynamic text rendered as textarea (#3239) (#3301) 2023-08-05 18:58:19 +05:00
Kaede Hoshikawa
8b9e164d7e
Update Dependencies to Fix CI (#3326)
* Update dependencies.

* Update dependencies.

* Fix gloo breaking change.
2023-07-01 01:33:18 +00:00
Kaede Hoshikawa
71b0f206a1
Allow any type to be used as Children (take 2) (#3289)
* Partially copy useful implementation.

* Adjust conversion.

* Temporary fix iterator.

* Add ToString implementation.

* Add Renderable trait.

* Make Macro tests pass.

* Add tests for render_prop as Children.

* Update benchmark and Children used in yew packages.

* Selective suppress lints.

* Rollback unintentional rollback.

* Fix rustfmt.

* Remove unneeded implementation.

* Update Comment.

* Rollback more changes.

* Rollback more changes.

* Fix website.

* Fix documentation tests.

* Add prelude.

* Fix test.

* Blanket Implementation for &'_ T for Renderable types.

* Implement Renderable for &str.

* Update signature.

* Update children to Html in examples.

* Remove unnecessary dereferencing.

* Rollback nested_list example.

* Fix comment.

* Convert to Pattern Matching.

* Add tracing issue.

* Rename Renderable to ToHtml.

* Move ToHtml to yew::html.

* Convert more to match pattern.
2023-06-11 15:33:39 +05:00
Vlad Beskrovny
c7b7e45e4c
Implement component name completion in html! for IntelliJ Rust plugin (#2972) 2023-02-02 22:36:51 +09:00
Kaede Hoshikawa
456a05ba40
Fix clippy for 1.67 (#3100)
* Fix clippy for 1.67

* Fix trybuild.
2023-02-01 21:57:05 +05:00
WorldSEnder
bb71b5db61
Fix checked property being reset (#2907)
if the value is uncontrolled, do not touch it. Only if it is explicitly given
2022-10-08 20:50:19 +05:00
Muhammad Hamza
4c35f95350
Bind to properties instead of attributes by default (#2819)
* Set to properties, not attributes

* fix tests

* Add tests

* enable disabled test, fmt

* Introduce @key syntax to forcefully set as attribute

* Everything compiles

* More tests

* id as property

* This was not meant to be committed

* Make test pass, fmt + clippy

* fucking rustfmt

* is this enough formatting

* that was not supposed to be commited

* apply review

* fmt

* fix CI

* will you be happy now, clippy?
2022-08-14 21:41:04 +02:00
Muhammad Hamza
a4e70914ac
Convert nightly from a feature flag to a compiler flag (#2827)
* `nightly_yew` compiler flag instead of `nightly` feature

* update ci

* update ci: 2

* fmt & nightly_yew for examples

* update size-cmp too
2022-08-15 04:03:45 +09:00
wdcocq
5570710cdf
Fixed NodeRef not being implicitly cloned with components (#2775)
* Use IntoPropValue for node refs in html component

* Add NodeRef ImplicitClone test for html element

* Change node_refs example to use ImplicitClone

* Reuse key and ref attribute wrapping
2022-07-07 21:00:27 +05:00
Muhammad Hamza
54de041981
Nightly features (#2743)
* Nightly features

* Tests

* Fix tests

* Don't invent new syntax

* Do not impl Fn for UseReducerHandle

* Simplify UseForceUpdateHandle

* Manually specify clippy features

* Revert "Simplify UseForceUpdateHandle"

This reverts commit 761dbb0f8bb7c280054d55dcc724f08604ee4ece.

* `UseForceUpdateHandle`

* fmt
2022-06-24 19:21:02 +05:00
WorldSEnder
e68060afa7
Span hygene and editor UX (#2702)
* add span for closing tag to macro expansion

* decouple name resolution from locations

* commit to new macro errors
2022-05-25 13:01:10 +02:00
Muhammad Hamza
c28a71e78e
Use nightly for Rustfmt (#2630)
* add rustfmt.toml, use nightly in CI, update contributing docs

* run `cargo +nightly fmt`
2022-04-21 23:21:15 +05:00
WorldSEnder
8978baa45d
Fix casing of dynamic tags (#2578)
* fix casing of dynamic tags
* add test case for unknown tag names
* add lint for non-normalized tags
2022-04-05 19:07:31 +02:00
Muhammad Hamza
f05ba4152c
Update to edition 2021 (#2354)
* cargo fix --edition

* change edition="2018" to edition="2021" in Cargo.toml
2022-01-12 16:22:00 +02:00
Matt
1ef364ffda
Add braces when html_nested used on html element (#2270)
* add braces when html_nested used on html element

* run rustfmt
2021-12-15 22:56:24 +01: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
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
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
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
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
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
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
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
Simon
f17d370217 Implicit optional attributes (#1637) 2021-06-05 23:00:58 +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
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
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