77 Commits

Author SHA1 Message Date
WorldSEnder
bb031eb68f
Maintain some nightly features and CI (#3934)
* remove `doc_auto_cfg`

removed in favor of `doc_cfg` which is already present

* fix optimization flags

the fix targets the change to panic_abort in rust-lang/rust#146974
Incidentally, this led me to realize that some RUSTFLAGS were being
ignored, due to the exclusivity of env variables vs config options (see ref).
With this change, all config options are read from toml files instead of
env variables.

reference: https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags

use old optimization flags for master branch before this change

* skip example paths that don't contain a Cargo.toml
2025-10-22 13:08:44 +02:00
WorldSEnder
a86c4f847f
Fix nightly lints and various small CI issues (#3857)
* fix lint span location

`feature(proc_macro_span)` has been partially stabilized in 1.89 (currently nightly) so
use it without feature config now.

* fix various other small lints that got added over time
* use build-examples binary in size-cmp to unify build process
* adjust optimization flags to newer nightly compiler
2025-05-12 18:57:14 +02:00
Matt Yan
a0d4ab0fc8 build examples script in rust with wasm-opt checks 2025-03-02 23:56:22 +09:00
Siyuan Yan
3c6fed4834
deps: rand 0.8 -> 0.9 (#3808) 2025-02-21 18:18:57 +09:00
WorldSEnder
69e3b5f814
Explicit duplicate key check (#3785)
* explicit duplicate key check in debug_assertions

also a bit more defensive in production code, this should not lead to any slowdown
or changes in code with proper keys

CI changes:

* force install cli tools over cached versions on version mismatch
* Upload PR information for CI
   see also: actions/upload-artifact#618

misc:

* fix panic in panic
   don't set the panic hook if we are already panicking
2024-12-28 17:24:34 +01:00
dependabot[bot]
aa211192a9
Bump the cargo-deps group across 1 directory with 23 updates (#3713)
* Bump the cargo-deps group across 1 directory with 23 updates

Bumps the cargo-deps group with 20 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.3.0` | `2.4.0` |
| [js-sys](https://github.com/rustwasm/wasm-bindgen) | `0.3.69` | `0.3.70` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.55` | `1.0.63` |
| [serde](https://github.com/serde-rs/serde) | `1.0.193` | `1.0.208` |
| [web-sys](https://github.com/rustwasm/wasm-bindgen) | `0.3.69` | `0.3.70` |
| [wasm-bindgen-futures](https://github.com/rustwasm/wasm-bindgen) | `0.4.42` | `0.4.43` |
| [wasm-bindgen-test](https://github.com/rustwasm/wasm-bindgen) | `0.3.42` | `0.3.43` |
| [trybuild](https://github.com/dtolnay/trybuild) | `1.0.86` | `1.0.99` |
| [syn](https://github.com/dtolnay/syn) | `2.0.72` | `2.0.75` |
| [getrandom](https://github.com/rust-random/getrandom) | `0.2.14` | `0.2.15` |
| [tabled](https://github.com/zhiburt/tabled) | `0.15.0` | `0.16.0` |
| [clap](https://github.com/clap-rs/clap) | `4.5.13` | `4.5.16` |
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.12.5` | `0.12.7` |
| [derive_more](https://github.com/JelteF/derive_more) | `0.99.18` | `1.0.0` |
| [gloo-net](https://github.com/rustwasm/gloo) | `0.5.0` | `0.6.0` |
| [pulldown-cmark](https://github.com/raphlinus/pulldown-cmark) | `0.9.6` | `0.12.0` |
| [hyper-util](https://github.com/hyperium/hyper-util) | `0.1.6` | `0.1.7` |
| [tower](https://github.com/tower-rs/tower) | `0.4.13` | `0.5.0` |
| [env_logger](https://github.com/rust-cli/env_logger) | `0.10.2` | `0.11.5` |
| [postcard](https://github.com/jamesmunns/postcard) | `1.0.8` | `1.0.10` |



Updates `indexmap` from 2.3.0 to 2.4.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.3.0...2.4.0)

Updates `js-sys` from 0.3.69 to 0.3.70
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `wasm-bindgen` from 0.2.92 to 0.2.93
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/compare/0.2.92...0.2.93)

Updates `thiserror` from 1.0.55 to 1.0.63
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.55...1.0.63)

Updates `serde` from 1.0.193 to 1.0.208
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.193...v1.0.208)

Updates `web-sys` from 0.3.69 to 0.3.70
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `wasm-bindgen-futures` from 0.4.42 to 0.4.43
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `wasm-bindgen-test` from 0.3.42 to 0.3.43
- [Release notes](https://github.com/rustwasm/wasm-bindgen/releases)
- [Changelog](https://github.com/rustwasm/wasm-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/wasm-bindgen/commits)

Updates `trybuild` from 1.0.86 to 1.0.99
- [Release notes](https://github.com/dtolnay/trybuild/releases)
- [Commits](https://github.com/dtolnay/trybuild/compare/1.0.86...1.0.99)

Updates `syn` from 2.0.72 to 2.0.75
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.72...2.0.75)

Updates `getrandom` from 0.2.14 to 0.2.15
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.2.14...v0.2.15)

Updates `tabled` from 0.15.0 to 0.16.0
- [Changelog](https://github.com/zhiburt/tabled/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zhiburt/tabled/commits)

Updates `serde_json` from 1.0.109 to 1.0.125
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.109...1.0.125)

Updates `clap` from 4.5.13 to 4.5.16
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.13...clap_complete-v4.5.16)

Updates `reqwest` from 0.12.5 to 0.12.7
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.5...v0.12.7)

Updates `derive_more` from 0.99.18 to 1.0.0
- [Release notes](https://github.com/JelteF/derive_more/releases)
- [Changelog](https://github.com/JelteF/derive_more/blob/master/CHANGELOG.md)
- [Commits](https://github.com/JelteF/derive_more/compare/v0.99.18...v1.0.0)

Updates `gloo-net` from 0.5.0 to 0.6.0
- [Release notes](https://github.com/rustwasm/gloo/releases)
- [Changelog](https://github.com/rustwasm/gloo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rustwasm/gloo/compare/0.5.0...0.6.0)

Updates `pulldown-cmark` from 0.9.6 to 0.12.0
- [Release notes](https://github.com/raphlinus/pulldown-cmark/releases)
- [Commits](https://github.com/raphlinus/pulldown-cmark/compare/v0.9.6...v0.12.0)

Updates `hyper-util` from 0.1.6 to 0.1.7
- [Release notes](https://github.com/hyperium/hyper-util/releases)
- [Changelog](https://github.com/hyperium/hyper-util/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/hyper-util/compare/v0.1.6...v0.1.7)

Updates `tower` from 0.4.13 to 0.5.0
- [Release notes](https://github.com/tower-rs/tower/releases)
- [Commits](https://github.com/tower-rs/tower/compare/tower-0.4.13...tower-0.5.0)

Updates `env_logger` from 0.10.2 to 0.11.5
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.10.2...v0.11.5)

Updates `serde_derive` from 1.0.193 to 1.0.208
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.193...v1.0.208)

Updates `postcard` from 1.0.8 to 1.0.10
- [Release notes](https://github.com/jamesmunns/postcard/releases)
- [Changelog](https://github.com/jamesmunns/postcard/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jamesmunns/postcard/compare/v1.0.8...v1.0.10)

---
updated-dependencies:
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-deps
- dependency-name: js-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: wasm-bindgen
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: web-sys
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: wasm-bindgen-futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: wasm-bindgen-test
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: trybuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: getrandom
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: tabled
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-deps
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: derive_more
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: cargo-deps
- dependency-name: gloo-net
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-deps
- dependency-name: pulldown-cmark
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-deps
- dependency-name: hyper-util
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: tower
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-deps
- dependency-name: env_logger
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo-deps
- dependency-name: serde_derive
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
- dependency-name: postcard
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo-deps
...

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

* fix markup parsing

* update web_sys bindings to non-deprecated

* fix formatting

* fix feature set for derive_more

* update lock file to work around tower-rs/tower#784

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Molzer <WorldSEnder@users.noreply.github.com>
2024-08-23 02:31:58 +05:00
WorldSEnder
3871418174
Modernize github workflows (#3711)
* modernize github workflows

this mainly fixes some inconsistencies in style, outdated or wrong comments and action version
- replace Legit-Labs/action-download-artifact with actions/download-artifact
- fix Swatinem/rust-cache arguments
- fix benchmark transformations
- expand feature soundness lints
- wording and capitalization in comments

* fix no_run on crate level doc

* fix some more small issues
2024-08-22 20:04:04 +05:00
WorldSEnder
620d9076f8
fix example serving (#3701)
specifying an absolute URL as the public base is necessary since trunk 0.19
see also trunk-rs/trunk#668
2024-08-03 17:15:39 +02:00
Kaede Hoshikawa
8d308fb617
Separate PR and master size collection. (#3101) 2023-02-01 22:11:43 +05:00
Kaede Hoshikawa
da09755c27
Separate Yew Platform (#2893)
* Remove pinned module.

* Create Yew Platform.

* Remove some additional dependencies.

* Fix clippy.

* Restore wasm-bindgen-futures.

* Fix docs.

* Migrate to prokio.

* Fix docs warnings.

* Fix dependencies.
2022-10-21 06:56:15 +09:00
Muhammad Hamza
a4e70914ac
Convert nightly from a feature flag to a compiler flag (#2827)
* `nightly_yew` compiler flag instead of `nightly` feature

* update ci

* update ci: 2

* fmt & nightly_yew for examples

* update size-cmp too
2022-08-15 04:03:45 +09:00
Kaede Hoshikawa
108a5e80ba
Fix SSR Benchmark, 2nd attempt (#2806)
* Fix benchmark, 2nd attempt.

* Read items, not attributes.
2022-08-03 15:08:23 +02:00
Kaede Hoshikawa
e026b4f54e
Fix SSR Benchmark. (#2805) 2022-08-03 21:35:47 +09:00
Kaede Hoshikawa
7562b650b1
SSR Benchmark (#2800)
* Add benchmark binary.

* Add benchmark workflow.

* Fix rendering stream.

* Revert "Fix rendering stream."

This reverts commit 651dd157520dccd19da337130713335a04c80f2d.

* Naming.

* Write to writer.

* Move result calculation into a method.

* Fix round calculation.

* Apply optimisation flag.

* Should be applied to profile bench.
2022-08-03 20:18:02 +09:00
Muhammad Hamza
2e4a919679
Split the huge workspace into smaller & improve CI (#2774)
* Split repository into multiple workspaces, update CI

* pull_request_target for build-website workflow

This should allow the workflow to read secrets instead of requiring a different, publish-website workflow to be needed to publish the side

* pull_request_target for build-api-docs workflow

This should allow the workflow to read secrets instead of requiring a different, publish-api-docs workflow to be needed to publish the side

* use `paths` instead of `path_ignore` for examples

* cleanup main-checks.yml

* it's rustfmt, not fmt

* correct paths for workflow files

* it's rustfmt, not fmt: part 2 electric bolgoo

* me idiot: part infinity

* ???

* main checks should be the same then?

* ??? part 2

* it should work now

* more fixes

* checkout before using file, actually use stable for wasm-bindgen-cli

* Revert "pull_request_target for build-api-docs workflow"

This reverts commit 38977292c87f4f5b55a09eb458f9acb083158570.

* Revert "pull_request_target for build-website workflow"

This reverts commit 1638a0cd241f1cd195afae27405714f5111819e7.

* Benchmark workflow uses pull_request event

* pull_request for size-cmp
2022-07-07 00:17:03 +05: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
WorldSEnder
a6df894f21
Fix: boids and password_strength deployment (#2695)
* fix: boids and password_strength deployment

also adds a compile failure when examples have unresolved symbols

* add caution notice to website
2022-05-21 08:38:18 +05:00
Kaede Hoshikawa
fd1906fe5a
Slightly adjust comment format, fix detail table formatting. (#2658)
* Slightly adjust comment format, fix detail table formatting.

* Always add a conclusion.
2022-05-04 14:07:05 +02:00
Kaede Hoshikawa
6a568a5379
Fix Size Comparison (#2656)
* Update Scripts.

* Try to limit this to the main application.

* Use actual file.

* Sum size of all bundles.

* Update ci/make_example_size_cmt.py

Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>

Co-authored-by: WorldSEnder <WorldSEnder@users.noreply.github.com>
2022-05-04 19:15:12 +09:00
WorldSEnder
6373f98cac
Deploy examples again (#2655)
* actually build examples, not just echo

* write into the correct file

* be more sensitive to ci changes
2022-05-04 10:44:08 +02:00
Muhammad Hamza
31594245ef
Update examples and their builds in CI (#2652)
- Remove agents example
- Agents example is replaced by web_worker_fib as they both serve the same purpose now that trunk 0.15 has been released
- Clean up CI setup and ensure that examples are deployed in publish-examples.yml as they're built in size-cmp.yml
2022-05-03 16:08:05 +05:00
WorldSEnder
b580bd4c2f
Code Size: Document and use additional nightly features (#2604)
* code size: doc and use additional nightly features

* add ci paths to run condition

* undo unrelated edit to benchmark workflow

* Add links to nightly feature docs
2022-04-13 13:30:33 +05:00
Muhammad Hamza
20f76e78da
Tidy up documentation (2) (#2137)
* Tidy up documentation.

* Fix spelling (maybe)

* Fix CI

* Update docs/concepts/function-components.md

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

* apply review

Co-authored-by: teymour-aldridge <teymour.aldridge@icloud.com>
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2021-11-11 16:25:31 +02:00
Muhammad Hamza
d1f15b6f86
Add docs for adding minimal editor support (#1716)
* Add docs for adding minimal editor support

* fight with aspell

* add link to ij-rust issue about proc-macro generated items

* apply suggestions
2021-02-25 11:41:01 +01:00
Muhammad Hamza
23a166b5d9
Add attribute for generating function components from functions (#1638)
* Add attribute macro for functional components

* make rustfmt happy

* add docstring for macro

* Add example for functional components

* make rustfmt and clippy happy

* oops

* https://tenor.com/view/come-on-brad-gregory-upset-freaking-out-overwhelmed-gif-17476366

* remove functional example

* remove useless feature, fix order of deps, fix docs

* various fixes

* make rustfmt happy

* oopsie

* bruh i forgot

* handle generics, box Block

* handle >1 parameters

* don't do `TokenStream1`, make rustfmt happy

* ensure const, async and extern functions can't be used, better error messages

* thanks rustfmt

* transparently consume FnArg

* add tests, fix error message

* seriously?

* fix these 2

* More test cases, better errors, formatting

* docs

* properly use #![no_implicit_prelude] for passing tests

* pass all attributes as is

* add Makefile.toml

* docs

* update test

* docs

* hooks docs

* Add docs for FunctionalProvider trait

* oopsie

* is this it?

* lets try this

* bruh moment

* better error message for bad return type, use function name for function struct,  fix order in dictionary.txt

* better error messages

* replace `function` with `functional`

* completely replace `function` with `functional`

* completely replace `functional` with `function`: part 2

Missed this in previous commit

* revert package/crate names back

* formatting + fix workflow

* proc macros are fragile

* fix what i broke

* fixes

* Update docs

Co-authored-by: Simon <simon@siku2.io>

* Improve examples in docs

Co-authored-by: Simon <simon@siku2.io>

* update how #[function_component(_)] is explained

* finish "macro" -> "attribute", docs updates

* move contribute note to the top

* update #[function_component(_)] docstring

* Update docs

Co-authored-by: Simon <simon@siku2.io>

* oops, missed this

Co-authored-by: Simon <simon@siku2.io>

* Move hello world to a more appropriate place

* forgot to update the stderr file

* apparently this example didn't compile

* improve example

Co-authored-by: Simon <simon@siku2.io>
2020-11-09 17:58:06 +01:00
Simon
3106b7be54
Document dynamic tag names (#1628)
* add MSRV to docs

* document dynamic tag names

* update dictionary

* right, it dooesn't know about boolean still
2020-10-21 16:07:29 +02:00
Simon
fa2ab5abe7
Add a macro for building properties outside of html! (#1599)
* remove renamed imports from yew-macro

They add a lot of cognitive overhead and don't provide much benefit in this case.

* just a prototype

* cleanup

* add prop type resolver

* use new props for tags

* silence clippy

* simplify tag parsing

* clean up

* improve names

* fix list span

* new component props parsing

* fix rogue lint

* update tag attribute parsing

* unify prop handling

* add new tests

* integrate prop validation

* improve error span regression

* add docstring

* update tests

* add test for specifying `children` twice

* move properties derive macro

* component transformer documentation

* update properties documentation

* document special properties

* let's try to fix the spellcheck

* let's just use a newer image then

* document `with props` children

* clean up a tad

* is boolean the missing word?
Starting to question the use of this spell checker...

* add the note for the recursion limit back in

* code review

* improve error for duplicate children

* clippyfying

* revert Task: Drop

* HtmlTag -> HtmlElement

* link the issue for prop_or_else

* PropList -> SortedPropList

* use struct syntax

* use html! in transformer demonstration
2020-10-21 14:05:06 +02:00
Justin Starry
0941cba819
Doc spelling fixes (#1571) 2020-09-20 13:50:52 +08:00
Justin Starry
80b31b9396
Fix doctest spell check (#1570) 2020-09-20 12:29:56 +08:00
Simon
b6e98adac0
Adopt cargo-make (#1541)
* format and cleanup

* remove bash scripts

* update pr template

* ignore router examples

* add pr-flow task

* I really don't know what I'm doing

* add wasm_bench feature

* well that explains one of my issues

also, that Geckodriver issue seems to be resolved

* run macro tests on 1.45.2

* update the documentation

* test flags no longer necessary

* remove benchmark instructions

* finishing touch
2020-09-14 15:39:27 +02:00
Simon
1507c21b39
Finish implementation of optional attributes (#1537)
* Add support for optional attributes on HTML elements/tags

* Fix a couple of minor details

* Follow quote_spanned! documentation

* Remove undesirable example

* Add documentation for optional attributes

* Move optional token handling from HtmlDashedName to HtmlProp

* Do various requested changes to implementation

* Use fully qualified types in macro output
* Use fully qualified method calls for better error messages
* Remove support for optional attributes on boolean attributes

* Add error message for using optional attribute on HtmlList

Also, move tests where they belong

* Apply suggestions from code review

Co-authored-by: Simon <simon@siku2.io>

* Apply remaining suggestions from code review

* update

* clean up a bit

* Update docs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* remove code duplication for callbacks

* clean up attribute handling

`push_attribute` doesn't need to be accessible to users since the `attributes` field is public anyway.

* fix formatting

* remove macro exports

this also solves the issue of silently replacing all attributes that were set up to that point.

* switch to optional attribute values

* clean up stringify
make it a trait instead of a struct and implement it so it can preserve spans properly.
You can thank me later, future me

* even more cleanup

This also fixes an issue with attribute diffing which has been present for some time.
If `new` is `IndexMap` but `old` isn't, `new` is mutated into an `IndexMap`.
This conversion happens every single time from then on out.
Once `IndexMap`, always `IndexMap`.

This is fixed now.

* improve attribute benchmarks

* use different name to make clippy happy

* add dedicated feature for benchmarks

* bump indexmap to latest version

* improve vec-vec performance for unordered attributes

* increase benchmark time limit

* there's no need to store Patches in the hashmap

* Update yew-macro/src/html_tree/html_prop.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* adjust code style

* how about we actually use placeholders

* add a comment explaining the new_iter param

* fix typo

Co-authored-by: Alexander Krivács Schrøder <alexschrod@gmail.com>
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
2020-09-10 00:35:56 +02:00
Teymour Aldridge
18b9086bc9
Tidy up documentation (#1528)
* Add more files to the .gitignore.

* Add notes on testing.

* More tidy up.

* Satisfy spellcheck.

* Make spelling even happier.
Not sure if it's acceptable to modify the old versions of this?

* More fixes to the dictionary.

* Update docs/more/testing.md

Co-authored-by: Simon <simon@siku2.io>

* Update docs/more/debugging.md

Co-authored-by: Simon <simon@siku2.io>

* Adopt @siku2's suggestions :)

* Update docs/more/testing.md

Co-authored-by: Simon <simon@siku2.io>

* Update docs/more/external-libs.md

Co-authored-by: Simon <simon@siku2.io>

* Tidy up panic hook.

* Update docs/more/debugging.md

Co-authored-by: Simon <simon@siku2.io>

Co-authored-by: Simon <simon@siku2.io>
2020-08-31 20:56:19 +02:00
bakape
2b584ca37b
Optimise vtag (#1447)
* yew/vtag: remove needless indirection

* yew/vtag: reduce VTag memory footprint

* Revert "yew/vtag: remove needless indirection"

This reverts commit 7c59c61e0e6b32261fe79d9b48f786bd880aed29.

* yew/vtag,yew-macro: optimise attribute setting and memory usage

* yew/vtag,yew-macro: reduce string memory footprint and use static strings more

* yew,yew-macro: opportunistically use static memory for VText

* yew/vtag: use String instead of Box<str>

* yew-macro: remove one extra iteration

* yew/vtag: remove API extension for textarea

* yew/vtag: remove extra calls

* yew-macro: preconstruct StringRef for class literals

* yew-macro: construct non-dynamic VTags in-place

* yew-macro: Insert class and href into attrs in-place

* *: run stable checks

* yew/vtag: use key-pair vector for attributes

* yew/macro,yew: use trait associated methods with paths, where possible

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* Update yew/src/virtual_dom/vtag.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* yew/vtag: comment clarification

as suggested by @teymour-aldridge

* yew/vtag: fix added test failing

* yew/vlist: revert removing key

* yew/vtag,yew-macro: stash VTagInner changes for later

* yew/vtag: restore diff_attributes() generating a patch list + add bechmarks

* yew: fix becnhmarks running with std_web

* yew: remove Href

* yew/vtag: fix comment changes

* examples: fix trait impl

* yew: swap Stringref with Cow

* examples: remove redundant clone

* ci: fix stable check

* yew/VText: remove needless constructor

* *: remove needless trait full paths

* yew/benchmarks: add IndexMap attribute diff becnhmark

* yew-macro: fix stderr regressions

* yew: convert Attributes to enum

with variants optimised for both the html! macro and the VTag API

* yew/benchmarks: move feature guard

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* Update examples/common/src/markdown.rs

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* examples: remove unused import

* Apply suggestions from code review

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* yew-macro: rebuild stderr

* yew-macro: accept Into<Cow> for dynamic tags

* yew-macro: remove unneeded {} wrapping

* yew: revert doc comment

* yew/vtag: clean up attribute type conversion

* yew-macro: remove now supported literal failures

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
Co-authored-by: Justin Starry <justin.starry@icloud.com>
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
2020-08-22 18:45:02 +08:00
Simon
55f7a42cbd
Move CI to GitHub Actions (#1474)
* clippy in tests

* add pull request workflow

* fix formatting

* add names to steps

* fix clippy

* update

* avoid mutable

* use wasm target

* install it too

* except there

* let's give chrome a spin

* clippy has some more to say

* only run specific tests

* fix tests on chrome

* add cache

* rename benchmark for consistency

* re-enable geckodriver

* clean up old files

* remove all mentions of Travis

* check all examples

* let's try with a bigger timeout

* test both browsers at the same time

* chrome really doesn't like me

* finish up

* run for pushes to master

* improve caching

* fix order in workspace members

* clippy use --all-targets

* rename workflow file

* Apply suggestions from code review

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>

* use stable toolchain for lints

* run lints on nightly too

* add doctest for yew-stdweb

* allow failure for nightly clippy steps

* let's try it on the job level again

* always run all lint steps

* only run lints on stable toolchain

* use 'no_run' instead of 'ignore'

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
2020-08-15 22:32:19 +08:00
Justin Starry
28dd837534
Fix yew-validation tests (#1479) 2020-08-15 22:04:41 +08:00
Philip Peterson
17fa773324
Add yew-validation crate (#1376)
* Add yew-validation crate

* Update description

* add test to run-tests.sh
2020-08-15 15:13:40 +08:00
Philip Peterson
309dbcba00
Update main yew examples (remove static dir) (#1417)
* remove static directory, move script to run_example.sh

* gitignore

* server infra

* Support --build-only

* fix npm_and_rest example

* Fix various static index.html's

* Fix spacing

* newlines at the end

* Cleanup

* tabs -> spaces

* line ending

* remove build_examples.sh

* Apply suggestions from code review

Co-authored-by: Simon <simon@siku2.io>

* format file and improve EXIT trap

Co-authored-by: Simon <simon@siku2.io>
2020-07-22 13:29:55 +02:00
Teymour Aldridge
f3d53a7710
Update optimizations.md: (#1422)
* Update optimizations.md:
 * Make some sentences more clear
 * Add additional links and references ("further reading")
 * Capitalise some proper nouns

* Add missing terms to the dictionary.

* Split out a paragraph.

* Fix spelling.

* Update links.

* Apply suggestions from code review

Co-authored-by: Simon <simon@siku2.io>

* Update docs/advanced-topics/optimizations.md

Co-authored-by: Simon <simon@siku2.io>
2020-07-20 20:53:44 +02:00
Simon
4eb7916f94
Update tests to use wasm-pack (#1415)
* run tests using wasm-pack

* update contributing guide

* fix typo

* should probably install wasm-pack

* clarify manual webdriver installation

* Apply suggestions from code review

Had to do this again because I messed up my rebase, sorry!

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

* make capitalisation of WebDriver consistent

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-07-19 15:57:04 +02:00
F.J. Navarro
1e609b4af8
add styled frameworks for yew (#1396)
* add styled frameworks for yew

* revert some changes that was updated previously

* fix code review

* capitalize fist letter yewtify explanation

* fix code review

* switch definitions

* add Vuetify and Javascript in the dictionary
2020-07-11 00:54:36 +08:00
Justin Starry
104479d62a Fix spellcheck 2020-07-10 16:53:44 +08:00
Teymour Aldridge
3fe6121c3c
Ci for documentation (#1393)
* Add contributing guidelines.

* Add spellchecking.

* Update dictionary.

* Update dictionary.

* Update dictionary.
2020-07-10 11:18:21 +08:00
Stig Johan Berggren
a878fdd56f
Test Select component (#1177)
* Fix imports in doctest

* Add a basic test case

* Enable test in CI
2020-05-03 12:41:54 +08:00
fbucek
528ec66fbc
updated examples, added build script (#1165)
* script for building examples

minimal example updated to work with wasm-pack
minimal_wb exampel to be used with wasm-bindgen directly

* minimal is wasm-bindgen as default ( wp wasm-pack )

* examples updated to work with wasm-bindgen

* script to run all yew/examples

* upated example doc, added script to multi-thread

* cargo fmt, disabled build_examples.sh

* one build.sh for examples, updated doc

* removed build size optimalization

* wasm-pack requirement info in lib.rs

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/readme.md

* Update examples/build.sh

Co-Authored-By: Justin Starry <justin.m.starry@gmail.com>

* Update examples/build.sh exit trap

Co-Authored-By: Justin Starry <justin.m.starry@gmail.com>

Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
2020-04-29 22:57:55 +08:00
Stig Johan Berggren
3d42a812ad
Derive Clone on props in Yewtil doctest (#1161)
* Derive Clone on props in Yewtil doctest

* Run Yewtil tests in CI
2020-04-28 21:05:32 +08:00
Justin Starry
9a7acdd58c Enable yew-router tests in CI 2020-04-28 13:00:43 +00:00
Justin Starry
10555fd69a
Bump MSRV to v1.40.0 (#1152) 2020-04-28 00:09:44 +08:00
Justin Starry
fa8a1d9f00
Reorganize examples and general repo layout (#1092)
* Reorganize crates

* Remove symlink

* Check examples

* Cleanup CI scripts

* nits

* cleanup

* cargo fmt

* Fix yew-stdweb

* cargo clippy --all

* stdweb-examples

* run_emscripten_checks.sh

* Fix typo

* fix typo

* yew-stdweb

* Run tests from yew-stdweb

* fix webgl script
2020-04-20 22:22:24 +08:00
Bill
6c16c8c134
Fix examples (#1093)
* ci: verify all examples build.

Using examples/showcase masked breakages in multiple examples.

* examples/future: add change implementation.

* examples/minimal: add change implementation.

* examples/nested_list: add change implementation.

* ci: add block lists to skip some examples.
2020-04-20 15:42:50 +08:00
Mathis
d81168b620
Introducing the use_effect hook (#1036)
* fixed missing feature flag for yew dependency

* added functional components + hooks + tests

* added wasm pack to travis yaml

* fixed warnings

* ran rustfmt on files

* fix nit

* fix nit

* fix nit use_reducer_with_init

* fixed nit Rc can be Box

* fixed nit: unnecessary boxing

* UseRefState now tuple struct

* fixed unecessary option for phantomdata

* userefstate is now a type alias for Rc<RefCell<T>>;

* integrated suggested change to hook state storing and extracting

* functional-yew -> functional

* tests now work with stdweb *and* web_sys 😊

* correctly implemented use_effect

* hook test now running as stdweb. also removed redundant deps

* removed next tick, message is now an FnOnce -> bool, renamed render_call

* tests now run on web_sys only, making functional yew backend agnostic

* removed use_effect hook for seperate PR

* chore

* we didn't need that Rc anymore

* chore; comment cleanup

* reintroducing use_effect hook

* adjusted use_effect hook behaviour and added tests:
use_effect() always runs
callbacks are executed in the message callback, meaning they can use NodeRef
neither trigger a rerender

* improved test coverage to check for previous render passes

* yew-functional needs yew dependency to have a feature specified, as the package resolver does not infer it from the version used top-level

* use_reducer now returns an Rc instead of a Box

* destructor now called when component is destroyed

* use_effect now accepts one tuple instead of a number of dependencies

* added functional components + hooks + tests

* added wasm pack to travis yaml

* fixed warnings

* ran rustfmt on files

* fix nit

* fix nit

* fix nit use_reducer_with_init

* fixed nit Rc can be Box

* fixed nit: unnecessary boxing

* UseRefState now tuple struct

* fixed unecessary option for phantomdata

* userefstate is now a type alias for Rc<RefCell<T>>;

* integrated suggested change to hook state storing and extracting

* functional-yew -> functional

* tests now work with stdweb *and* web_sys 😊

* correctly implemented use_effect

* removed next tick, message is now an FnOnce -> bool, renamed render_call

* tests now run on web_sys only, making functional yew backend agnostic

* removed use_effect hook for seperate PR

* chore; comment cleanup

* reintroducing use_effect hook

* adjusted use_effect hook behaviour and added tests:
use_effect() always runs
callbacks are executed in the message callback, meaning they can use NodeRef
neither trigger a rerender

* improved test coverage to check for previous render passes

* yew-functional needs yew dependency to have a feature specified, as the package resolver does not infer it from the version used top-level

* use_reducer now returns an Rc instead of a Box

* destructor now called when component is destroyed

* use_effect now accepts one tuple instead of a number of dependencies

* minor chore (warnings)

Co-authored-by: Mathis <mk@thepeaklab.com>
2020-03-29 01:01:30 +08:00