feat: add support for parsing the ::part() selectors#48
feat: add support for parsing the ::part() selectors#48cray0000 wants to merge 1 commit intokristerkari:masterfrom
Conversation
Pull Request Test Coverage Report for Build 370
💛 - Coveralls |
|
Sorry @cray0000 , I have totally not noticed this one. What is the use case for the |
|
hi @kristerkari , it's something which is supposed to be working together with the Regarding the I forked some of your stuff related to classnames/stylenames and extended it with the emulation of styling parts of components following the So when you write the following in css file: // index.styl
.card
background: red
padding: 8px
&:part(title)
color: blue
&:part(footer)
padding: greenthis will get compiled into passing not just the <Card styleName='card' />will get transformed to: <Card {...styles.card} />where {
style: { ... },
titleStyle: { ... },
footerStyle: { ... }
}it's actually not just a simple And then from the JSX side I also added support for the <View part='root'>
<View part='title'>will be transformed to ( <View style={style}>
<View style={titleStyle}>and again it's a bit more complex than that, supporting merging in styles from the If you are interested in looking at the test cases and implementation, you can find it here: Tests for the JSX transformation are in And regarding this PR -- I'm not actually sure if it makes sense to merge it, since Let me know what you think. |
|
@cray0000 Thank you for the detailed explanation! i’m not home at the moment, but I’m happy to add the change if you have libraries that are using the parser. It should be safe to add since it’s behind a flag. |
Parse
::part()selectors whenparsePartSelectors: trueoption is passed.