Skip to content

Commit 51fbd7a

Browse files
committed
0.19.0
1 parent 3b572bc commit 51fbd7a

37 files changed

Lines changed: 41709 additions & 2567 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 0.19.0 (May 29, 2026)
4+
- New `@stylexjs/atoms` package for inline atomic styles.
5+
- Experimental nested APIs for `stylex.create` and `stylex.defineVars`.
6+
- Add support for Svelte with the `unplugin` bundler plugin.
7+
- New StyleX DevTools browser extension for inspecting compiled styles.
8+
- ESLint auto-fixers for shorthand expansion in `stylex-valid-styles`.
9+
- Improve treeshakability of the `@stylexjs/stylex` runtime.
10+
- Respect project `browserslist` config instead of hardcoding defaults.
11+
- Fix Vite 8 CSS duplication in the `unplugin` plugin.
12+
313
## 0.18.3 (Apr 29, 2026)
414
- Add recursive derivation support for `defineVars`.
515
- StyleX DevTools extension now available in the Chrome Web Store.

examples/example-bun/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "example-bun",
4-
"version": "0.18.3",
4+
"version": "0.19.0",
55
"description": "Example: StyleX with Bun via @stylexjs/unplugin",
66
"main": "src/App.jsx",
77
"scripts": {
@@ -12,13 +12,13 @@
1212
},
1313
"license": "MIT",
1414
"dependencies": {
15-
"@stylexjs/stylex": "0.18.3",
15+
"@stylexjs/stylex": "0.19.0",
1616
"react": "^19.2.0",
1717
"react-dom": "^19.2.0"
1818
},
1919
"devDependencies": {
20-
"@stylexjs/unplugin": "0.18.3",
21-
"@stylexjs/eslint-plugin": "0.18.3",
20+
"@stylexjs/unplugin": "0.19.0",
21+
"@stylexjs/eslint-plugin": "0.19.0",
2222
"eslint": "^8.57.1",
2323
"shx": "^0.4.0"
2424
}

