-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
feat(template): support spread syntax ... #1965
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1965 +/- ##
==========================================
- Coverage 88.62% 88.57% -0.05%
==========================================
Files 272 272
Lines 22823 22909 +86
Branches 5292 5302 +10
==========================================
+ Hits 20226 20292 +66
- Misses 2597 2617 +20 ☔ View full report in Codecov by Sentry. |
How does order work or is there an error? e.g. <mb-button small.bind="false" $bindables.spread="{small:true}" /> |
It will create 2 binding in the order seen in the template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work @bigopon it's actually awesome how very little code this is to implement.
Thanks @bigopon for this nice addition! |
@fkleuver @Sayan751 I ended up giving a special treatment to |
@Sayan751 I'll go ahead with a new beta for the weekend, but will address any comments you have. |
2.0.0-beta.17 (2024-05-11) **BREAKING CHANGES:** * **template:** auto infer binding expression when empty (#1963) ([3359939](3359939)) Previously only the expression of binding to element bindables get auto inferred, now it's expanded to all bindings with `.bind`/`.to-view`/`.from-view`/`.two-way`/`.one-time` Examples: ```html <div some-prop.bind=""> means <div some-prop.bind="someProp"> <div some-prop.bind> means <div some-prop.bind="someProp"> <div some-prop.one-time> means <div some-prop.one-time="someProp"> ... ``` * **convention:** rewrite runtime-html decorators (#1960) ([eaf2cd7](eaf2cd7)) With tooling in the instable state for the tc39 decorator support, we will generate standard fn call code instead of decorator. This will likely be changed when browsers start officially supporting it, or at least when the tooling (both spec & tooling stability + compat) gets better **Features:** * **template:** support spread syntax with `spread` command and ... (#1965) ([ccae63b](ccae63b)) * **repeat:** allow custom repeatable value (#1962) ([c47df91](c47df91)) **Bug Fixes:** * **compiler:** fix order when spreading custom attribute into element bindable ([ccae63b](ccae63b)) * **au-slot:** separate parent scope selection from host scope selection (#1961) ([ff605fb](ff605fb)) **Refactorings:** * **kernel:** mark side effect free (#1964) ([22c8f71](22c8f71))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @bigopon! Just some minor comments and questions.
📖 Description
When the number of bindable properties grows bigger, and the binding are repetitive, it's quite a boilerplate having to specify everything, as per the examples in #1477 #1258 :
Desirable:
Not desirable
This PR adds support for spread syntaxes:
$bindables.spread="expression"
...$bindables="expression"
...expresion
Note:
$bindables
will have modeto-view
, ignoring any default mode of the target bindable properties...$attrs
not consider element bindable properties before custom attribute🎫 Issues
Close #1477
Close #1258
cc @fkleuver @Sayan751 @brandonseydel @Vheissu