-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Why are custom properties not optional? #69
Comments
Hey, Thanks! :)
|
Thank you. PR opened! (: On
Having said that, it doesn't appear to be permissible to nest Not permissiblediv[data-component="test"] {
@property --color {
syntax: "<color>";
inherits: false;
initial-value: rebeccapurple;
}
outline: 10rem solid var(--color);
} Permissible, but can no longer be associated with an element@property --color {
syntax: "<color>";
inherits: false;
initial-value: rebeccapurple;
}
div[data-component="test"] {
outline: 10rem solid var(--color);
} Some half baked thoughts:
Maybe I'm overthinking it 😅. |
Thanks for the example! Private custom property@property --color {
syntax: "<color>";
inherits: false;
initial-value: rebeccapurple;
}
div[data-component="test"] {
outline: 10rem solid var(--color);
} // TS not allowed
<div data-component="test" style={{ color: ' red' }} /> Public custom property@property --color {
syntax: "<color>";
inherits: false;
initial-value: rebeccapurple;
}
div[data-component="test"] {
--color: var(--color); /* Exposed/public custom property */
outline: 10rem solid var(--color);
} // TS allowed
<div data-component="test" style={{ color: ' red' }} /> Regarding |
Aha! That's a great suggestion, thank you. I'll try adopting this pattern and see how it goes.
Yeeeeep... I love that Mist embraces the cascade, unlike other approaches that discourage or completely disallow it. However, for typing props, a distinct entry point is necessary. Appreciate your thoughts on this topic 🙏. |
I was really impressed to learn Mist generates types for CSS custom properties. However, I'm wondering why the resulting
style
object types are not optional. Especially because—as far as I can tell—Mist can only discover custom properties that have been declared with a default value in a style. Style consumers may not wish to override this default.CSS input
TypeScript output (
--color
is not optional)Questions
@property
at-rule for discovering custom properties, and perhaps inferring information about them?Love the work that's been done here ❤️.
The text was updated successfully, but these errors were encountered: