🐼 Panda v0.36.0 #2407
anubra266
announced in
Announcements
🐼 Panda v0.36.0
#2407
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
To upgrade to v0.36.0:
What's Changed
Fixed
Fix
Expression produces a union type that is too complex to representwithsplitCssPropsbecause ofJsxStylePropstypeFix merging issue when using a preset that has a token with a conflicting value with another (or the user's config)
When merged with the preset, the config would create nested tokens (
black.10,black.20,black.30) inside of theinitially flat
blacktoken.This would cause issues as the token engine stops diving deeper after encountering an object with a
valueproperty.To fix this, we now automatically replace the flat
blacktoken using theDEFAULTkeyword when resolving the configso that the token engine can continue to dive deeper into the object:
{ "theme": { "tokens": { "colors": { "black": { "0": { "value": "black", }, "10": { "value": "black/10", }, "20": { "value": "black/20", }, "30": { "value": "black/30", }, - "value": "black", + "DEFAULT": { + "value": "black", + }, }, }, }, }, }strictPropertyValuestypings should allow forCssVars(either predefined fromglobalVarsor any custom CSSvariable)
If no
globalVarsare defined, anyvar(--*)will be allowedAdded
globalVarsconfig option to define type-safeCSS variables and custom
CSS @property.
Example:
config.themesto easily define and apply a theme on multiple tokens at once, using data attributes and CSSvariables.
Can pre-generate multiple themes with token overrides as static CSS, but also dynamically import and inject a theme
stylesheet at runtime (browser or server).
Example:
Pregenerating themes
By default, no additional theme variant is generated, you need to specify the specific themes you want to generate in
staticCss.themesto include them in the CSS output.This will generate the following CSS:
An alternative way of applying a theme is by using the new
styled-system/themesentrypoint where you can import thethemes CSS variables and use them in your app.
Each theme has a corresponding JSON file with a similar structure:
{ "name": "primary", "id": "panda-themes-primary", "dataAttr": "primary", "css": "[data-panda-theme=primary] { ... }" }Dynamically import a theme using its name:
Inject the theme styles into the DOM:
SSR example with NextJS:
Finally, you can create a theme contract to ensure that all themes have the same structure:
Cbanged
When using
strictTokens: true, if you didn't havetokens(orsemanticTokens) on a givenToken category, you'dstill not be able to use any values in properties bound to that category. Now,
strictTokenswill correctly onlyrestrict properties that have values in their token category.
Example:
Description
csstypecomments for each property.You will now be able to see a utility or
csstypevalues in 2 clicks !How
Instead of relying on TS to infer the correct type for each properties, we now just generate the appropriate value for
each property based on the config.
This should make it easier to understand the type of each property and might also speed up the TS suggestions as there's
less to infer.
Beta Was this translation helpful? Give feedback.
All reactions