* enable interning
* intern tag names
* intern attribute keys and event listener types
* intern attribute values
* cache and clone elements
* clean up the node cloning version a bit
* use HashMap instead of Vec for element cache
* Revert "intern attribute values"
This reverts commit 28653c4660dcf1942fab3b0ad7d4c840b96e0f2a.
* add `enable-interning` feature to Yew that activates the same in wasm-bindgen
* remove interning feature
use instead of NodeRef, decoupling the two
fixes#3043
* implement internal DomSlot
* move DomSlot into submodule of dom_bundle
* hide behind feature csr
* add test cases
* write get in continuation style, this saves a clone
* private DomSlot::get
* 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>