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

Add the @ExportDecoratedItemsIfPublic decorator modifier. #1128

Closed
wants to merge 1 commit into from

Conversation

rictic
Copy link
Contributor

@rictic rictic commented Dec 15, 2019

@ExportDecoratedItemsIfPublic is a new decorator modifier for fields which should only be exported if public. When private or protected they are renamable and may be eliminated as dead code. This is more optimal version of @ExportDecoratedItems for fields which can only be accessed by reflection if they're public.

Our use case ExportDecoratedItemsIfPublic is the LitElement @Property decorator, where public properties are accessible as HTML attributes and may be written by raw HTML files or various template languages (lit-html, soy, angular templates, etc). This obviously is taking place outside of the class hierarchy of the element and so is only valid for public properties, but it is still useful for private properties to participate in the update lifecycle that comes along with @Property.

This change, combined with the already-landed #1125 we'll be able to remove the final @ExportDecoratedItems annotation from the LitElement decorators.

@ExportDecoratedItemsIfPublic is a new decorator modifier for fields which should only be exported if public. When private or protected they are renamable and may be eliminated as dead code. This is more optimal version of @ExportDecoratedItems for fields which can only be accessed by reflection if they're public.

Our use case ExportDecoratedItemsIfPublic is the LitElement @Property decorator, where public properties are accessible as HTML attributes and may be written by raw HTML files or various template languages (lit-html, soy, angular templates, etc). This obviously is taking place outside of the class hierarchy of the element and so is only valid for public properties, but it is still useful for private properties to participate in the update lifecycle that comes along with @Property.

This change, combined with the already-landed angular#1125 we'll be able to remove the final @ExportDecoratedItems annotation from the LitElement decorators.
@rictic
Copy link
Contributor Author

rictic commented Dec 15, 2019

Internal CL (with global presubmit): cl/285597256

@mprobst
Copy link
Contributor

mprobst commented Mar 5, 2020

We've decided not to go ahead with this, and instead have the library use different decorators.

@mprobst mprobst closed this Mar 5, 2020
@rictic
Copy link
Contributor Author

rictic commented Mar 5, 2020

See lit/lit-element#881 for the approach we're taking with LitElement

@rictic rictic deleted the export-if-public branch March 5, 2020 23:24
@rictic rictic restored the export-if-public branch March 5, 2020 23:24
@rictic rictic deleted the export-if-public branch March 5, 2020 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants