Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the prop:* directive to the view macro #435

Merged
merged 2 commits into from
Jun 18, 2022

Conversation

mc1098
Copy link
Contributor

@mc1098 mc1098 commented Jun 11, 2022

Adds the ability to set properties directly in the view macro that
accepts any value that can be converted into the JsValue.

Supports both static and dynamic values in a similar manner that
attributes do currently.

Updates some of the examples to use the new directive when the type can
be used directly as a property instead of cloning or serializing the
value.

I did update the website to include a section on this new directive but there
is not a similar section for the builder API, so I'm not sure if you want to keep
this out or whether you'd like me to add something similar for the builder docs :).

Closes #330

Adds the ability to set properties directly in the view macro that
accepts any value that can be coverted into the `JsValue`.

Supports both static and dynamic values in the same manner that
attributes do currently.

Updates some of the examples to use the new directive when the type can
be used directly as a property instead of cloning or serializing the
value.
@codecov
Copy link

codecov bot commented Jun 11, 2022

Codecov Report

Merging #435 (8e37b45) into master (215a015) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #435      +/-   ##
==========================================
+ Coverage   64.97%   64.99%   +0.02%     
==========================================
  Files          52       52              
  Lines        8268     8305      +37     
==========================================
+ Hits         5372     5398      +26     
- Misses       2896     2907      +11     
Impacted Files Coverage Δ
packages/sycamore-macro/src/view/ir.rs 100.00% <ø> (ø)
packages/sycamore-macro/src/view/codegen.rs 97.34% <100.00%> (+1.12%) ⬆️
packages/sycamore-macro/src/view/parse.rs 96.89% <100.00%> (+0.08%) ⬆️
packages/sycamore-web/src/lib.rs 2.38% <0.00%> (-1.33%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 215a015...8e37b45. Read the comment docs.

Checks that literal values are accepted as property values.
@mc1098
Copy link
Contributor Author

mc1098 commented Jun 11, 2022

Lets see if I can make Codecov happy this time :)

@lukechu10
Copy link
Member

Codecov is indeed happy this time but don't worry too much about it. The reason is that half of our test suite does not actually count towards coverage because they run only in wasm. In fact, our coverage should be much better than what it shows.

@lukechu10
Copy link
Member

Sorry for taking so long to review. LGTM. As for the docs, I'm planning on rehauling it anyways, so I'll handle that.

@lukechu10 lukechu10 merged commit 95a7e14 into sycamore-rs:master Jun 18, 2022
@mc1098 mc1098 deleted the view-prop-directive branch June 18, 2022 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set element property directly from view! macro
2 participants