@pandacss/studio 0.37.1 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/studio",
3
- "version": "0.37.1",
3
+ "version": "0.38.0",
4
4
  "description": "The automated token documentation for Panda CSS",
5
5
  "main": "dist/studio.js",
6
6
  "module": "dist/studio.mjs",
@@ -47,13 +47,13 @@
47
47
  "astro": "4.4.0",
48
48
  "react": "18.2.0",
49
49
  "react-dom": "18.2.0",
50
- "vite": "5.1.3",
51
- "@pandacss/config": "0.37.1",
52
- "@pandacss/logger": "0.37.1",
53
- "@pandacss/shared": "0.37.1",
54
- "@pandacss/token-dictionary": "0.37.1",
55
- "@pandacss/types": "0.37.1",
56
- "@pandacss/astro-plugin-studio": "0.37.1"
50
+ "vite": "5.1.7",
51
+ "@pandacss/config": "0.38.0",
52
+ "@pandacss/logger": "0.38.0",
53
+ "@pandacss/shared": "0.38.0",
54
+ "@pandacss/token-dictionary": "0.38.0",
55
+ "@pandacss/types": "0.38.0",
56
+ "@pandacss/astro-plugin-studio": "0.38.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "18.2.55",
@@ -1,4 +1,4 @@
1
- import { getSlotRecipes, memo, splitProps } from '../helpers.mjs';
1
+ import { compact, getSlotRecipes, memo, splitProps } from '../helpers.mjs';
2
2
  import { cva } from './cva.mjs';
3
3
  import { cx } from './cx.mjs';
4
4
 
@@ -6,6 +6,7 @@ const slotClass = (className, slot) => className + '__' + slot
6
6
 
7
7
  export function sva(config) {
8
8
  const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)])
9
+ const defaultVariants = config.defaultVariants ?? {}
9
10
 
10
11
  function svaFn(props) {
11
12
  const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), config.className && slotClass(config.className, slot))])
@@ -23,6 +24,7 @@ export function sva(config) {
23
24
  function splitVariantProps(props) {
24
25
  return splitProps(props, variantKeys);
25
26
  }
27
+ const getVariantProps = (variants) => ({ ...(defaultVariants || {}), ...compact(variants) })
26
28
 
27
29
  const variantMap = Object.fromEntries(
28
30
  Object.entries(variants).map(([key, value]) => [key, Object.keys(value)])
@@ -34,5 +36,6 @@ export function sva(config) {
34
36
  variantMap,
35
37
  variantKeys,
36
38
  splitVariantProps,
39
+ getVariantProps,
37
40
  })
38
41
  }
@@ -31,13 +31,13 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
31
31
  function recipeClass() {
32
32
  const { css: cssStyles, ...propStyles } = styleProps
33
33
  const compoundVariantStyles = __cvaFn__.__getCompoundVariantCss__?.(variantProps)
34
- return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.className)
34
+ return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, ...(Array.isArray(cssStyles) ? cssStyles : [cssStyles])), combinedProps.className)
35
35
  }
36
36
 
37
37
  function cvaClass() {
38
38
  const { css: cssStyles, ...propStyles } = styleProps
39
39
  const cvaStyles = __cvaFn__.raw(variantProps)
40
- return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.className)
40
+ return cx(css(cvaStyles, propStyles, ...(Array.isArray(cssStyles) ? cssStyles : [cssStyles])), combinedProps.className)
41
41
  }
42
42
 
43
43
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -50,6 +50,10 @@ export interface PatternConfig<T extends PatternProperties = PatternProperties>
50
50
  * The css object this pattern will generate.
51
51
  */
52
52
  transform?: (props: InferProps<T>, helpers: PatternHelpers) => SystemStyleObject
53
+ /**
54
+ * Whether the pattern is deprecated.
55
+ */
56
+ deprecated?: boolean | string
53
57
  /**
54
58
  * The jsx element name this pattern will generate.
55
59
  */
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- import type { Conditional } from './conditions';
2
+ import type { ConditionalValue } from './conditions';
3
3
  import type { CssProperties } from './system-types';
4
4
  import type { Tokens } from '../tokens/index';
5
5
 
@@ -208,7 +208,7 @@ type WithColorOpacityModifier<T> = T extends string ? `${T}/${string}` : T
208
208
  type ImportantMark = "!" | "!important"
209
209
  type WhitespaceImportant = ` ${ImportantMark}`
210
210
  type Important = ImportantMark | WhitespaceImportant
211
- type WithImportant<T> = T extends string ? `${T}${Important}${string}` : T
211
+ type WithImportant<T> = T extends string ? `${T}${Important}` & { __important?: true } : T;
212
212
 
213
213
  /**
214
214
  * Only relevant when using `strictTokens` or `strictPropertyValues` in your config.
@@ -226,7 +226,7 @@ type WithImportant<T> = T extends string ? `${T}${Important}${string}` : T
226
226
  * @see https://panda-css.com/docs/concepts/writing-styles#stricttokens
227
227
  * @see https://panda-css.com/docs/concepts/writing-styles#strictpropertyvalues
228
228
  */
229
- export type WithEscapeHatch<T> = T | `[${string}]` | (T extends string ? WithColorOpacityModifier<string> | WithImportant<T> : T)
229
+ export type WithEscapeHatch<T> = T | `[${string}]` | WithColorOpacityModifier<T> | WithImportant<T>
230
230
 
231
231
  /**
232
232
  * Will restrict the value of properties that have predefined values to those values only.
@@ -64,6 +64,10 @@ export interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantR
64
64
  * The base styles of the recipe.
65
65
  */
66
66
  base?: SystemStyleObject
67
+ /**
68
+ * Whether the recipe is deprecated.
69
+ */
70
+ deprecated?: boolean | string
67
71
  /**
68
72
  * The multi-variant styles of the recipe.
69
73
  */
@@ -123,6 +127,9 @@ export interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVaria
123
127
  raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>
124
128
  variantKeys: (keyof T)[]
125
129
  variantMap: RecipeVariantMap<T>
130
+ splitVariantProps<Props extends RecipeSelection<T>>(
131
+ props: Props,
132
+ ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]
126
133
  getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>
127
134
  }
128
135
 
@@ -138,6 +145,10 @@ export interface SlotRecipeDefinition<
138
145
  * An optional class name that can be used to target slots in the DOM.
139
146
  */
140
147
  className?: string
148
+ /**
149
+ * Whether the recipe is deprecated.
150
+ */
151
+ deprecated?: boolean | string
141
152
  /**
142
153
  * The parts/slots of the recipe.
143
154
  */
@@ -66,7 +66,7 @@ export type CompositionStyleObject<Property extends string> = Nested<FilterStyle
66
66
  * Jsx style props
67
67
  * -----------------------------------------------------------------------------*/
68
68
  interface WithCss {
69
- css?: SystemStyleObject
69
+ css?: SystemStyleObject | SystemStyleObject[]
70
70
  }
71
71
  type StyleProps = SystemStyleObject & WithCss
72
72