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 support for typed Custom CSS Properties #68

Closed
p-ob opened this issue Jun 20, 2021 · 1 comment · Fixed by #74
Closed

Add support for typed Custom CSS Properties #68

p-ob opened this issue Jun 20, 2021 · 1 comment · Fixed by #74
Assignees

Comments

@p-ob
Copy link

p-ob commented Jun 20, 2021

Summary

Today, there's no way to provide type-hints to consumers about a CSS custom property (e.g. '<color>', '<length>', etc.) This requires component authors to have very explicit property names (--my-foo-color) or document the property adequately in the description. Unfortunately, neither is suitable for IDE intellisense support.

Chrome has shipped the CSS @property rule and enabled by default as of 85, and the CSS Properties and Values API as of 78.

Proposal

Add a "type" property to the Custom CSS Property schema. Manifest consumers can treat the omission of this value as '*', which I believe is the default behavior of Custom CSS Properties.

We can additionally strongly type the TypeScript declaration schema with all the legal string values

@justinfagnani
Copy link
Collaborator

This is a good idea. I think we should add a "syntax" field to more closely match the properties and values APIs. I wish we had used "initialValue" rather than "default" for that reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants