* Fixing https://github.com/yewstack/yew/issues/2911
Prevents Link onclick behaviour from executing if the Ctrl key (for
Windows and Linux) or Meta Key (For Mac) is pressed.
This technically introduces a bug that means that links will reload the
page on windows machines when the windows key is held down. However,
this error is also in React Router, so I think we can get away with it.
See:
11156ac7f3/packages/react-router-dom/dom.ts (L29)
* Router Links now use default browser behaviour for alt and shift keys.
This change is inspired by 11156ac7f3/packages/react-router-dom/dom.ts (L29)
This allows uses to shift click links to save whatever the link points
at, and alt click on links to open them in new windows
* assert there are no circular references
the check is costly in release builds and should always fail
note that the current PartialEq impl is *not* symmetric!
should be fixed as well, with an improved design
* remove internal test for cyclic node refs
wasm_bindgen does not yet support #[should_panic]
see also https://github.com/rustwasm/wasm-bindgen/issues/2286
* Use AttrValue instead of Cow in Classes
* Wrap indexset into Rc
* Impl ImplicitClone for Classes
* clippy
* Trigger CI
* Update macro stderr
* Copy optimization made for String to AttrValue
* Update macro stderr again
* Add VNode::html_from_raw
* Add docs for VNode::html_from_raw
* feature lock to available flags
* Actually raw
* Formatting + docs
* Tests
* More tests + docs
* fmt
* clippy
* CI
* No <div> around multi top-level nodes
* Update docs
* Fix braw detach
* Clippy & fmt
* Fix compile errors
* I hope you get attacked by Cow, Clippy
* Address review
* Reduce DOM calls
* improve detach bundle impl
* Add more tests
* Update example
* fmt
* Apply review suggestions
* fmt
* fix ci
* fix braw shift with multiple nodes
* rename function name
* fmt
* this should've been there
* ci be green
The following main.rs replicates the clippy warning:
```
use yew::prelude::*;
struct Props {
droppable: Vec<()>,
}
fn component(props: &Props) -> Html {
let props = Props { droppable: Vec::new() };
html! { <Component ..props /> }
}
fn main() {}
```
If I'm not mistaken this happens when using the `..` on any `Properties` with a field that implements `Drop`.
* Replace unwrap with if let to prevent panic
* Add resume after unmount test
* Change BaseSuspense methods to associated functions
* Fix rustfmt issues
* fix portal shifting on reconciliation too often
the public vdom api changes to only allow directly
setting a Node as sibling (still optional) instead of a NodeRef.
This was the intention all along, since the NodeRef was
not dynamically tracked, and creating a portal into a subtree
already controlled by yew is not supported anway.
* fix feature soundness
* fix doc tests
* Various improvements to Classes, oriented around reducing allocations
- `push` no longer performs unnecessary allocations if `self` is empty.
- Most constructors (FromIterator, From, Extend) are now oriented around push, to take advantage of this
- `to_string` and `into_prop_value`:
- No longer allocate an unnecessary `Vec`; they instead preallocate a string of the correct length and push into it directly.
- No longer use a length check + `unsafe`; they instead match over a fallible .next() and proceed from there.
- Additionally, `into_prop_value` no longer builds a `String` or `Rc` if `Classes` contains a single `&'static str` or is empty.
- `From<String>` no longer clones the string if it contains a single class.
- `impl Eq for Classes`
* Fix duplicated is_empty test
* Allow skipping a callback when reforming
This adds a method to the callback, similar to Rust's filter_map, which
allows to reform a callback, but also suppress the emit in case
the reform function returns `None`.
* Update packages/yew/src/callback.rs
Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>
* Implement filter_reform for all Callback output types
As suggested in the PR, this implements filter_reform for all output
types of callbacks by mapping to `Option<OUT>`.
* Fix clippy error
Although I believe that the code is more readable/understandable with
an explicit map, I am not sure adding a clippy exception just for that
is justified. So I applied the clippy suggestion.
Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>
* Adding old_props to fn changed()
* Change old_props type to &Self::Properties
* Update examples that use fn changed() and want old_props
* Fix tests
* Fix invalid test flags
* cargo fmt
* Oops wrong regex
* Revert change for older version
* Remove unnecessary clone
* Add migration guide
* Oh wow the test was not running xD
* add send_stream method for Scope
* add eof stream note
* map stream item type
* No need for nightly, fmt, updates
Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
* Switch to pinned channels.
* Fix ServerRenderer so it's not blocked until the result is resolved.
* Fix tests.
* Remove unused SendError.
* Revert channel-based BufWriter.
* Removed unused fmt module.
* Update docs.
* Add safety comments, adjust borrowing designs.
* Adjust oneshot as well.
* Fix workflow temporarily.
* Cell or UnsafeCell?
* Update safety notice.
* Should be sync.
* Actually should be both.
* Update packages/yew/src/platform/pinned/mpsc.rs
Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
* 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?
* use tracing for logging
* embed spans in the scheduler for tracing
* fix feature soundness
* remove spans from scheduler for now
* feature soundness take 2
* use tracing::* throughout lib code
not yet in testing, and for some errors!