-
Notifications
You must be signed in to change notification settings - Fork 34
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
Remove collection libraries #59
Comments
I'm perfectly fine with removing these directives. But I'd appreciate more detailed examples and explanations when you need them and when you don't. Like can you please explain these three:
-- like paper-item doesn't use both directives, right? - then short explanation why |
Your question highlights a big motivation for their removal: how inherently confusing they are. <paper-item>{{name}}</paper-item> This element does not need EmitChangesDirective or IronControlDirective. There is no banana-binding syntax, so there's no need to re-emit change events in an Angular format. There's also no usage of Angular form directives. <paper-input [(ngModel)]="value"></paper-input>
<paper-input formControlName="value"></paper-input> Both of these elements require IronControlDirective because they use Angular's forms. The first uses Template forms with the Neither of them require EmitChangesDirective, since we aren't directly two-way banana binding to a direct property. Instead we're banana binding to the <paper-checkbox [(checked)]="isChecked"></paper-checkbox> This requires EmitChangesDirective, because of the banana binding syntax. This element will fire a It doesn't use any form directives, so it doesn't need IronControlDirective in this situation. <paper-checkbox [checked]="isChecked" (checked-changed)="isChecked = $event.detail.value"></paper-checkbox> As a bonus, this element does not need either EmitChangesDirective or IronControlDirective. Its two-way binding is hooked up manually instead of using the banana binding shortcut. |
@hotforfeature Thank a lot for detailed explanation! I actually wasn't asking these questions, I was just proposing how readme should be organized :) But this is really helpful - just copy-pasted this whole seciont to our confulence page, coz I'm already tired explaining these things to our developers over and over again :) |
@hotforfeature I am in complete agreement on removing these. Ours is the same confusion. All our components are extensions of either |
Removal it is! |
closes #59 BREAKING CHANGE: Collections have been removed to avoid confusion. Add directives explicitly to elements only if they need them.
For Origami v2, I am considering removing the collection libraries and would like feedback from the community on it.
Current Implementation
The collection libraries are small directives that auto-target many common Polymer elements. This means developers do not have to use the
[ironControl]
and[emitChanges]
directives directly.With Collections
Without Collections
Motivation
Size
The collections module adds 8kb of data for this convenience. Not a lot, but every bit counts when trying to target a lower payload size for mobile, and Angular apps are already extremely bloated with Angular core, Zone.js, and Rxjs.
This extra size is even more frustrating when you realize you're only using a small portion of paper/app elements and not all of iron/gold/molecule/platinum elements that are included.
Confusion
When non-Google custom elements are using (such as the ever-popular Vaadin elements), it gets confusing when some Polymer elements need the directives and some do not.
Performance
Not all elements need the
[ironControl]
or[emitChanges]
directives. Auto-adding them by default will not be favorable on performance, especially when using dozens or hundreds of Polymer elements at once.Proposal
I would suggest we remove the collections library entirely from Origami v2 and change the documentation to encourage developers to use these helper directives sparingly and only when needed.
The text was updated successfully, but these errors were encountered: