Skip to content

Commit 00be31e

Browse files
lfantonevceder
authored andcommitted
Add transform function for @starting-style
--co-authored-by: Viktor Ceder <[email protected]> --co-authored-by: Luciano Fantone <[email protected]>
1 parent 383bf1e commit 00be31e

29 files changed

+1784
-1339
lines changed

.changeset/tender-beans-cheat.md

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

fixtures/features/src/features.css.ts

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

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)