-
Notifications
You must be signed in to change notification settings - Fork 10
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
question about getViewBounds #10
Comments
Yes, they’re pretty safe. For all but the most esoteric use cases I think element modifiers can give you the same information without using private API. I should probably update to that where possible. We have talked about publicizing these, probably under a name that isn’t a throwback to the views days. The main challenge with using them is that they are a snapshot in time, they don’t update. Though that is also why they’re quite safe: it’s cheap to expose this information. |
I forgot to add: one reason these are stable is that the ember inspector needs them. |
Somebody should do an RFC to make this API public, the only sticking point is figuring out how this kind of pro API fits into the teaching story. |
Cool. Thanks for all the info. In my case I'm using them to make a <DropdownList as |List|>
<ul class='flex'>
<List.item as |Item|>
<li class='w-64 {{if Item.isActive 'bg-yellow'}}>
Item A
</li>
</List.item>
</ul>
</DropdownList> Both There's other situations I've wanted to be able to "iterate over children" too. |
A thing I'm going to encourage at least in ember-animated's docs is using angle invocation for components that truly represent elements, and curly for ones that don't. In a situation like <AnimatedContainer>
{{#animated-if showThing}}
<div>Thing</div>
{{/animated-if}}
</AnimatedContainer> you can see the real DOM structure, because I think if you have a strong requirement that a tagless component must have exactly one child, then it's a hint that tagless is not a good idea. It has recently become much easier to let people customize the DOM you are providing for them, so that is no longer a good reason to go tagless. This <DropdownList as |List|>
<ul class='flex'> Could just be <DropdownList class='flex' @tagName='ul' as |List|> with no loss of generality. Even element modifiers like <DropdownList {{on "click" something}} as |List|> are supported in angle invocation, as long as your component sets |
Hmm... <DropdownList class='flex' @tagName='ul' as |List|> Do/will Glimmer components support I like your convention in Ember Animated but also don't necessarily see the problem with doing some validation on what kind of children are passed into a tagless component. I think <DropdownList as |List|>
<ul class='flex'> generally feels way cleaner & more composable than using |
Of course, I didn't mention the one case that actually motivated this to begin with: <List.item as |Item|>
<li class='w-64 p-4 {{if Item.isActive "bg-yellow"}}'>
Item 2
</li>
</List.item> In this case, my <DropdownList class='flex' @tagName='ul' as |List|> that is not true, leading to strange APIs like |
What we're trying to get away from is making component authors use tagName just to customize their own element. Letting callers customize your components tag is a different beast. I agree that Your example using lexical scope is a good argument for why in some cases it's more powerful. |
* update ember-concurrency * ran ember-cli-update * update yarn.lock * patching up readme after merge * sure use yarn * releasing * Fix installation command * ember-cli-update * codemods * factoring out some uses of jquery * removing jquery usage in tests * dep updates and deprecation cleanup * drop jquery scenario because we always still use jquery * releasing Co-authored-by: Edward Faulkner <[email protected]> Co-authored-by: vladucu <[email protected]>
I've seen
getViewBounds
in several of your addons. Is this one of Ember's "intimate APIs", that will almost certainly have an upgrade path if/when it changes?The text was updated successfully, but these errors were encountered: