@pandacss/generator 0.0.0-dev-20240402212239 → 0.0.0-dev-20240402215554

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
@@ -292,9 +292,10 @@ function generateCvaFn(ctx) {
292
292
 
293
293
  export function cva(config) {
294
294
  const { base, variants, defaultVariants, compoundVariants } = defaults(config)
295
+ const getVariantProps = (variants) => ({ ...defaultVariants, ...compact(variants) })
295
296
 
296
297
  function resolve(props = {}) {
297
- const computedVariants = { ...defaultVariants, ...compact(props) }
298
+ const computedVariants = getVariantProps(props)
298
299
  let variantCss = { ...base }
299
300
  for (const [key, value] of Object.entries(computedVariants)) {
300
301
  if (variants[key]?.[value]) {
@@ -338,6 +339,7 @@ function generateCvaFn(ctx) {
338
339
  config,
339
340
  merge,
340
341
  splitVariantProps,
342
+ getVariantProps
341
343
  })
342
344
  }
343
345
 
@@ -634,7 +636,7 @@ function generateCreateRecipe(ctx) {
634
636
  ${ctx.file.import("compact, createCss, splitProps, uniq, withoutSpace", "../helpers")}
635
637
 
636
638
  export const createRecipe = (name, defaultVariants, compoundVariants) => {
637
- const getRecipeStyles = (variants) => {
639
+ const getVariantProps = (variants) => {
638
640
  return {
639
641
  [name]: '__ignore__',
640
642
  ...defaultVariants,
@@ -668,7 +670,7 @@ function generateCreateRecipe(ctx) {
668
670
  }
669
671
  })
670
672
 
671
- const recipeStyles = getRecipeStyles(variants)
673
+ const recipeStyles = getVariantProps(variants)
672
674
 
673
675
  if (withCompoundVariants) {
674
676
  const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
@@ -678,11 +680,13 @@ function generateCreateRecipe(ctx) {
678
680
  return recipeCss(recipeStyles)
679
681
  }
680
682
 
681
- return Object.assign(recipeFn, {
683
+ return {
684
+ recipeFn,
685
+ getVariantProps,
682
686
  __getCompoundVariantCss__: (variants) => {
683
- return getCompoundVariantCss(compoundVariants, getRecipeStyles(variants));
687
+ return getCompoundVariantCss(compoundVariants, getVariantProps(variants));
684
688
  },
685
- })
689
+ }
686
690
  }
687
691
 
688
692
  export const mergeRecipes = (recipeA, recipeB) => {
@@ -732,7 +736,7 @@ function generateRecipes(ctx, filters) {
732
736
  const ${baseName}SlotFns = /* @__PURE__ */ ${baseName}SlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, ${baseName}DefaultVariants, getSlotCompoundVariant(${baseName}CompoundVariants, slotName))])
733
737
 
734
738
  const ${baseName}Fn = memo((props = {}) => {
735
- return Object.fromEntries(${baseName}SlotFns.map(([slotName, slotFn]) => [slotName, slotFn(props)]))
739
+ return Object.fromEntries(${baseName}SlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
736
740
  })
737
741
 
738
742
  const ${baseName}VariantKeys = ${stringify2(Object.keys(variantKeyMap))}
@@ -761,9 +765,10 @@ function generateRecipes(ctx, filters) {
761
765
 
762
766
  const ${baseName}VariantKeys = Object.keys(${baseName}VariantMap)
763
767
 
764
- export const ${baseName} = /* @__PURE__ */ Object.assign(memo(${baseName}Fn), {
768
+ export const ${baseName} = /* @__PURE__ */ Object.assign(memo(${baseName}Fn.recipeFn), {
765
769
  __recipe__: true,
766
770
  __name__: '${baseName}',
771
+ __getCompoundVariantCss__: ${baseName}Fn.__getCompoundVariantCss__,
767
772
  raw: (props) => props,
768
773
  variantKeys: ${baseName}VariantKeys,
769
774
  variantMap: ${baseName}VariantMap,
@@ -773,6 +778,7 @@ function generateRecipes(ctx, filters) {
773
778
  splitVariantProps(props) {
774
779
  return splitProps(props, ${baseName}VariantKeys)
775
780
  },
781
+ getVariantProps: ${baseName}Fn.getVariantProps,
776
782
  })
777
783
  `
778
784
  );
@@ -807,6 +813,7 @@ function generateRecipes(ctx, filters) {
807
813
  variantMap: ${upperName}VariantMap
808
814
  variantKeys: Array<keyof ${upperName}Variant>
809
815
  splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<DistributiveOmit<Props, keyof ${upperName}VariantProps>>]
816
+ getVariantProps: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
810
817
  }
811
818
 
812
819
  ${description ? `/** ${description} */` : ""}
@@ -3510,7 +3517,7 @@ var pattern_d_ts_default = {
3510
3517
 
3511
3518
  // src/artifacts/generated/recipe.d.ts.json
3512
3519
  var recipe_d_ts_default = {
3513
- content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends 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\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The class 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 * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\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> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\n /**\n * An optional class name that can be used to target slots in the DOM.\n */\n className?: string\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<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"
3520
+ content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends 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 getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The class 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 * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\n /**\n * An optional class name that can be used to target slots in the DOM.\n */\n className?: string\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<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"
3514
3521
  };
3515
3522
 
3516
3523
  // src/artifacts/generated/selectors.d.ts.json
package/dist/index.mjs CHANGED
@@ -256,9 +256,10 @@ function generateCvaFn(ctx) {
256
256
 
257
257
  export function cva(config) {
258
258
  const { base, variants, defaultVariants, compoundVariants } = defaults(config)
259
+ const getVariantProps = (variants) => ({ ...defaultVariants, ...compact(variants) })
259
260
 
260
261
  function resolve(props = {}) {
261
- const computedVariants = { ...defaultVariants, ...compact(props) }
262
+ const computedVariants = getVariantProps(props)
262
263
  let variantCss = { ...base }
263
264
  for (const [key, value] of Object.entries(computedVariants)) {
264
265
  if (variants[key]?.[value]) {
@@ -302,6 +303,7 @@ function generateCvaFn(ctx) {
302
303
  config,
303
304
  merge,
304
305
  splitVariantProps,
306
+ getVariantProps
305
307
  })
306
308
  }
307
309
 
@@ -598,7 +600,7 @@ function generateCreateRecipe(ctx) {
598
600
  ${ctx.file.import("compact, createCss, splitProps, uniq, withoutSpace", "../helpers")}
599
601
 
600
602
  export const createRecipe = (name, defaultVariants, compoundVariants) => {
601
- const getRecipeStyles = (variants) => {
603
+ const getVariantProps = (variants) => {
602
604
  return {
603
605
  [name]: '__ignore__',
604
606
  ...defaultVariants,
@@ -632,7 +634,7 @@ function generateCreateRecipe(ctx) {
632
634
  }
633
635
  })
634
636
 
635
- const recipeStyles = getRecipeStyles(variants)
637
+ const recipeStyles = getVariantProps(variants)
636
638
 
637
639
  if (withCompoundVariants) {
638
640
  const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
@@ -642,11 +644,13 @@ function generateCreateRecipe(ctx) {
642
644
  return recipeCss(recipeStyles)
643
645
  }
644
646
 
645
- return Object.assign(recipeFn, {
647
+ return {
648
+ recipeFn,
649
+ getVariantProps,
646
650
  __getCompoundVariantCss__: (variants) => {
647
- return getCompoundVariantCss(compoundVariants, getRecipeStyles(variants));
651
+ return getCompoundVariantCss(compoundVariants, getVariantProps(variants));
648
652
  },
649
- })
653
+ }
650
654
  }
651
655
 
652
656
  export const mergeRecipes = (recipeA, recipeB) => {
@@ -696,7 +700,7 @@ function generateRecipes(ctx, filters) {
696
700
  const ${baseName}SlotFns = /* @__PURE__ */ ${baseName}SlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, ${baseName}DefaultVariants, getSlotCompoundVariant(${baseName}CompoundVariants, slotName))])
697
701
 
698
702
  const ${baseName}Fn = memo((props = {}) => {
699
- return Object.fromEntries(${baseName}SlotFns.map(([slotName, slotFn]) => [slotName, slotFn(props)]))
703
+ return Object.fromEntries(${baseName}SlotFns.map(([slotName, slotFn]) => [slotName, slotFn.recipeFn(props)]))
700
704
  })
701
705
 
702
706
  const ${baseName}VariantKeys = ${stringify2(Object.keys(variantKeyMap))}
@@ -725,9 +729,10 @@ function generateRecipes(ctx, filters) {
725
729
 
726
730
  const ${baseName}VariantKeys = Object.keys(${baseName}VariantMap)
727
731
 
728
- export const ${baseName} = /* @__PURE__ */ Object.assign(memo(${baseName}Fn), {
732
+ export const ${baseName} = /* @__PURE__ */ Object.assign(memo(${baseName}Fn.recipeFn), {
729
733
  __recipe__: true,
730
734
  __name__: '${baseName}',
735
+ __getCompoundVariantCss__: ${baseName}Fn.__getCompoundVariantCss__,
731
736
  raw: (props) => props,
732
737
  variantKeys: ${baseName}VariantKeys,
733
738
  variantMap: ${baseName}VariantMap,
@@ -737,6 +742,7 @@ function generateRecipes(ctx, filters) {
737
742
  splitVariantProps(props) {
738
743
  return splitProps(props, ${baseName}VariantKeys)
739
744
  },
745
+ getVariantProps: ${baseName}Fn.getVariantProps,
740
746
  })
741
747
  `
742
748
  );
@@ -771,6 +777,7 @@ function generateRecipes(ctx, filters) {
771
777
  variantMap: ${upperName}VariantMap
772
778
  variantKeys: Array<keyof ${upperName}Variant>
773
779
  splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<DistributiveOmit<Props, keyof ${upperName}VariantProps>>]
780
+ getVariantProps: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
774
781
  }
775
782
 
776
783
  ${description ? `/** ${description} */` : ""}
@@ -3474,7 +3481,7 @@ var pattern_d_ts_default = {
3474
3481
 
3475
3482
  // src/artifacts/generated/recipe.d.ts.json
3476
3483
  var recipe_d_ts_default = {
3477
- content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends 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\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The class 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 * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\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> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\n /**\n * An optional class name that can be used to target slots in the DOM.\n */\n className?: string\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<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"
3484
+ content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends 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 getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The class 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 * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\n /**\n * An optional class name that can be used to target slots in the DOM.\n */\n className?: string\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<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"
3478
3485
  };
3479
3486
 
3480
3487
  // src/artifacts/generated/selectors.d.ts.json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20240402212239",
3
+ "version": "0.0.0-dev-20240402215554",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -37,12 +37,12 @@
37
37
  "pluralize": "8.0.0",
38
38
  "postcss": "8.4.35",
39
39
  "ts-pattern": "5.0.8",
40
- "@pandacss/core": "0.0.0-dev-20240402212239",
41
- "@pandacss/is-valid-prop": "^0.0.0-dev-20240402212239",
42
- "@pandacss/logger": "0.0.0-dev-20240402212239",
43
- "@pandacss/shared": "0.0.0-dev-20240402212239",
44
- "@pandacss/token-dictionary": "0.0.0-dev-20240402212239",
45
- "@pandacss/types": "0.0.0-dev-20240402212239"
40
+ "@pandacss/core": "0.0.0-dev-20240402215554",
41
+ "@pandacss/is-valid-prop": "^0.0.0-dev-20240402215554",
42
+ "@pandacss/logger": "0.0.0-dev-20240402215554",
43
+ "@pandacss/shared": "0.0.0-dev-20240402215554",
44
+ "@pandacss/token-dictionary": "0.0.0-dev-20240402215554",
45
+ "@pandacss/types": "0.0.0-dev-20240402215554"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/pluralize": "0.0.33"