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

ui: Add optional name="" attribute to slots so you can name the slots using it (as opposed to positional params) #6740

Merged
merged 1 commit into from
Nov 19, 2019

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Nov 4, 2019

Pretty soon we would like to move to XML/Angle Bracket style
components. As they are XML-y it means you can't use positional
parameters anymore (every 'argument' for the component requires it to
use an XML-like attribute).

This adds a name="" attribute to both block-slot and yield-slot
components so we can use attributes to specify the name. We prefer using
attributes from now on, whilst the positional parameter is still
available yet deprecated so we can move over at whatever speed fits.

We also did the same with the block params positional parameter.

As a final note this entire in repo addon is a fork of
ember-block-slots

We've specifically not used or here for the same reasons as jQuery trigger vs click, hover, keyup etc etc. The ember team seem to be going through a similar reduction of API lately so we would like to follow that approach. If anyone feels strongly I'd happily switch in or instead.

There is no implementation right now, we'll either do this as we go along, or we'll do a few separate PRs when time allows/bit-by-bit.

@johncowen johncowen requested a review from a team November 4, 2019 17:27
@johncowen johncowen added the theme/ui Anything related to the UI label Nov 4, 2019
@johncowen johncowen changed the title ui: Add optional name="" attribute so you can name slots with it ui: Add optional name="" attribute to slots so you can name the slots using it (as opposed to positional params) Nov 5, 2019
Pretty soon we would like to move to XML/Angle Bracket style
components. As they are XML-y it means you can't use positional
parameters anymore (every 'argument' for the component requires it to
use an XML-like attribute).

This adds a `name=""` attribute to both block-slot and yield-slot
components so we can use attributes to specify the name. We prefer using
attributes from now on, whilst the positional parameter is still
available yet deprecated so we can move over at whatever speed fits.

We also did the same with the block params positional parameter.

As a final note this entire in repo addon is a fork of
`ember-block-slots`
@johncowen johncowen force-pushed the feature/ui-named-slots branch from 5de9c2e to c54d0bc Compare November 18, 2019 11:43
Copy link
Contributor

@meirish meirish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! FWIW I don't think the computed macros are getting cut in Glimmer, they'd just move to decorators, but it doesn't bother me that you're not using it here. I'd be more inclined if it were usable in more than one spot.

@johncowen
Copy link
Contributor Author

Thanks @meirish , re: computed macros - yeah for sure. Although I am concerned about the ticking timebomb with this and a move to Glimmer components 😬. I'm pretty sure none of this will work with a move to Glimmer components so I'm kinda pretending that problem isn't there for the moment and hoping it will go away at some point, preferably through some sort of slotting support in Glimmer. I know there is an RFC for this somewhere.

Anyhoo thanks for the review! You'll probably see a gradual (or maybe in a single PR) change throughout our templates to use this name="" approach at somepoint soonish.

@johncowen johncowen merged commit d5b5203 into ui-staging Nov 19, 2019
@johncowen johncowen deleted the feature/ui-named-slots branch November 19, 2019 10:13
@meirish
Copy link
Contributor

meirish commented Nov 19, 2019

Here's a tracking issue for named blocks in glimmer if you want to follow it: emberjs/rfc-tracking#44. I wouldn't fret this too much though, you can keep components that use block slots in the old style for now, it's not going away anytime soon.

johncowen added a commit that referenced this pull request Dec 11, 2019
Pretty soon we would like to move to XML/Angle Bracket style
components. As they are XML-y it means you can't use positional
parameters anymore (every 'argument' for the component requires it to
use an XML-like attribute).

This adds a `name=""` attribute to both block-slot and yield-slot
components so we can use attributes to specify the name. We prefer using
attributes from now on, whilst the positional parameter is still
available yet deprecated so we can move over at whatever speed fits.

We also did the same with the block params positional parameter.

As a final note this entire in repo addon is a fork of
`ember-block-slots`
johncowen added a commit that referenced this pull request Dec 17, 2019
Pretty soon we would like to move to XML/Angle Bracket style
components. As they are XML-y it means you can't use positional
parameters anymore (every 'argument' for the component requires it to
use an XML-like attribute).

This adds a `name=""` attribute to both block-slot and yield-slot
components so we can use attributes to specify the name. We prefer using
attributes from now on, whilst the positional parameter is still
available yet deprecated so we can move over at whatever speed fits.

We also did the same with the block params positional parameter.

As a final note this entire in repo addon is a fork of
`ember-block-slots`
johncowen added a commit that referenced this pull request Dec 18, 2019
Pretty soon we would like to move to XML/Angle Bracket style
components. As they are XML-y it means you can't use positional
parameters anymore (every 'argument' for the component requires it to
use an XML-like attribute).

This adds a `name=""` attribute to both block-slot and yield-slot
components so we can use attributes to specify the name. We prefer using
attributes from now on, whilst the positional parameter is still
available yet deprecated so we can move over at whatever speed fits.

We also did the same with the block params positional parameter.

As a final note this entire in repo addon is a fork of
`ember-block-slots`
@ghost
Copy link

ghost commented Jan 25, 2020

Hey there,

This issue has been automatically locked because it is closed and there hasn't been any activity for at least 30 days.

If you are still experiencing problems, or still have questions, feel free to open a new one 👍.

@ghost ghost locked and limited conversation to collaborators Jan 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants