433 Commits

Author SHA1 Message Date
Kaede Hoshikawa
989d804947
Fix Clippy for 1.63 (#2825) 2022-08-12 22:16:05 +09:00
Muhammad Hamza
f640fc7c18
Allow keywords after dash in element and attribute names (#2820) 2022-08-08 23:36:10 +02:00
Muhammad Hamza
d422b533ea
onsubmit should be a SubmitEvent (#2816)
* onsubmit should be a SubmitEvent

* At least v0.3.59

* Enable feature, add re-export

* fmt
2022-08-08 02:10:38 +05:00
WorldSEnder
4206da7c41
Replace custom logging by tracing (#2814)
* 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!
2022-08-07 21:06:01 +02:00
Kaede Hoshikawa
f0b0df33e6
Fix VList Stream in SSR (#2801)
* Fix rendering stream.

* Update naming.

* Resolve first, then transfer.

* Use slice pattern.

* Update workflow paths.

* Use join_all.

* Do not map.

* Remove map.

* Fix rustfmt.
2022-08-07 11:59:54 +09:00
Cecile Tonglet
c802167419
Make fn update() re-render the component by default (#2786) 2022-08-01 11:07:19 +01:00
Kaede Hoshikawa
de613fa832
Implement sleep and interval for Yew Platform (#2784)
* Rename runtime.

* Implement sleep and interval.

* Replace sleep usage with one provided by the platform.

* Fix imports.

* Fix tests.

* Enable futures on gloo.

* Always inline sleep.

* Fix tests.

* Implement sleep in house.

* Remove futures feature.

* Oops.

* Prevent Excessive Polling.
2022-07-31 23:17:34 +09:00
Raphaël Duhen
8f269bbd61
docs: remove repeated word (#2788) 2022-07-23 21:20:40 +09:00
Muhammad Hamza
544990a6b4
Remove component NodeRef (#2783)
* 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
2022-07-21 01:32:26 +09:00
Kaede Hoshikawa
924792c002
Enable Dependabot for Examples and Tools (#2785)
* Enable dependabot for examples and tools.

* Make everything to use Gloo.

* Require features for binaries.

* Update every Friday.
2022-07-21 01:23:22 +09:00
Kaede Hoshikawa
9d94f24a11
Prepared States dependency should be Reference Counted (#2769)
* 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.
2022-07-19 22:59:39 +09:00
Kaede Hoshikawa
6f53a4e677
Document features automatically. (#2780)
* document features automatically.

* Document with `#[cfg(...)]`.

* Fix Clippy.

* Adjust unreleased docs header.

* Adapt dark mode as well.
2022-07-18 20:10:14 +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
WorldSEnder
11424bd840
Fix: prevent bubbling of !bubbles() events (#2768)
* fix: prevent bubbling of !bubbles() events

* fmt: cargo fmt
2022-07-01 19:56:31 +02:00
dependabot[bot]
0af7a4d038
Update implicit-clone requirement from 0.2 to 0.3 (#2763)
Updates the requirements on [implicit-clone](https://github.com/rustminded/implicit-clone) to permit the latest version.
- [Release notes](https://github.com/rustminded/implicit-clone/releases)
- [Commits](https://github.com/rustminded/implicit-clone/compare/v0.2.0...v0.3.1)

---
updated-dependencies:
- dependency-name: implicit-clone
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-01 21:41:45 +09:00
dependabot[bot]
814e52daac
Update gloo requirement from 0.7 to 0.8 (#2766)
Updates the requirements on [gloo](https://github.com/rustwasm/gloo) to permit the latest version.
- [Release notes](https://github.com/rustwasm/gloo/releases)
- [Commits](https://github.com/rustwasm/gloo/compare/0.7.0...0.8.0)

---
updated-dependencies:
- dependency-name: gloo
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-01 21:32:32 +09:00
Kaede Hoshikawa
8013724b5d
Fix Workflow (#2767)
* Fix clippy.

* Fix cargo version as well.

* Fix changed pkgid syntax.
2022-07-01 21:08:11 +09:00
Kaede Hoshikawa
7f5eb3890c
Streamed SSR Response (#2697)
* yew::platform?

* Stream Response.

* Migrate example

* Remove old implementation.

* Remove extra implementation.

* Prefer String instead of Cow.

* Fix MSRV.

* Fix trybuild.

* Optimise Memory Allocation.

* More optimisation.

* BufWriter.

* Fix tests.

* Optimise BufWriter.

* Remove more allocations.

* Allow setting of buffer capacity.

* Fix capacity size.

* Fix capacity size.

* Remove unneeded const notation.

* Fix macro tests.

* Slightly optimises BufWriter committing logic.

* Optimise Implementation.

* Move BufWriter to a separate file.

* Additional Implementation Note.

* Adjust API so it matches `std::channel::mpsc::channel`.

* Fix feature soundness.

* Make a compatibility layer on channels.

* Fix clippy.

* Fix feature soundness.

* Fix CI.

* Inlining.

* Add documentation.

* Punctuation.

* Switch to tokio channel.

* Remvoe pin-project.

* Fix feature soundness.

* Typo.

* Move io to platform.

* Tokio does not compile.

* Fix workflow.

* Restore wrongly removed docs.

* Does tokio work?

* Switch back to tokio.

* Remove pin-project.

* Use cargo resolver 2.

* Add panic notice.

* Update documentation.

* Properties does not have to be send.

* Fix capacity checking as pointed in the review.

* Implementation order.

* Update note.
2022-07-01 14:26:12 +05:00
Shrey Sudhir
f82af86c66
add use_bridge docs (#2722)
* 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
2022-06-24 20:17:58 +02:00
Cecile Tonglet
7ddf26752f
Introduce immutable string, array and map (#2563) 2022-06-24 16:58:20 +01:00
Kaede Hoshikawa
6b89e21034
Migrate to once_cell (#2750)
* Replace lazy_static with once_cell.

* Migrate to clap v3, so 1 less lazy_static.

* Convert with `.into()`.
2022-06-24 19:32:00 +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
Kaede Hoshikawa
a5973bdca6
Allow VNode props to be converted to Children. (#2749)
* Allow VNode props to be converted to Children.

* Also implement ChildrenWithProps as well.

* Update macro tests.
2022-06-24 19:06:09 +05:00
WorldSEnder
cda74c464b
Fix generic props structs (#2746)
* fixup of generic props structs

* fix build errors from msrv 1.57 on time crate

* build wasm-bindgen-cli with cargo +stable
2022-06-23 11:21:52 +02:00
WorldSEnder
75bb9031cd
Redo derive(Properties), take 2 (#2729)
* 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
2022-06-21 22:33:57 +02:00
Muhammad Hamza
526ecb975e
Increase MSRV to 1.56.1 (#2740) 2022-06-19 18:45:52 +05:00
orzogc
7221933f8c
Callback::reform() should return Callback<T, OUT> (#2719) 2022-06-05 23:31:17 +02:00
WorldSEnder
cb5a609e08
Dont shift on normal props updates (#2705)
* 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
2022-05-30 07:47:19 +02: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
WorldSEnder
b90c99af0c
Partially undo #2673, different approach for the DerefMut impl of VList (#2692)
* 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
2022-05-24 23:05:37 +02:00
Kaede Hoshikawa
b29b4535b7
use_prepared_state & use_transitive_state (#2650)
* Some initial implementation.

* Read prepared state during hydration.

* Decode each state with bincode.

* Feature gate prepared state.

* Update documentation.

* Switch from base64 to String.

* cargo +nightly fmt.

* Fix test.

* Add some tests.

* Minor adjustments.

* Remove unused marker.

* Update example.

* Add use_transitive_state.

* Remove unused dead code notation.

* Opt for better code size.

* Add tests for use_transitive_state.

* Fix cargo fmt.

* Fix rustdoc.

* Asynchronously decode data during hydration.

* Fix feature flags.

* Fix docs.

* Feature flags on ssr_router.

* Adjust workflow to reflect feature flags.

* Fix features.

* Restore wasm-bindgen-futures to be wasm32 only.

* Revert wasm-bindgen-futures.

* Second attempt to remove wasm-bindgen-futures.

* Remove spaces as well.

* Address reviews.

* Better diagnostic message.

* Update diagnostic messages.
2022-05-24 13:35:16 +09:00
Kaede Hoshikawa
027ab6af8b
Block props update during hydration (#2665)
* 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.
2022-05-24 08:29:13 +09:00
WorldSEnder
6f6c61b975
Allow macro invocations as prop values (#2687)
* fix: macro invocations in props #2267

convert macro invocation Item statements to Exprs

* remove now useless braces in docs
2022-05-18 07:58:46 +02:00
Shadlock0133
08fb060afb
Point to callback_future in callback docs (#2674) 2022-05-11 12:56:44 +02:00
WorldSEnder
d7b43bbc26
Change access to VList children to a wrapper (#2673)
this should avoid having to manually call recheck_fully_keyed

* add mutable accessor to children
* fix workflow
* fix markdown example
* remove recheck_fully_keyed
2022-05-11 12:37:39 +02:00
WorldSEnder
1d579a8bf4
Rework a bunch of cfg(feature) flags to be more principled (#2666)
* rework a bunch of feature flags to be more principled

* fixup of Collectable

* silence clippy

* unfix Mountable trait

leads to bundle size increase, so stick to the optimized version

* use required-features for function_router

* use --all-features in various places

* disable tokio dependency on wasm tests again

* add some #[inline] annotations

* merge one more feature annotations

* fixup: remove a line connected to trace_hydration
2022-05-07 21:17:47 +05:00
Kaede Hoshikawa
00b94d0051
Make Switch to accept a closure as render function directly (#2659)
* RenderFn can be be directly Fn() now.

* Switch switch to function component.

* Make Link a function component.

* Remove non-exhaustive.

* Add migration guide.

* Update Website Docs.

* Fix CI.

* Pushing to Navigator no longer requires an owned instance.

* Fix CI.

* Fix code size.

* Further optimisation.
2022-05-06 09:56:49 +09:00
Dietmar Maurer
e5880136bb
Attributes: Fix apply_diff_index_maps (#2653)
* Attributes: Fix apply_diff_index_maps

The old algorithm simply stops when key name/order changes, which
is simply wrong.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>

* add test case for test for bug #2653
2022-05-05 15:20:05 +09:00
Muhammad Hamza
18f004bc57
Fix cargo make config and tests (#2640)
* remove pr-flow, run all the tests when asked

* make tests that were never run pass

* run tests cargo make properly

* use wasm-pack-base test for running wasm tests

* cargo make config should be good

* update CI
2022-04-28 21:04:55 +05:00
Kaede Hoshikawa
2576372e26
Delay Hydration second render until all assistive nodes have been removed (#2629)
* Separate hydration and render queue.

* Revert "Fix issue with node refs and hydration (#2597)"

This reverts commit 469cc341c340bd0093d9233847f523b66a18fd90.

* Priority Render.

* Add some tests.

* Add more tests.

* Add test result after click.

* Fix test comment.

* Fix test timing.

* Restore test.

* Once AtomicBool, now a Cell.

* Prefer use_future.

* Revealing of Suspense always happen after the component has re-rendered itself.

* Shifting should register correct next_sibling.

* Revert to HashMap.

* cargo +nightly fmt.

* Fix comment.

* Optimise Code size?

* Add comment if assertion fails.

* Revert "Merge branch 'hydration-4' into fc-prepared-state"

This reverts commit 427b087d4db6b2e497ad618273655bd18ba9bd01, reversing
changes made to 109fcfaa127aefc5fa3c697e254fe2c049292be2.

* Revert "Revert "Merge branch 'hydration-4' into fc-prepared-state""

This reverts commit f1e408958d94cb13813ce75aa6f0aad06c9fa3e8.

* Redo #2957.
2022-04-25 07:35:55 +09:00
Lucille Blumire
2db4c81ad6
Add VTag::into_children (#2638)
* Add `VTag::into_children`

Currently, VTag supports `children` and `children_mut`, but not `into_children` to complete the pattern. This is useful if someone wishes to destructively acquire the children of a VTag to reparent them to a different VTag.

* Repair broken doc comment on `VTag::children_mut`

* Remove spaces between functions
2022-04-23 21:06:41 +09:00
WorldSEnder
1794dd01bc
Fix cargo fmt from merge changes (#2636)
Fixup #2630
2022-04-22 17:26:41 +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
Muhammad Hamza
12c9ebb0ea
Move hook API docs to Rustdoc (#2628)
* Move hook API docs to Rustdoc

* npm update, fix links and doc tests and callback docs

* make doc tests pass

* Update packages/yew/src/functional/hooks/use_ref.rs

* Update packages/yew/src/functional/hooks/use_ref.rs

* Update use_ref.rs
2022-04-21 15:28:09 +05:00
WorldSEnder
c2b2f2cf2d
fixes bubbling of events originating in shadow dom (#2627)
when we not explicitly portaling into the shadow, we
should bubble up to the host element and continue.
This fixes custom elements internally using open SD
2022-04-20 16:33:52 +05:00
WorldSEnder
504693ff30
Introduce use_future_with_deps (#2615)
* introduce use_future_with_deps

* add documentation to use_future

* use_future_with_deps now uses Rc<D> instead of &D

* fix expansion and simplify use_future
2022-04-17 21:07:26 +05:00
Kaede Hoshikawa
c5b7790949
Remove IntoComponent (#2579)
* Make Function Component to Implement BaseComponent.

* Remove IntoComponent.

* Inline some methods.

* Move some logic out of proc macro.

* Move position of the self generics.

* Discourage direct implementation `FunctionComponent` & `#[doc(hidden)]`.
2022-04-16 00:44:39 +02:00
Kaede Hoshikawa
6fb547339f
Fix some Hook edge cases (#2592)
* Fix a couple edge cases.

* no implicit prelude.
2022-04-16 01:47:04 +05:00
Jet Li
58db53a026
Allow to consume deps in use_callback (#2617) 2022-04-16 01:43:13 +05:00
dependabot[bot]
d2c3685521
Update gloo requirement from 0.6 to 0.7 (#2613)
Updates the requirements on [gloo](https://github.com/rustwasm/gloo) to permit the latest version.
- [Release notes](https://github.com/rustwasm/gloo/releases)
- [Commits](https://github.com/rustwasm/gloo/compare/0.6.0...0.7.0)

---
updated-dependencies:
- dependency-name: gloo
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-15 12:16:04 +02:00