wix / stylable

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

feat: experimental `@st` structure definition v0 #2862

Closed idoros closed 1 year ago

idoros commented 1 year ago

This PR is the first step in our plan for an improved way to define a stylesheet structure.

Changes in this PR add the ability to define nested pseudo-elements in a single stylesheet and focus on new syntax for defining classes, pseudo-elements, and pseudo-states. The new syntax allows to define deep nested pseudo-elements in the same stylesheet and currently enforce limits that exist in stylable (will be loosed in the future):

More information on this effort can be found in the proposal.

Changes

Refactor parts handling

Up until now pseudo-elements were registered directly by css-class/ st-custom-selector features. This PR add a higher level feature st-structure to handle the previous auto parts mode (now called legacy-flat mode) and the new structure mode.

New @st definition

syntax: @st .class

Nested pseudo-state

syntax: @st :state;

Nested pseudo-element

syntax: @st ::part => mapped-selector

Technical debts