@pandacss/studio 0.34.2 → 0.35.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.34.2",
3
+ "version": "0.35.0",
4
4
  "description": "The automated token documentation for Panda CSS",
5
5
  "main": "dist/studio.js",
6
6
  "module": "dist/studio.mjs",
@@ -48,12 +48,12 @@
48
48
  "react": "18.2.0",
49
49
  "react-dom": "18.2.0",
50
50
  "vite": "5.1.3",
51
- "@pandacss/config": "0.34.2",
52
- "@pandacss/logger": "0.34.2",
53
- "@pandacss/shared": "0.34.2",
54
- "@pandacss/token-dictionary": "0.34.2",
55
- "@pandacss/types": "0.34.2",
56
- "@pandacss/astro-plugin-studio": "0.34.2"
51
+ "@pandacss/config": "0.35.0",
52
+ "@pandacss/logger": "0.35.0",
53
+ "@pandacss/shared": "0.35.0",
54
+ "@pandacss/token-dictionary": "0.35.0",
55
+ "@pandacss/types": "0.35.0",
56
+ "@pandacss/astro-plugin-studio": "0.35.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "18.2.55",
@@ -1,11 +1,14 @@
1
1
  import { getSlotRecipes, memo, splitProps } from '../helpers.mjs';
2
2
  import { cva } from './cva.mjs';
3
+ import { cx } from './cx.mjs';
4
+
5
+ const slotClass = (className, slot) => className + '__' + slot
3
6
 
4
7
  export function sva(config) {
5
8
  const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)])
6
9
 
7
10
  function svaFn(props) {
8
- const result = slots.map(([slot, cvaFn]) => [slot, cvaFn(props)])
11
+ const result = slots.map(([slot, cvaFn]) => [slot, cx(cvaFn(props), config.className && slotClass(config.className, slot))])
9
12
  return Object.fromEntries(result)
10
13
  }
11
14
 
@@ -17,9 +17,10 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
17
17
 
18
18
  const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
19
19
  const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
20
+ const __base__ = Dynamic.__base__ || Dynamic
20
21
 
21
22
  const PandaComponent = /* @__PURE__ */ forwardRef(function PandaComponent(props, ref) {
22
- const { as: Element = Dynamic.__base__ || Dynamic, children, ...restProps } = props
23
+ const { as: Element = __base__, children, ...restProps } = props
23
24
 
24
25
  const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
25
26
 
@@ -50,11 +51,11 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
50
51
  }, combinedProps.children ?? children)
51
52
  })
52
53
 
53
- const name = getDisplayName(Dynamic)
54
+ const name = getDisplayName(__base__)
54
55
 
55
56
  PandaComponent.displayName = `panda.${name}`
56
57
  PandaComponent.__cva__ = __cvaFn__
57
- PandaComponent.__base__ = Dynamic
58
+ PandaComponent.__base__ = __base__
58
59
  PandaComponent.__shouldForwardProps__ = shouldForwardProp
59
60
 
60
61
  return PandaComponent
@@ -376,7 +376,14 @@ type StrictableProps =
376
376
  | 'wordBreak'
377
377
  | 'writingMode'
378
378
 
379
- type WithEscapeHatch<T> = T | `[${string}]`
379
+ type WithColorOpacityModifier<T> = T extends string ? `${T}/${string}` : T
380
+
381
+ type ImportantMark = "!" | "!important"
382
+ type WhitespaceImportant = ` ${ImportantMark}`
383
+ type Important = ImportantMark | WhitespaceImportant
384
+ type WithImportant<T> = T extends string ? `${T}${Important}${string}` : T
385
+
386
+ type WithEscapeHatch<T> = T | `[${string}]` | (T extends string ? WithColorOpacityModifier<string> | WithImportant<T> : T)
380
387
 
381
388
  type FilterVagueString<Key, Value> = Value extends boolean
382
389
  ? Value
@@ -81,7 +81,7 @@ export type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefi
81
81
 
82
82
  interface RecipeConfigMeta {
83
83
  /**
84
- * The name of the recipe.
84
+ * The class name of the recipe.
85
85
  */
86
86
  className: string
87
87
  /**
@@ -133,6 +133,10 @@ export interface SlotRecipeDefinition<
133
133
  S extends string = string,
134
134
  T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,
135
135
  > {
136
+ /**
137
+ * An optional class name that can be used to target slots in the DOM.
138
+ */
139
+ className?: string
136
140
  /**
137
141
  * The parts/slots of the recipe.
138
142
  */