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

Use new @property annotation for custom properties #1396

Open
6 tasks
janivo opened this issue Aug 8, 2024 · 0 comments
Open
6 tasks

Use new @property annotation for custom properties #1396

janivo opened this issue Aug 8, 2024 · 0 comments

Comments

@janivo
Copy link
Collaborator

janivo commented Aug 8, 2024

Task: Apply New @property API for Custom CSS Properties

Description

The new @property API for custom CSS properties allows for better type definitions, default values, and inheritance handling. We should update our custom CSS properties to use this new syntax for improved debugging and browser support.

To-Do

  • Review all custom CSS properties currently in use within the project.
  • Identify which custom properties can benefit from the new @property API.
  • Update the identified custom properties to use the new @property syntax.

Acceptance Criteria

  • Custom CSS properties are updated to use the @property API where applicable.
  • The updated properties function correctly with the new syntax.
  • Type validation, inheritance, and default values are properly applied as per the new API.

Example Implementation

@property --color {
  syntax: '<color>';
  inherits: true;
  initial-value: #586de7; 
}

@property --size {
  syntax: '<length>';
  inherits: true;
  initial-value: 20px; 
}

@property --cols {
  syntax: '<integer>';
  inherits: true;
  initial-value: 12; 
}

Why This is a Good Idea

  • Type Safety: The @Property API allows for typed CSS variables, reducing the risk of errors and improving the debugging experience.
  • Default Values: It provides a straightforward way to set default values for custom properties.
  • Maintainability: Using the @Property API can make CSS code more maintainable and self-documenting.

Additional Resources

MDN Documentation on @property

@github-actions github-actions bot added the new This issue has been recently added and has no estimation label Aug 8, 2024
@janivo janivo removed the new This issue has been recently added and has no estimation label Aug 8, 2024
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

No branches or pull requests

1 participant