@pandacss/generator 0.0.0-dev-20230824133357 → 0.0.0-dev-20230825123547

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/dist/index.js CHANGED
@@ -629,7 +629,7 @@ function generateCssFn(ctx) {
629
629
  import type { SystemStyleObject } from '../types'
630
630
 
631
631
  interface CssFunction {
632
- (styles: SystemStyleObject): string
632
+ (...styles: SystemStyleObject[]): string
633
633
  raw: (styles: SystemStyleObject) => SystemStyleObject
634
634
  }
635
635
 
@@ -696,12 +696,7 @@ function generateCssFn(ctx) {
696
696
  }
697
697
 
698
698
  const cssFn = createCss(context)
699
- export const cssCache = new Map()
700
- export const css = (styles) => {
701
- const classNames = cssFn(styles)
702
- cssCache.set(classNames, styles)
703
- return classNames
704
- }
699
+ export const css = (...styles) => cssFn(mergeCss(...styles))
705
700
  css.raw = (styles) => styles
706
701
 
707
702
  export const { mergeCss, assignCss } = createMergeCss(context)
@@ -767,7 +762,7 @@ function generateCvaFn(ctx) {
767
762
  export function cva(config) {
768
763
  const { base = {}, variants = {}, defaultVariants = {}, compoundVariants = [] } = config
769
764
 
770
- function resolve(props) {
765
+ function resolve(props = {}) {
771
766
  const computedVariants = { ...defaultVariants, ...compact(props) }
772
767
  let variantCss = { ...base }
773
768
  for (const [key, value] of Object.entries(computedVariants)) {
@@ -782,7 +777,7 @@ function generateCvaFn(ctx) {
782
777
  function cvaFn(props) {
783
778
  return css(resolve(props))
784
779
  }
785
-
780
+
786
781
  const variantKeys = Object.keys(variants)
787
782
 
788
783
  function splitVariantProps(props) {
@@ -795,7 +790,7 @@ function generateCvaFn(ctx) {
795
790
  __cva__: true,
796
791
  variantMap,
797
792
  variantKeys,
798
- resolve,
793
+ raw: resolve,
799
794
  config,
800
795
  splitVariantProps,
801
796
  })
@@ -823,7 +818,7 @@ function generateCvaFn(ctx) {
823
818
  if (compoundVariants.length > 0 && typeof variants[prop] === 'object') {
824
819
  throw new Error(\`[recipe:\${name}:\${prop}] Conditions are not supported when using compound variants.\`)
825
820
  }
826
- }
821
+ }
827
822
 
828
823
  `,
829
824
  dts: import_outdent6.outdent`
@@ -839,32 +834,21 @@ function generateCvaFn(ctx) {
839
834
 
840
835
  // src/artifacts/js/cx.ts
841
836
  var import_outdent7 = __toESM(require("outdent"));
842
- function generateCx(ctx) {
837
+ function generateCx() {
843
838
  return {
844
839
  js: import_outdent7.default`
845
- ${ctx.file.import("cssCache, css, mergeCss", "./css")}
846
-
847
840
  function cx() {
848
- const objs = []
849
841
  let str = '',
850
842
  i = 0,
851
843
  arg
852
844
 
853
845
  for (; i < arguments.length; ) {
854
- arg = arguments[i++]
855
- if (!arg || typeof arg !== 'string') continue
856
-
857
- if (cssCache.has(arg)) {
858
- objs.push(cssCache.get(arg))
859
- continue
846
+ if ((arg = arguments[i++]) && typeof arg === 'string') {
847
+ str && (str += ' ')
848
+ str += arg
860
849
  }
861
-
862
- str && (str += ' ')
863
- str += arg.toString()
864
850
  }
865
-
866
- const merged = mergeCss(...objs)
867
- return [css(merged), str].join(' ')
851
+ return str
868
852
  }
869
853
 
870
854
  export { cx }
@@ -1003,7 +987,7 @@ function generatePattern(ctx) {
1003
987
 
1004
988
  interface ${upperName}PatternFn {
1005
989
  (styles?: ${upperName}Styles): string
1006
- raw: (styles: ${upperName}Styles) => ${upperName}Styles
990
+ raw: (styles: ${upperName}Styles) => SystemStyleObject
1007
991
  }
1008
992
 
1009
993
  ${description ? `/** ${description} */` : ""}
@@ -1021,7 +1005,7 @@ transform`)}
1021
1005
  export const ${styleFnName} = (styles = {}) => ${baseName}Config.transform(styles, { map: mapObject })
1022
1006
 
1023
1007
  export const ${baseName} = (styles) => css(${styleFnName}(styles))
1024
- ${baseName}.raw = (styles) => styles
1008
+ ${baseName}.raw = ${styleFnName}
1025
1009
  `
1026
1010
  };
1027
1011
  });
@@ -1285,7 +1269,7 @@ function generatePreactJsxFactory(ctx) {
1285
1269
 
1286
1270
  function cvaClass() {
1287
1271
  const { css: cssStyles, ...propStyles } = styleProps
1288
- const cvaStyles = cvaFn.resolve(variantProps)
1272
+ const cvaStyles = cvaFn.raw(variantProps)
1289
1273
  const styles = assignCss(cvaStyles, propStyles, cssStyles)
1290
1274
  return cx(css(styles), elementProps.className, elementProps.class)
1291
1275
  }
@@ -1527,7 +1511,7 @@ function generateQwikJsxFactory(ctx) {
1527
1511
  }
1528
1512
 
1529
1513
  function cvaClass() {
1530
- const cvaStyles = cvaFn.resolve(variantProps)
1514
+ const cvaStyles = cvaFn.raw(variantProps)
1531
1515
  const styles = assignCss(cvaStyles, propStyles, cssStyles)
1532
1516
  return cx(css(styles), elementProps.class)
1533
1517
  }
@@ -1779,7 +1763,7 @@ function generateReactJsxFactory(ctx) {
1779
1763
 
1780
1764
  function cvaClass() {
1781
1765
  const { css: cssStyles, ...propStyles } = styleProps
1782
- const cvaStyles = cvaFn.resolve(variantProps)
1766
+ const cvaStyles = cvaFn.raw(variantProps)
1783
1767
  const styles = assignCss(cvaStyles, propStyles, cssStyles)
1784
1768
  return cx(css(styles), elementProps.className)
1785
1769
  }`;
@@ -1794,7 +1778,7 @@ function generateReactJsxFactory(ctx) {
1794
1778
  }
1795
1779
 
1796
1780
  function cvaClass() {
1797
- const cvaStyles = cvaFn.resolve(variantProps)
1781
+ const cvaStyles = cvaFn.raw(variantProps)
1798
1782
  const styles = assignCss(cvaStyles, elementProps.css)
1799
1783
  return cx(css(styles), elementProps.className)
1800
1784
  }`;
@@ -1809,7 +1793,7 @@ function generateReactJsxFactory(ctx) {
1809
1793
  }
1810
1794
 
1811
1795
  function cvaClass() {
1812
- const cvaStyles = cvaFn.resolve(variantProps)
1796
+ const cvaStyles = cvaFn.raw(variantProps)
1813
1797
  const styles = assignCss(cvaStyles)
1814
1798
  return cx(css(styles), elementProps.className)
1815
1799
  }`;
@@ -2065,7 +2049,7 @@ function generateSolidJsxFactory(ctx) {
2065
2049
 
2066
2050
  function cvaClass() {
2067
2051
  const { css: cssStyles, ...propStyles } = styleProps
2068
- const cvaStyles = cvaFn.resolve(variantProps)
2052
+ const cvaStyles = cvaFn.raw(variantProps)
2069
2053
  const styles = assignCss(cvaStyles, propStyles, cssStyles)
2070
2054
  return cx(css(styles), localProps.class)
2071
2055
  }
@@ -2904,7 +2888,7 @@ var composition_d_ts_default = {
2904
2888
 
2905
2889
  // src/artifacts/generated/recipe.d.ts.json
2906
2890
  var recipe_d_ts_default = {
2907
- content: "import type { SystemStyleObject, DistributiveOmit } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n resolve: (props: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\nexport type RecipeCompoundSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type RecipeDefinition<T extends RecipeVariantRecord> = {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | RecipeVariantRecord\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ntype RecipeConfigMeta = {\n /**\n * The name of the recipe.\n */\n className: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\n\nexport type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & RecipeConfigMeta\n\n/* -----------------------------------------------------------------------------\n * Recipe / Slot\n * -----------------------------------------------------------------------------*/\n\ntype SlotRecord<S extends string, T> = Partial<Record<S, T>>\n\nexport type SlotRecipeVariantRecord<S extends string> = Record<any, Record<any, SlotRecord<S, SystemStyleObject>>>\n\nexport type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord> = (\n props?: RecipeSelection<T>,\n) => SlotRecord<S, string>\n\nexport type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = SlotRecipeVariantFn<S, T> & {\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> = {\n /**\n * The parts/slots of the recipe.\n */\n slots: S[] | Readonly<S[]>\n /**\n * The base styles of the recipe.\n */\n base?: SlotRecord<S, SystemStyleObject>\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | SlotRecipeVariantRecord<S>\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<SlotRecipeCompoundVariant<S, T>>\n}\n\nexport type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(\n config: SlotRecipeDefinition<S, T>,\n) => SlotRecipeRuntimeFn<S, T>\n\nexport type SlotRecipeConfig<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> = SlotRecipeDefinition<S, T> & RecipeConfigMeta\n"
2891
+ content: "import type { SystemStyleObject, DistributiveOmit } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n raw: (props?: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\nexport type RecipeCompoundSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type RecipeDefinition<T extends RecipeVariantRecord> = {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | RecipeVariantRecord\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ntype RecipeConfigMeta = {\n /**\n * The name of the recipe.\n */\n className: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\n\nexport type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & RecipeConfigMeta\n\n/* -----------------------------------------------------------------------------\n * Recipe / Slot\n * -----------------------------------------------------------------------------*/\n\ntype SlotRecord<S extends string, T> = Partial<Record<S, T>>\n\nexport type SlotRecipeVariantRecord<S extends string> = Record<any, Record<any, SlotRecord<S, SystemStyleObject>>>\n\nexport type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord> = (\n props?: RecipeSelection<T>,\n) => SlotRecord<S, string>\n\nexport type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = SlotRecipeVariantFn<S, T> & {\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> = {\n /**\n * The parts/slots of the recipe.\n */\n slots: S[] | Readonly<S[]>\n /**\n * The base styles of the recipe.\n */\n base?: SlotRecord<S, SystemStyleObject>\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | SlotRecipeVariantRecord<S>\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<SlotRecipeCompoundVariant<S, T>>\n}\n\nexport type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(\n config: SlotRecipeDefinition<S, T>,\n) => SlotRecipeRuntimeFn<S, T>\n\nexport type SlotRecipeConfig<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> = SlotRecipeDefinition<S, T> & RecipeConfigMeta\n"
2908
2892
  };
2909
2893
 
2910
2894
  // src/artifacts/generated/pattern.d.ts.json
@@ -3179,7 +3163,7 @@ function setupSva(ctx) {
3179
3163
  };
3180
3164
  }
3181
3165
  function setupCx(ctx) {
3182
- const code = generateCx(ctx);
3166
+ const code = generateCx();
3183
3167
  return {
3184
3168
  dir: ctx.paths.css,
3185
3169
  files: [
package/dist/index.mjs CHANGED
@@ -598,7 +598,7 @@ function generateCssFn(ctx) {
598
598
  import type { SystemStyleObject } from '../types'
599
599
 
600
600
  interface CssFunction {
601
- (styles: SystemStyleObject): string
601
+ (...styles: SystemStyleObject[]): string
602
602
  raw: (styles: SystemStyleObject) => SystemStyleObject
603
603
  }
604
604
 
@@ -665,12 +665,7 @@ function generateCssFn(ctx) {
665
665
  }
666
666
 
667
667
  const cssFn = createCss(context)
668
- export const cssCache = new Map()
669
- export const css = (styles) => {
670
- const classNames = cssFn(styles)
671
- cssCache.set(classNames, styles)
672
- return classNames
673
- }
668
+ export const css = (...styles) => cssFn(mergeCss(...styles))
674
669
  css.raw = (styles) => styles
675
670
 
676
671
  export const { mergeCss, assignCss } = createMergeCss(context)
@@ -736,7 +731,7 @@ function generateCvaFn(ctx) {
736
731
  export function cva(config) {
737
732
  const { base = {}, variants = {}, defaultVariants = {}, compoundVariants = [] } = config
738
733
 
739
- function resolve(props) {
734
+ function resolve(props = {}) {
740
735
  const computedVariants = { ...defaultVariants, ...compact(props) }
741
736
  let variantCss = { ...base }
742
737
  for (const [key, value] of Object.entries(computedVariants)) {
@@ -751,7 +746,7 @@ function generateCvaFn(ctx) {
751
746
  function cvaFn(props) {
752
747
  return css(resolve(props))
753
748
  }
754
-
749
+
755
750
  const variantKeys = Object.keys(variants)
756
751
 
757
752
  function splitVariantProps(props) {
@@ -764,7 +759,7 @@ function generateCvaFn(ctx) {
764
759
  __cva__: true,
765
760
  variantMap,
766
761
  variantKeys,
767
- resolve,
762
+ raw: resolve,
768
763
  config,
769
764
  splitVariantProps,
770
765
  })
@@ -792,7 +787,7 @@ function generateCvaFn(ctx) {
792
787
  if (compoundVariants.length > 0 && typeof variants[prop] === 'object') {
793
788
  throw new Error(\`[recipe:\${name}:\${prop}] Conditions are not supported when using compound variants.\`)
794
789
  }
795
- }
790
+ }
796
791
 
797
792
  `,
798
793
  dts: outdent6`
@@ -808,32 +803,21 @@ function generateCvaFn(ctx) {
808
803
 
809
804
  // src/artifacts/js/cx.ts
810
805
  import outdent7 from "outdent";
811
- function generateCx(ctx) {
806
+ function generateCx() {
812
807
  return {
813
808
  js: outdent7`
814
- ${ctx.file.import("cssCache, css, mergeCss", "./css")}
815
-
816
809
  function cx() {
817
- const objs = []
818
810
  let str = '',
819
811
  i = 0,
820
812
  arg
821
813
 
822
814
  for (; i < arguments.length; ) {
823
- arg = arguments[i++]
824
- if (!arg || typeof arg !== 'string') continue
825
-
826
- if (cssCache.has(arg)) {
827
- objs.push(cssCache.get(arg))
828
- continue
815
+ if ((arg = arguments[i++]) && typeof arg === 'string') {
816
+ str && (str += ' ')
817
+ str += arg
829
818
  }
830
-
831
- str && (str += ' ')
832
- str += arg.toString()
833
819
  }
834
-
835
- const merged = mergeCss(...objs)
836
- return [css(merged), str].join(' ')
820
+ return str
837
821
  }
838
822
 
839
823
  export { cx }
@@ -972,7 +956,7 @@ function generatePattern(ctx) {
972
956
 
973
957
  interface ${upperName}PatternFn {
974
958
  (styles?: ${upperName}Styles): string
975
- raw: (styles: ${upperName}Styles) => ${upperName}Styles
959
+ raw: (styles: ${upperName}Styles) => SystemStyleObject
976
960
  }
977
961
 
978
962
  ${description ? `/** ${description} */` : ""}
@@ -990,7 +974,7 @@ transform`)}
990
974
  export const ${styleFnName} = (styles = {}) => ${baseName}Config.transform(styles, { map: mapObject })
991
975
 
992
976
  export const ${baseName} = (styles) => css(${styleFnName}(styles))
993
- ${baseName}.raw = (styles) => styles
977
+ ${baseName}.raw = ${styleFnName}
994
978
  `
995
979
  };
996
980
  });
@@ -1254,7 +1238,7 @@ function generatePreactJsxFactory(ctx) {
1254
1238
 
1255
1239
  function cvaClass() {
1256
1240
  const { css: cssStyles, ...propStyles } = styleProps
1257
- const cvaStyles = cvaFn.resolve(variantProps)
1241
+ const cvaStyles = cvaFn.raw(variantProps)
1258
1242
  const styles = assignCss(cvaStyles, propStyles, cssStyles)
1259
1243
  return cx(css(styles), elementProps.className, elementProps.class)
1260
1244
  }
@@ -1496,7 +1480,7 @@ function generateQwikJsxFactory(ctx) {
1496
1480
  }
1497
1481
 
1498
1482
  function cvaClass() {
1499
- const cvaStyles = cvaFn.resolve(variantProps)
1483
+ const cvaStyles = cvaFn.raw(variantProps)
1500
1484
  const styles = assignCss(cvaStyles, propStyles, cssStyles)
1501
1485
  return cx(css(styles), elementProps.class)
1502
1486
  }
@@ -1748,7 +1732,7 @@ function generateReactJsxFactory(ctx) {
1748
1732
 
1749
1733
  function cvaClass() {
1750
1734
  const { css: cssStyles, ...propStyles } = styleProps
1751
- const cvaStyles = cvaFn.resolve(variantProps)
1735
+ const cvaStyles = cvaFn.raw(variantProps)
1752
1736
  const styles = assignCss(cvaStyles, propStyles, cssStyles)
1753
1737
  return cx(css(styles), elementProps.className)
1754
1738
  }`;
@@ -1763,7 +1747,7 @@ function generateReactJsxFactory(ctx) {
1763
1747
  }
1764
1748
 
1765
1749
  function cvaClass() {
1766
- const cvaStyles = cvaFn.resolve(variantProps)
1750
+ const cvaStyles = cvaFn.raw(variantProps)
1767
1751
  const styles = assignCss(cvaStyles, elementProps.css)
1768
1752
  return cx(css(styles), elementProps.className)
1769
1753
  }`;
@@ -1778,7 +1762,7 @@ function generateReactJsxFactory(ctx) {
1778
1762
  }
1779
1763
 
1780
1764
  function cvaClass() {
1781
- const cvaStyles = cvaFn.resolve(variantProps)
1765
+ const cvaStyles = cvaFn.raw(variantProps)
1782
1766
  const styles = assignCss(cvaStyles)
1783
1767
  return cx(css(styles), elementProps.className)
1784
1768
  }`;
@@ -2034,7 +2018,7 @@ function generateSolidJsxFactory(ctx) {
2034
2018
 
2035
2019
  function cvaClass() {
2036
2020
  const { css: cssStyles, ...propStyles } = styleProps
2037
- const cvaStyles = cvaFn.resolve(variantProps)
2021
+ const cvaStyles = cvaFn.raw(variantProps)
2038
2022
  const styles = assignCss(cvaStyles, propStyles, cssStyles)
2039
2023
  return cx(css(styles), localProps.class)
2040
2024
  }
@@ -2873,7 +2857,7 @@ var composition_d_ts_default = {
2873
2857
 
2874
2858
  // src/artifacts/generated/recipe.d.ts.json
2875
2859
  var recipe_d_ts_default = {
2876
- content: "import type { SystemStyleObject, DistributiveOmit } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n resolve: (props: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\nexport type RecipeCompoundSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type RecipeDefinition<T extends RecipeVariantRecord> = {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | RecipeVariantRecord\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ntype RecipeConfigMeta = {\n /**\n * The name of the recipe.\n */\n className: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\n\nexport type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & RecipeConfigMeta\n\n/* -----------------------------------------------------------------------------\n * Recipe / Slot\n * -----------------------------------------------------------------------------*/\n\ntype SlotRecord<S extends string, T> = Partial<Record<S, T>>\n\nexport type SlotRecipeVariantRecord<S extends string> = Record<any, Record<any, SlotRecord<S, SystemStyleObject>>>\n\nexport type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord> = (\n props?: RecipeSelection<T>,\n) => SlotRecord<S, string>\n\nexport type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = SlotRecipeVariantFn<S, T> & {\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> = {\n /**\n * The parts/slots of the recipe.\n */\n slots: S[] | Readonly<S[]>\n /**\n * The base styles of the recipe.\n */\n base?: SlotRecord<S, SystemStyleObject>\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | SlotRecipeVariantRecord<S>\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<SlotRecipeCompoundVariant<S, T>>\n}\n\nexport type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(\n config: SlotRecipeDefinition<S, T>,\n) => SlotRecipeRuntimeFn<S, T>\n\nexport type SlotRecipeConfig<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> = SlotRecipeDefinition<S, T> & RecipeConfigMeta\n"
2860
+ content: "import type { SystemStyleObject, DistributiveOmit } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n raw: (props?: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\nexport type RecipeCompoundSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type RecipeDefinition<T extends RecipeVariantRecord> = {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | RecipeVariantRecord\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ntype RecipeConfigMeta = {\n /**\n * The name of the recipe.\n */\n className: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\n\nexport type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & RecipeConfigMeta\n\n/* -----------------------------------------------------------------------------\n * Recipe / Slot\n * -----------------------------------------------------------------------------*/\n\ntype SlotRecord<S extends string, T> = Partial<Record<S, T>>\n\nexport type SlotRecipeVariantRecord<S extends string> = Record<any, Record<any, SlotRecord<S, SystemStyleObject>>>\n\nexport type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord> = (\n props?: RecipeSelection<T>,\n) => SlotRecord<S, string>\n\nexport type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = SlotRecipeVariantFn<S, T> & {\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> = {\n /**\n * The parts/slots of the recipe.\n */\n slots: S[] | Readonly<S[]>\n /**\n * The base styles of the recipe.\n */\n base?: SlotRecord<S, SystemStyleObject>\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | SlotRecipeVariantRecord<S>\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<SlotRecipeCompoundVariant<S, T>>\n}\n\nexport type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(\n config: SlotRecipeDefinition<S, T>,\n) => SlotRecipeRuntimeFn<S, T>\n\nexport type SlotRecipeConfig<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> = SlotRecipeDefinition<S, T> & RecipeConfigMeta\n"
2877
2861
  };
2878
2862
 
2879
2863
  // src/artifacts/generated/pattern.d.ts.json
@@ -3148,7 +3132,7 @@ function setupSva(ctx) {
3148
3132
  };
3149
3133
  }
3150
3134
  function setupCx(ctx) {
3151
- const code = generateCx(ctx);
3135
+ const code = generateCx();
3152
3136
  return {
3153
3137
  dir: ctx.paths.css,
3154
3138
  files: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20230824133357",
3
+ "version": "0.0.0-dev-20230825123547",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,17 +20,17 @@
20
20
  "pluralize": "8.0.0",
21
21
  "postcss": "8.4.27",
22
22
  "ts-pattern": "5.0.4",
23
- "@pandacss/core": "0.0.0-dev-20230824133357",
24
- "@pandacss/is-valid-prop": "0.0.0-dev-20230824133357",
25
- "@pandacss/logger": "0.0.0-dev-20230824133357",
26
- "@pandacss/shared": "0.0.0-dev-20230824133357",
27
- "@pandacss/token-dictionary": "0.0.0-dev-20230824133357",
28
- "@pandacss/types": "0.0.0-dev-20230824133357"
23
+ "@pandacss/core": "0.0.0-dev-20230825123547",
24
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230825123547",
25
+ "@pandacss/logger": "0.0.0-dev-20230825123547",
26
+ "@pandacss/shared": "0.0.0-dev-20230825123547",
27
+ "@pandacss/token-dictionary": "0.0.0-dev-20230825123547",
28
+ "@pandacss/types": "0.0.0-dev-20230825123547"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.30",
32
32
  "hookable": "5.5.3",
33
- "@pandacss/fixture": "0.0.0-dev-20230824133357"
33
+ "@pandacss/fixture": "0.0.0-dev-20230825123547"
34
34
  },
35
35
  "scripts": {
36
36
  "prebuild": "tsx scripts/prebuild.ts",