wix / stylable

Stylable - CSS for components
https://stylable.io
MIT License
1.26k stars 62 forks source link

fix: first level pseudo-element def with extend in structure mode #2888

Closed idoros closed 11 months ago

idoros commented 12 months ago

This PR fixes a pseudo-element missed case with the new @st structure definition.

When defining a class with pseudo-element and extend, it is expected to resolve the name of the pseudo-element to it's top definition in the inheritance chain:

@st .base {
    @st ::part => .part-base;
}
@st .top :is(.base) {
    @st ::part => .part-top;
}

/* expect to resolve ::part to ".part-top" */
.top::part {}

This doesn't work before this PR because the infer selector process preferred to skip the first resolved symbol (start at .base instead of .top). This is due to legacy flat mode implicitly defining any local class as a pseudo-element of the .root class. Skipping the first resolved symbol allowed targeting both extended parts through pseudo-element syntax or local directly using class syntax.

This is no longer necessary in structure mode, because there are no implicit parts.