Conversation
fitzgen
approved these changes
Mar 16, 2019
fitzgen
left a comment
There was a problem hiding this comment.
This is super awesome! What quick work!
I'm not familiar with the proc macro's implementation but I've left a small note below. Its the kind of thing that isn't a big deal, and could definitely be pushed off into a follow up issue to be addressed at a later date :)
|
|
||
| dodrio!(bump, | ||
| <div> | ||
| <button onclick={|root, vdom, _event| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This isn't very modular, but this PR adds a
dodrio!macro behind a feature flag which bypasses the usualDOMTree->VNode-> native song and dance and generatesdodrio::buildercode directly in the macro.It still populates a
typed_html::elementsstruct with attribute values so that we still have proper type checking, but instead of keeping these structs around in a full tree to be rendered later, the attributes are stringified on the spot and fed directly tododrio::builder::ElementBuilder.Alas, event handlers all take
Eventrather than a refined type because that's all Dodrio's API allows for. On the bright side, because they all have the same type, there's no need to construct a giant event handler struct to type check them all, and we just bypass that bit entirely and pass the functions directly on to Dodrio without any further indirection.Testing has been sparse, but the basic "counter" example from Dodrio (in
examples/dodrio) works.