examples/example-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "example-cli",
4-
"version": "0.18.3",
4+
"version": "0.19.0",
55
"scripts": {
66
"example:build": "stylex --config .stylex.json5"
77
},
@@ -12,7 +12,7 @@
1212
"devDependencies": {
1313
"@babel/preset-react": "^7.25.7",
1414
"@babel/preset-typescript": "^7.25.7",
15-
"@stylexjs/cli": "0.18.3",
15+
"@stylexjs/cli": "0.19.0",
1616
"@types/react": "^19.2.6",
1717
"@types/react-dom": "^19.2.3",
1818
"shx": "^0.4.0",

examples/example-esbuild/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "example-esbuild",
4-
"version": "0.18.3",
4+
"version": "0.19.0",
55
"description": "Simple esbuild example for @stylexjs/unplugin",
66
"main": "src/App.jsx",
77
"scripts": {
@@ -10,13 +10,13 @@
1010
},
1111
"license": "MIT",
1212
"dependencies": {
13-
"@stylexjs/stylex": "0.18.3",
13+
"@stylexjs/stylex": "0.19.0",
1414
"react": "^19.2.0",
1515
"react-dom": "^19.2.0"
1616
},
1717
"devDependencies": {
18-
"@stylexjs/unplugin": "0.18.3",
19-
"@stylexjs/eslint-plugin": "0.18.3",
18+
"@stylexjs/unplugin": "0.19.0",
19+
"@stylexjs/eslint-plugin": "0.19.0",
2020
"esbuild": "^0.27.0",
2121
"eslint": "^8.57.1",
2222
"shx": "^0.4.0"
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
'use client';
9+
10+
import { useState } from 'react';
11+
import * as stylex from '@stylexjs/stylex';
12+
import x from '@stylexjs/atoms';
13+
14+
// === Edge case: atoms assigned to variables ===
15+
const redText = x.color.red;
16+
const boldText = x.fontWeight._700;
17+
18+
// === Edge case: conditional variable assignment ===
19+
const maybeStyle = true ? x.color.green : x.color.gray;
20+
21+
// === Component accepting atoms via xstyle prop ===
22+
function Card({
23+
xstyle,
24+
children,
25+
}: {
26+
xstyle?: stylex.StyleXStyles;
27+
children: React.ReactNode;
28+
}) {
29+
return (
30+
<div {...stylex.props(styles.card, xstyle)}>
31+
{children}
32+
</div>
33+
);
34+
}
35+
36+
export default function AtomsDemo() {
37+
const [color, setColor] = useState('tomato');
38+
const [count, setCount] = useState(0);
39+
40+
return (
41+
<div
42+
{...stylex.props(
43+
x.display.flex,
44+
x.flexDirection.column,
45+
x.alignItems.center,
46+
x.padding._32px,
47+
x.gap._24px,
48+
x.fontFamily['system-ui, sans-serif'],
49+
x.minHeight['100vh'],
50+
)}
51+
>
52+
<h1 {...stylex.props(x.fontSize._2rem, x.fontWeight._700)}>
53+
Atoms Test Page
54+
</h1>
55+
56+
{/* 1. Static atoms inline */}
57+
<Card>
58+
<span {...stylex.props(x.color.green)}>
59+
1. Inline static atom
60+
</span>
61+
</Card>
62+
63+
{/* 2. Atoms as variables */}
64+
<Card>
65+
<span {...stylex.props(redText, boldText)}>
66+
2. Variable atoms: red bold
67+
</span>
68+
</Card>
69+
70+
{/* 3. Atoms through xstyle prop */}
71+
<Card xstyle={x.backgroundColor.lavender}>
72+
3. xstyle prop: lavender bg
73+
</Card>
74+
75+
{/* 4. Array of atoms through xstyle */}
76+
<Card xstyle={[x.backgroundColor.lightyellow, x.color.navy]}>
77+
4. xstyle array: yellow bg + navy text
78+
</Card>
79+
80+
{/* 5. Dynamic atoms */}
81+
<div
82+
{...stylex.props(
83+
x.padding._16px,
84+
x.color(color),
85+
x.borderWidth._2px,
86+
x.borderStyle.solid,
87+
x.borderColor(color),
88+
x.borderRadius._8px,
89+
)}
90+
>
91+
5. Dynamic: {color}
92+
</div>
93+
<div {...stylex.props(x.display.flex, x.gap._8px)}>
94+
{['tomato', 'dodgerblue', 'purple', 'green'].map((c) => (
95+
<button
96+
key={c}
97+
onClick={() => setColor(c)}
98+
{...stylex.props(
99+
x.padding._8px,
100+
x.borderRadius._4px,
101+
x.backgroundColor(c),
102+
x.color.white,
103+
x.borderStyle.none,
104+
x.cursor.pointer,
105+
)}
106+
>
107+
{c}
108+
</button>
109+
))}
110+
</div>
111+
112+
{/* 6. Atoms + stylex.create mixed */}
113+
<Card xstyle={x.color.darkgreen}>
114+
<span {...stylex.props(styles.emphasis)}>
115+
6. stylex.create + atom xstyle
116+
</span>
117+
</Card>
118+
119+
{/* 7. Deduplication: atoms override create */}
120+
<div
121+
{...stylex.props(
122+
styles.redText,
123+
x.color.blue,
124+
)}
125+
>
126+
7. Dedup: should be blue (atom overrides create)
127+
</div>
128+
129+
{/* 8. Computed key syntax */}
130+
<div
131+
{...stylex.props(
132+
x.width['calc(100% - 64px)'],
133+
x.maxWidth['600px'],
134+
x.padding._16px,
135+
x.backgroundColor['#e8e8ff'],
136+
x.borderRadius._8px,
137+
x.textAlign.center,
138+
x.borderWidth._2px,
139+
x.borderStyle.dashed,
140+
x.borderColor['#8888ff'],
141+
)}
142+
>
143+
8. Computed keys: calc(100% - 64px) width, dashed purple border
144+
</div>
145+
146+
{/* 9. Leading underscore values */}
147+
<div
148+
{...stylex.props(
149+
x.fontSize['1.5rem'],
150+
x.lineHeight._2,
151+
x.padding._16px,
152+
x.margin._8px,
153+
x.backgroundColor['#fff3e0'],
154+
x.borderRadius._8px,
155+
x.fontWeight._700,
156+
)}
157+
>
158+
9. Leading underscores: 1.5rem font, bold, orange bg, 16px padding
159+
</div>
160+
161+
{/* 10. Conditional with && */}
162+
<div
163+
{...stylex.props(
164+
x.padding._16px,
165+
count > 0 && x.color.green,
166+
count === 0 && x.color.gray,
167+
)}
168+
>
169+
10. Conditional &&: count={count} (
170+
<button onClick={() => setCount(count + 1)} {...stylex.props(x.cursor.pointer)}>+</button>
171+
<button onClick={() => setCount(Math.max(0, count - 1))} {...stylex.props(x.cursor.pointer)}>-</button>
172+
)
173+
</div>
174+
175+
{/* 11. Ternary conditional */}
176+
<div
177+
{...stylex.props(
178+
x.padding._16px,
179+
count % 2 === 0 ? x.backgroundColor.lightyellow : x.backgroundColor.lightblue,
180+
)}
181+
>
182+
11. Ternary: {count % 2 === 0 ? 'yellow' : 'blue'} bg
183+
</div>
184+
185+
{/* 12. Static + dynamic coexist */}
186+
<div
187+
{...stylex.props(
188+
x.display.flex,
189+
x.gap._8px,
190+
x.alignItems.center,
191+
x.color(color),
192+
)}
193+
>
194+
12. Static + dynamic together
195+
</div>
196+
197+
{/* 13. Multiple dynamic atoms */}
198+
<div
199+
{...stylex.props(
200+
x.color(color),
201+
x.backgroundColor(color === 'tomato' ? '#fff0f0' : '#f0f0ff'),
202+
x.padding._16px,
203+
x.borderRadius._8px,
204+
)}
205+
>
206+
13. Multiple dynamic: color + bg
207+
</div>
208+
209+
{/* 14. Shorthand property */}
210+
<div
211+
{...stylex.props(
212+
x.margin._16px,
213+
x.padding._8px,
214+
x.borderWidth._1px,
215+
x.borderStyle.solid,
216+
x.borderColor.gray,
217+
)}
218+
>
219+
14. Shorthand: margin, padding, border
220+
</div>
221+
222+
{/* 15. Conditional variable */}
223+
<div {...stylex.props(maybeStyle, x.padding._8px)}>
224+
15. Conditional variable (should be green)
225+
</div>
226+
227+
{/* 16. Raw inline object via stylex.props (runtime inline style) */}
228+
{/* @ts-ignore */}
229+
<div {...stylex.props({color: 'blue', fontWeight: 'bold', padding: '16px', backgroundColor: '#e0e0ff', borderRadius: '8px'})}>
230+
16. Raw inline object (runtime inline style, not atomic class)
231+
</div>
232+
233+
{/* 17. Raw object mixed with atoms */}
234+
{/* @ts-ignore */}
235+
<div {...stylex.props(x.display.flex, x.gap._8px, {color: 'purple', fontStyle: 'italic'})}>
236+
17. Atoms + raw object mixed
237+
</div>
238+
239+
{/* 18. Raw object mixed with stylex.create */}
240+
{/* @ts-ignore */}
241+
<div {...stylex.props(styles.card, {color: 'darkred', fontWeight: 'bold'})}>
242+
18. stylex.create + raw object mixed
243+
</div>
244+
</div>
245+
);
246+
}
247+
248+
const styles = stylex.create({
249+
card: {
250+
width: '100%',
251+
maxWidth: 480,
252+
padding: '16px',
253+
borderColor: '#ddd',
254+
borderStyle: 'solid',
255+
borderWidth: 1,
256+
borderRadius: '8px',
257+
},
258+
emphasis: {
259+
fontStyle: 'italic',
260+
fontWeight: 600,
261+
},
262+
redText: {
263+
color: 'red',
264+
},
265+
});

examples/example-nextjs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "example-nextjs",
4-
"version": "0.18.3",
4+
"version": "0.19.0",
55
"scripts": {
66
"clean": "shx rm -rf .next",
77
"example:build": "next build",
@@ -10,15 +10,15 @@
1010
"example:start": "next start"
1111
},
1212
"dependencies": {
13-
"@stylexjs/stylex": "0.18.3",
13+
"@stylexjs/stylex": "0.19.0",
1414
"next": "^16.1.7",
1515
"react": "^19.0.0-rc-de68d2f4-20241204",
1616
"react-dom": "^19.0.0-rc-de68d2f4-20241204"
1717
},
1818
"devDependencies": {
1919
"autoprefixer": "^10.4.20",
20-
"@stylexjs/eslint-plugin": "0.18.3",
21-
"@stylexjs/postcss-plugin": "0.18.3",
20+
"@stylexjs/eslint-plugin": "0.19.0",
21+
"@stylexjs/postcss-plugin": "0.19.0",
2222
"@types/json-schema": "^7.0.15",
2323
"@types/node": "^22.7.6",
2424
"@types/react": "^19.2.6",

0 commit comments

Comments
 (0)