Rust / Wasm framework for building client web apps

Overview

About

Yew is a modern Rust framework for creating multi-threaded front-end web apps with WebAssembly.

  • Features a macro for declaring interactive HTML with Rust expressions. Developers who have experience using JSX in React should feel quite at home when using Yew.
  • Achieves high performance by minimizing DOM API calls for each page render and by making it easy to offload processing to background web workers.
  • Supports JavaScript interoperability, allowing developers to leverage NPM packages and integrate with existing JavaScript applications.

Note: Yew is not (yet) production ready but is great for side projects and internal tools.

Contributing

Yew is a community effort and we welcome all kinds of contributions, big or small, from developers of all backgrounds. We want the Yew community to be a fun and friendly place, so please review our Code of Conduct to learn what behavior will not be tolerated.

🤠 New to Yew?

Start learning about the framework by helping us improve our documentation. Pull requests which improve test coverage are also very welcome.

😎 Looking for inspiration?

Check out the community curated list of awesome things related to Yew / WebAssembly at jetli/awesome-yew.

🤔 Confused about something?

Feel free to drop into our Discord chatroom or open a new "Question" issue to get help from contributors. Often questions lead to improvements to the ergonomics of the framework, better documentation, and even new features!

🙂 Ready to dive into the code?

After reviewing the Contribution Guide, check out the "Good First Issues" (they are eager for attention!). Once you find one that interests you, feel free to assign yourself to an issue and don't hesitate to reach out for guidance, the issues vary in complexity.

🤑 Let's help each other!

Come help us on the issues that matter that the most and receive a small cash reward for your troubles. We use Issuehunt to fund issues from our Open Collective funds. If you really care about an issue, you can choose to add funds yourself!

😱 Found a bug?

Please report all bugs! We are happy to help support developers fix the bugs they find if they are interested and have the time.

🤓 Want to help translate?

Translations can be submitted on the Yew GitLocalize Repo. If you are interested in being the official moderator for a language, please reach out on Discord.

Contributors

Code Contributors

This project exists thanks to all the people who contribute.

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

