@pandacss/error
Advanced tools
Changelog
[0.21.0] - 2023-12-09
While parsing over the AST Nodes, due to an optimization where we skipped retrieving the current JSX element and instead kept track of the latest one, the logic was flawed and did not extract other properties after encountering a JSX attribute that was another JSX node.
const Component = () => {
return (
<>
{/* ❌ this wasn't extracting ml="2" */}
<Flex icon={<svg className="icon" />} ml="2" />
{/* ✅ this was fine */}
<Stack ml="4" icon={<div className="icon" />} />
</>
)
}
Now both will be fine again.
const App = () => {
// here the content property is a valid CSS property, so Panda will try to generate the CSS for it
// but since it's an URL, it would produce invalid CSS
// we now check if the property value is an URL and skip it if needed
return <CopyButton content="https://www.buymeacoffee.com/grizzlycodes" />
}
styled
factory internal class merging, for example:<script setup>
import { styled } from '../styled-system/jsx'
const StyledButton = styled('button', {
base: {
bgColor: 'red.300',
},
})
</script>
<template>
<StyledButton id="test" class="test">
<slot></slot>
</StyledButton>
</template>
Will now correctly include the test
class in the final output.
configPath
and cwd
options in the @pandacss/astro
integration just like in the @pandacss/postcss
This can be useful with Nx monorepos where the
panda.config.ts
is not in the root of the project.
config.strictTokens
, by prefixing the value with [
and
suffixing with ]
, e.g. writing [123px]
as a value will bypass the token validation.import { css } from '../styled-system/css'
css({
// @ts-expect-error TS will throw when using from strictTokens: true
color: '#fff',
// @ts-expect-error TS will throw when using from strictTokens: true
width: '100px',
// ✅ but this is now allowed:
bgColor: '[rgb(51 155 240)]',
fontSize: '[12px]',
})
config.importMap
optionYou can now also use a string to customize the base import path and keep the default entrypoints:
{
"importMap": "@scope/styled-system"
}
is the equivalent of:
{
"importMap": {
"css": "@scope/styled-system/css",
"recipes": "@scope/styled-system/recipes",
"patterns": "@scope/styled-system/patterns",
"jsx": "@scope/styled-system/jsx"
}
}
staticCss
options from inside a recipe config, e.g.:import { defineRecipe } from '@pandacss/dev'
const card = defineRecipe({
className: 'card',
base: { color: 'white' },
variants: {
size: {
small: { fontSize: '14px' },
large: { fontSize: '18px' },
},
},
staticCss: [{ size: ['*'] }],
})
would be the equivalent of defining it inside the main config:
import { defineConfig } from '@pandacss/dev'
export default defineConfig({
// ...
staticCss: {
recipes: {
card: {
size: ['*'],
},
},
},
})