-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[FEATURE ember-contextual-components] Contextual components per RFC #64 #12285
Conversation
Lookin good so far, keep it up! |
1cb7986
to
8dab134
Compare
After a great talk with @mixonic, it seems the best road is to do a component cell. Since my streams and cells knowledge is pretty limited, I tried to follow the I create a
I did not plumbing yet because I am only going as far as I feel I understand properly. |
30ca578
to
a0d0823
Compare
just yield a hash: | ||
|
||
```handlebars | ||
{{yield (hash |
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.
We can give a more generic example here.
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.
donezo
e059007
to
5cc8139
Compare
93e553b
to
7fabb60
Compare
What is this error about? In this other error, I see a lot of them but then the numbers say everything is fine. |
@Serabe the first error is sauce labs. Either there is something here incompatible with IE9, or (more likely) sauce labs had an intermittent failure. I'll kick the server. The "other" error, is the same link in your comment. |
25e42e4
to
04ea479
Compare
This feature moves previous component keyword implementation to `element-component` and adds a `closure-component` that creates a cell that closes over the component's path, positional parameters and hash parameters. These cells can be nested, merging the previous parameters with the previous ones.
04ea479
to
9e50864
Compare
@wycats @mmun @rwjblue I'd like to merge this PR with an initial implementation of contextual components. It does not include:
Getting this behind a FF will allow devs to explore the feature and get us early feedback. I hope to tie up the loose ends here as glimmer component lands and ship with 2.3 (ideally). @Serabe has also edited the component helper documentation to explain nested usage in a branch, so there are docs in the works already. |
If it's feature flagged and works reasonably well I am 👍 merging. |
[FEATURE ember-contextual-components] Contextual components per RFC #64
@Serabe - Thank you for working so hard on this! |
Thanks to you, guys, for the support. |
@Serabe Fantastic, you pulled it off! Great work! |
Submitted #12378 with some minor tweaks to the feature flagging syntax. |
This works great, thanks! Forms with the much-lauded simplified syntax are pretty easy to achieve. Utter barebones: {{!-- my-form --}}
<form {{action "submit" on="submit"}}>
{{yield (hash input=(component 'my-form-field' model=model))}}
</form> {{!-- my-form-field --}}
<div>
{{#if hasBlock}}
{{yield}} {{!-- escape hatch for custom form fields, they happen --}}
{{else}}
<label for="...">{{label}}</label>
{{input value=(mut (get model for))}}
{{/if}}
</div> {{!-- usage --}}
{{#my-form model=someModel as |form|}}
{{form.input label="First Name" for="firstName"}}
{{form.input label="Last Name" for="lastName"}}
{{#form.input}}
{{!-- random stuff here --}}
{{/form.input}}
{{/model-form}} |
emberjs/rfcs#64 (rendered html)
Introduce new syntax and semantics for improving component composition.
TODO
component
helper implementation toelement_component
.ember-contextual-components
feature flag.hash
helper.closure_component
.component
helper handle a component closure.(after [BUGFIX beta] Change preference in positional parameters #12350 this is no longer needed)ImplementThis needs changes in HTMLBars.{{my.component.closure}}
syntax.API docs for(left for a different PR after this has been merged)(component)