<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>StyleX Blog</title>
        <link>https://stylexjs.com/blog</link>
        <description>StyleX Blog</description>
        <lastBuildDate>Tue, 25 Nov 2025 00:00:00 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <item>
            <title><![CDATA[Release 0.17.1]]></title>
            <link>https://stylexjs.com/blog/v0.17.1</link>
            <guid>https://stylexjs.com/blog/v0.17.1</guid>
            <pubDate>Tue, 25 Nov 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[StyleX v0.17 introduces an all new unplugin package for improved integration with various modern bundlers,]]></description>
            <content:encoded><![CDATA[<p>StyleX v0.17 introduces an all new unplugin package for improved integration with various modern bundlers,
the ability to define custom markers for use with <code>stylex.when.*</code> APIs, and a slew of bug-fixes
and improvements.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="new-stylexjsunplugin-package">New <code>@stylexjs/unplugin</code> package<a href="#new-stylexjsunplugin-package" class="hash-link" aria-label="Direct link to new-stylexjsunplugin-package" title="Direct link to new-stylexjsunplugin-package">​</a></h2><p>Stylex 0.17 comes with a new <code>@stylexjs/unplugin</code> package that use the excellent <code>unplugin</code> library to create a near-universal bundler
plugin that works with Vite, Rollup, Webpack, Rspack, Esbuild, and more. In supported project setups, this new package should offer
the best developer experience and performance for StyleX integration. We've introduced new
<a href="https://github.com/facebook/stylex/tree/main/examples" target="_blank" rel="noopener noreferrer">examples</a> for
Webpack, RSPack, and various Vite setups (RSCs, React-Router, Waky and RedwoodSDK) with testing for both production builds and HMR in development builds when applicable. For frameworks that are not yet supported by our unplugin package, we continue to maintain the <code>@stylexjs/postcss-plugin</code> and
and <code>@stylexjs/cli</code> packages for maximum compatibitiy.</p><p>We look forward to expanding this set of examples with more common frameworks and bundler setups.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="custom-markers-for-stylexwhen-apis">Custom Markers for <code>stylex.when.*</code> APIs<a href="#custom-markers-for-stylexwhen-apis" class="hash-link" aria-label="Direct link to custom-markers-for-stylexwhen-apis" title="Direct link to custom-markers-for-stylexwhen-apis">​</a></h2><p>StyleX 0.16 introduced new set of APIs to observe the state of other elements:</p><ul><li><code>stylex.when.ancestor(pseudo, marker?)</code></li><li><code>stylex.when.descendant(pseudo, marker?)</code></li><li><code>stylex.when.siblingBefore(pseudo, marker?)</code></li><li><code>stylex.when.siblingAfter(pseudo, marker?)</code></li><li><code>stylex.when.anySibling(pseudo, marker?)</code></li><li><code>stylex.defaultMarker()</code></li></ul><p>StyleX 0.17 introduces one new API to create custom named markers, <code>stylex.defineMarker()</code>.</p><p>Using these APIs, a typical CSS selector such as <code>.parent:hover .child</code> can be implemented as:</p><article class="xmkeg23 xa8d7ve x1y0btm7 x169e31c xgqmno8 x1tamke2 xyi6m4r x78zum5 xdt5ytf x167g77z x1w4pylu"><p>Hovering here makes the button pink and the arrow opaque</p><button class="x78zum5 x6s0dn4 xl56j7k xjyslct xng3xce x1hr3lfm x1vvogim x12oqio5 x1ook6xo x3zbbde x1heor9g x2qerf1 x15406qy x13dflua xz4gly6 x4y0dgu">Hovering here moves the arrow to the right<span class="x6o7n8i x13dflua xz4gly6 x13fj5qh xvpkmg4 x14ov6tg xbryuvx x1wg8f91">→</span></button></article><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token comment" style="color:rgb(98, 114, 164)">// markers.stylex.ts</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">export</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> cardMarker </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">defineMarker</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">export</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> btn </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">defineMarker</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token comment" style="color:rgb(98, 114, 164)">// Card.tsx</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token imports"> cardMarker</span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token imports"> btnMarker </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'./markers.stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token imports">tokens</span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'./tokens.stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">export</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">function</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">Card</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">return</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">article</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag spread operator" style="color:rgb(255, 121, 198)">...</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">props</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread" style="color:rgb(255, 121, 198)">styles</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread property-access" style="color:rgb(255, 121, 198)">card</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token tag spread" style="color:rgb(255, 121, 198)"> cardMarker</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">      </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">p</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text">Markers let siblings and ancestors opt into the same state.</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">p</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">      </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">button</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag spread operator" style="color:rgb(255, 121, 198)">...</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">props</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread" style="color:rgb(255, 121, 198)">btnMarker</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token tag spread" style="color:rgb(255, 121, 198)"> styles</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread property-access" style="color:rgb(255, 121, 198)">cta</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">        Action</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">        </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag class-name" style="color:rgb(255, 121, 198)">ArrowIcon</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">style</span><span class="token tag script language-javascript script-punctuation punctuation" style="color:rgb(248, 248, 242)">=</span><span class="token tag script language-javascript punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag script language-javascript" style="color:rgb(255, 121, 198)">styles</span><span class="token tag script language-javascript punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag script language-javascript property-access" style="color:rgb(255, 121, 198)">icon</span><span class="token tag script language-javascript punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">/&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">      </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">button</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">    </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">article</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  card</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderWidth</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderStyle</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'solid'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderColor</span><span class="token operator">:</span><span class="token plain"> tokens</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">borderColor</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  cta</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    backgroundColor</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'black'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">when</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">ancestor</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">':hover'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> cardMarker</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> tokens</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">accent</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    color</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'white'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  icon</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    opacity</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">0</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">when</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">ancestor</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">':hover'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> cardMarker</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    transform</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'translateX(0)'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">when</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">ancestor</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">':hover'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> btnMarker</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'translateX(4px)'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Icon in the button appears when card is hovered, but it moves to the right when the button itself is hovered.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="updating-default-configuration-options">Updating default configuration options<a href="#updating-default-configuration-options" class="hash-link" aria-label="Direct link to Updating default configuration options" title="Direct link to Updating default configuration options">​</a></h2><p>We are updating some of the default StyleX configuration options to help make the builds more consistent across development
and production and improve the developer experience in many scenarios.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="enabledebugclassnames-is-now-disabled-by-default"><code>enableDebugClassNames</code> is now disabled by default<a href="#enabledebugclassnames-is-now-disabled-by-default" class="hash-link" aria-label="Direct link to enabledebugclassnames-is-now-disabled-by-default" title="Direct link to enabledebugclassnames-is-now-disabled-by-default">​</a></h3><p>Enabling this option will emit classNames that reference the CSS property being applied, and CSS variable names
that are prefixed with the name used in source. However, generating incompatible CSS in development and production
can cause caching-related bugs in some setups and so we are disabling this option by default.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="data-style-src-prop-now-shows-full-file-paths"><code>data-style-src</code> prop now shows full file paths<a href="#data-style-src-prop-now-shows-full-file-paths" class="hash-link" aria-label="Direct link to data-style-src-prop-now-shows-full-file-paths" title="Direct link to data-style-src-prop-now-shows-full-file-paths">​</a></h3><p>The <code>data-style-src</code> prop is injected in addition to <code>className</code> and <code>style</code> during development to help identify the
list of style objects applied to to the element in order or application. Previously, it showed only the last two segments
of the file path which can be confusing.</p><p>Now, the it will include the full path relative to the nearest <code>package.json</code> file. For third-party package, we will also
include the package name itself.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="enabledevclassnames-will-now-be-enabled-when-dev-is-enabled"><code>enableDevClassNames</code> will now be enabled when <code>dev</code> is enabled<a href="#enabledevclassnames-will-now-be-enabled-when-dev-is-enabled" class="hash-link" aria-label="Direct link to enabledevclassnames-will-now-be-enabled-when-dev-is-enabled" title="Direct link to enabledevclassnames-will-now-be-enabled-when-dev-is-enabled">​</a></h3><p>The <code>dev</code> option inserts additional classNames that help identify where various classNames are coming from.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="enablemediaqueryorder-is-now-enabled-by-default"><code>enableMediaQueryOrder</code> is now enabled by default<a href="#enablemediaqueryorder-is-now-enabled-by-default" class="hash-link" aria-label="Direct link to enablemediaqueryorder-is-now-enabled-by-default" title="Direct link to enablemediaqueryorder-is-now-enabled-by-default">​</a></h3><p>This config ensures that authored media query order is respected, with later queries taking precedence over earlier ones.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="other-improvements">Other Improvements<a href="#other-improvements" class="hash-link" aria-label="Direct link to Other Improvements" title="Direct link to Other Improvements">​</a></h2><ul><li>Added support for handling <code>defineConsts</code> correctly when runtime injection is enabled.</li><li>Fixed a bug sometimes that caused invalid CSS output when media queries use <code>screen and</code> conditionals</li><li>Dependency updates, including Jest, to pick up the latest fixes. (Thanks <a href="https://github.com/vincentriemer" target="_blank" rel="noopener noreferrer">@vincentriemer</a>, <a href="https://github.com/jcperez-ch" target="_blank" rel="noopener noreferrer">@jcperez-ch</a>!)</li><li>Specificity improvements when using <code>stylex.when.*</code> selectors alongside regular pseudo-classes.</li><li>Expand how often <code>stylex.props</code> is precompiled to improve performance.</li><li>Various improvements to Flow and Typescript types. (Thanks <a href="https://github.com/j-malt" target="_blank" rel="noopener noreferrer">@j-malt</a>, <a href="https://github.com/henryqdineen" target="_blank" rel="noopener noreferrer">@henryqdineen</a>!)</li><li>Various improvements and fixes to the ESlint plugin, including support for <code>defineConsts</code> in <code>enforce-extension</code>, and improvements to <code>sort-key</code> ordering. (Thanks <a href="https://github.com/hiteshshetty-dev" target="_blank" rel="noopener noreferrer">@hiteshshetty-dev</a>, <a href="https://github.com/yjoer" target="_blank" rel="noopener noreferrer">@yjoer</a>, <a href="https://github.com/dwei-figma" target="_blank" rel="noopener noreferrer">@dwei-figma</a>!)</li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.16.0]]></title>
            <link>https://stylexjs.com/blog/v0.16.0</link>
            <guid>https://stylexjs.com/blog/v0.16.0</guid>
            <pubDate>Thu, 25 Sep 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[This release adds support for a long-requested feature—descendant and sibling selectors! We've also expanded defineConsts capabilities, improved our lint rules, added a webpack example, and made some performance optimizations.]]></description>
            <content:encoded><![CDATA[<p>This release adds support for a long-requested feature—descendant and sibling selectors! We've also expanded <code>defineConsts</code> capabilities, improved our lint rules, added a webpack example, and made some performance optimizations.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="descendant-and-sibling-selectors">Descendant and sibling selectors<a href="#descendant-and-sibling-selectors" class="hash-link" aria-label="Direct link to Descendant and sibling selectors" title="Direct link to Descendant and sibling selectors">​</a></h2><p>We’re adding a new suite of APIs under <code>stylex.when</code> with support for descendant and sibling selectors: <code>ancestor</code>, <code>descendant</code>, <code>anySibling</code>, <code>siblingBefore</code>, and <code>siblingAfter</code>.</p><ul><li>Ancestor/descendant (<code>stylex.when.ancestor</code> and <code>stylex.when.descendant</code>) selectors let you style an element based on the state of ancestors or descendants in the DOM tree.</li><li>Sibling selectors (<code>stylex.when.anySibling</code>, <code>stylex.when.siblingBefore</code> and <code>stylex.when.siblingAfter</code>) let you style an element based on the state of adjacent siblings.</li></ul><p>To use descendant and sibling selectors, you'll need to mark the element being observed by passing the <code>stylex.defaultMarker</code> class name. Support for custom markers will be added in a future release.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    foo</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      backgroundColor</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">        </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'blue'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">        </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">when</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">ancestor</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">':hover'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'red'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">div</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag spread operator" style="color:rgb(255, 121, 198)">...</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">props</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">defaultMarker</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">  </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">div</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag spread operator" style="color:rgb(255, 121, 198)">...</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">props</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread" style="color:rgb(255, 121, 198)">styles</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread property-access" style="color:rgb(255, 121, 198)">foo</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"> Some Content </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">div</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text"></span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">div</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Note: Lookahead selectors like <code>stylex.when.siblingAfter</code>, <code>stylex.when.anySibling</code>, and <code>stylex.when.descendant</code> rely on the CSS <code>has()</code> selector, which does not yet have <a href="https://caniuse.com/css-has" target="_blank" rel="noopener noreferrer">widespread browser support</a>.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="defineconsts-improvements"><code>defineConsts</code> improvements<a href="#defineconsts-improvements" class="hash-link" aria-label="Direct link to defineconsts-improvements" title="Direct link to defineconsts-improvements">​</a></h2><p>We’ve added support for overriding <code>defineConsts</code> constants that reference CSS variables (<code>var(--*)</code>) when set to variables and variable fallbacks. Constants now behave like passthroughs, with overrides applying to the original CSS variable. This allows you to re-define them within <code>create</code> calls as you would for <code>defineVars</code>.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">export</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> colors </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">defineConsts</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  bg</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">"var(--background-color)"</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  accent</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">"var(--accent, lightblue)"</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token imports">colors</span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">"./colors.stylex.js"</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  root</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">colors</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">bg</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">"red"</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">colors</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">accent</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">"darkblue"</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>We've also added support for <code>defineConsts</code> in dynamic styles. You can now use <code>defineConsts</code> to declare media queries within dynamic styles as you would in regular StyleX namespaces.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> style </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token function-variable function" style="color:rgb(80, 250, 123)">main</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">height</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"> </span><span class="token arrow operator">=&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    color</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> colors</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">red</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">breakpoints</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">sm</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> colors</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">blue</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">breakpoints</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">md</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> colors</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">yellow</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    height</span><span class="token operator">:</span><span class="token plain"> height </span><span class="token operator">-</span><span class="token plain"> </span><span class="token number">10</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="linter-improvements">Linter improvements<a href="#linter-improvements" class="hash-link" aria-label="Direct link to Linter improvements" title="Direct link to Linter improvements">​</a></h2><p>We made several improvements and lint fixes to the <code>valid-styles</code> rule. The <code>valid-styles</code> rule now has support for locally resolved constants.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> </span><span class="token constant" style="color:rgb(189, 147, 249)">HEIGHT</span><span class="token plain"> </span><span class="token operator">=</span><span class="token plain"> </span><span class="token number">5</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    scrollMarginTop</span><span class="token operator">:</span><span class="token plain"> </span><span class="token constant" style="color:rgb(189, 147, 249)">HEIGHT</span><span class="token plain"> </span><span class="token operator">+</span><span class="token plain"> </span><span class="token number">5</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    scrollMarginBottom</span><span class="token operator">:</span><span class="token plain"> </span><span class="token constant" style="color:rgb(189, 147, 249)">HEIGHT</span><span class="token plain"> </span><span class="token operator">*</span><span class="token plain"> </span><span class="token number">5</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>We added linter support for setting CSS custom properties within <code>create</code> calls. (Thanks <a href="https://github.com/dwei-figma" target="_blank" rel="noopener noreferrer">@dwei-figma</a>!)</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token operator">--</span><span class="token plain">background</span><span class="token operator">-</span><span class="token plain">color</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'red'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>We also added support for positionTry styles (Thanks <a href="https://github.com/abhakat" target="_blank" rel="noopener noreferrer">@abhakat</a>!), better validation for pseudo-elements (Thanks <a href="https://github.com/dwrth" target="_blank" rel="noopener noreferrer">@dwrth</a>!), migrated object type validation to Flow (Thanks <a href="https://github.com/jcperez-ch" target="_blank" rel="noopener noreferrer">@jcperez-ch</a>!), and of 0 values as strings ('0') for length properties.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="bug-fixes">Bug fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to Bug fixes" title="Direct link to Bug fixes">​</a></h2><ul><li>Fixed class name construction for dynamic contextual styles.</li><li>Reduced chances of dynamic variable name collisions. (Thanks <a href="https://github.com/necolas" target="_blank" rel="noopener noreferrer">@necolas</a>!)</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="miscellaneous">Miscellaneous<a href="#miscellaneous" class="hash-link" aria-label="Direct link to Miscellaneous" title="Direct link to Miscellaneous">​</a></h2><ul><li>A <a href="https://github.com/facebook/stylex/tree/main/examples/example-webpack" target="_blank" rel="noopener noreferrer">webpack example</a> was added to our suite of StyleX example integrations! (Thanks <a href="https://github.com/RavenColEvol" target="_blank" rel="noopener noreferrer">@RavenColEvol</a>!)</li><li>Support to hoist <code>stylex.create</code> and nested objects within functions.</li><li>Optimized precomputed props calls in JSX. (Thanks <a href="https://github.com/necolas" target="_blank" rel="noopener noreferrer">@necolas</a>!)</li><li>More efficient handling of null/undefined in dynamic styles.</li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.15.0]]></title>
            <link>https://stylexjs.com/blog/v0.15.0</link>
            <guid>https://stylexjs.com/blog/v0.15.0</guid>
            <pubDate>Thu, 31 Jul 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[StyleX v0.15.0 introduces significant improvements to media query handling, dynamic styles optimization, and improvements to the linter, types, and documentation.]]></description>
            <content:encoded><![CDATA[<p>StyleX v0.15.0 introduces significant improvements to media query handling, dynamic styles optimization, and improvements to the linter, types, and documentation.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="media-query-ordering">Media query ordering<a href="#media-query-ordering" class="hash-link" aria-label="Direct link to Media query ordering" title="Direct link to Media query ordering">​</a></h2><p>Previously, media queries within a style property were applied in a predetermined sorting order. This often meant that the order you authored the queries did not match how they were applied, so we recommended manually ensuring your media queries didn’t overlap to prevent unexpected overrides in behavior.</p><p>We've integrated our in-house media query parser and transformer to handle this automatically. You can now write overlapping media queries in a contextual style in the order you desire, and the compiler will rewrite them so that later queries take precedence over earlier ones.</p><p>The compiler now also validates media query syntax and simplifies complex queries when possible, opening the door to later optimizations.</p><p>As an example, take this <code>create</code> call:</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  foo</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;gridColumn</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1 / 2'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token string" style="color:rgb(255, 121, 198)">'@media (max-width: 1440px)'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1 / 4'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token string" style="color:rgb(255, 121, 198)">'@media (max-width: 1024px)'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1 / 3'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token string" style="color:rgb(255, 121, 198)">'@media (max-width: 768px)'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1 / -1'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This is now transformed at compile time to:</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  foo</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;gridColumn</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1 / 2'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token string" style="color:rgb(255, 121, 198)">'@media (max-width: 1440px) and (min-width: 1024.01px)'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1 / 4'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token string" style="color:rgb(255, 121, 198)">'@media (min-width: 768.01px) and (max-width: 1024px)'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1 / 3'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token string" style="color:rgb(255, 121, 198)">'@media (max-width: 768px)'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1 / -1'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">&nbsp;&nbsp;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This new feature is gated behind the config option <code>enableMediaQueryOrder</code>.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="dynamic-styles-improvements">Dynamic styles improvements<a href="#dynamic-styles-improvements" class="hash-link" aria-label="Direct link to Dynamic styles improvements" title="Direct link to Dynamic styles improvements">​</a></h2><p>Dynamic styles should now work more consistently when given the same values as static styles. Improvements have been made to how we handle <code>null</code> and <code>undefined</code> values.</p><p>We've also made optimizations in how we process dynamic styles to improve performance and minimize the amount of generated Javascript. We do this by using heuristics to detect values that can never be nullable.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="fixes">Fixes<a href="#fixes" class="hash-link" aria-label="Direct link to Fixes" title="Direct link to Fixes">​</a></h2><ul><li>Fixed TypeScript types for <code>stylex.types.*</code> functions (Thanks <a href="https://github.com/nmn" target="_blank" rel="noopener noreferrer">@nmn</a>!)</li><li>Resolved opaque type issues for InlineStyles.  (Thanks <a href="https://github.com/pawelblaszczyk5" target="_blank" rel="noopener noreferrer">@pawelblaszczyk5</a>!)</li><li>Fixed ESLint utility functions for number and math call validation and added style validation for length properties.</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="documentation">Documentation<a href="#documentation" class="hash-link" aria-label="Direct link to Documentation" title="Direct link to Documentation">​</a></h2><ul><li>Added <a href="https://stylexjs.com/docs/api/javascript/defineVars/" target="_blank" rel="noopener noreferrer">documentation</a> around manual CSS variables generated with <code>defineVars</code>. (Thanks <a href="https://github.com/necolas" target="_blank" rel="noopener noreferrer">@necolas</a>!)</li><li>Updated outdated <a href="https://stylexjs.com/docs/learn/theming/defining-variables/" target="_blank" rel="noopener noreferrer">theming docs</a> to align with current <code>createTheme</code> behaviour (Thanks <a href="https://github.com/nmn" target="_blank" rel="noopener noreferrer">@nmn</a>!)</li><li>Fixed ESLint rule severity syntax in the installation guide examples and cleaned up docs for descendent styles. (Thanks <a href="https://github.com/sonsu95" target="_blank" rel="noopener noreferrer">@sonsu95</a> and <a href="https://github.com/mtpetros" target="_blank" rel="noopener noreferrer">@mtpetros</a>!)</li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.14.0]]></title>
            <link>https://stylexjs.com/blog/v0.14.0</link>
            <guid>https://stylexjs.com/blog/v0.14.0</guid>
            <pubDate>Mon, 30 Jun 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[StyleX v0.14.0 introduces new APIs to the compiler and linter, as well as a couple of breaking changes to improve performance.]]></description>
            <content:encoded><![CDATA[<p>StyleX v0.14.0 introduces new APIs to the compiler and linter, as well as a couple of breaking changes to improve performance.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="new-features">New features<a href="#new-features" class="hash-link" aria-label="Direct link to New features" title="Direct link to New features">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="compiler-viewtransitionclass">Compiler: <code>viewTransitionClass</code><a href="#compiler-viewtransitionclass" class="hash-link" aria-label="Direct link to compiler-viewtransitionclass" title="Direct link to compiler-viewtransitionclass">​</a></h3><p>The <a href="https://stylexjs.com/docs/api/javascript/viewTransitionClass/" target="_blank" rel="noopener noreferrer"><code>viewTransitionClass</code></a> API allows you to use StyleX to customize your <a href="https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API" target="_blank" rel="noopener noreferrer">CSS View Transitions</a>. This API works nicely with React’s new <a href="https://react.dev/reference/react/ViewTransition" target="_blank" rel="noopener noreferrer"><code>&lt;ViewTransition /&gt;</code></a> component:</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token imports">unstable_ViewTransition </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> </span><span class="token imports maybe-class-name">ViewTransition</span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'react'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> transitionClass </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">viewTransitionClass</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  old</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationName</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">keyframes</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> to</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> opacity</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">0</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationTimingFunction</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'ease-out'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationDuration</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'300ms'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">new</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationName</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">keyframes</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> from</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> opacity</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">0</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationTimingFunction</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'ease-out'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationDuration</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'300ms'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token comment" style="color:rgb(98, 114, 164)">// in a component definition</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag class-name" style="color:rgb(255, 121, 198)">ViewTransition</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag attr-name" style="color:rgb(241, 250, 140)">default</span><span class="token tag script language-javascript script-punctuation punctuation" style="color:rgb(248, 248, 242)">=</span><span class="token tag script language-javascript punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag script language-javascript" style="color:rgb(255, 121, 198)">transitionClass</span><span class="token tag script language-javascript punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">  </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag class-name" style="color:rgb(255, 121, 198)">Content</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">/&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text"></span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag class-name" style="color:rgb(255, 121, 198)">ViewTransition</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="linter-validimports">Linter: <code>validImports</code><a href="#linter-validimports" class="hash-link" aria-label="Direct link to linter-validimports" title="Direct link to linter-validimports">​</a></h3><p>The <code>@stylexjs/eslint-plugin</code> package now supports the <code>validImports</code> option for all rules, allowing you to configure where the linter expects StyleX to be imported from. This is equivalent to the <a href="https://stylexjs.com/docs/api/configuration/babel-plugin/#importsources" target="_blank" rel="noopener noreferrer"><code>importSources</code></a> option for the compiler. Thanks to <a href="https://github.com/javascripter" target="_blank" rel="noopener noreferrer">@javascripter</a> for this improvement.</p><div class="language-ts codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-ts codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token comment" style="color:rgb(98, 114, 164)">// Default: ['stylex', '@stylexjs/stylex']</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  validImports</span><span class="token operator">:</span><span class="token plain"> </span><span class="token builtin" style="color:rgb(189, 147, 249)">Array</span><span class="token operator">&lt;</span><span class="token builtin" style="color:rgb(189, 147, 249)">string</span><span class="token plain"> </span><span class="token operator">|</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> from</span><span class="token operator">:</span><span class="token plain"> </span><span class="token builtin" style="color:rgb(189, 147, 249)">string</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token operator">:</span><span class="token plain"> </span><span class="token builtin" style="color:rgb(189, 147, 249)">string</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token operator">&gt;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="breaking-changes">Breaking changes<a href="#breaking-changes" class="hash-link" aria-label="Direct link to Breaking changes" title="Direct link to Breaking changes">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="style-resolution">Style resolution<a href="#style-resolution" class="hash-link" aria-label="Direct link to Style resolution" title="Direct link to Style resolution">​</a></h3><p>StyleX will now use <code>property-specificity</code> instead of <code>application-order</code> as the default value for the <code>styleResolution</code> option (the strategy used to merge styles). The difference between these 2 strategies is as follows:</p><ul><li><code>application-order</code><ul><li>The last style wins, i.e., <code>margin</code> wins over <code>marginTop</code> if it appears last in the order of styles.</li><li>Larger generated JavaScript objects.</li></ul></li><li><code>property-specificity</code><ul><li>The more specific style wins, i.e., <code>marginTop</code> wins over <code>margin</code> irrespective of the order of styles.</li><li>Disallows more shorthands, e.g., <code>background</code>, <code>border</code>.</li><li>Smaller generated JavaScript objects.</li></ul></li></ul><p>If you experience visual regressions, set <code>styleResolution</code> to <code>application-order</code>. However, the <a href="https://github.com/facebook/stylex/pull/1064" target="_blank" rel="noopener noreferrer">performance metrics</a> we track are all significantly improved or neutral when using <code>property-specificity</code>, therefore, we strongly encourage migration.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="fixes">Fixes<a href="#fixes" class="hash-link" aria-label="Direct link to Fixes" title="Direct link to Fixes">​</a></h2><ul><li>[babel-plugin]<!-- --> Fix theming in dev/debug mode.</li><li>[eslint-plugin]<!-- --> Add autofix support for all remaining nonstandard CSS properties to the <code>valid-styles</code> rule.</li><li>[stylex]<!-- --> Fix the TypeScript types. Thanks to <a href="https://github.com/pawelblaszczyk5" target="_blank" rel="noopener noreferrer">@pawelblaszczyk5</a> for this improvement.</li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.13.0]]></title>
            <link>https://stylexjs.com/blog/v0.13.0</link>
            <guid>https://stylexjs.com/blog/v0.13.0</guid>
            <pubDate>Mon, 19 May 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[StyleX v0.13.0 introduces two new APIs and several breaking changes to compiler defaults, alongside various bug fixes.]]></description>
            <content:encoded><![CDATA[<p>StyleX v0.13.0 introduces two new APIs and several breaking changes to compiler defaults, alongside various bug fixes.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="new-apis">New APIs<a href="#new-apis" class="hash-link" aria-label="Direct link to New APIs" title="Direct link to New APIs">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="defineconsts"><code>defineConsts</code><a href="#defineconsts" class="hash-link" aria-label="Direct link to defineconsts" title="Direct link to defineconsts">​</a></h3><p>We've added a new <code>defineConsts</code> API to allow for declaration and use of constant values. Unlike <code>defineVars</code>, these are inlined at build-time and do not generate CSS variables. This is a long requested feature that allows for shareable media queries.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_zAEH">constants.stylex.js</div><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">export</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> breakpoints </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">defineConsts</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  small</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@media (max-width: 600px)'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  medium</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@media (min-width: 601px) and (max-width: 1024px)'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  large</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@media (min-width: 1025px)'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">export</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> colors </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">defineConsts</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  brand</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'#0055FF'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  surface</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'#FFFFFF'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  text</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'#111111'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>You can then import and use these constants in any <code>create</code> call:</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token imports"> breakpoints</span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token imports"> colors </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'./constants.stylex.js'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  container</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    padding</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'4px'</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">breakpoints</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">small</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'8px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">breakpoints</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">medium</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'16px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">breakpoints</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">large</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'24px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  label</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    color</span><span class="token operator">:</span><span class="token plain"> colors</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">text</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="positiontry"><code>positionTry</code><a href="#positiontry" class="hash-link" aria-label="Direct link to positiontry" title="Direct link to positiontry">​</a></h3><p><code>positionTry</code> enables graceful fallback positioning via the <code>@property-try</code> at-rule. This makes it easier to handle layout edge cases across varying browser support and runtime constraints.  (Thanks <a href="https://github.com/nmn" target="_blank" rel="noopener noreferrer">nmn</a>!)</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> fallback </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">positionTry</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  positionAnchor</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'--anchor'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  top</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'0'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  left</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'0'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  width</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'100px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  height</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'100px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  box</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    positionTryFallbacks</span><span class="token operator">:</span><span class="token plain"> fallback</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="breaking-changes">Breaking changes<a href="#breaking-changes" class="hash-link" aria-label="Direct link to Breaking changes" title="Direct link to Breaking changes">​</a></h2><ul><li>The <code>attrs</code> API is removed due to low usage and redundant functionality; non-React users can replace it with a wrapper around <code>props</code> as documented <a href="https://stylexjs.com/docs/api/javascript/props/#not-using-react" target="_blank" rel="noopener noreferrer">here</a>.</li><li>The <code>runtimeInjection</code> compiler option is now disabled by default in development mode (<code>dev:true</code>) to better match production behavior.</li><li>ESLint rule <code>no-legacy-conditional-styles</code> is renamed to <code>no-legacy-contextual-styles</code>.</li><li>The config option <code>useRemForFontSize</code> is renamed to <code>enableFontSizePxToRem</code>; now disabled by default and not intended for external use.</li><li>The config option <code>genConditionalClasses</code> is renamed to <code>enableInlinedConditionalMerge</code>; now enabled by default and not intended for external use.</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="fixes">Fixes<a href="#fixes" class="hash-link" aria-label="Direct link to Fixes" title="Direct link to Fixes">​</a></h2><ul><li>Fixed duplicate classNames in styles with nested pseudo-classes (Thanks <a href="https://github.com/jeongminsang" target="_blank" rel="noopener noreferrer">jeongminsang</a>!)</li><li>ESLint plugin now correctly supports <code>importSources</code> object syntax in <code>validImports</code> (Thanks <a href="https://github.com/javascripter" target="_blank" rel="noopener noreferrer">javascripter</a>!)</li><li>Fixed a bug where CSS variables would be wrapped in quotes when used with the <code>content</code> property.</li><li>Fixed evaluation bug in <code>firstThatWorks</code> when the final value was a CSS variable.</li><li>Fixed TypeScript types for themes and types functions.</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="miscellaneous">Miscellaneous<a href="#miscellaneous" class="hash-link" aria-label="Direct link to Miscellaneous" title="Direct link to Miscellaneous">​</a></h2><ul><li>Rewrote the runtime style injection system to be more robust in dev. This resolves issues with hot reloading and duplicate style tags.</li><li>Added Flow types for anchor positioning. (Thanks <a href="https://github.com/Jta26" target="_blank" rel="noopener noreferrer">Jta26</a>!)</li><li>Added support for custom <code>importSources</code> in the PostCSS plugin for <a href="https://github.com/facebook/react-strict-dom" target="_blank" rel="noopener noreferrer">React Strict DOM</a> compatibility. (Thanks <a href="https://github.com/javascripter" target="_blank" rel="noopener noreferrer">javascripter</a>!)</li><li>Improved compiler error messages.</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="deprecations">Deprecations<a href="#deprecations" class="hash-link" aria-label="Direct link to Deprecations" title="Direct link to Deprecations">​</a></h2><p>We’ve deprecated the <code>@stylexjs/shared</code> package on npm.</p>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.12.0]]></title>
            <link>https://stylexjs.com/blog/v0.12.0</link>
            <guid>https://stylexjs.com/blog/v0.12.0</guid>
            <pubDate>Thu, 10 Apr 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[StyleX v0.12.0 introduces performance optimizations, several bug fixes, a new lint rule, and some cleanup of deprecated packages.]]></description>
            <content:encoded><![CDATA[<p>StyleX v0.12.0 introduces performance optimizations, several bug fixes, a new lint rule, and some cleanup of deprecated packages.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="performance">Performance<a href="#performance" class="hash-link" aria-label="Direct link to Performance" title="Direct link to Performance">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="object-key-minification">Object key minification<a href="#object-key-minification" class="hash-link" aria-label="Direct link to Object key minification" title="Direct link to Object key minification">​</a></h3><p>The keys of compiled style objects are now minified to reduce overall code size.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="faster-theme-compilation">Faster theme compilation<a href="#faster-theme-compilation" class="hash-link" aria-label="Direct link to Faster theme compilation" title="Direct link to Faster theme compilation">​</a></h3><p>Compiling <code>createTheme</code> calls is now several orders of magnitude faster. This was achieved by caching evaluated theme objects.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="eslint-improvements">ESLint improvements<a href="#eslint-improvements" class="hash-link" aria-label="Direct link to ESLint improvements" title="Direct link to ESLint improvements">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="new-no-legacy-contextual-styles-rule">New <code>no-legacy-contextual-styles</code> rule<a href="#new-no-legacy-contextual-styles-rule" class="hash-link" aria-label="Direct link to new-no-legacy-contextual-styles-rule" title="Direct link to new-no-legacy-contextual-styles-rule">​</a></h3><p>A new rule has been added to the StyleX ESLint plugin to flag uses of the deprecated media query and pseudo-class syntax. This rule flags usage of the legacy media query and pseudo-class syntax that wraps multiple property values inside a single <code>@</code>-rule or pseudo-class block. This pattern is deprecated and should be replaced with the updated syntax <a href="https://stylexjs.com/docs/learn/styling-ui/defining-styles/#media-queries-and-other--rules" target="_blank" rel="noopener noreferrer">here</a>. (Thanks <a href="https://github.com/vincentriemer" target="_blank" rel="noopener noreferrer">vincentriemer</a>!)</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="bug-fixes">Bug fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to Bug fixes" title="Direct link to Bug fixes">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="styling-pseudo-elements-in-dynamic-styles">Styling pseudo-elements in dynamic styles<a href="#styling-pseudo-elements-in-dynamic-styles" class="hash-link" aria-label="Direct link to Styling pseudo-elements in dynamic styles" title="Direct link to Styling pseudo-elements in dynamic styles">​</a></h3><p>Dynamic styles can now be used to style pseudo-elements. Previously, the generated CSS variables could not be inherited by pseudo-elements.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="disallow-object-spreads-in-create">Disallow object spreads in <code>create</code><a href="#disallow-object-spreads-in-create" class="hash-link" aria-label="Direct link to disallow-object-spreads-in-create" title="Direct link to disallow-object-spreads-in-create">​</a></h3><p>Object spreading in <code>create</code> calls is now disallowed by the compiler, as this breaks runtime caching of style merging.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="deprecations">Deprecations<a href="#deprecations" class="hash-link" aria-label="Direct link to Deprecations" title="Direct link to Deprecations">​</a></h2><p>The following bundler integration packages have been deprecated. We're focusing development on the core StyleX toolchain, and providing consistent tools for use across different bundlers. We recommend using the <a href="https://stylexjs.com/docs/api/configuration/postcss-plugin/" target="_blank" rel="noopener noreferrer"><code>@stylexjs/postcss-plugin</code></a>.</p><ul><li><code>@stylexjs/esbuild-plugin</code></li><li><code>@stylexjs/nextjs-plugin</code></li><li><code>@stylexjs/webpack-plugin</code></li></ul><p>The <a href="https://github.com/facebook/stylex/tree/main/packages/rollup-plugin" target="_blank" rel="noopener noreferrer"><code>@stylexjs/rollup-plugin</code></a> remains, but may be generalized into an <code>unplugin</code> package to extend this option to other bundlers.</p><p>The following other packages have also been deprecated.</p><ul><li><code>@stylexjs/dev-runtime</code></li><li><code>@stylexjs/open-props</code> (replacement available at <a href="https://github.com/nmn/stylextras/tree/main/packages/open-props" target="_blank" rel="noopener noreferrer"><code>stylextras/open-props</code></a>)</li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.11.0]]></title>
            <link>https://stylexjs.com/blog/v0.11.0</link>
            <guid>https://stylexjs.com/blog/v0.11.0</guid>
            <pubDate>Thu, 27 Feb 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Release Notes]]></description>
            <content:encoded><![CDATA[<h2 class="anchor anchorWithStickyNavbar_fF9Z" id="release-notes">Release Notes<a href="#release-notes" class="hash-link" aria-label="Direct link to Release Notes" title="Direct link to Release Notes">​</a></h2><p>StyleX v0.11.0 is now available, with significant improvements in debugging, CLI caching, and documentation!</p><div class="x42x0ya x1qhigcl x78zum5 xdt5ytf x6s0dn4 xur7f20"><div class="xygnafs x1wkxgih x87ps6o"><svg class="xh8yej3 x5yr21d"><circle cx="60" cy="60" r="40" class="x14afsfd xb7if6w xvlca1e"></circle><text x="19.849649455426793" y="117.34064310022944" class="xypthjr xif65rj xw6cgo0 xhntxdp">1</text><line x1="34.18906036420294" x2="28.45329600069248" y1="96.86184199300465" y2="105.05336243589457" class="xb7if6w xvlca1e"></line><line x1="19.554267916537484" x2="10.56632745354581" y1="79.72670160550848" y2="84.11041307339926" class="xb7if6w xvlca1e"></line><line x1="15.06167093604418" x2="5.075375588498439" y1="57.64488196906754" y2="57.12152240663811" class="xb7if6w xvlca1e"></line><line x1="21.83783567296083" x2="13.357354711396567" y1="36.15363310950578" y2="30.85444046717374" class="xb7if6w xvlca1e"></line><line x1="38.18356708891484" x2="33.335470886451475" y1="20.642113178727186" y2="11.895916107333228" class="xb7if6w xvlca1e"></line><line x1="59.99999999999999" x2="59.99999999999999" y1="15" y2="5" class="xb7if6w xvlca1e"></line><line x1="81.81643291108514" x2="86.66452911354851" y1="20.64211317872718" y2="11.895916107333214" class="xb7if6w xvlca1e"></line><line x1="98.16216432703914" x2="106.6426452886034" y1="36.15363310950574" y2="30.85444046717368" class="xb7if6w xvlca1e"></line><line x1="104.93832906395582" x2="114.92462441150155" y1="57.644881969067505" y2="57.12152240663806" class="xb7if6w xvlca1e"></line><line x1="100.44573208346252" x2="109.43367254645419" y1="79.72670160550848" y2="84.11041307339926" class="xb7if6w xvlca1e"></line><text x="100.15035054457326" y="117.3406431002294" class="xypthjr xif65rj xw6cgo0 xhntxdp">11</text><line x1="85.8109396357971" x2="91.54670399930755" y1="96.86184199300462" y2="105.05336243589453" class="xb7if6w xvlca1e"></line><line x1="60" x2="42.79270690946862" y1="60" y2="84.57456132866976" class="x12h2add xqjr0vm"></line></svg></div><div class="x1awj2ng x1sy10c2 xif65rj">Turn it up to v0.11.0!</div></div><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="debugging-improvements">Debugging Improvements<a href="#debugging-improvements" class="hash-link" aria-label="Direct link to Debugging Improvements" title="Direct link to Debugging Improvements">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="improved-runtime-debugging">Improved Runtime Debugging<a href="#improved-runtime-debugging" class="hash-link" aria-label="Direct link to Improved Runtime Debugging" title="Direct link to Improved Runtime Debugging">​</a></h3><p>We've made some big improvements to the information available in debug mode. We now include sourceMap information to indicate the file and line of the <code>create</code> call responsible for providing styles on a given element. This information is contained in the <code>data-style-src</code> prop in the DOM. To use, set <code>debug</code> to <code>true</code> in the StyleX config. (Thanks <a href="https://github.com/necolas" target="_blank" rel="noopener noreferrer">necolas</a>)</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="cli-cache-improvements">CLI Cache Improvements<a href="#cli-cache-improvements" class="hash-link" aria-label="Direct link to CLI Cache Improvements" title="Direct link to CLI Cache Improvements">​</a></h2><p>The StyleX CLI now includes better cache invalidation and expanded support:</p><ul><li>Cache now invalidates when config options change in the <code>StyleX</code> and <code>.babelrc</code> configurations</li><li>Added support for relative file paths</li><li>Now supports Deno applications</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="documentation-updates">Documentation Updates<a href="#documentation-updates" class="hash-link" aria-label="Direct link to Documentation Updates" title="Direct link to Documentation Updates">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="new-theming-recipes">New theming recipes<a href="#new-theming-recipes" class="hash-link" aria-label="Direct link to New theming recipes" title="Direct link to New theming recipes">​</a></h3><p>We've added new documentation that provides improved guidance on <a href="https://stylexjs.com/docs/learn/recipes" target="_blank" rel="noopener noreferrer">theming</a>, including best practices for resetting and merging themes, as well as dynamic color-scheme management using built-in functions. (Thanks <a href="https://github.com/nmn" target="_blank" rel="noopener noreferrer">nmn</a>)</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="api-enhancements">API enhancements<a href="#api-enhancements" class="hash-link" aria-label="Direct link to API enhancements" title="Direct link to API enhancements">​</a></h3><p>We've added documentation about the new <a href="https://stylexjs.com/docs/api/configuration/postcss-plugin/" target="_blank" rel="noopener noreferrer">PostCSS plugin</a> and updated the docs to reflect the latest debug information. (Thanks <a href="https://github.com/necolas" target="_blank" rel="noopener noreferrer">necolas</a>)</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="miscellaneous">Miscellaneous<a href="#miscellaneous" class="hash-link" aria-label="Direct link to Miscellaneous" title="Direct link to Miscellaneous">​</a></h2><ul><li>We've added exported return types for <code>stylex.types.*</code> functions such as <code>stylex.Color</code> and <code>stylex.Length</code>. Now, expressions like <code>stylex.types.color("red")</code> are explicitly typed as <code>stylex.Color&lt;string&gt;</code> (Thanks <a href="https://github.com/nmn" target="_blank" rel="noopener noreferrer">nmn</a>)</li><li>We've added an autofix to the <code>valid-styles</code> rule to provide autofix suggestions for border styles</li><li>We've made a fix to how we process multivalue shorthands with slashes (Thanks <a href="https://github.com/yasuhiro-yamamoto" target="_blank" rel="noopener noreferrer">yasuhiro-yamamoto</a>)</li><li>Small typo fixes (Thanks <a href="https://github.com/mattstyles" target="_blank" rel="noopener noreferrer">mattstyles</a> and <a href="https://github.com/necolas" target="_blank" rel="noopener noreferrer">necolas</a>)</li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.10.1]]></title>
            <link>https://stylexjs.com/blog/v0.10.1</link>
            <guid>https://stylexjs.com/blog/v0.10.1</guid>
            <pubDate>Fri, 17 Jan 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Release Notes]]></description>
            <content:encoded><![CDATA[<h2 class="anchor anchorWithStickyNavbar_fF9Z" id="release-notes">Release Notes<a href="#release-notes" class="hash-link" aria-label="Direct link to Release Notes" title="Direct link to Release Notes">​</a></h2><ul><li>Fixed a bug where variables with camelCase names were incorrectly converted to kebab-case (Thanks <a href="https://github.com/yasuhiro-yamamoto" target="_blank" rel="noopener noreferrer">yasuhiro-yamamoto</a>)</li><li>Fixed a bug in the eslint <code>valid-styles</code> rule where it would incorrectly flag when importing a file with an extension (Thanks <a href="https://github.com/beaumontjonathan" target="_blank" rel="noopener noreferrer">beaumontjonathan</a>)</li><li>Added support for <code>.js</code> resolved file extension imports from <code>.ts</code> files (Thanks <a href="https://github.com/beaumontjonathan" target="_blank" rel="noopener noreferrer">beaumontjonathan</a>)</li><li>Replaced <code>crypto</code> with <code>murmurhash</code> for CLI caching </li><li>Fixed a bug where the <code>import resolve</code> function would not respect the Windows system (Thanks <a href="https://github.com/nonzzz" target="_blank" rel="noopener noreferrer">nonzzz</a>)</li><li>Fixed a bug where the <code>initial-value</code> in <code>@Property</code> was invalid</li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.10.0]]></title>
            <link>https://stylexjs.com/blog/v0.10.0</link>
            <guid>https://stylexjs.com/blog/v0.10.0</guid>
            <pubDate>Thu, 02 Jan 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Happy new year! We are excited to announce the release of StyleX v0.10.0, which includes several new features and improvements.]]></description>
            <content:encoded><![CDATA[<p>Happy new year! We are excited to announce the release of StyleX v0.10.0, which includes several new features and improvements.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="easier-adoption-with-the-all-new-postcss-plugin">Easier adoption with the all-new PostCSS plugin<a href="#easier-adoption-with-the-all-new-postcss-plugin" class="hash-link" aria-label="Direct link to Easier adoption with the all-new PostCSS plugin" title="Direct link to Easier adoption with the all-new PostCSS plugin">​</a></h2><p>StyleX now ships with an all-new PostCSS plugin. This plugin allows you to use StyleX with any PostCSS-compatible toolchain,
to better integrate with existing projects. The PostCSS plugin is now our recommended approach for using StyleX
in a Next.js or Vite project. The example Next.js app in this repository has been updated to reflect this change. The existing
<code>@stylexjs/nextjs-plugin</code> will be deprecated in the next release.</p><p>A huge thanks to <a href="https://github.com/javascripter/" target="_blank" rel="noopener noreferrer">javascripter</a> for contributing this plugin.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="better-debugging">Better debugging<a href="#better-debugging" class="hash-link" aria-label="Direct link to Better debugging" title="Direct link to Better debugging">​</a></h2><p>StyleX has a new <code>debug</code> option to enable more readable classNames and variable names during development.
With this option turned on, classNames will be prefixed with the affected CSS property and variables will
be prefixed with their key name in your source code. (Thanks <a href="https://github.com/mellyeliu/" target="_blank" rel="noopener noreferrer">mellyeliu</a>)</p><p>Additionally, the error messages of the StyleX Babel plugin have been improved to be more granular and
correctly highlight the location of the source code causing the error.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="eslint-improvements">ESLint improvements<a href="#eslint-improvements" class="hash-link" aria-label="Direct link to ESLint improvements" title="Direct link to ESLint improvements">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="all-new-no-unused-rule">All new <code>no-unused</code> rule<a href="#all-new-no-unused-rule" class="hash-link" aria-label="Direct link to all-new-no-unused-rule" title="Direct link to all-new-no-unused-rule">​</a></h3><p>The StyleX ESLint plugin now ships with a new <code>no-unused</code> rule that detects unused styles. (Thanks <a href="https://github.com/Samantha-Zhan/" target="_blank" rel="noopener noreferrer">Samantha-Zhan</a>)</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="other-improvements">Other improvements<a href="#other-improvements" class="hash-link" aria-label="Direct link to Other improvements" title="Direct link to Other improvements">​</a></h3><p>The <code>valid-styles</code> rule now offers more auto-fixes, and a small bug was fixed in the <code>valid-shorthands</code> rule.
(Thanks <a href="https://github.com/mellyeliu/" target="_blank" rel="noopener noreferrer">mellyeliu</a>)</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="theming-now-works-without-manually-configuring-rootdir">Theming now works without manually configuring <code>rootDir</code><a href="#theming-now-works-without-manually-configuring-rootdir" class="hash-link" aria-label="Direct link to theming-now-works-without-manually-configuring-rootdir" title="Direct link to theming-now-works-without-manually-configuring-rootdir">​</a></h2><p>StyleX previously required manual configuration of <code>unstable_moduleResolution.rootDir</code> for enabling
the theming APIs. This is no longer the case. Additionally, compilation should be more reliable
and cache-friendly, especially when using package managers like <code>pnpm</code>.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="performance-improvements-for-dynamic-styles">Performance improvements for Dynamic styles<a href="#performance-improvements-for-dynamic-styles" class="hash-link" aria-label="Direct link to Performance improvements for Dynamic styles" title="Direct link to Performance improvements for Dynamic styles">​</a></h2><p>StyleX uses CSS custom properties (aka CSS variables) as inline styles for dynamic values for styles.
In v0.10.0 StyleX now generates <code>@property</code> declarations marking these variables as non-inheritable.
This improves the style resolution performance of the browser's styling engine, which in some cases can
be quite significant. We have also updated our benchmarks to track the code size impact of this change.
(Thanks <a href="https://github.com/Samantha-Zhan/" target="_blank" rel="noopener noreferrer">Samantha-Zhan</a>)</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="cli-improvements">CLI improvements<a href="#cli-improvements" class="hash-link" aria-label="Direct link to CLI improvements" title="Direct link to CLI improvements">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="caching">Caching<a href="#caching" class="hash-link" aria-label="Direct link to Caching" title="Direct link to Caching">​</a></h3><p>The StyleX CLI now uses a cache by default which ensures that only changed files are recompiled.
This cache is stored in the nearest <code>node_modules</code> folder and works even without using <code>watch</code> mode.
(Thanks <a href="https://github.com/mellyeliu/" target="_blank" rel="noopener noreferrer">mellyeliu</a>)</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="better-interoperability">Better interoperability<a href="#better-interoperability" class="hash-link" aria-label="Direct link to Better interoperability" title="Direct link to Better interoperability">​</a></h3><p>The CLI now supports configuring additional Babel presets and plugins that can run before the StyleX
plugin to let you use custom syntax transformations. The StyleX Babel plugin was also updated to make
this use-case more reliable.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="windows-support">Windows support<a href="#windows-support" class="hash-link" aria-label="Direct link to Windows support" title="Direct link to Windows support">​</a></h3><p>A bug with file paths was fixed and the CLI should now work correctly on Windows.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="documentation">Documentation<a href="#documentation" class="hash-link" aria-label="Direct link to Documentation" title="Direct link to Documentation">​</a></h2><p>We have introduced a new <a href="/docs/learn/recipes/variants/">Recipes</a> section in the documentation to showcase some useful patterns when
using StyleX.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="miscellaneous">Miscellaneous<a href="#miscellaneous" class="hash-link" aria-label="Direct link to Miscellaneous" title="Direct link to Miscellaneous">​</a></h2><ul><li>The StyleX Rollup plugin now supports generating filename hashes. (Thanks <a href="https://github.com/nonzzz" target="_blank" rel="noopener noreferrer">nonzzz</a>)</li><li>We now use the <code>@dual-bundle/import-meta-resolve</code> package to replace <code>esm-resolve</code> which should making theming APIs more reliable.
(Thanks <a href="https://github.com/p0nch000" target="_blank" rel="noopener noreferrer">p0nch000</a>)</li><li>Removed unnecessary quotes around 'content' values in CSS files. (Thanks <a href="https://github.com/nikeee" target="_blank" rel="noopener noreferrer">nikeee</a>)</li><li>Added support for <code>view-transition-name</code> in ESLint's <code>valid-styles</code> rule.</li><li>Added support for <code>interpolate-size</code> in ESLint's <code>valid-styles</code> rule.</li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.9.3]]></title>
            <link>https://stylexjs.com/blog/v0.9.3</link>
            <guid>https://stylexjs.com/blog/v0.9.3</guid>
            <pubDate>Fri, 01 Nov 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[StyleX v0.9.3 is now available with some big improvements and bug-fixes.]]></description>
            <content:encoded><![CDATA[<p>StyleX v0.9.3 is now available with some big improvements and bug-fixes.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="improvements-to-theming-apis">Improvements to Theming APIs<a href="#improvements-to-theming-apis" class="hash-link" aria-label="Direct link to Improvements to Theming APIs" title="Direct link to Improvements to Theming APIs">​</a></h2><p>There are some big improvements to the predictability and reliability of our
theming APIs — <code>defineVars</code> and <code>createTheme</code>.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="breaking-change-themes-are-now-exclusive">Breaking Change: Themes are now exclusive<a href="#breaking-change-themes-are-now-exclusive" class="hash-link" aria-label="Direct link to Breaking Change: Themes are now exclusive" title="Direct link to Breaking Change: Themes are now exclusive">​</a></h3><p>When you create a <code>VarGroup</code> with <code>defineVars</code>, you are able to theme
any subset of the variables within using the <code>createTheme</code> API. These
themes can then be applied like any other StyleX styles using <code>props</code>
(or <code>attrs</code>). If you try to apply multiple themes for the same <code>VarGroup</code>,
on the same element, <em>the last applied theme wins</em>, just as you might expect.</p><p>However, previously, if you instead applied one theme on a parent element,
and another theme on a child element, the themes would end up being merged.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token comment" style="color:rgb(98, 114, 164)">// tokens.stylex.ts</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">export</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> varGroup </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">defineVars</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  primary</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'black'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  secondary</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'grey'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token imports">varGroup</span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'./tokens.stylex.ts'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> red </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">createTheme</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">varGroup</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  primary</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'red'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> blue </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">createTheme</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">varGroup</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  secondary</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'blue'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  primary</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain">color</span><span class="token operator">:</span><span class="token plain"> varGroup</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">primary</span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  secondary</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain">color</span><span class="token operator">:</span><span class="token plain"> varGroup</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">secondary</span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">function</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">App</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">return</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">div</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag spread operator" style="color:rgb(255, 121, 198)">...</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">props</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread" style="color:rgb(255, 121, 198)">red</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">      </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">div</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag spread operator" style="color:rgb(255, 121, 198)">...</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">props</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread" style="color:rgb(255, 121, 198)">blue</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">        </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">span</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag spread operator" style="color:rgb(255, 121, 198)">...</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">props</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread" style="color:rgb(255, 121, 198)">styles</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread property-access" style="color:rgb(255, 121, 198)">primary</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text">Hello </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">span</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">        </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;</span><span class="token tag" style="color:rgb(255, 121, 198)">span</span><span class="token tag" style="color:rgb(255, 121, 198)"> </span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token tag spread operator" style="color:rgb(255, 121, 198)">...</span><span class="token tag spread" style="color:rgb(255, 121, 198)">stylex</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread method function property-access" style="color:rgb(80, 250, 123)">props</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token tag spread" style="color:rgb(255, 121, 198)">styles</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token tag spread property-access" style="color:rgb(255, 121, 198)">secondary</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token tag spread punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text">World!</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">span</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">      </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">div</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain-text"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain-text">    </span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&lt;/</span><span class="token tag" style="color:rgb(255, 121, 198)">div</span><span class="token tag punctuation" style="color:rgb(248, 248, 242)">&gt;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Previously this would have resulted in the text "Hello World!" being styled
with a red primary color and a blue secondary color. Now, the text will be
styled with a black primary color and a blue secondary color.</p><p>You can think of themes conceptually as <em>re-applying</em> the default values for any
variables that are not explicitly overridden by the theme. This change simplifies
the mental model for how themes work, and has the added benefit of making it
easy to create "reset" themes:</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> reset </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">createTheme</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">varGroup</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="theme-admonition theme-admonition-tip alert alert--success admonition_qNG0"><div class="admonitionHeading_l909"><span class="admonitionIcon_UNbs"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_oUmQ"><p>You can define this "reset" theme multiple times within your app and they
will all be de-duplicated by the compiler. We encourage you to "repeat yourself"!</p></div></div><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="rootdir-is-now-optional"><code>rootDir</code> is now optional!<a href="#rootdir-is-now-optional" class="hash-link" aria-label="Direct link to rootdir-is-now-optional" title="Direct link to rootdir-is-now-optional">​</a></h3><p>Previously, when configuring the StyleX Babel plugin, you had to explicitly
specify a <code>rootDir</code> value. Internally, this path was used to generate a canonical
file path for every <code>.stylex.js</code> file in your project.</p><p>However, this was not only cumbersome, but it also resulted in errors when importing
<code>VarGroup</code>s from <code>node_modules</code>. Different package managers deal with packages differently,
and this can be particularly consequential for mono-repos.</p><p>Now, the <code>rootDir</code> option is optional, and StyleX will use the nearest <code>package.json</code> file
to determine the canonical path, automatically. This should make theming APIs work more
reliably.</p><div class="theme-admonition theme-admonition-note alert alert--secondary admonition_qNG0"><div class="admonitionHeading_l909"><span class="admonitionIcon_UNbs"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_oUmQ"><p>When determining the canonical path, StyleX will use the <code>name</code> field from the nearest
<code>package.json</code> file and the relative path to the <code>.stylex.js</code> file. We intentionally
ignore the <code>version</code> number.</p><p>This means that your project happens to contain multiple versions of the same package,
StyleX will only generate a single set of variables for them. This will usually be
the desired behavior, but you may see some unexpected results if the variables within
the two versions are different.</p><p>We will be making further improvements to minimize any such edge-cases.</p></div></div><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="more-reliable-esm-resolution">More reliable ESM resolution<a href="#more-reliable-esm-resolution" class="hash-link" aria-label="Direct link to More reliable ESM resolution" title="Direct link to More reliable ESM resolution">​</a></h3><p>The StyleX Babel plugin now uses the <code>esm-resolve</code> package to resolve ESM imports.
This should fix most situations where the compiler would fail to resolve <code>VarGroup</code>
imports in result in the compilation of <code>create</code> to fail.</p><p>Thanks <a href="https://github.com/hipstersmoothie" target="_blank" rel="noopener noreferrer">hipstersmoothie</a>!</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="dynamic-style-improvements">Dynamic style improvements<a href="#dynamic-style-improvements" class="hash-link" aria-label="Direct link to Dynamic style improvements" title="Direct link to Dynamic style improvements">​</a></h2><p>Dynamic Styles within StyleX have been improved to be more reliable and efficient.
Previously, if the dynamic value of a style resolved to <code>null</code> at runtime, StyleX
would represent that with the <code>revert</code> keyword in CSS. This did not always work as
expected, ran into certain browser bugs and resulted in styles that were unnecessarily
bloated.</p><p>In v0.9.3, <code>null</code> values for Dynamic styles work exactly the same as using <code>null</code>
as a static value within <code>create</code>. This means any previously applied value
for the given property will be removed and no className will be applied for that
property.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="stylexjsdev-runtime-overhaul"><code>@stylexjs/dev-runtime</code> overhaul<a href="#stylexjsdev-runtime-overhaul" class="hash-link" aria-label="Direct link to stylexjsdev-runtime-overhaul" title="Direct link to stylexjsdev-runtime-overhaul">​</a></h2><p>The <code>@stylexjs/dev-runtime</code> package is a development-only package that lets you use
a <em>much slower</em> version of StyleX that runs entirely at runtime. Previously, it worked
by patching the main <code>@stylexjs/stylex</code> package at runtime. However, this did not always
work reliably.</p><p><strong>Breaking Change</strong>: The <code>@stylexjs/dev-runtime</code> package now <em>returns</em> the StyleX API.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports">makeStyleX</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/dev-runtime'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> stylex </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">makeStyleX</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token comment" style="color:rgb(98, 114, 164)">// configuration options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  classNamePrefix</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'x'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  dev</span><span class="token operator">:</span><span class="token plain"> </span><span class="token boolean">true</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  test</span><span class="token operator">:</span><span class="token plain"> </span><span class="token boolean">false</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  color</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'red'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="theme-admonition theme-admonition-warning alert alert--danger admonition_qNG0"><div class="admonitionHeading_l909"><span class="admonitionIcon_UNbs"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"></path></svg></span>danger</div><div class="admonitionContent_oUmQ"><p>The <code>@stylexjs/dev-runtime</code> only exists as a convenience for development purposes.
It does not completely match the behavior of the StyleX compiler and will always
lack certain features.</p><p><strong>DO NOT</strong> use it in production.</p></div></div><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="improved-handling-of-nested-pseudo-elements-and-pseudo-classes">Improved handling of nested pseudo-elements and pseudo-classes<a href="#improved-handling-of-nested-pseudo-elements-and-pseudo-classes" class="hash-link" aria-label="Direct link to Improved handling of nested pseudo-elements and pseudo-classes" title="Direct link to Improved handling of nested pseudo-elements and pseudo-classes">​</a></h2><p>Fixed a bug where using Pseudo Classes (such as <code>:hover</code>) within Pseudo Elements (such as <code>::before</code>)
(or vice-versa) would sometimes result in surprising behavior. StyleX now handles such cases, with
an arbitrary level of nesting, correctly.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="miscellaneous">Miscellaneous<a href="#miscellaneous" class="hash-link" aria-label="Direct link to Miscellaneous" title="Direct link to Miscellaneous">​</a></h2><ul><li>Added support for additional Pseudo Elements and Pseudo Classes to our ESLint rule and type definitions.<ul><li>Thanks <a href="https://github.com/aspizu" target="_blank" rel="noopener noreferrer">aspizu</a> and <a href="https://github.com/nikeee" target="_blank" rel="noopener noreferrer">nikeee</a>!</li></ul></li><li>Slightly better compiler error messages.<ul><li>Thanks <a href="https://github.com/EvanBacon" target="_blank" rel="noopener noreferrer">EvanBacon</a>!</li></ul></li></ul>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.8.0]]></title>
            <link>https://stylexjs.com/blog/v0.8.0</link>
            <guid>https://stylexjs.com/blog/v0.8.0</guid>
            <pubDate>Sun, 06 Oct 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[StyleX v0.8.0 is now available with a bunch of fixes and new ESlint rules.]]></description>
            <content:encoded><![CDATA[<p>StyleX v0.8.0 is now available with a bunch of fixes and new ESlint rules.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="linting-enhancements">Linting Enhancements<a href="#linting-enhancements" class="hash-link" aria-label="Direct link to Linting Enhancements" title="Direct link to Linting Enhancements">​</a></h2><p>We've been making a lot of improvements to our ESLint plugin. We've both improved
our existing rules and added new ones. Thanks to <a href="https://github.com/mellyeliu" target="_blank" rel="noopener noreferrer">Melissa Liu</a>!</p><p>Here are some of the highlights:</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="new-valid-shorthands-rule">New <code>valid-shorthands</code> rule<a href="#new-valid-shorthands-rule" class="hash-link" aria-label="Direct link to new-valid-shorthands-rule" title="Direct link to new-valid-shorthands-rule">​</a></h3><p>This rule enforces our opinions on when and how you should use CSS shorthand properties.
It disallows the use of multi-value shorthands for shorthands, and disallows certain
properties altogether.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  invalidShorthands</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token comment" style="color:rgb(98, 114, 164)">// border shorthands are entirely disallowed</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token comment" style="color:rgb(98, 114, 164)">// Use `borderWidth`, `borderStyle`, and `borderColor` instead</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    border</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1px solid black'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token comment" style="color:rgb(98, 114, 164)">// Multiple values for different sides within the same shorthand are disallowed</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderWidth</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'1px 2px 3px 4px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    margin</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'10px 20px 30px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    padding</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'10px 20px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  validShorthands</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderBottomWidth</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">3</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderColor</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'black'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderInlineEndWidth</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">2</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderInlineStartWidth</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">4</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderStyle</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'solid'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    borderTopWidth</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">1</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    marginBottom</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">30</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    marginInline</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">20</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    marginTop</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">10</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    paddingBlock</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">10</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    paddingInline</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">20</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>These opinions guide you towards the most consistent and most re-usable CSS.</p><div class="theme-admonition theme-admonition-tip alert alert--success admonition_qNG0"><div class="admonitionHeading_l909"><span class="admonitionIcon_UNbs"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_oUmQ"><p>This rule offers an autofix for all disallowed properties.</p></div></div><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="new-enforce-extension-rule">New <code>enforce-extension</code> rule<a href="#new-enforce-extension-rule" class="hash-link" aria-label="Direct link to new-enforce-extension-rule" title="Direct link to new-enforce-extension-rule">​</a></h3><p>This new rule enforces the <a href="https://stylexjs.com/docs/learn/theming/defining-variables/#rules-when-defining-variables" target="_blank" rel="noopener noreferrer">rules when defining variables</a>._createMdxContent
It enforces that usages of <code>defineVars</code> are named exports within a file with a <code>.stylex.js</code> (or '.ts' or '.jsx' or '.tsx') extension,
and that such a file does not have any other exports.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="other-lint-fixes">Other Lint fixes<a href="#other-lint-fixes" class="hash-link" aria-label="Direct link to Other Lint fixes" title="Direct link to Other Lint fixes">​</a></h3><p>We've updated the ESLint rule to include additional missing properties and values.
Notably, the <code>valid-styles</code> rule should now understand:</p><ul><li><code>fieldSizing</code> as a valid prop</li><li><code>@starting-style</code> as a valid at-rule.</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="using-lightningcss-for-post-processing">Using <code>lightningcss</code> for post-processing<a href="#using-lightningcss-for-post-processing" class="hash-link" aria-label="Direct link to using-lightningcss-for-post-processing" title="Direct link to using-lightningcss-for-post-processing">​</a></h2><p>StyleX's compilation process is conceptually a three step process:</p><ol><li>Transform JavaScript source files to replace usages of <code>create</code> etc.
with the resulting classNames and collect the generated CSS.</li><li>De-duplicate and sort all the collected CSS.</li><li>Write the CSS to a file.</li></ol><p>However, often it's useful to post-process the CSS before writing it to a file.
This post-processing can include minification, prefixing, or other transformations.
After much discussion we have decided to standardize on <code>lightningcss</code> for this post-processing.</p><p>As a first step, we're add <code>lightningcss</code> by default for our Rollup Plugin. We will
be rolling out support for our other bundler plugins next.</p><p>Thanks <a href="https://github.com/Prakshal-Jain" target="_blank" rel="noopener noreferrer">Prakshal Jain</a> for his work on this!</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="theming-improvements">Theming Improvements<a href="#theming-improvements" class="hash-link" aria-label="Direct link to Theming Improvements" title="Direct link to Theming Improvements">​</a></h2><p>We've made two small but important improvements for theming in StyleX.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="use-stylexfirstthatworks-to-define-fallback-values-for-css-variables">Use <code>stylex.firstThatWorks</code> to define fallback values for CSS variables.<a href="#use-stylexfirstthatworks-to-define-fallback-values-for-css-variables" class="hash-link" aria-label="Direct link to use-stylexfirstthatworks-to-define-fallback-values-for-css-variables" title="Direct link to use-stylexfirstthatworks-to-define-fallback-values-for-css-variables">​</a></h3><p>StyleX has a <code>firstThatWorks</code> function that can be used to define fallback values for CSS property.
This is akin to using the same property multiple times with different values in CSS.</p><div class="language-css codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-css codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token comment" style="color:rgb(98, 114, 164)">/* Represent this */</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token selector class" style="color:rgb(255, 121, 198)">.my-class</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token property">background-color</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token hexcode color">#808080</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token property">background-color</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">oklab</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token number">0.5</span><span class="token plain"> </span><span class="token number">0.5</span><span class="token plain"> </span><span class="token number">0.5</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  myClass</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token comment" style="color:rgb(98, 114, 164)">// as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    backgroundColor</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">firstThatWorks</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token string" style="color:rgb(255, 121, 198)">'oklab(0.5 0.5 0.5)'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token string" style="color:rgb(255, 121, 198)">'#808080'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Now, the same API will also work for CSS variables.</p><div class="language-css codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-css codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token comment" style="color:rgb(98, 114, 164)">/* Represent this */</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token selector class" style="color:rgb(255, 121, 198)">.my-class</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token property">background-color</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token function" style="color:rgb(80, 250, 123)">var</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token variable" style="color:rgb(189, 147, 249);font-style:italic">--bg-color</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token hexcode color">#808080</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  myClass</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token comment" style="color:rgb(98, 114, 164)">// as:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    backgroundColor</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">firstThatWorks</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token string" style="color:rgb(255, 121, 198)">'var(--bg-color)'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">      </span><span class="token string" style="color:rgb(255, 121, 198)">'#808080'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="themes-have-higher-specificity-than-default-var-values">Themes have higher specificity than default var values<a href="#themes-have-higher-specificity-than-default-var-values" class="hash-link" aria-label="Direct link to Themes have higher specificity than default var values" title="Direct link to Themes have higher specificity than default var values">​</a></h3><p>The CSS rule created with <code>createTheme</code> now has higher specificity than the rule
created with <code>defineVars</code>.</p><p>This should not have been issue in the vast majority of cases already, as we always sorted
the rules in the correct order. However, in extreme edge-cases where you may be loading multiple
StyleX CSS files on the same page, this fix will ensure consistency.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="other-fixes">Other fixes<a href="#other-fixes" class="hash-link" aria-label="Direct link to Other fixes" title="Direct link to Other fixes">​</a></h2><p>We've made some other fixes in various parts of StyleX:</p><ul><li><strong>fix</strong>: Logical values for <code>textAlign</code> are no longer converted to <code>left</code> and <code>right</code>.</li><li><strong>fix</strong>: <!-- -->[CLI]<!-- --> Handle errors while deleting files gracefully (#695)</li><li><strong>feat</strong>: Expand configuration options to CLI (#638)</li><li><strong>fix</strong>: Don't add 'px' units for number values used for variables (#694)<ul><li><strong>fix</strong>:  Don't add 'px' units for additional properties that accept raw numbers as values (#705)</li></ul></li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="documentation-improvements">Documentation Improvements<a href="#documentation-improvements" class="hash-link" aria-label="Direct link to Documentation Improvements" title="Direct link to Documentation Improvements">​</a></h2><p>We've added documentation for options of our various bundler plugin and added additional
projects to our <a href="https://stylexjs.com/docs/learn/ecosystem/" target="_blank" rel="noopener noreferrer">ecosystem page</a>.</p><p>We've also updated the search on our website to be much more comprehensive and accurate.
(Powered by Algolia)</p>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.7.3]]></title>
            <link>https://stylexjs.com/blog/v0.7.3</link>
            <guid>https://stylexjs.com/blog/v0.7.3</guid>
            <pubDate>Fri, 28 Jun 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[StyleX v0.7.3 is now available with a fix to the Rollup plugin, which]]></description>
            <content:encoded><![CDATA[<p>StyleX v0.7.3 is now available with a fix to the Rollup plugin, which
didn't previously include all the necessary files in the publish to NPM.</p>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.7.0]]></title>
            <link>https://stylexjs.com/blog/v0.7.0</link>
            <guid>https://stylexjs.com/blog/v0.7.0</guid>
            <pubDate>Tue, 25 Jun 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to release StyleX v0.7.0 with a new CLI to make it easier to]]></description>
            <content:encoded><![CDATA[<p>We're excited to release StyleX v0.7.0 with a new CLI to make it easier to
get started with StyleX, improvements to variables, and various bug-fixes.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="cli">CLI<a href="#cli" class="hash-link" aria-label="Direct link to CLI" title="Direct link to CLI">​</a></h2><p>StyleX relies on a compiler that transforms your JavaScript code
<em>and</em> generates a static CSS file. However, integrating this compiler with
with your bundler can be tricky. So, while we continue to work on improving
the quality of our bundler integrations, we are introducing a new CLI as an
alternative!</p><p>The CLI transforms an entire folder. It generates an output folder where StyleX
has already been compiled away and a static CSS file has been generated. Further,
the CLI inserts an import statement for the generated CSS file into each file
that uses StyleX.</p><p>We are excited to offer this alternative to the bundler-based setup and are
choosing to release the CLI in an experimental state. We would love to hear
your feedback on how it works for you and what improvements you would like to see.</p><p>Special thanks to <a href="https://github.com/Jta26" target="_blank" rel="noopener noreferrer">Joel Austin</a> for his work on the CLI.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="literal-names-for-css-variables">Literal names for CSS variables<a href="#literal-names-for-css-variables" class="hash-link" aria-label="Direct link to Literal names for CSS variables" title="Direct link to Literal names for CSS variables">​</a></h2><p>When using, <code>defineVars</code>, StyleX abstracts away the actual CSS variable name,
and lets you use it as a JavaScript reference. Behind the scenes, unique variable names
are generated for each variable.</p><p>However, there are scenarios where it is useful to know the exact variable name. For
example, when you may want to use the variable in a standalone CSS file.</p><p>To address such use-cases, we have updated the <code>defineVars</code> API to use literals
that start with <code>--</code> as is. Other than the keys passed to <code>defineVars</code>, the
API is unchanged.</p><div class="language-ts codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-ts codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> vars </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token function" style="color:rgb(80, 250, 123)">defineVars</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token string-property property">'--primary-color'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'red'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token string-property property">'--secondary-color'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'blue'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><div class="theme-admonition theme-admonition-info alert alert--info admonition_qNG0"><div class="admonitionHeading_l909"><span class="admonitionIcon_UNbs"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>Note</div><div class="admonitionContent_oUmQ"><p>When using literals for variable names, StyleX cannot guarantee uniqueness.</p></div></div><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="bug-fixes-and-improvements">Bug Fixes and improvements<a href="#bug-fixes-and-improvements" class="hash-link" aria-label="Direct link to Bug Fixes and improvements" title="Direct link to Bug Fixes and improvements">​</a></h2><p>Additionally bug fixes to types, eslint rules and the bundler plugins has been made.</p>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.6.1]]></title>
            <link>https://stylexjs.com/blog/v0.6.1</link>
            <guid>https://stylexjs.com/blog/v0.6.1</guid>
            <pubDate>Tue, 16 Apr 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to release StyleX v0.6.1 with some big improvements for working]]></description>
            <content:encoded><![CDATA[<p>We're excited to release StyleX v0.6.1 with some big improvements for working
with CSS custom properties (aka "variables") as well as numerous bug-fixes.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="improvements-for-variables">Improvements for variables<a href="#improvements-for-variables" class="hash-link" aria-label="Direct link to Improvements for variables" title="Direct link to Improvements for variables">​</a></h2><p>We've added some new features and improvements for working with variables
and themes in StyleX.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="fallback-values-for-variables">Fallback values for variables<a href="#fallback-values-for-variables" class="hash-link" aria-label="Direct link to Fallback values for variables" title="Direct link to Fallback values for variables">​</a></h3><p>You can now provide a fallback value for variables defined with the <code>defineVars</code> API.
This new capability does not introduce any new API. Instead, the existing <code>firstThatWorks</code> API
now supports variables as arguments.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token imports">colors</span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'./tokens.stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  container</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    color</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">firstThatWorks</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token plain">colors</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">primary</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'black'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Using a list of fallbacks variables is supported.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="typed-variables">Typed variables<a href="#typed-variables" class="hash-link" aria-label="Direct link to Typed variables" title="Direct link to Typed variables">​</a></h3><p>StyleX introduces a brand new set of APIs for defining <code>&lt;syntax&gt;</code> types for CSS
variables. This results in <code>@property</code> rules in the generated CSS output which
can be used to animate CSS variables as well as other special use-cases.</p><p>The new <code>types.*</code> functions can be used when defining variables to define
them with a particular type.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> typedTokens </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">defineVars</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  bgColor</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">types</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">color</span><span class="token operator">&lt;</span><span class="token builtin" style="color:rgb(189, 147, 249)">string</span><span class="token operator">&gt;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'cyan'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token constant" style="color:rgb(189, 147, 249)">DARK</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'navy'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  cornerRadius</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">types</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">length</span><span class="token operator">&lt;</span><span class="token builtin" style="color:rgb(189, 147, 249)">string</span><span class="token plain"> </span><span class="token operator">|</span><span class="token plain"> </span><span class="token builtin" style="color:rgb(189, 147, 249)">number</span><span class="token operator">&gt;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">default</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'4px'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    </span><span class="token string-property property">'@media (max-width: 600px)'</span><span class="token operator">:</span><span class="token plain"> </span><span class="token number">0</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  translucent</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">types</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">number</span><span class="token operator">&lt;</span><span class="token builtin" style="color:rgb(189, 147, 249)">number</span><span class="token operator">&gt;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token number">0.5</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  angle</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">types</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">angle</span><span class="token operator">&lt;</span><span class="token builtin" style="color:rgb(189, 147, 249)">string</span><span class="token operator">&gt;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">'0deg'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  shortAnimation</span><span class="token operator">:</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">types</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">time</span><span class="token operator">&lt;</span><span class="token builtin" style="color:rgb(189, 147, 249)">string</span><span class="token operator">&gt;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token string" style="color:rgb(255, 121, 198)">'0.5s'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>Once variables have been defined with types, they can be animated
with <code>keyframes</code> just like any other CSS property.</p><div class="language-tsx codeBlockContainer_ZGJx theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_qZBB"><pre tabindex="0" class="prism-code language-tsx codeBlock_TAPP thin-scrollbar"><code class="codeBlockLines_AdAo"><span class="token-line" style="color:#F8F8F2"><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports operator">*</span><span class="token imports"> </span><span class="token imports keyword module" style="color:rgb(189, 147, 249);font-style:italic">as</span><span class="token imports"> stylex</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'@stylexjs/stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">import</span><span class="token plain"> </span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token imports">typedTokens</span><span class="token imports punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token plain"> </span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">from</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'./tokens.stylex'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> rotate </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">keyframes</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  from</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">typedTokens</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">angle</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'0deg'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  to</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token plain">typedTokens</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token property-access">angle</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'360deg'</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token keyword" style="color:rgb(189, 147, 249);font-style:italic">const</span><span class="token plain"> styles </span><span class="token operator">=</span><span class="token plain"> stylex</span><span class="token punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token method function property-access" style="color:rgb(80, 250, 123)">create</span><span class="token punctuation" style="color:rgb(248, 248, 242)">(</span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  gradient</span><span class="token operator">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    backgroundImage</span><span class="token operator">:</span><span class="token plain"> </span><span class="token template-string template-punctuation string" style="color:rgb(255, 121, 198)">`</span><span class="token template-string string" style="color:rgb(255, 121, 198)">conic-gradient(from </span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:rgb(248, 248, 242)">${</span><span class="token template-string interpolation">tokens</span><span class="token template-string interpolation punctuation" style="color:rgb(248, 248, 242)">.</span><span class="token template-string interpolation">angle</span><span class="token template-string interpolation interpolation-punctuation punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token template-string string" style="color:rgb(255, 121, 198)">, ...colors)</span><span class="token template-string template-punctuation string" style="color:rgb(255, 121, 198)">`</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationName</span><span class="token operator">:</span><span class="token plain"> rotate</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationDuration</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'10s'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationTimingFunction</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'linear'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">    animationIterationCount</span><span class="token operator">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">'infinite'</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">  </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span><span class="token punctuation" style="color:rgb(248, 248, 242)">)</span><br></span></code></pre><div class="buttonGroup_TNwR"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_MVhB" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_yxgH"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_QJLJ"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div><p>This can be used achieve some interesting effects, such as animating the
<code>angle</code> of a conic-gradient:</p><div class="x78zum5 x6s0dn4 xl56j7k x186iv6y xur7f20 x9f619 xh8yej3 x2i9t41 x1ja2u2z"><div class="xgqmno8 xmydgjh x1n2onr6 x1oux285 x9f619"><div class="x10l6tqk x10a8y8t xtwf6cq xgqmno8 xfi0m9a x18ebdri x1esw782 xa4qsjk"></div><div class="x10l6tqk x10a8y8t xtwf6cq xgqmno8 xfi0m9a x18ebdri x1esw782 xa4qsjk x120zzft"></div></div></div><p>This new capability is primarily about CSS types, but the new API
also makes the TypeScript (or Flow) types for the variables more powerful.</p><p>As can be seen in the example, generic type arguments can be used to constrain
the values the variable can take when creating themes with <code>createTheme</code>.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="eslint-plugin">ESlint plugin<a href="#eslint-plugin" class="hash-link" aria-label="Direct link to ESlint plugin" title="Direct link to ESlint plugin">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="new-sort-keys-rule">New <code>sort-keys</code> rule<a href="#new-sort-keys-rule" class="hash-link" aria-label="Direct link to new-sort-keys-rule" title="Direct link to new-sort-keys-rule">​</a></h3><p>We've added a new <code>sort-keys</code> rule to the StyleX ESlint plugin. This rule
is a stylistic rule to enforce a consistent order for keys for your StyleX
styles.</p><p>Thanks <a href="https://github.com/nedjulius" target="_blank" rel="noopener noreferrer">nedjulius</a></p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="improvements-to-proplimits-for-valid-styles-rule">Improvements to <code>propLimits</code> for <code>valid-styles</code> rule.<a href="#improvements-to-proplimits-for-valid-styles-rule" class="hash-link" aria-label="Direct link to improvements-to-proplimits-for-valid-styles-rule" title="Direct link to improvements-to-proplimits-for-valid-styles-rule">​</a></h3><p>The <code>valid-styles</code> rule has been improved to allow more expressive
"prop limits".</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="miscellaneous">Miscellaneous<a href="#miscellaneous" class="hash-link" aria-label="Direct link to Miscellaneous" title="Direct link to Miscellaneous">​</a></h2><ul><li>ESlint <code>'valid-styles'</code> rule now allows using variables created with
<code>defineVars</code> as keys within dynamic styles.</li><li>Bug-fixes to the experimental <code>include</code> API</li><li>Fixed debug className generation for <code>createTheme</code></li><li>Units are no longer removed from <code>0</code> values</li><li>Compilation bug-fixes</li></ul><p>Our <a href="/docs/learn/ecosystem/">Ecosystem</a> page continues to grow with community projects. Including a
<a href="https://github.com/nedjulius/prettier-plugin-stylex-key-sort" target="_blank" rel="noopener noreferrer">Prettier plugin</a> for sorting StyleX styles.</p>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.5.0]]></title>
            <link>https://stylexjs.com/blog/v0.5.0</link>
            <guid>https://stylexjs.com/blog/v0.5.0</guid>
            <pubDate>Thu, 25 Jan 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[We're excited to release Stylex v0.5.0 with some big improvements and fixes!]]></description>
            <content:encoded><![CDATA[<p>We're excited to release Stylex v0.5.0 with some big improvements and fixes!</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="new-attrs-function">New <code>attrs</code> function<a href="#new-attrs-function" class="hash-link" aria-label="Direct link to new-attrs-function" title="Direct link to new-attrs-function">​</a></h2><p>The <code>props</code> function returns an object with a <code>className</code> string and a
<code>style</code> object. Some frameworks may expect <code>class</code> instead of <code>className</code> and a
string value for <code>style</code>.</p><p>We are introducing a new <code>attrs</code> function so StyleX works well in more
places. <code>attrs</code> returns an object with a <code>class</code> string and a <code>style</code>
string.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="new-sort-keys-rule-for-the-eslint-plugin">New <code>sort-keys</code> rule for the Eslint plugin<a href="#new-sort-keys-rule-for-the-eslint-plugin" class="hash-link" aria-label="Direct link to new-sort-keys-rule-for-the-eslint-plugin" title="Direct link to new-sort-keys-rule-for-the-eslint-plugin">​</a></h2><p>A new <code>@stylexjs/sort-keys</code> plugin has been introduced which will sort styles
alphabetically and by priority. This will make media query order more
predictable.</p><p>Thanks <a href="https://github.com/nedjulius" target="_blank" rel="noopener noreferrer">@nedjulius</a>!</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="new-aliases-option-for-the-stylex-babel-plugin">New <code>aliases</code> option for the StyleX Babel plugin<a href="#new-aliases-option-for-the-stylex-babel-plugin" class="hash-link" aria-label="Direct link to new-aliases-option-for-the-stylex-babel-plugin" title="Direct link to new-aliases-option-for-the-stylex-babel-plugin">​</a></h2><p>A new <code>aliases</code> field can be used to configure StyleX to resolve custom aliases
that may be set up in your <code>tsconfig</code> file. <strong>NOTE</strong>: StyleX currently needs to
be configured with absolute paths for your aliases.</p><p>Thanks <a href="https://github.com/rayan1810" target="_blank" rel="noopener noreferrer">@rayan1810</a>!</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="new-esbuild-plugin">New Esbuild plugin<a href="#new-esbuild-plugin" class="hash-link" aria-label="Direct link to New Esbuild plugin" title="Direct link to New Esbuild plugin">​</a></h2><p>A new official plugin for Esbuild has been introduced as
<code>@stylexjs/esbuild-plugin</code>.</p><p>Thanks <a href="https://github.com/nedjulius" target="_blank" rel="noopener noreferrer">@nedjulius</a>!</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="other-enhancements">Other Enhancements<a href="#other-enhancements" class="hash-link" aria-label="Direct link to Other Enhancements" title="Direct link to Other Enhancements">​</a></h2><ul><li>Configuration options passed to the StyleX Babel plugin will now be validated.</li><li>The <code>@stylexjs/stylex</code> now has ESM exports alongside the commonJS exports.</li><li>The ESLint <code>valid-styles</code> rule will catch when using empty strings as string
values.</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="bug-fixes">Bug Fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to Bug Fixes" title="Direct link to Bug Fixes">​</a></h2><ul><li>Some CSS properties which previously caused type and lint errors will now be
accepted.</li><li>Using variables for <code>opacity</code> will no longer cause type errors.</li><li>Using <code>keyframes</code> within <code>defineVars</code> will now work correctly</li><li><code>runtimeInjection</code> will correctly be handled</li><li>Setting the value of variables from <code>defineVars</code> as dynamic styles will now
work correctly.</li><li>Usage of <code>0px</code> within CSS functions will no longer be simplified to a
unit-less <code>0</code> as this doesn't work in certain cases.</li><li>Spaces around CSS operators will be maintained.</li></ul><p>In addition to these, we've added an "Ecosystem" page to our website to
highlight various community projects around StyleX.</p>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Release 0.4.1]]></title>
            <link>https://stylexjs.com/blog/v0.4.1</link>
            <guid>https://stylexjs.com/blog/v0.4.1</guid>
            <pubDate>Fri, 29 Dec 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Three weeks ago, we open-sourced StyleX. Since then, we've been diligently]]></description>
            <content:encoded><![CDATA[<p>Three weeks ago, we open-sourced StyleX. Since then, we've been diligently
fixing bugs and making improvements. Here are some of the highlights:</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="enhancements">Enhancements<a href="#enhancements" class="hash-link" aria-label="Direct link to Enhancements" title="Direct link to Enhancements">​</a></h2><ul><li>The amount of JavaScript generated after compilation has been further reduced.</li><li>Added support for some previously missing CSS properties to the ESLint plugin.</li><li>Added support for using variables in <code>keyframes</code>.</li><li>Removed the code for style injection from the production runtime, reducing the
size of the runtime by over 50%.</li><li>Added Flow and TypeScript types for the Rollup Plugin.</li><li>Added the option to use CSS Layers in all bundler plugins.</li><li>TypeScript will now auto-complete style property names.</li><li>Bundler plugins will now skip files that don't contain StyleX, resulting in
faster build times.</li></ul><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="bug-fixes">Bug Fixes<a href="#bug-fixes" class="hash-link" aria-label="Direct link to Bug Fixes" title="Direct link to Bug Fixes">​</a></h2><ul><li>Fixed a bug where the ESLint plugin was sometimes unable to resolve local
constants used for Media Queries and Pseudo Classes.</li><li>Resolved a bug where the runtime injection of styles in dev mode would
sometimes fail.</li><li>Addressed a bug where styles injected at runtime during development would
sometimes suffer from specificity conflicts.</li><li>The TypeScript types for <code>Theme</code> will now correctly throw an error when
applying a theme for the wrong <code>VarGroup</code>.</li></ul><p>In addition to these, we've made other improvements to the types and
documentation. I want to extend my gratitude to all the contributors for their
pull requests. ♥️</p><p>Happy New Year!</p>]]></content:encoded>
            <category>release</category>
        </item>
        <item>
            <title><![CDATA[Introducing StyleX]]></title>
            <link>https://stylexjs.com/blog/introducing-stylex</link>
            <guid>https://stylexjs.com/blog/introducing-stylex</guid>
            <pubDate>Tue, 05 Dec 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[We are thrilled to introduce StyleX. StyleX is an expressive, deterministic,]]></description>
            <content:encoded><![CDATA[<p>We are thrilled to introduce StyleX. StyleX is an expressive, deterministic,
reliable, and scalable styling system for ambitious applications. We've taken
the best ideas from the styling libraries that have come before to create
something that is simultaneously familiar and uniquely new.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="what-is-stylex">What is StyleX?<a href="#what-is-stylex" class="hash-link" aria-label="Direct link to What is StyleX?" title="Direct link to What is StyleX?">​</a></h2><p>StyleX takes the developer experience of CSS-in-JS libraries and uses
compile-time tooling to bridge it with the performance and scalability of static
CSS. However, StyleX is not just another compiler-based CSS-in-JS library.
StyleX has been carefully designed to meet the requirements of large
applications, reusable component libraries, and statically typed codebases.</p><ol><li>StyleX supports an expressive subset of CSS. It avoids complex selectors and
guarantees no specificity conflicts in the generated CSS.</li><li>StyleX transforms, organizes, and optimizes styles into "atomic" CSS class
names. There's no need to learn or manage a separate library of utility class
names.</li><li>StyleX allows styles to be merged across file and component boundaries,
making it ideal for component libraries that allow user customization.</li><li>StyleX is fully typed and provides type utilities to allow fine-grained
control over what properties and values can be accepted by a component.</li></ol><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="what-are-the-advantages-of-stylex">What are the advantages of StyleX?<a href="#what-are-the-advantages-of-stylex" class="hash-link" aria-label="Direct link to What are the advantages of StyleX?" title="Direct link to What are the advantages of StyleX?">​</a></h2><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="fast">Fast<a href="#fast" class="hash-link" aria-label="Direct link to Fast" title="Direct link to Fast">​</a></h3><p>StyleX is designed to be fast at both compile-time and runtime. The Babel
transforms do not significantly slow down builds.</p><p>At runtime, StyleX entirely avoids the costs associated with using JavaScript to
insert styles at runtime, and does little more than efficiently combine class
name strings when necessary. And the generated CSS is optimized for size,
ensuring that the styles for even the largest websites can be quickly parsed by
browsers.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="scalable">Scalable<a href="#scalable" class="hash-link" aria-label="Direct link to Scalable" title="Direct link to Scalable">​</a></h3><p>StyleX is designed to scale to extremely large codebases, like the ones we have
at Meta. The Babel plugin can handle processing styles in many thousands of
components at compile-time by leveraging atomic builds and file-level caching.
And because StyleX is designed to encapsulate styles, it allows new components
to be developed in isolation with the expectation that they will render
predictably once used within other components.</p><p>By generating atomic CSS class names, StyleX helps minimize the size of the CSS
bundle. As the number of components in an application grows, the size of the CSS
bundle starts to plateau. This frees developers from having to manually optimize
or lazy-load CSS files.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="predictable">Predictable<a href="#predictable" class="hash-link" aria-label="Direct link to Predictable" title="Direct link to Predictable">​</a></h3><p>StyleX automatically manages the specificity of CSS selectors to guarantee that
there are no collisions between the generated rules. StyleX gives developers a
system that reliably applies styles, and ensures that "the last style applied
always wins"</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="composable">Composable<a href="#composable" class="hash-link" aria-label="Direct link to Composable" title="Direct link to Composable">​</a></h3><p>StyleX styles are easy to compose. Not only can multiple local styles be applied
conditionally, styles can also be passed across files and components. Styles
always merge with predictable results.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="type-safe">Type-Safe<a href="#type-safe" class="hash-link" aria-label="Direct link to Type-Safe" title="Direct link to Type-Safe">​</a></h3><p>You can constrain the styles a component accepts by using TypeScript or Flow
types. Every style property and variable is fully typed.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="colocation">Colocation<a href="#colocation" class="hash-link" aria-label="Direct link to Colocation" title="Direct link to Colocation">​</a></h3><p>StyleX allows and encourages authoring styles in the same file as the component
that uses them. This co-location helps make styles more readable and
maintainable in the long run. StyleX is able to use static analysis and
build-time tools to de-duplicate styles across components and to remove unused
styles.</p><h3 class="anchor anchorWithStickyNavbar_fF9Z" id="testable">Testable<a href="#testable" class="hash-link" aria-label="Direct link to Testable" title="Direct link to Testable">​</a></h3><p>StyleX can be configured to output debug class names <em>instead</em> of functional
atomic class names. This can be used to generate snapshots that don't change as
often in response to minor design changes.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="how-does-stylex-work">How does StyleX work?<a href="#how-does-stylex-work" class="hash-link" aria-label="Direct link to How does StyleX work?" title="Direct link to How does StyleX work?">​</a></h2><p>StyleX is a collection of tools that work together.</p><ul><li>A Babel plugin</li><li>A small runtime library</li><li>An ESlint plugin</li><li>A growing collection of integrations with bundlers and frameworks.</li></ul><p>The most important part of StyleX is the Babel plugin. It finds and extracts all
the styles defined within your source code and converts them to atomic class
names at compile time. A helper function deduplicates, sorts, and writes the
collected styles to a CSS file. These tools are used to implement bundler
plugins.</p><p>To make using StyleX feel as natural as possible, StyleX supports various static
patterns to define your styles by using local constants and expressions.
Additionally, in order to give you the best performance possible, the Babel
plugin also pre-computes the final class names when possible to remove any
runtime cost — even merging class names — from a given file. If a component is
defining and using styles within the same file statically, the runtime cost will
be <strong>ZERO</strong>.</p><p>When using more powerful patterns such as style composition, a tiny runtime
merges objects of class names dynamically. This runtime has been optimized to be
extremely fast and the results are then memoized.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="the-origins-of-stylex">The origins of StyleX<a href="#the-origins-of-stylex" class="hash-link" aria-label="Direct link to The origins of StyleX" title="Direct link to The origins of StyleX">​</a></h2><p>The previous Facebook website used something akin to CSS modules and suffered
from various problems that inspired
<a href="https://blog.vjeux.com/2014/javascript/react-css-in-js-nationjs.html" target="_blank" rel="noopener noreferrer">the initial idea for CSS-in-JS</a>.
The average visitor to <a href="https://www.facebook.com/" target="_blank" rel="noopener noreferrer">facebook.com</a> would download
tens of megabytes of CSS. Much of it unused. In order to optimize the initial
load, we would lazy load our CSS which would, in turn, lead to slow update (or
"Interaction to Next Paint") times. Usage of complex selectors would lead to
conflicts or "specificity wars". Engineers would often resort to using
<code>!important</code> or more complex selectors to solve their problems, making the
entire system progressively worse.</p><p>A few years ago, when we were rebuilding
<a href="https://www.facebook.com/" target="_blank" rel="noopener noreferrer">facebook.com</a> from the ground up using React, we
knew we needed something better and built StyleX.</p><p>StyleX was designed to scale, and the design has proven itself in our years of
experience using it. We've added new features to StyleX without regressing on
performance or scalability while making StyleX more of a joy to use.</p><p>Using StyleX has been a massive improvement in both scalability and expressivity
for us at Meta. On <code>facebook.com</code> we were able to bring down our CSS bundle from
tens of megabytes of lazy-loaded CSS to a single bundle of a couple hundred
kilobytes.</p><p>We created StyleX not only to meet the styling needs of React developers on the
web, but to unify styling for React across web and native.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="how-does-meta-use-stylex">How does Meta use StyleX?<a href="#how-does-meta-use-stylex" class="hash-link" aria-label="Direct link to How does Meta use StyleX?" title="Direct link to How does Meta use StyleX?">​</a></h2><p>StyleX has become the preferred way to style components for every web surface
within Meta. StyleX is used to style React components for every major external
and internal product at Meta including Facebook, WhatsApp, Instagram, Workplace,
and Threads. It has changed the way we author components, and resolved the
issues our teams previously had with not being able to encapsulate and scale
their styled components.</p><p>We expanded the original capabilities of StyleX so that engineers at Meta can
use StyleX to author both static and dynamic styles. Our teams are using StyleX
theming APIs to develop "universal" components that are themed to take on the
appearance of different design systems used within different Meta products. And
we're gradually expanding support for cross-platform styling, thanks to StyleX
being aligned with the principles of encapsulation introduced by React Native's
styling system.</p><h2 class="anchor anchorWithStickyNavbar_fF9Z" id="open-source">Open Source<a href="#open-source" class="hash-link" aria-label="Direct link to Open Source" title="Direct link to Open Source">​</a></h2><p>What we're open sourcing is what we use internally. We develop on Github first
and sync it back to Meta. Although StyleX was originally created at Meta for
Meta, it is not specific to Meta.</p><p>That said, this is still just the beginning. We look forward to working with the
community to introduce further optimizations and more integrations.</p><p>We hope you love using StyleX as much as we do. ❤️</p>]]></content:encoded>
            <category>announcement</category>
        </item>
    </channel>
</rss>