proposal: Type only class definition #2676
Labels
core
Processing and transforming logic
discussion
Ongoing conversation
feature
New syntax feature or behavior
There are cases where components don't allow passing a CSS class to the root of the component, but expose styling of inner parts.
For example Radix has components with an invisible unstylable wrapper, like
Alert
andTooltip
that don't accept styling for the grouping component, but accept a class for inner parts liketrigger
,overlay
, andcontent
.Current state
When writing a selector in Stylable, CSS class might be transformed to namespace or map to a different selector, but the intent to target something is preserved.
If we define an
alert.st.css
stylesheet today, with inner parts and try to use the alert root class as a selector then we get thealert__root
class that won't be in the DOM, so it won't target and apply anything:This means that we can try and model the style API to treat each inner part as a separate component by either:
1. Having a different stylesheet for each part
2. Import inner parts
The second is probably better as it is less verbose on files and code, but it is still less good then having a component root to group inner parts as syntactic sugar, especially with some component stylesheets containing many parts.
Goals
Proposal
-st-type-only
or maybe add an option to-st-extends
to accept a "none" value to indicate its not a runtime class and is not intended to target anything.definition
transform away interface only root
no runtime
extend interface only class
The text was updated successfully, but these errors were encountered: