Thanks for the great feedback!
The cyclical problem is a bit different from other proposals I think, because it’s not operating at the selector level but at declaration level. And for declarations there are already rules how to handle cyclic dependencies AFAIK. For example:
This is specified to fail for both
--b and sets them to the initial/invalid value. I think the
@when could work similar to
@apply. For example:
This always resolves to
red. I think the
@when in your example would always be true, as long as the parent
--my-var is larger than
color: blue should always apply.
If I’m wrong and
@when has different cyclical problems then
@apply, I agree that applying the condition to the variables of the parent element would still make this feature very very useful.
Many of my use cases would be solved by this lighter form, what about yours?
Most use cases I could think of so far, are solved by the lighter form too. But if it’s possible to handle the cyclical problem, I would prefer the more powerful version.