28 Commits

Author SHA1 Message Date
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
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
Kaede Hoshikawa
485a1b8c4a
Function Components & Hooks V2 (#2401)
* Make a use_hook hook with the new Hook trait.

* Implement Lifetime.

* Rewrites function signature.

* Only apply lifetime if there're other lifetimes.

* Cleanup signature rewrite logic.

* Rewrite hook body.

* Port some built-in hooks.

* Finish porting all built-in hooks.

* Port tests.

* Fix tests.

* Migrate to macro-based hooks.

* Fix HookContext, add tests on non-possible locations.

* Fix stderr for trybuild.

* Add 1 more test case.

* Adjust doc location.

* Pretty print hook signature.

* Fix Items & std::ops::Fn*.

* Add use_memo.

* Optimise Implementation of hooks.

* Use Box to capture function value only.

* Detect whether needs boxing.

* Add args if boxing not needed.

* Enforce hook number.

* Deduplicate use_effect.

* Optimise Implementation.

* Update documentation.

* Fix website test. Strip BoxedHook implementation from it.

* Allow doc string.

* Workaround doc tests.

* Optimise codebase & documentation.

* Fix website test.

* Reduce implementation complexity.

* Destructor is no more.

* Documentation and macros.

* Reduce heap allocation and hook complexity.

* Remove Queue as well.

* Prefer Generics.

* Fix typo.

* Remove more allocations.

* Add comments.

* Remove outdated comment.

* Bare Function Pointer for better code size.
2022-01-28 11:51:37 +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
Muhammad Hamza
3ca7c0f90a
Move yew-agent to gloo (#2326)
* move agent to gloo

* rename: agent -> worker

* make it compile

* use gloo-worker from crates.io & fmt
2022-01-05 19:40:27 +05:00
Kaede Hoshikawa
6f6519dab4
Implement PrivateAgent (#2318)
* Implement PrivateAgent, Separate Threaded into PublicAgent & PrivateAgent.

* Add migration docs.

* Update docs.
2022-01-01 19:45:11 +01:00
Kaede Hoshikawa
7d52858d01
Remove context & job agent (#2295)
* Remove context and job agent.

* Revert "Remove context and job agent."

This reverts commit 408f6fcdf062800c9e9852e6662a55ff3eef4533.

* Revert "Revert "Remove context and job agent.""

This reverts commit 44a42dfb313c111ceaa654163c8aa610a88e6a95.

* Update example.

* Fix docs.

* Fix test.

* Rename examples.

* Fix examples & docs.

* Update website/docs/concepts/function-components/custom-hooks.mdx

Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>

* Examples in alphabetical order.

Co-authored-by: Muhammad Hamza <muhammadhamza1311@gmail.com>
2021-12-29 17:15:26 +05:00
Muhammad Hamza
3758e6d077
Refactor and simplify Callback (#2301)
* yeet Callback::once

* yeet Callback::reform

* remove passive overrides

Event's passive state will be determined by sane defaults set by Yew

* clippy

* docs

* make CI happy

* Revert "yeet Callback::reform"

This reverts commit 33e7770d

* why?

I literally tick-marked reformat before commit. Does it not use rustfmt???

* Update packages/yew/src/callback.rs

Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>

Co-authored-by: Julius Lungys <32368314+voidpumpkin@users.noreply.github.com>
2021-12-28 21:27:31 +02:00
Julius Lungys
cf0f59af55
Add paths for yew dependencies (#2265) 2021-12-12 21:19:38 +01:00
GitHub Action
8246827030 (cargo-release) version yew-agent-v0.1.0 2021-12-11 20:12:22 +00:00
Julius Lungys
39724c6d5d
fix yew-agent for release (#2264)
* add mising metadata

* lover version to make it bumpable
2021-12-11 22:09:38 +02:00
Julius Lungys
4515df03ee
Change path versions to tag versions (#2263) 2021-12-11 21:56:01 +02:00
Julius Lungys
bbf57e1efe
add back readmes (#2248) 2021-12-06 15:35:05 +00:00
Julius Lungys
cf488c53b5
Fix: use path versions (#2247) 2021-12-06 16:17:50 +01:00
Julius Lungys
5c477f25c8
Fix cargo tomls for release (#2246) 2021-12-06 16:02:01 +01:00
mc1098
071f1b28df
Refactor use ref hooks (#2093)
* Refactor use ref hooks

`use_ref` has been renamed to `use_mut_ref` and `use_ref` has become a
similar hook for immutable reference.

This is different from React but I think lines up nicely with Rust as a
reference is immutable unless specified to be a mut ref.

* fix CI

Co-authored-by: Hamza <muhammadhamza1311@gmail.com>
2021-11-21 16:20:19 +02:00
Andrew Straw
916dc2e907
allow web worker resource to be relative (#2086)
* allow web worker resource to be relative

fixes #2056

* make backwards compatible with rust < 1.52

* fix clippy warning

* Apply suggestions from code review

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>

* do not reimplement stdlib function

* fixup previous

* improve docstring

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-11-20 15:39:35 +02:00
Shihpin Tseng
a5c343dd62
add Clone implementation for use_bridge (#2150) 2021-11-16 09:06:32 +00:00
Kaede Hoshikawa
fb9c398048
use_bridge hook for agents (#2125)
* Add Redirect Comp.

* Fix router behaviour.

* Fix output.

* Fix pr-flow.

* Remove Redirect.

* Readd 77b46bf.

* Add use_bridge hook.

* Add documentation.
2021-11-12 09:04:03 +01:00
dependabot[bot]
7d873b264c
Update gloo-console requirement from 0.1 to 0.2 (#2122)
Updates the requirements on [gloo-console](https://github.com/rustwasm/gloo) to permit the latest version.
- [Release notes](https://github.com/rustwasm/gloo/releases)
- [Commits](https://github.com/rustwasm/gloo/commits/0.2.0)

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

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-11-11 16:10:31 +01:00
Muhammad Hamza
dd2db93996
Use functions from gloo_utils instead of re-implementing them (#2124)
* Use functions from `gloo_utils` instead of re-implementing them

* Remove `anyhow` dependency

* fix errors

* review + post merge fixes
2021-11-11 16:45:08 +02:00
Andrew Straw
0e4be56a18
yew-agent: add missing web-sys features (#2085) 2021-09-26 08:33:00 +01:00
mc1098
4ca68e07ca
Fix unmaintained anymap dependency (#2071)
This changes the dependency on anymap which is unmaintained and has a
soundness bug to an updated fork `anymap2` where the soundness bug has
been fixed.
2021-09-21 21:10:14 +02:00
mc1098
adb3fcfce1
Update dependencies (#2064)
General review of dependencies, removing ones that are not used and
bumping up minor versions to avoid breakage.

Consistent use of caret so that we use the most recent minor/patch
version of a dependency when building Yew crates.
2021-09-19 11:14:08 +02:00
mc1098
0e52b88742
Update gloo dependencies in yew and examples (#2021)
Updates to using the latest stable gloo, in some cases removing
dependencies on `master` branch.

Removes `weblog` in favour of `gloo_console`, where applicable.
2021-08-29 02:13:06 +01:00
Xavientois
c9deba05f1
Fix clippy lints from 1.54.0 (#1976)
* Fix clippy lints from 1.54.0

* Format fixed code
2021-07-30 17:21:45 +02:00
Francis Murillo
1721669d71
Drop Private worker handler when bridge is dropped (#1944) 2021-07-19 01:15:16 +02:00
Muhammad Hamza
2412a68bee
Refactor and cleanup codebase (#1842)
* remove yew-dsl

* remove yew-components

* remove yew-services

* remove yew::format

* fix CI

* move yew::agent to yew-agent crate

* move yew-functional to yew

plus a couple of misc fixes

* move futures and neqassign out of yewtil

* move yewtil::store to yew_agent, remove yewtil

* formatting

* fix tests

* update docs

* use `rustwasm` gloo repo instead of mine

* add docs

* use rustwasm/gloo repo

* remove unused file

* fix Makefile.toml

* Fix issues after rebase

* Apply suggestions from code review (part 1)

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>

* Apply suggestions from code review (part 2)

* move `#[function_component(_)]` tests

missed those before

* Apply suggestions from code review

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>

Co-authored-by: mc1098 <m.cripps1@uni.brighton.ac.uk>
2021-07-18 15:57:09 +02:00