Comments
  • SSR: Stringify VNodes (II)

    SSR: Stringify VNodes (II)

    Description

    Fixes #1154 by rebasing the previous draft for that issue on latest master.

    Stringifying nodes should work except for VRef, which is marked as unimplemented. Conditional compilation also supported via flags -- probably closing #1155 as well. ~Tests are still to come, but workin on on it!~ Tests are in!

    Checklist:

    • [x] I have run ./ci/run_stable_checks.sh
    • [x] I have reviewed my own code
    • [x] I have added tests
    opened by philip-peterson 54
  • Proposal: Hooks API

    Proposal: Hooks API

    Is your feature request related to a problem? Please describe. Currently component classes are required to have (stateful) components. They contain state management and lifecycle methods, requiring a message to be sent back for changes. This process can be simplified with functional components that use hooks.

    Describe the solution you'd like Introducing: hooks. Hooks are used in React to enable components, complex or simple, whose state is managed by the framework. This enables developers to progress faster and avoid some pitfalls. The hooks API is described at https://reactjs.org/docs/hooks-reference.html

    Describe alternatives you've considered Hooks aren't strictly necessary, neither for react nor yew, so they are optional. But they do have clear advantages, not least being easier to think about than messages.

    Implementation I propose (and have implemented) the following api:

    use_state is the most basic hook. It outputs a state, provided by initial_state initially, and a function to update that state. Once the set_state method is called, the component rerenders with the call to use_state outputting that new state instead of the initial state.

    pub fn use_state<T, F>(initial_state_fn: F) -> (Rc<T>, Box<impl Fn(T)>)
    where
        F: FnOnce() -> T,
        T: 'static,
    {
     // ...
    }
    

    use_effect lets you initialize a component and recompute if selected state changes. It is provided a closure and its arguments. If any of the arguments, which need to implement ==, change, the provided closure is executed again with those arguments and not executed again until the arguments change. There are use_effect1 through use_effect5 for number of arguments, while not giving any arguments executes the closure only once (it is debatable whether it should execute once or always in that case)

    pub fn use_effect1<F, Destructor, T1>(callback: Box<F>, o1: T1)
    where
        F: FnOnce(&T1) -> Destructor,
        Destructor: FnOnce() + 'static,
        T1: PartialEq + 'static,
    {
      // ...
    }
    

    use_reducer2 is an advanced use_state function that lets you externalize computations of state change and initial state. It is given a function that combines an action and the previous state, as well as an initial state argument and a function that computes it into the initial state.
    It returns the current state and a dispatch(Action) function to update the state.

    pub fn use_reducer2<Action: 'static, Reducer, State: 'static, InitialState, InitFn>(
        reducer: Reducer,
        initial_state: InitialState,
        init: InitFn,
    ) -> (Rc<State>, Box<impl Fn(Action)>)
    where
        Reducer: Fn(Rc<State>, Action) -> State + 'static,
        InitFn: Fn(InitialState) -> State,
    {
      // ...
    }
    

    *use_reducer1 is a variaton that takes the initial state directly instead of a compute function to compute it.

    pub fn use_reducer1<Action: 'static, Reducer, State: 'static>(
        reducer: Reducer,
        initial_state: State,
    ) -> (Rc<State>, Box<impl Fn(Action)>)
    where
        Reducer: Fn(Rc<State>, Action) -> State + 'static,
    {
      // ...
    }
    

    use_ref lets you have e RefCell of a state in your component that you can update yourself as need be

    pub fn use_ref<T: 'static, InitialProvider>(initial_value: InitialProvider) -> Rc<RefCell<T>>
    where
        InitialProvider: FnOnce() -> T,
    {
      // ...
    }
    

    Reference implementation (needs to be cleaned up): https://pastebin.com/rWMn7YBX Example uses follow.

    proposal 
    opened by ZainlessBrombie 52
  • Rewrite router

    Rewrite router

    Description

    This PR rewrites the yew-router crate. I'd appreciate any input about the API of the crate.

    This API provided by this PR is a bit different and works as follows:

    https://github.com/yewstack/yew/blob/d25c07719bdcc9c71c32fda35ca47e178b4c2944/packages/yew-router/tests/router.rs#L12-L67

    A new Routable macro is introduced which generates the implementation for Routable trait.

    There will also be another (derive) macro which will be used to allow structs to be created from Params so query parameters are also not stringly typed. I've decided to keep query parameters separate as https://github.com/http-rs/route-recognizer/issues/47 would provide a better and cleaner way to handle those. Right now, URLSearchParams is used for their parsing. A macro should be sufficient for now.

    So far, this PR:
    Fixes #1245
    Fixes #1101
    Fixes #1679
    Fixes #1102
    Fixes #1107
    Closes #1615 (the macro is removed) Closes #1575 (the API is completely changed) Closes #1096 (the API is completely changed) Closes #1098 (the crate is removed entirely, route_recognizer is used instead) Closes #1261 (this implementation doesn't deal with state at all)
    Closes #1585 (we no longer do the route parsing ourselves, route_recognizer is used instead. Maybe we could convert the route to something that is accepted by route_recognizer or patch it so it can accept different kinds of values)

    Checklist

    • [ ] I have run cargo make pr-flow
    • [x] I have reviewed my own code
    • [x] I have added tests
    breaking change A-yew-router A-yew-router-macro 
    opened by hamza1311 47
  • Global state

    Global state

    Description

    I'm submitting a ...

    • question

    Yew apps I write typically need global state. Some details of the pattern are:

    • Components persist properties they're passed, in create or change, to their component struct.
    • Properties have a global state struct field.
    • A shared properties struct exists for passing properties with only a global state field to a subcomponent.
    • Custom component properties structs are made for passing properties with a global state field, as well as others specific to the component, to a subcomponent.

    Can that be improved somehow? If Yew could be changed to improve how global state is facilitated, what would that look like?

    proposal 
    opened by kellytk 40
  • Introduce immutable string, array and map

    Introduce immutable string, array and map

    Description

    Please check the example immutable in this PR to see how it is used.

    I have started some time ago an experiment of porting Immutable.js to Yew. This basically leverage the use of ImplicitClone on 3 core types: String, Array and Map. And use garbage collection with Rc.

    • The immutable string type already exists in Yew for some time. It has been introduced in #1994 It's very handy for passing cheap strings around and it is also very useful for library maintainers who want to have string properties that work with &str and String indifferently and with Rc.
    • The immutable array type allows creating a cheap Rc'ed array of static size of any type. It's very similar to the immutable string type.
    • The immutable map type allows creating a cheap IndexMap. This is slightly more complicated because the map is not a primitive in Rust. Here we use either: an Rc<IndexMap<K, V>> or a &'static [(K, V)].

    Following the discussion in #2448 I realized that it is better to create a more generic "immutable" crate rather than crating a "yew-immutable" crate. This is why I created this new project: https://github.com/rustminded/imut It's currently not published on crates.io yet because I prefer getting the green light here first. If my PR here is approved I will add the documentation and publish imut. (I couldn't take the crate immutable because it is already taken and I couldn't reach the owner.)

    To avoid breaking compatibility I added a type alias from AttrValue to IString. Those types were identical anyway.

    I also added a re-export of imut to yew::immutable so people can import them easily if they want without the need to add imut to their dependencies.

    It is best for the reviewers to also review https://github.com/rustminded/imut and put their remarks in this PR. The most important changes are there after all.

    Fixes #2448

    Checklist

    • [x] I have run cargo make pr-flow
    • [x] I have reviewed my own code
    • [x] I have added tests
    • [x] I have added documentation to imut
    • ~I have added a similar API of immutable.js to imut~ [edit: conflicting too much with rust's api... not a good idea, it would be confusing]
    • [x] I have published imut
    • [x] Add doc to Yew's documentation web site
    opened by cecton 39
  • Styling Brainstorming

    Styling Brainstorming

    I'd like to add a styling system to yew - not having a built-in way of styling components seems a bit unfinished to me. If we want to build better, bigger, and faster web apps, then we need a way of managing styles that doesn't clobber a global namespace and makes sense when looking at the components.

    I'd like to see a Stylable trait where we can pull in an existing stylesheet (using css-parser for the servo project), modify it (override the defaults), and then set that as the element style.

    We could also have a special style property for each element where we can inject style into even the subdivs of elements.

    I personally favor parsing an external stylesheet and doing inline modification because of autocompletes working with .css files, but there is also room for a css! macro and reserve a keyword for the element that the style is being applied to, to access subdivs in that element.

    Curious what the thoughts of the community is before I try pull my changes into the project.

    proposal 
    opened by jkelleyrtp 36
  • Components should be able to wrap html elements in the `html!` macro

    Components should be able to wrap html elements in the `html!` macro

    Description

    The html! macro should allow components to enclose other elements and have that be set as the children property in the component's props. This is allowed in JSX as seen here: https://reactjs.org/docs/composition-vs-inheritance.html

    Expected Results

    This should compile

    html! {
      <Dialog>
        <div class="header"> ... </div>
        <div class="body"> ... </div>
      </Dialog>
    }
    
    opened by jstarry 32
  • Write up issues needed for Hooks API

    Write up issues needed for Hooks API

    We should organize the remaining work for functional components + hooks api so that the community can easily track progress! They should all be added to this project: https://github.com/yewstack/yew/projects/3

    • [x] Document how to use Functional Components on https://yew.rs/docs
    • [x] Document how to write a custom hook
    • #2072
    • #1642
    • [ ] Review API ergonomics of writing functional components
    • [ ] Review API ergonomics of writing custom hooks

    Hooks 2.0

    • [ ] Add support for use_memo hook
    • [ ] Create macro for creating hook macros
    • #2026

    cc @ZainlessBrombie

    meta 
    opened by jstarry 31
  • Introduce explicit internal datastructures modeling dom state

    Introduce explicit internal datastructures modeling dom state

    Description

    Prior to this change, reconciliation of the virtual DOM works by mutating the incoming virtual DOM internally, taking an optional ancestor parameter. With this change, for each (most) type of virtual node, there is an explicit second structure modeling the state that is relevant only after the virtual DOM has been applied (reconciled). In effect, this slims down some of the vdom structures and gets rid of some unwraps by making illegal state unrepresentable.

    The introduced structure is called "Bundle" throughout the code, coming from the mathematical sense, meaning here "living above the virtual dom".

    Tries to continue tackling #758. Most of the vdom should be more easily removable now that it is rid of state logic.

    Should make it easier to implement #2154 as "host logic" (listener registration) can more easily be added to the bundle structure.

    As a side effect of a change to the list reconciler, fixes #2327 .

    Might impact future considerations in #1154.


    Please apply the performance label.

    How to review this change

    Most of the test cases have been moved into the new dom_bundle module, as it tests how the vdom is reconciled and rendered. There might be some test cases that only inspect the vdom structure, but I've honestly not looked too closely. It might make sense to split those off (back into virtual_dom).

    The change should be invisible to most, if not all users of yew. Please take a few minutes to double check that I haven't accidentally removed trait impls from vdom structures. Further moved methods are all internal (pub(crate)) to yew. No pub methods should have been moved.

    Obviously, some fields have been removed or renamed in the virtual_dom structures, but I don't think this is defined as a "stable" public interface of yew?

    Checklist

    • [x] I have run cargo make pr-flow
    • [x] I have reviewed my own code
    • [x] I have added tests
    performance A-yew 
    opened by WorldSEnder 30
  • Replace bash with cargo-make

    Replace bash with cargo-make

    Description

    See #1418 Basically this first draft only replaces the run_stable_checks script to cargo make. In addition it also installs rustfmt, clippy and cargo-web if missing. You can run it from the root as cargo make stable-checks

    By the way, one of the member crates is failing on cargo check.

    [cargo-make][2] INFO - Execute Command: "cargo" "check"
        Checking pure_component v0.1.0 (/workspace/yew/yewtil/examples/pure_component)
    error[E0432]: unresolved imports `yewtil::Pure`, `yewtil::PureComponent`
     --> yewtil/examples/pure_component/src/button.rs:3:14
      |
    3 | use yewtil::{Pure, PureComponent};
      |              ^^^^  ^^^^^^^^^^^^^ no `PureComponent` in the root
      |              |
      |              no `Pure` in the root
    
    error: aborting due to previous error
    

    Fixes # (issue)

    Checklist:

    • [ x] I have run ./ci/run_stable_checks.sh. - sort of, i ran cargo make stable-checks
    • [ x] I have reviewed my own code
    • [ ] I have added tests
    opened by sagiegurari 30
  • Lay foundation for a statically typed vdom

    Lay foundation for a statically typed vdom

    Description

    Pulls useful code from https://github.com/yewstack/yew/pull/2369

    The implementation generates components for each HTML element using a new macro, generate_element!. Every attribute and listener is passed as props to the component. The component's view method creates a VTag based on the passed data,

    Special casing for textarea in VTag has also been removed. Previously, we used value attribute on textarea, which is not part of standard. See MDN docs:

    Default content entered between the opening and closing tags. <textarea> does not support the value attribute.

    Limitations

    Right now, there are some limitations (to be resolved in the future):

    • Typed support for SVG elements is not implemented. The MDN documentation does not list every attribute for the elements so I can't generate code from the information on that page. If there's a resource for that, I would like to hear it.
    • data attributes not yet supported with static typing.
    • Custom elements can't be used directly with html! macro

    Workaround

    These limitations can be bypassed by opting out of static typing. This is done by using dynamic tags.

    Checklist

    • [x] ~~I have run cargo make pr-flow~~ CI passes
    • [x] I have reviewed my own code
    • [x] I have added tests
    breaking change A-yew A-yew-macro 
    opened by hamza1311 29
  • Suspense does loop endlessly if used with children

    Suspense does loop endlessly if used with children

    Problem When using futures with suspense in a component which has other components as childrens, the future is never called and the component is called endlessly.

    Steps To Reproduce Steps to reproduce the behavior:

    1. enable tracing.
    2. have a function component which uses a future and has children.
    3. add a log call to the future (just for debugging, problems occurs without it as well)
    4. browser hangs due to an endless loop.
    5. console spits out an endless stream of logs, but never the one from within the future.

    Examples:

    Works Endless loop (you need to kill the browser tab)

    Expected behavior The future is executed and the suspense resumed.

    Environment:

    • Yew version: 0.20
    • Rust version: 1.65

    Questionnaire

    • [X] I'm interested in fixing this myself but don't know where to start
    • [ ] I would like to fix and I have a solution
    • [X] I don't have time to fix this right now, but maybe later
    bug 
    opened by bluec0re 0
  • yew/examples/function_memory_game/ -> Game's broken

    yew/examples/function_memory_game/ -> Game's broken

    Problem

    Steps To Reproduce Steps to reproduce the behavior: Use examples folder & trunk serve for the path in the issue title above

    Expected behavior there is a bug where there are two missing pieces which are different pieces

    Screenshots image Peek 2023-01-07 22-39

    Questionnaire

    • [ yes] I'm interested in fixing this myself but don't know where to start
    • [ ] I would like to fix and I have a solution
    • [ ] I don't have time to fix this right now, but maybe later
    bug 
    opened by ninetynin 2
  • Bump @docusaurus/theme-classic from 2.1.0 to 2.2.0 in /website

    Bump @docusaurus/theme-classic from 2.1.0 to 2.2.0 in /website

    Bumps @docusaurus/theme-classic from 2.1.0 to 2.2.0.

    Release notes

    Sourced from @​docusaurus/theme-classic's releases.

    2.2.0 (2022-10-29)

    :rocket: New Feature

    • docusaurus-plugin-client-redirects
    • docusaurus
      • #8210 feat(core): add --config param to swizzle command (@​e-im)
    • docusaurus-mdx-loader, docusaurus-plugin-content-blog, docusaurus-plugin-content-docs, docusaurus-plugin-content-pages, docusaurus-theme-classic, docusaurus-theme-mermaid, docusaurus-types, docusaurus
    • docusaurus-types, docusaurus

    :bug: Bug Fix

    • docusaurus-plugin-ideal-image
    • docusaurus-theme-common
    • docusaurus-plugin-content-docs
      • #8234 fix(plugin-content-docs): fix error message context (error cause) when doc processing fails (@​shanpriyan)
    • docusaurus-theme-classic, docusaurus-theme-translations
    • docusaurus-theme-classic, docusaurus-theme-common
      • #8204 fix(theme-classic): fix SkipToContent without JS , refactor, make it public theming API (@​mturoci)
      • #8059 fix(theme): preserve url ?search#hash on navbar version/locale dropdowns navigations (@​slorber)
    • docusaurus
    • docusaurus-theme-classic
    • docusaurus-utils
      • #8137 fix(utils): remove non-ASCII limitation for path normalization (@​birjj)
      • #8158 fix(content-blog): make RSS feed generation work with slugs with .html extension (@​Pranav2612000)
    • docusaurus-theme-translations
    • docusaurus-plugin-client-redirects
      • #8067 fix(redirect): tolerate trailing slash difference if config is undefined (@​Josh-Cena)

    :nail_care: Polish

    • docusaurus-theme-translations

    ... (truncated)

    Changelog

    Sourced from @​docusaurus/theme-classic's changelog.

    2.2.0 (2022-10-29)

    :rocket: New Feature

    • docusaurus-plugin-client-redirects
    • docusaurus
      • #8210 feat(core): add --config param to swizzle command (@​e-im)
    • docusaurus-mdx-loader, docusaurus-plugin-content-blog, docusaurus-plugin-content-docs, docusaurus-plugin-content-pages, docusaurus-theme-classic, docusaurus-theme-mermaid, docusaurus-types, docusaurus
    • docusaurus-types, docusaurus

    :bug: Bug Fix

    • docusaurus-plugin-ideal-image
    • docusaurus-theme-common
    • docusaurus-plugin-content-docs
      • #8234 fix(plugin-content-docs): fix error message context (error cause) when doc processing fails (@​shanpriyan)
    • docusaurus-theme-classic, docusaurus-theme-translations
    • docusaurus-theme-classic, docusaurus-theme-common
      • #8204 fix(theme-classic): fix SkipToContent without JS , refactor, make it public theming API (@​mturoci)
      • #8059 fix(theme): preserve url ?search#hash on navbar version/locale dropdowns navigations (@​slorber)
    • docusaurus
    • docusaurus-theme-classic
    • docusaurus-utils
      • #8137 fix(utils): remove non-ASCII limitation for path normalization (@​birjj)
      • #8158 fix(content-blog): make RSS feed generation work with slugs with .html extension (@​Pranav2612000)
    • docusaurus-theme-translations
    • docusaurus-plugin-client-redirects
      • #8067 fix(redirect): tolerate trailing slash difference if config is undefined (@​Josh-Cena)

    :nail_care: Polish

    • docusaurus-theme-translations
      • #8253 chore(theme-translations): complete ru translations (@​lex111)
      • #8243 chore(theme-translations): complete French translations (@​forresst)
      • #8075 fix(theme-translation): complete Japanese theme default translation (@​pasora)
    • docusaurus

    ... (truncated)

    Commits
    • a308fb7 v2.2.0
    • a9b622b fix(theme-classic): hamburger menu control navigation by keyboard (#8207)
    • e5fb257 fix(theme-classic): fix SkipToContent without JS , refactor, make it public t...
    • 433f08b feat: support mermaid code blocks in Markdown (#7490)
    • 6f5e669 fix(theme): announce theme switches when using screen reader. #7667 (#8174)
    • d1bf80e fix(theme): add more tag names to inline element set (#8190)
    • 64601a9 fix(theme): mobile navbar & skipToContent should cover announcementBar (#8163)
    • 08b4caa fix(theme): do not show tab content when tabbing over it; show after selectio...
    • d0feba0 refactor(theme): remove hard-coded tag border-radius (#8062)
    • 42ba857 fix(theme): preserve line breaks when copying code with showLineNumbers in Fi...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies javascript 
    opened by dependabot[bot] 0
  • Feature/add cypress

    Feature/add cypress

    Description

    I have created 3 e2e tests for todomvc using cypress. And i added to the README how to run the tests.

    1. Todo can be created successfully
    2. Links are successfully attached
    3. The specified port is accessible I would be glad if someone could review it. Thanks in advance.

    Checklist

    • [x] I have reviewed my own code
    • [x] I have added tests
    opened by nash1111 13
  • Added Convenience method to Scope<impl BaseComponent>

    Added Convenience method to Scope

    Description

    I added a method called callback_event( ) to Scope<impl BaseComponent>. It does the same thing as callback( ), but with the added benefit of calling prevent_default() on the web_sys::Event (or a subclass of that) that is passed to the callback.

    I was motivated to add this method after several hours of struggling to figure out why my page scrolled to the top every time an Message was sent. This method prevents that in a predictable way.

    If this pull is accepted, I plan to submit another pull request with an update to the website documentation explaining where and why this method is useful, and what problem it addresses.

    Checklist

    • [ x ] I have reviewed my own code
    • [ x ] I have added tests
    • [ x ] Ran all of the commands in CONTRIBUTING.md

    Thank you for your time.

    opened by Threadzless 3
Releases(yew-agent-v0.2.0)
  • yew-agent-v0.2.0(Nov 28, 2022)

  • yew-v0.20.0(Nov 25, 2022)

  • yew-router-v0.17.0(Nov 25, 2022)

  • yew-v0.19.3(Dec 11, 2021)

    Changelog

    Source code(tar.gz)
    Source code(zip)
  • yew-router-v0.16.0(Dec 11, 2021)

    Changelog

    Source code(tar.gz)
    Source code(zip)
  • yew-agent-v0.1.0(Dec 11, 2021)

    Changelog

    Source code(tar.gz)
    Source code(zip)
  • 0.18.0(May 16, 2021)

    Changelog

    Source code(tar.gz)
    Source code(zip)
  • 0.17.4(Oct 25, 2020)

  • 0.17.3(Oct 25, 2020)

    Changelog

    • ⚡️ Features

    • 🛠 Fixes

      • Properties with default type params can now have Properties trait derived. [@siku2, #1408]
      • html!: Improved compile error messages for invalid list fragments. [@siku2, #1445]
      • Batch component updates are processed more efficiently. [@bakape, #1470]
    Source code(tar.gz)
    Source code(zip)
  • 0.17.2(Jul 4, 2020)

  • 0.17.1(Jul 1, 2020)

  • 0.17.0(Jun 29, 2020)

    Changelog

    • ⚡️ Features

      • Allow agents to send input messages to themselves. [@mkawalec, #1278]

      • Rendering performance has been improved by ~20%. [@jstarry, #1296, #1309]

      • html!: Elements can be specified with dynamic tag names. [@siku2, #1266]

        In order to specify a dynamic tag name, wrap an expression with @{..}:

        let tag_name = "input";
        html! { <@{tag_name} value="Hello" /> }
        
      • HTML button element type can now be specified ("submit", "reset", or "button"). [@captain-yossarian, #1033]

      • All global event listeners can be used as listeners (onerror, onloadend, and many more). [@siku2, #1244]

      • PartialEq is now implemented for VChild when properties also implement PartialEq. [@kellpossible, #1242]

      • Agent callbacks now accept Into<Message> to improve ergonomics. [@totorigolo, #1215]

      • Agents can now send messages to themselves. [@totorigolo, #1215]

    • 🛠 Fixes

      • Bincode dependency version has been loosened 1.2.1 -> 1. [@jstarry, #1349]

      • Keyed list ordering algorithm has been fixed. [@totorigolo and @jstarry, #1231]

      • html!: key and ref are no longer ignored for components with no properties. [@jstarry, #1338]

      • html!: List rendering behavior is consistent no matter which syntax is chosen. [@siku2, #1275]

        html! { for node_list } is now equivalent to html! { node_list } when node_list is a Vec<VNode>.

      • KeyboardService events can now have default behavior prevented. [@ghpu, #1286]

      • Yew will check the current DOM input value before comparing with the desired value. [@ShadoySV, #1268]

      • html!: Void elements (<br/>, <input />) are no longer allowed to have children. [@kaoet, #1217]

      • Local agents no longer require Input and Output to implement Serializable. [@mkawalec, #1195]

    • 🚨 Breaking changes

      • Renders are now done lazily and will not be executed until all updates have been processed. [@jstarry, #1309]

      • ConsoleService, DialogService, IntervalService, RenderService, TimeoutService, and WebSocketService methods are now static. [@teymour-aldridge, #1313]

      • html!: Children no longer implements Renderable. [@siku2, #1275]

        Replace instances of self.props.children.render() with self.props.children.clone().

      • Yew no longer stops propagation of events by default. [@jstarry, #1256]

        Event propagation is usually stopped when you have event listeners attached to nested elements and do not want the event to bubble up from where it was first captured. If your app has this behavior, you can stop propagation by calling stop_propagation() on the desired event.

      • The onsubmit listener now uses FocusEvent instead Event when using web-sys. [@siku2, #1244]

      • The onmousewheel and ontouchenter listeners have been removed. [@siku2, #1244]

      • The ondoubleclick listener is now named ondblclick. [@siku2, #1244]

      • FetchService methods are now static. [@teymour-aldridge, #1235]

        Instead of FetchService::new().fetch(..) you should now use FetchService::fetch(..)

      • The send_message_batch method has been removed from AgentLink. [@totorigolo, #1215]

      • Minimum supported rust version has been bumped from 1.40.0 to 1.42.0. [@mkawalec, #1195]

      • Every agent Reach type is now generic. [@mkawalec, #1195]

        In order to fix your app, simply append <Self> to the reach:

        Reach = Context -> Reach = Context<Self>

      • Removed Global agent because it was never implemented. [@jstarry, #1202]

      • Reduced visibility of internal agent types that were not intended to be public. [@jstarry, #1202]

    Source code(tar.gz)
    Source code(zip)
  • 0.16.2(May 14, 2020)

  • 0.16.1(May 14, 2020)

  • 0.16.0(May 9, 2020)

    Changelog

    • ⚡️ Features

      • Added optional id, class, and placeholder properties to the Select component. [@Stigjb, #1187]

      • Re-export web-sys from Yew. This allows projects to use web-sys without adding it to their Cargo.toml. [@D4nte, #1176]

      • Added support for Option wrapped class names. [@liquidblock, #1085]

        The following code is now supported:

        let color: &Option<String> = &self.color;
        html! { <div class=("btn", color)></div> }
        
      • Added get_parent and get_component methods to ComponentLink to allow access to parent component state. [@jstarry, #1151]

    • 🛠 Fixes

      • Fixed bug that caused html class attributes to be set to an empty string. [@liquidblock, #1085]
      • Fixed Private worker lifecycle event sending. [@joaquindk, #1146]
    • 🚨 Breaking changes

      • Bumped minimum supported Rust version (MSRV) to 1.40.0. [@jstarry, #1152]
    Source code(tar.gz)
    Source code(zip)
  • 0.15.0(Apr 25, 2020)

    Attention!

    yew now uses web-sys by default. If your project uses web-sys, you can now drop the "web_sys" feature from your yew dependency. Don't worry stdweb users, we have created a new alias crate for y'all called yew-stdweb. In order to use it, update your Cargo.toml yew dependency to the following:

    yew = { version = "0.15", package = "yew-stdweb" }
    

    Dev Survey Results

    Thank you to everyone that took the time to fill out the Yew Dev Survey! 🙇‍♂️

    Results have been posted here: https://github.com/yewstack/yew/wiki/Dev-Survey-%5BSpring-2020%5D

    New Chatroom

    We moved from Gitter to Discord! Join us: https://discord.gg/VQck8X4

    Changelog

    • ⚡️ Features

      • Add support for single use callbacks (useful for TimeoutService). [@lukerandall, #1125]
      • Updated scheduler to eagerly destroy components to avoid unnecessary renders. [@jstarry, #1072]
      • Add support key attribute to improve rendering performance. [@mrh0057, #1076]
    • 🛠 Fixes

      • Split class names on whitespace when passed within tuple or Vec. [@bryanjswift, #1084]
    • 🚨 Breaking changes

      • The components module has been moved out yew and into yew-components. [@jstarry, #1132]
      • Replaced mounted component lifecycle method with rendered which is called after each render. [@jstarry, #1072]
      • Components must now implement the change method (forgetting this was a very common issue). [@jstarry, #1071]
      • Yew now builds with web-sys by default. [@jstarry, #1092]
    Source code(tar.gz)
    Source code(zip)
  • 0.14.3(Apr 4, 2020)

  • 0.14.2(Mar 23, 2020)

  • 0.14.1(Mar 14, 2020)

  • 0.14.0(Mar 14, 2020)

    Happy 🥧 (PI) Day! This release brings a number of bug fixes for web-sys apps and ergonomic improvements to the API. Huge thanks to the community for diving into the migration from stdweb to web-sys so quickly and uncovering these issues!

    Changelog

    • ⚡️ Features

    • 🛠 Fixes

      • Fixed panic in stdweb ResizeService event handling. [@nicklaswj, #1014]
      • Removed build check for OS compatibility. [@jstarry, #1019]
      • Fixed interval and timer usage in web-sys workers by updating gloo. [@jstarry, #1018]
      • Send Connected message for Public agents. [@TheNeikos, #1007]
      • Fixed web-sys Public / Private agent initialization. [@jstarry, #1006]
      • Fixed websocket 'text' message handling for web-sys agents. [@jstarry, #1005]
    • 🚨 Breaking changes

      • FetchError::FetchFailed enum variant now wraps a String to hold the failure reason. [@jstarry, #1025]
      • Message APIs now accept Into<Msg>, so calling msg.into() will cause compile errors. [@captain-yossarian, #999]
    Source code(tar.gz)
    Source code(zip)
  • 0.13.2(Mar 7, 2020)

  • 0.13.1(Mar 4, 2020)

  • 0.13.0(Mar 1, 2020)

    web-sys support has arrived!

    @daxpedda spear-headed the effort and courageously integrated web-sys while maintaining support for stdweb through no small amount of cfg macro usage. We chose to continue support for apps built with stdweb because the dev experience is still quite a bit better (Unfortunately cargo-web is incompatible with web-sys). However, the Yew team recognizes that the future of cargo-web of stdweb are uncertain. For this reason, we recommend devs start making the switch over to web-sys and wasm-bindgen. We will likely invest in improving the dev experience with these tools so that switching over is eventually a no-brainer. Please reach out with ideas and feedback for this migration through Github issues and in our Gitter chatroom!

    After upgrading to v0.13, devs will now have to opt in to either stdweb or web-sys by using either the "web_sys" or "std_web" on the yew crate in their Cargo.toml.

    # Choose `stdweb`
    yew = { version = "0.13", features = ["std_web"] }
    
    # Choose `web-sys`
    yew = { version = "0.13", features = ["web_sys"] }
    

    Lastly, take note that API docs on https://docs.rs/yew will be using the "web_sys" feature. For "std_web" docs, please visit https://docs.rs/yew-stdweb.

    Changelog

    • ⚡️ Features

      • Added support for building apps with web-sys. [@daxpedda, #961]

      • Properties 2.0 [@AlephAlpha, #975]

        Component properties are now assumed to be required unless otherwise annotated with a default value. Check out the proposal issue #928 for more details!

    • 🛠 Fixes

      • Fixed Component children re-rendering bug. [@jstarry, #980]
      • Fixed panic when interacting with agents after receiving an agent message. [@jstarry, #981]
      • Fixed panic when a component with a root VRef node is detached. [@jstarry, #983]
      • Fixed annoying warning when a component with a root VTag node is detached. [@jstarry, #983]
    • 🚨 Breaking changes

      • Changed Properties macro behavior. Check out the proposal issue #928 for more details! [@AlephAlpha, #975]
      • Cleaned up exported apis and doc visibility. [@jstarry, #977]
      • ReaderService methods now return a Result instead of panicking. [@daxpedda, #868]
      • FetchService methods now return a Result instead of panicking. [@daxpedda, #867]
      • StorageService methods now return a Result instead of panicking. [@daxpedda, #827]
    Source code(tar.gz)
    Source code(zip)
  • 0.12.0(Feb 16, 2020)

    Happy (belated) Valentine's Day for all who ♥️ Yew! Yew ♥️'s you too! This release, as always, packs a bunch of fixes and features from the Yew community. Take special care of the few breaking changes.

    • ⚡️ Features

      • Improved ergonomics for html! { for .. }. [@jstarry, #875]
      • Added #[props(default = "fn_path")] for specifying a default property value. [@AlephAlpha, #881]
      • Exposed the macros for creating format types. [@ctm, #883]
      • Added support for binary-only and text-only formats in WebSocketService. [@ctm, #851]
      • Implemented PartialEq for ChildrenRenderer to allow children comparison. [@jstarry, #916]
      • Reduced restrictions on ComponentLink methods to improve Future support. [@jplatte, #931]
      • Added referrer, referrer_policy and integrity to FetchOptions. [@leo-lb, #931]
    • 🛠 Fixes

    • 🚨 Breaking changes

      • Switched from using failure to anyhow and thiserror for Yew errors. [@daxpedda, #863]
      • Removed cancel method from Task trait in favor of relying on Drop. [@kakoc, #899]
      • Renamed NodeRef.try_into to NodeRef.cast to avoid trait conflicts. [@jstarry, #917]
    Source code(tar.gz)
    Source code(zip)
  • 0.11.0(Jan 6, 2020)

    This release aims to lay the groundwork for Yew component libraries as well as clean up the API for the ever elusive 1.0 release 😜

    Transition Guide

    This release comes with a lot of breaking changes. We understand it's a hassle to update projects but the Yew team felt it was necessary to rip a few bandaids off now as we approach a 1.0 release in the (hopefully) near future. To ease the transition, here's a guide which outlines the main refactoring you will need to do for your project. (Note: all of the changes are reflected in the many example projects if you would like a proper reference example)

    1. Callback syntax

    This is the main painful breaking change. It applies to both element listeners as well as Component callback properties. A good rule of thumb is that your components will now have to retain a ComponentLink to create callbacks on demand or initialize callbacks in your component's create() method.

    Before:

    struct Model;
    
    enum Msg {
        Click,
    }
    
    impl Component for Model {
        type Message = Msg;
        type Properties = ();
    
        fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
            Model
        }
    
        fn update(&mut self, msg: Self::Message) -> ShouldRender {
            match msg {
                Msg::Click => true,
            }
        }
    
        fn view(&self) -> Html<Self> {
            // BEFORE: Callbacks were created implicitly from this closure syntax
            html! {
                <button onclick=|_| Msg::Click>{ "Click me!" }</button>
            }
        }
    }
    

    After:

    struct Model {
      link: ComponentLink<Self>,
    }
    
    enum Msg {
        Click,
    }
    
    impl Component for Model {
        type Message = Msg;
        type Properties = ();
    
        fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self {
            Model { link }
        }
    
        fn update(&mut self, msg: Self::Message) -> ShouldRender {
            match msg {
                Msg::Click => true,
            }
        }
    
        fn view(&self) -> Html {
            // AFTER: Callbacks need to be explicitly created now
            let onclick = self.link.callback(|_| Msg::Click);
            html! {
                <button onclick=onclick>{ "Click me!" }</button>
            }
        }
    }
    

    If a closure has a parameter you will now need to specify the parameter's type. A tip for finding the appropriate type is to search Yew's repo for the HTML attribute the closure is assigned to.

    For example, onkeydown of <button>:

    let onkeydown = self.link.callback(|e: KeyDownEvent| {
        // ...
    });
    

    and

    html! {
        <button onkeydown=onkeydown type="button">
            { "button" }
        </button>
    }
    

    2. Method Renames

    It should be safe to do a project-wide find/replace for the following:

    • send_self( -> send_message(
    • send_back( -> callback(
    • response( -> respond(
    • AgentUpdate -> AgentLifecycleEvent

    These renames will probably require some more care:

    • fn handle( -> fn handle_input( (for Agent trait implementations)

    3. Drop Generic Types for Html<Self> -> Html

    :tada: We are pretty excited about this change! The generic type parameter was confusing and restrictive and is now a thing of the past!

    Before:

    impl Component for Model {
        // ...
    
        fn view(&self) -> Html<Self> {
            html! { /* ... */ }
        }
    }
    

    After:

    impl Component for Model {
        // ...
    
        fn view(&self) -> Html {
            html! { /* ... */ }
        }
    }
    

    4. Properties must implement Clone

    In yew v0.8 we removed the requirement that component properties implement Clone and in this release we are adding the requirement again. This change is needed to improve the ergonomics of nested components. The only time properties will be cloned is when a wrapper component re-renders nested children components.


    Changelog

    • ⚡️ Features

      • Added html_nested! macro to support nested iterable children access. [@trivigy, #843]
      • Added bincode to the list of supported formats. [@serzhiio, #806]
      • Added a noop() convenience method to Callback which creates a no-op callback. [@mdtusz, #793]
      • The html! macro now accepts a Callback for element listeners. [@jstarry, #777]
      struct Model {
          onclick: Callback<ClickEvent>,
      }
      
      enum Msg {
          Click,
      }
      
      impl Component for Model {
          type Message = Msg;
          type Properties = ();
      
          fn create(_: Self::Properties, link: ComponentLink<Self>) -> Self {
              Model {
                  onclick: link.callback(|_| Msg::Click),
              }
          }
      
          fn update(&mut self, msg: Self::Message) -> ShouldRender {
              match msg {
                  Msg::Click => true,
              }
          }
      
          fn view(&self) -> Html {
              html! {
                  <button onclick=&self.onclick>{ "Click me!" }</button>
              }
          }
      }
      
      • Add send_message_batch method to ComponentLink. [@hgzimmerman, #748]
      • Allow compilation to wasi target without wasm_bindgen. [@dunnock, #746]
      • AgentLink now implements Clone which enables Future usage without explicit Yew framework support. [@izissise, #802]
      • ComponentLink now implements Clone which enables Future usage without explicit Yew framework support. [@hgzimmerman, #749]
      use wasm_bindgen::JsValue;
      use wasm_bindgen_futures::future_to_promise;
      
      // future must implement `Future<Output = Component::Message> + 'static`
      let link = self.link.clone();
      let js_future = async move {
          link.send_message(future.await);
          Ok(JsValue::NULL)
      };
      
      future_to_promise(js_future);
      
    • 🛠 Fixes

      fn view(&self) -> Html {
          html! {
              <Wrapper>
                  // This is now valid. (before #780, this would cause a lifetime
                  // compile error because children nodes were moved into a closure)
                  <Nested on_click=&self.nested_on_click />
              </Wrapper>
          }
      }
      
      • Creating a Callback with ComponentLink is no longer restricted to mutable references, improving ergonomics. [@jstarry, #780]
      • The Callback reform method no longer consumes self making it easier to "reverse map" a Callback. [@jstarry, #779]
      pub struct ListHeader {
          props: Props,
      }
      
      #[derive(Properties, Clone)]
      pub struct Props {
          #[props(required)]
          pub on_hover: Callback<Hovered>,
          #[props(required)]
          pub text: String,
      }
      
      impl Component for ListHeader {
          type Message = ();
          type Properties = Props;
      
          fn create(props: Self::Properties, _: ComponentLink<Self>) -> Self {
              ListHeader { props }
          }
      
          fn update(&mut self, _: Self::Message) -> ShouldRender {
              false
          }
      
          fn view(&self) -> Html {
              let onmouseover = self.props.on_hover.reform(|_| Hovered::Header);
              html! {
                  <div class="list-header" onmouseover=onmouseover>
                      { &self.props.text }
                  </div>
              }
          }
      }
      
      • Reduced allocations in the Classes to_string method. [@hgzimmerman, #772]
      • Empty string class names are now filtered out to prevent panics. [@jstarry, #770]
    • 🚨 Breaking changes

      • Components with generic args now need to be closed with the full type path. (e.g. html! { <Wrapper<String>></Wrapper<String>>}) [@jstarry, #837]
      • Changed VTag listener type from Box<dyn Listener> to Rc<dyn Listener>. [@jstarry, #786]
      • Properties need to implement Clone again in order to improve nested component ergonomics. [@jstarry, #786]
      • Removed send_future method from ComponentLink since it is no longer necessary for using Futures with Yew. [@hgzimmerman, #799]
      • Removed generic type parameter from Html and all virtual node types: VNode, VComp, VTag, VList, VText, etc. [@jstarry, #783]
      • Removed support for macro magic closure syntax for element listeners. (See transition guide for how to pass a Callback explicitly instead). [@jstarry, #782]
      • Renamed Agent methods and event type for clarity. handle -> handle_input, AgentUpdate -> AgentLifecycleEvent, response -> respond. [@philip-peterson, #751]
      • The ComponentLink send_back method has been renamed to callback for clarity. [@jstarry, #780]
      • The ComponentLink send_self and send_self_batch methods have been renamed to send_message and send_message_batch for clarity. [@jstarry, #780]
      • The Agent send_back method has been renamed to callback for clarity. [@jstarry, #780]
      • The VTag children value type has changed from Vec<VNode> to VList. [@jstarry, #754]
    Source code(tar.gz)
    Source code(zip)
  • 0.10.0(Nov 11, 2019)

    Back to the...

    • ⚡️ Features

      • Future support :tada: A Component can update following the completion of a Future. Check out this example to see how it works. This approach was borrowed from a fork of Yew called plaster created by @carlosdp. [@hgzimmerman, #717]
      • Added the agent and services features so that those modules can be disabled (useful if you are switching to using Futures). [@hgzimmerman, #684]
      • Add ref keyword for allowing a Component to have a direct reference to its rendered elements. For example, you can now easily focus an <input> element after mounting. [@jstarry, #715]
      use stdweb::web::html_element::InputElement;
      use stdweb::web::IHtmlElement;
      use yew::*;
      
      pub struct Input {
          node_ref: NodeRef,
      }
      
      impl Component for Input {
          type Message = ();
          type Properties = ();
      
          fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
              Input {
                  node_ref: NodeRef::default(),
              }
          }
      
          fn mounted(&mut self) -> ShouldRender {
              if let Some(input) = self.node_ref.try_into::<InputElement>() {
                  input.focus();
              }
              false
          }
      
          fn update(&mut self, _: Self::Message) -> ShouldRender {
              false
          }
      
          fn view(&self) -> Html<Self> {
              html! {
                  <input ref=self.node_ref.clone() type="text" />
              }
          }
      }
      
      • Make Agent related types public to allow other crates to create custom agents. [@dunnock, #721]
      • Component::change will now return false for components that have Component::Properties == (). [@kellytk, #690]]
      • Updated wasm-bindgen dependency to 0.2.54. Please update your wasm-bindgen-cli tool by running cargo install --force --version 0.2.54 -- wasm-bindgen-cli. [@jstarry, #730], [@ctaggart, #681]
    • 🛠 Fixes

      • Fixed the mount order of components. The root component will be mounted after all descendants have been mounted. [@jstarry, #725]
      • All public items now implement Debug. [@hgzimmerman, #673]
    • 🚨 Breaking changes

      • Minimum rustc version has been bumped to 1.39.0 for Future support. [@jstarry, #730]

      • Component now has a required view method and automatically implements the Renderable trait. The view method in the Renderable trait has been renamed to render. [@jstarry, #563]

        Before:

        impl Component for Model {
            type Message = Msg;
            type Properties = ();
        
            fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
                Model {}
            }
        
            fn update(&mut self, msg: Self::Message) -> ShouldRender {
                true
            }
        }
        
        impl Renderable<Model> for Model {
            fn view(&self) -> Html<Self> {
                html! { "hello" }
            }
        }
        

        After:

        impl Component for Model {
            type Message = Msg;
            type Properties = ();
        
            fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self {
                Model {}
            }
        
            fn update(&mut self, msg: Self::Message) -> ShouldRender {
                true
            }
        
            fn view(&self) -> Html<Self> {
                html! { "hello" }
            }
        }
        
      • Removed the Transferable trait since it did no more than extend the serde Serialize and Deserialize traits. [@hgzimmerman, #319]

        Before:

        impl Transferable for Input {}
        #[derive(Serialize, Deserialize)]
        pub enum Input {
          Connect,
        }
        

        After:

        #[derive(Serialize, Deserialize)]
        pub enum Input {
          Connect,
        }
        
      • WebSocketService::connect will now return a Result in order to stop panicking on malformed urls. [@lizhaoxian, #727]

      • VTag now is boxed within VNode to shrink the size of its enum representation. [@hgzimmerman, #675]

    Source code(tar.gz)
    Source code(zip)
  • 0.9.2(Oct 13, 2019)

  • 0.9.1(Oct 13, 2019)

    Happy Canadian Thanksgiving! 🦃

    • ⚡️ Features

      • Implemented Default trait for VNode so that unwrap_or_default can be called on Option<Html<Self>>. [@hgzimmerman, #672]
      • Implemented PartialEq trait for Classes so that is more ergonomic to use Classes type in component props. [@hgzimmerman, #680]
      • Updated wasm-bindgen dependency to 0.2.50. Please update your wasm-bindgen-cli tool by running cargo install --force --version 0.2.50 -- wasm-bindgen-cli. [@jstarry, #695]
    • 🛠 Fixes

      • Fixed issue where text nodes were sometimes rendered out of order. [@jstarry, #697]
      • Fixed regression introduced in 0.9.0 that prevented tag attributes from updating properly. [@jstarry, #698]
      • Fixed emscripten builds by pinning the version for the ryu downstream dependency. [@jstarry, #703]
      • Updated stdweb to 0.4.20 which fixed emscripten builds and unblocked updating wasm-bindgen to 0.2.50. [@ctaggart, @jstarry, #683, #694]
      • Cleaned up build warnings for missing dyn keywords. [@benreyn, #687]
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Sep 27, 2019)

    Feature Overload

    This release introduces a slew of new features, many of which come from first-time contributors! There's too many to mention so read more below 😄 Also, a long-standing bug was fixed by @hgzimmerman which was causing Component's to not be destroyed properly.

    • ⚡️ Features

      • New KeyboardService for setting up key listeners on browsers which support the feature. [@hgzimmerman, #647]

      • ComponentLink can now create a Callback with more than one Message. The Message's will be batched together so that the Component will not be re-rendered more than necessary. [@stkevintan, #660]

      • Message's to Public Agent's will now be queued if the Agent hasn't finished setting up yet. [@serzhiio, #596]

      • Agent's can now be connected to without a Callback. Instead of creating a bridge to the agent, create a dispatcher like so: MyAgent::dispatcher(). [@hgzimmerman, #639]

      • Component's can now accept children in the html! macro. [@jstarry, #589]

        // app.rs
        
        html! {
          <MyList name="Grocery List">
            <MyListItem text="Apples" />
          </MyList>
        }
        
        // my_list.rs
        
        use yew::prelude::*;
        
        pub struct MyList(Props);
        
        #[derive(Properties)]
        pub struct Props {
            #[props(required)]
            pub name: String,
            pub children: Children<MyListItem>,
        }
        
        impl Renderable<MyList> for MyList {
          fn view(&self) -> Html<Self> {
            html! {{
              self.props.children.iter().collect::<Html<Self>>()
            }}
          }
        }
        
      • Iterators can now be rendered in the html! macro without using the for keyword. [@hgzimmerman, #622]

        Before:

        html! {{
          for self.props.items.iter().map(renderItem)
        }}
        

        After:

        html! {{
          self.props.items.iter().map(renderItem).collect::<Html<Self>>()
        }}
        
      • Closures are now able to be transformed into optional Callback properties. [@Wodann, #612]

      • Improved CSS class ergonomics with new Classes type. [@DenisKolodin, #585], [@hgzimmerman, #626]

      • Touch events are now supported <div ontouchstart=|_| Msg::TouchStart> [@boydjohnson, #584], [@jstarry, #656]

      • The Component trait now has an mounted method which can be implemented to react to when your components have been mounted to the DOM. [@hgzimmerman, #583]

      • Additional Fetch options mode, cache, and redirect are now supported [@davidkna, #579]

      • The derive props macro now supports Properties with lifetimes [@jstarry, #580]

      • New ResizeService for registering for window size updates [@hgzimmerman, #577]

    • 🛠 Fixes

      • Fixed JS typo in RenderService. This was causing animation frames to not be dropped correctly. [@jstarry, #658]
      • Fixed VNode orphaning bug when destroying VTag elements. This caused some Components to not be properly destroyed when they should have been. [@hgzimmerman, #651]
      • Fix mishandling of Properties where clause in derive_props macro [@astraw, #640]
    • 🚨 Breaking changes

      None

    Source code(tar.gz)
    Source code(zip)
  • 0.8.0(Aug 10, 2019)

    Props! Props! Props!

    This release introduces a more developer friendly way to handle your Component props. Use the new #[derive(Properties)] macro to beef up your props! Property values can now be annotated as #[props(required)] which will enforce that props are present at compile time. This means that your props struct no longer needs to implement Default, so time to clean up all of those prop values you wrapped in Option to have a default value.

    • ⚡️ Features

      • html! - Self-closing html tags can now be used: <div class="marker" /> [@totorigolo, #523]
      • html! - SVG name-spaced tags are now supported! [@jstarry, #550]
      • Properties can now be required at compile time [@jstarry, #553]
      • App components can now be mounted with properties [@jstarry, #567]
      • Apps can now be mounted as the <body> tag [@jstarry, @kellytk, #540]
      • Content editable elements can now trigger oninput events [@tiziano88, #549]
    • 🛠 Fixes

      • html! - Class name order is now preserved which unlocks the use of Semantic UI [@charvp, #424]
      • html! - Dashed tag names and properties are supported [@jstarry, #512, #550]
      • html! - All rust keywords can be used as tag attributes [@jstarry, #550]
      • html! - Support Callback closure with explicit return type [@totorigolo, #564]
      • html! - Fixed edge case where > token would break parser [@totorigolo, #565]
      • Performance improvement to the diff engine [@totorigolo, #539]
      • Properties no longer need to implement the PartialEq, Clone, or Default traits [@jstarry, #553]
      • Component will not panic if the change method is unimplemented [@jstarry, #554]
    • 🚨 Breaking changes

      • The Component::Properties associated type must implement the new Properties trait [@jstarry, #553]

        The new Properties trait is what powers the ability to check required props are present at compile time. Use the derive props macro to implement automatically.

        use yew::Properties;
        
        #[derive(Properties)]
        pub struct Props {
          #[props(required)]
          pub value: MyStruct,
        }
        
      • Callback props no longer transform into Option types [@jstarry, #553]

        html! { <Button on_click=Msg::Click /> }
        

        before:

        #[derive(PartialEq, Clone, Default)]
        pub struct Props {
            on_click: Option<Callback<()>>,
        }
        

        after: note the #[props(required)] attribute

        #[derive(PartialEq, Properties)]
        pub struct Props {
            #[props(required)]
            on_click: Callback<()>,
        }
        
    Source code(tar.gz)
    Source code(zip)
Owner
Yew Stack
UI for Rust
Yew Stack
Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

null 3.6k Jan 6, 2023
The simplest build-time framework for writing web apps with html templates and typescript

Encoped A build-time fast af tool to write static apps with html and TypeScript Features Template-based ESLint, Prettier and Rollup integration No ext

null 1 Dec 11, 2021
Silkenweb - A library for writing reactive single page web apps

Silkenweb A library for building reactive single page web apps. Features Fine grained reactivity using signals to minimize DOM API calls No VDOM. Call

null 85 Dec 26, 2022
Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix 16.2k Jan 2, 2023
A (flash) message framework for actix-web. A port to Rust of Django's message framework.

actix-web-flash-messages Flash messages for actix-web Web applications sometimes need to show a one-time notification to the user - e.g. an error mess

Luca Palmieri 31 Dec 29, 2022
🌱🦀🌱 Trillium is a composable toolkit for building web applications with async rust 🌱🦀🌱

?????? Trillium is a composable toolkit for building web applications with async rust ??????

Trillium 243 Jan 2, 2023
Build, bundle & ship your Rust WASM application to the web.

Trunk Build, bundle & ship your Rust WASM application to the web. ”Pack your things, we’re going on an adventure!” ~ Ferris Trunk is a WASM web applic

Anthony Dodd 2.2k Jan 7, 2023
Thalo is an event-sourcing framework for building large scale systems

Thalo Event sourcing framework for building microservices. Overview Thalo is an event-sourcing framework for building large scale systems based on the

null 548 Jan 3, 2023
A blazingly fast HTTP client with a magnificent request building syntax, made for humans.

?? glue Make requests, select JSON responses, nest them in other requests: A magnificent syntax for blazingly fast cli HTTP calls, made for humans. Ta

Michele Esposito 4 Dec 7, 2022
Hot reload static web server for deploying mutiple static web site with version control.

SPA-SERVER It is to provide a static web http server with cache and hot reload. 中文 README Feature Built with Hyper and Warp, fast and small! SSL with

null 7 Dec 18, 2022
Code template for a production Web Application using Axum: The AwesomeApp Blueprint for Professional Web Development.

AwesomeApp rust-web-app More info at: https://awesomeapp.dev/rust-web-app/ rust-web-app YouTube episodes: Episode 01 - Rust Web App - Course to Produc

null 45 Sep 6, 2023
A highly customizable, full scale web backend for web-rwkv, built on axum with websocket protocol.

web-rwkv-axum A axum web backend for web-rwkv, built on websocket. Supports BNF-constrained grammar, CFG sampling, etc., all streamed over network. St

Li Junyu 12 Sep 25, 2023
A Rust web framework

cargonauts - a Rust web framework Documentation cargonauts is a Rust web framework intended for building maintainable, well-factored web apps. This pr

null 179 Dec 25, 2022
A rust web framework with safety and speed in mind.

darpi A web api framework with speed and safety in mind. One of the big goals is to catch all errors at compile time, if possible. The framework uses

null 32 Apr 11, 2022
A web framework for Rust.

Rocket Rocket is an async web framework for Rust with a focus on usability, security, extensibility, and speed. #[macro_use] extern crate rocket; #[g

Sergio Benitez 19.4k Jan 4, 2023
Thruster - An fast and intuitive rust web framework

A fast, middleware based, web framework written in Rust

null 913 Dec 27, 2022
A full-featured and easy-to-use web framework with the Rust programming language.

Poem Framework A program is like a poem, you cannot write a poem without writing it. --- Dijkstra A full-featured and easy-to-use web framework with t

Poem Web 2.2k Jan 6, 2023
Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, reactivity without a virtual DOM, and extreme customizability

arctic_hen7 1.2k Jan 8, 2023
Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

dougfort 3 Mar 18, 2022