Skip to content

Commit 8b49b35

Browse files
lfantoneaskoufis
andauthored
Add support for @starting-style rules (#1566)
Co-authored-by: Adam Skoufis <[email protected]> Co-authored-by: Adam Skoufis <[email protected]> Co-authored-by: Adam Skoufis <[email protected]>
1 parent 8aa8b06 commit 8b49b35

32 files changed

Lines changed: 2566 additions & 2107 deletions

.changeset/tender-beans-cheat.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@vanilla-extract/css': minor
3+
---
4+
5+
`style`: Add support for `@starting-style` rules
6+
7+
**EXAMPLE USAGE**:
8+
9+
```ts
10+
import { style } from '@vanilla-extact/css';
11+
export const styleWithStartingStyle = style({
12+
backgroundColor: 'black',
13+
'@starting-style': {
14+
backgroundColor: 'white',
15+
},
16+
});
17+
``

fixtures/features/src/features.css.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,10 @@ export const styleVariantsCompositionInSelector = styleVariants({
6060
globalStyle(`body ${styleVariantsCompositionInSelector.variant}`, {
6161
fontSize: '24px',
6262
});
63+
64+
export const styleWithStartingStyle = style({
65+
backgroundColor: 'black',
66+
'@starting-style': {
67+
backgroundColor: 'white',
68+
},
69+
});

fixtures/features/src/html.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default `
99
<div id="${testNodes.compositionOnly}" class="${styles.compositionOnly}">Composition only</div>
1010
<div id="${testNodes.styleCompositionInSelector}" class="${styles.styleCompositionInSelector}">Style composition in selector</div>
1111
<div id="${testNodes.styleVariantsCompositionInSelector}" class="${styles.styleVariantsCompositionInSelector.variant}">Style variants composition in selector</div>
12+
<div id="${testNodes.styleWithStartingStyle}" class="${styles.styleWithStartingStyle}">Style with @starting-style rule</div>
1213
`;
1314

1415
// @ts-expect-error Vite env not defined

fixtures/features/test-nodes.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"styleVariantsWithMappedComposition": "styleVariantsWithMappedComposition",
66
"compositionOnly": "compositionOnly",
77
"styleCompositionInSelector": "styleCompositionInSelector",
8-
"styleVariantsCompositionInSelector": "styleVariantsCompositionInSelector"
8+
"styleVariantsCompositionInSelector": "styleVariantsCompositionInSelector",
9+
"styleWithStartingStyle": "styleWithStartingStyle"
910
}

0 commit comments

Comments
 (0)