* 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!
* don't attach noderef to components, add test case
* remove node_ref from VNode and VComp
* fmt & macro tests
* remove uneeded test & todo
this test is done at compile time. there's no node_ref field so it can't be set
* feature soundness & clippy
* add marker field, in an attempt to reduce bundle size
* Update migration guide
* Makes Prepared States to be Rc'ed.
* Update example.
* Make prepared states work on none runtime as well.
* Remove more feature flags.
* Users always have to manually construct dependency into Rc.
* Import Rc.
* Revert "Users always have to manually construct dependency into Rc."
This reverts commit 9eee1da3e9a46e69a7b07e6064eb163e06261bfb.
* Revert "Import Rc."
This reverts commit d6bb90dc155d2bf87fd18eec4b78b8e07a9cc7a7.
* 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
* init use_bridge content
* cargo fmt
* cargo +nightly fmt --all
* more sensible code
* make example compile
* make example compile (for real this time)
* update docs
* oops
* oops
* make super work
* this is rust, not C
* remove props checking, but take builder by mut ref
* allow property name `build`
* add rough state token machinery
* first working impl, readd props checking
* improve error message
* add documentation and last adjustements
* address review
* don't shift on normal props updates
would remove focus from elements and fire other
dom mutation events we don't need or want
* rename mode -> creation_mode
it's not updated when the component finishes hydration
* rename node_ref to internal_ref for consistency
* fix the bug, should return internal_ref as node_ref gets unset during reconciliation
* also no need to shift during hydration props update
* debug: encode hydration invariant
* fix: next_sibling of descendents not updated
* add test case for regression
* address review and add one more test
* partially undo #2673
VList again has a DerefMut implementation
the internal fully_keyed state now has an "indeterminate" variant
instead of being a bool, this recomputes it during reconciliation
* add Copy impl to FullyKeyedState
* Delay props.
* Fix next sibling change not synced.
* Use shifting instead.
* Update docs, minor adjustments.
* More predictable props update.
* Delay longer.
* Only delay props during hydration.