@pandacss/generator 0.15.2 → 0.15.3

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.d.mts CHANGED
@@ -6,6 +6,7 @@ import * as _pandacss_types_dist_pattern from '@pandacss/types/dist/pattern';
6
6
 
7
7
  declare const getEngine: (conf: ConfigResultWithHooks) => {
8
8
  patterns: {
9
+ keys: string[];
9
10
  getConfig: (name: string) => _pandacss_types.PatternConfig<_pandacss_types_dist_pattern.PatternProperties>;
10
11
  transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
11
12
  getNames: (name: string) => {
@@ -181,6 +182,7 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
181
182
  jsx: string[];
182
183
  };
183
184
  jsx: {
185
+ framework: ("react" | "solid" | "preact" | "vue" | "qwik") | undefined;
184
186
  factory: string;
185
187
  styleProps: "all" | "minimal" | "none";
186
188
  isStyleProp: (key: string) => boolean;
@@ -211,6 +213,8 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
211
213
  props: string[];
212
214
  })[];
213
215
  };
216
+ patternKeys: string[];
217
+ recipeKeys: string[];
214
218
  getRecipesByJsxName: (jsxName: string) => {
215
219
  baseName: string;
216
220
  type: "recipe";
@@ -242,6 +246,7 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
242
246
  tsOptions: _pandacss_types.ConfigTsOptions | undefined;
243
247
  };
244
248
  patterns: {
249
+ keys: string[];
245
250
  getConfig: (name: string) => _pandacss_types.PatternConfig<_pandacss_types_dist_pattern.PatternProperties>;
246
251
  transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
247
252
  getNames: (name: string) => {
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import * as _pandacss_types_dist_pattern from '@pandacss/types/dist/pattern';
6
6
 
7
7
  declare const getEngine: (conf: ConfigResultWithHooks) => {
8
8
  patterns: {
9
+ keys: string[];
9
10
  getConfig: (name: string) => _pandacss_types.PatternConfig<_pandacss_types_dist_pattern.PatternProperties>;
10
11
  transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
11
12
  getNames: (name: string) => {
@@ -181,6 +182,7 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
181
182
  jsx: string[];
182
183
  };
183
184
  jsx: {
185
+ framework: ("react" | "solid" | "preact" | "vue" | "qwik") | undefined;
184
186
  factory: string;
185
187
  styleProps: "all" | "minimal" | "none";
186
188
  isStyleProp: (key: string) => boolean;
@@ -211,6 +213,8 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
211
213
  props: string[];
212
214
  })[];
213
215
  };
216
+ patternKeys: string[];
217
+ recipeKeys: string[];
214
218
  getRecipesByJsxName: (jsxName: string) => {
215
219
  baseName: string;
216
220
  type: "recipe";
@@ -242,6 +246,7 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
242
246
  tsOptions: _pandacss_types.ConfigTsOptions | undefined;
243
247
  };
244
248
  patterns: {
249
+ keys: string[];
245
250
  getConfig: (name: string) => _pandacss_types.PatternConfig<_pandacss_types_dist_pattern.PatternProperties>;
246
251
  transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
247
252
  getNames: (name: string) => {
package/dist/index.js CHANGED
@@ -1054,7 +1054,15 @@ function generateRecipes(ctx) {
1054
1054
  ${ctx.file.import("compact, createCss, withoutSpace", "../helpers")}
1055
1055
 
1056
1056
  export const createRecipe = (name, defaultVariants, compoundVariants) => {
1057
- return (variants) => {
1057
+ const getRecipeStyles = (variants) => {
1058
+ return {
1059
+ [name]: '__ignore__',
1060
+ ...defaultVariants,
1061
+ ...compact(variants),
1062
+ };
1063
+ };
1064
+
1065
+ const recipeFn = (variants, withCompoundVariants = true) => {
1058
1066
  const transform = (prop, value) => {
1059
1067
  assertCompoundVariant(name, compoundVariants, variants, prop)
1060
1068
 
@@ -1074,16 +1082,21 @@ function generateRecipes(ctx) {
1074
1082
  }
1075
1083
  })
1076
1084
 
1077
- const recipeStyles = {
1078
- [name]: '__ignore__',
1079
- ...defaultVariants,
1080
- ...compact(variants),
1081
- }
1085
+ const recipeStyles = getRecipeStyles(variants)
1082
1086
 
1083
- const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
1087
+ if (withCompoundVariants) {
1088
+ const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
1089
+ return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
1090
+ }
1084
1091
 
1085
- return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
1092
+ return recipeCss(recipeStyles)
1086
1093
  }
1094
+
1095
+ return Object.assign(recipeFn, {
1096
+ __getCompoundVariantCss__: (variants) => {
1097
+ return getCompoundVariantCss(compoundVariants, getRecipeStyles(variants));
1098
+ },
1099
+ })
1087
1100
  }
1088
1101
  `
1089
1102
  };
@@ -1280,7 +1293,7 @@ function generatePreactJsxFactory(ctx) {
1280
1293
  import { h } from 'preact'
1281
1294
  import { forwardRef } from 'preact/compat'
1282
1295
  import { useMemo } from 'preact/hooks'
1283
- ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1296
+ ${ctx.file.import("css, cx, cva", "../css/index")}
1284
1297
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
1285
1298
  ${ctx.file.import("isCssProperty", "./is-valid-prop")}
1286
1299
 
@@ -1296,15 +1309,14 @@ function generatePreactJsxFactory(ctx) {
1296
1309
 
1297
1310
  function recipeClass() {
1298
1311
  const { css: cssStyles, ...propStyles } = styleProps
1299
- const styles = assignCss(propStyles, cssStyles)
1300
- return cx(cvaFn(variantProps), css(styles), elementProps.className, elementProps.class)
1312
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1313
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className, elementProps.class)
1301
1314
  }
1302
1315
 
1303
1316
  function cvaClass() {
1304
1317
  const { css: cssStyles, ...propStyles } = styleProps
1305
1318
  const cvaStyles = cvaFn.raw(variantProps)
1306
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
1307
- return cx(css(styles), elementProps.className, elementProps.class)
1319
+ return cx(css(cvaStyles, propStyles, cssStyles), elementProps.className, elementProps.class)
1308
1320
  }
1309
1321
 
1310
1322
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -1525,7 +1537,7 @@ function generateQwikJsxFactory(ctx) {
1525
1537
  return {
1526
1538
  js: import_outdent19.outdent`
1527
1539
  import { h } from '@builder.io/qwik'
1528
- ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1540
+ ${ctx.file.import("css, cx, cva", "../css/index")}
1529
1541
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
1530
1542
  ${ctx.file.import("isCssProperty", "./is-valid-prop")}
1531
1543
 
@@ -1541,14 +1553,13 @@ function generateQwikJsxFactory(ctx) {
1541
1553
  const { css: cssStyles, ...propStyles } = styleProps
1542
1554
 
1543
1555
  function recipeClass() {
1544
- const styles = assignCss(propStyles, cssStyles)
1545
- return cx(cvaFn(variantProps), css(styles), elementProps.class)
1556
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1557
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.class)
1546
1558
  }
1547
1559
 
1548
1560
  function cvaClass() {
1549
1561
  const cvaStyles = cvaFn.raw(variantProps)
1550
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
1551
- return cx(css(styles), elementProps.class)
1562
+ return cx(css(cvaStyles, propStyles, cssStyles), elementProps.class)
1552
1563
  }
1553
1564
 
1554
1565
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -1776,7 +1787,7 @@ function generateReactJsxFactory(ctx) {
1776
1787
  return {
1777
1788
  js: import_outdent24.outdent`
1778
1789
  import { createElement, forwardRef, useMemo } from 'react'
1779
- ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1790
+ ${ctx.file.import("css, cx, cva", "../css/index")}
1780
1791
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
1781
1792
  ${ctx.jsx.styleProps === "all" ? ctx.file.import("isCssProperty", "./is-valid-prop") : ""}
1782
1793
 
@@ -1794,15 +1805,14 @@ function generateReactJsxFactory(ctx) {
1794
1805
 
1795
1806
  function recipeClass() {
1796
1807
  const { css: cssStyles, ...propStyles } = styleProps
1797
- const styles = assignCss(propStyles, cssStyles)
1798
- return cx(cvaFn(variantProps), css(styles), elementProps.className)
1808
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1809
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className)
1799
1810
  }
1800
1811
 
1801
1812
  function cvaClass() {
1802
1813
  const { css: cssStyles, ...propStyles } = styleProps
1803
1814
  const cvaStyles = cvaFn.raw(variantProps)
1804
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
1805
- return cx(css(styles), elementProps.className)
1815
+ return cx(css(cvaStyles, propStyles, cssStyles), elementProps.className)
1806
1816
  }`;
1807
1817
  }).with("minimal", () => {
1808
1818
  return import_outdent24.outdent`
@@ -1811,13 +1821,13 @@ function generateReactJsxFactory(ctx) {
1811
1821
  }, [restProps])
1812
1822
 
1813
1823
  function recipeClass() {
1814
- return cx(cvaFn(variantProps), css(assignCss(elementProps.css)), elementProps.className)
1824
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1825
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, elementProps.css), elementProps.className)
1815
1826
  }
1816
1827
 
1817
1828
  function cvaClass() {
1818
1829
  const cvaStyles = cvaFn.raw(variantProps)
1819
- const styles = assignCss(cvaStyles, elementProps.css)
1820
- return cx(css(styles), elementProps.className)
1830
+ return cx(css(cvaStyles, elementProps.css), elementProps.className)
1821
1831
  }`;
1822
1832
  }).with("none", () => {
1823
1833
  return import_outdent24.outdent`
@@ -1826,13 +1836,13 @@ function generateReactJsxFactory(ctx) {
1826
1836
  }, [restProps])
1827
1837
 
1828
1838
  function recipeClass() {
1829
- return cx(cvaFn(variantProps), elementProps.className)
1839
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1840
+ return cx(cvaFn(variantProps, false), elementProps.className)
1830
1841
  }
1831
1842
 
1832
1843
  function cvaClass() {
1833
1844
  const cvaStyles = cvaFn.raw(variantProps)
1834
- const styles = assignCss(cvaStyles)
1835
- return cx(css(styles), elementProps.className)
1845
+ return cx(css(cvaStyles), elementProps.className)
1836
1846
  }`;
1837
1847
  }).run()}
1838
1848
 
@@ -2082,15 +2092,13 @@ function generateSolidJsxFactory(ctx) {
2082
2092
 
2083
2093
  function recipeClass() {
2084
2094
  const { css: cssStyles, ...propStyles } = styleProps
2085
- const styles = assignCss(propStyles, cssStyles)
2086
- return cx(cvaFn(variantProps), css(styles), localProps.class)
2095
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), localProps.class)
2087
2096
  }
2088
2097
 
2089
2098
  function cvaClass() {
2090
2099
  const { css: cssStyles, ...propStyles } = styleProps
2091
2100
  const cvaStyles = cvaFn.raw(variantProps)
2092
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
2093
- return cx(css(styles), localProps.class)
2101
+ return cx(css(cvaStyles, propStyles, cssStyles), localProps.class)
2094
2102
  }
2095
2103
 
2096
2104
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -2341,15 +2349,14 @@ function generateVueJsxFactory(ctx) {
2341
2349
  const recipeClass = computed(() => {
2342
2350
  const [variantProps, styleProps, _htmlProps, elementProps] = splittedProps.value
2343
2351
  const { css: cssStyles, ...propStyles } = styleProps
2344
- const styles = assignCss(propStyles, cssStyles)
2345
- return cx(cvaFn(variantProps), css(styles), elementProps.className)
2352
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
2353
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className)
2346
2354
  })
2347
2355
 
2348
2356
  const cvaClass = computed(() => {
2349
2357
  const [variantProps, styleProps, _htmlProps, elementProps] = splittedProps.value
2350
2358
  const { css: cssStyles, ...propStyles } = styleProps
2351
- const styles = assignCss(propStyles, cssStyles)
2352
- return cx(cvaFn(variantProps), css(styles), elementProps.className)
2359
+ return cx(cvaFn(variantProps), css(propStyles, cssStyles), elementProps.className)
2353
2360
  })
2354
2361
 
2355
2362
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -2372,17 +2379,12 @@ function generateVueJsxFactory(ctx) {
2372
2379
  }
2373
2380
 
2374
2381
  function createJsxFactory() {
2375
- const cache = new Map()
2376
-
2377
2382
  return new Proxy(styledFn, {
2378
2383
  apply(_, __, args) {
2379
2384
  return styledFn(...args)
2380
2385
  },
2381
2386
  get(_, el) {
2382
- if (!cache.has(el)) {
2383
- cache.set(el, styledFn(el))
2384
- }
2385
- return cache.get(el)
2387
+ return styledFn(el)
2386
2388
  },
2387
2389
  })
2388
2390
  }
@@ -2697,7 +2699,7 @@ var composition_d_ts_default = {
2697
2699
 
2698
2700
  // src/artifacts/generated/recipe.d.ts.json
2699
2701
  var recipe_d_ts_default = {
2700
- 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 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\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 interface 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\ninterface 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 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 extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface 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"
2702
+ 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 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]>>\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface 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\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 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 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<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\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"
2701
2703
  };
2702
2704
 
2703
2705
  // src/artifacts/generated/pattern.d.ts.json
@@ -3430,6 +3432,7 @@ var getPatternEngine = (config) => {
3430
3432
  };
3431
3433
  });
3432
3434
  return {
3435
+ keys: Object.keys(patterns),
3433
3436
  getConfig: (name) => patterns[name],
3434
3437
  transform: (name, data) => {
3435
3438
  return patterns[name]?.transform?.(data, helpers2) ?? {};
@@ -3509,11 +3512,11 @@ var defaults = (conf) => ({
3509
3512
  }
3510
3513
  }
3511
3514
  });
3512
- var getImportMap = (outdir) => ({
3513
- css: [outdir, "css"],
3514
- recipe: [outdir, "recipes"],
3515
- pattern: [outdir, "patterns"],
3516
- jsx: [outdir, "jsx"]
3515
+ var getImportMap = (outdir, configImportMap) => ({
3516
+ css: configImportMap?.css ? [configImportMap.css] : [outdir, "css"],
3517
+ recipe: configImportMap?.recipes ? [configImportMap.recipes] : [outdir, "recipes"],
3518
+ pattern: configImportMap?.patterns ? [configImportMap.patterns] : [outdir, "patterns"],
3519
+ jsx: configImportMap?.jsx ? [configImportMap.jsx] : [outdir, "jsx"]
3517
3520
  });
3518
3521
  var createGenerator = (conf) => {
3519
3522
  const ctx = getEngine(defaults(conf));
@@ -3529,13 +3532,16 @@ var createGenerator = (conf) => {
3529
3532
  getParserCss: generateParserCss(ctx),
3530
3533
  messages: getMessages(ctx),
3531
3534
  parserOptions: {
3532
- importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
3535
+ importMap: getImportMap(config.outdir.replace(relativeBaseUrl, ""), config.importMap),
3533
3536
  jsx: {
3537
+ framework: jsx.framework,
3534
3538
  factory: jsx.factoryName,
3535
3539
  styleProps: jsx.styleProps,
3536
3540
  isStyleProp: isValidProperty,
3537
3541
  nodes: [...patterns.details, ...recipes.details]
3538
3542
  },
3543
+ patternKeys: patterns.keys,
3544
+ recipeKeys: recipes.keys,
3539
3545
  getRecipesByJsxName: recipes.filter,
3540
3546
  getPatternsByJsxName: patterns.filter,
3541
3547
  compilerOptions,
package/dist/index.mjs CHANGED
@@ -1023,7 +1023,15 @@ function generateRecipes(ctx) {
1023
1023
  ${ctx.file.import("compact, createCss, withoutSpace", "../helpers")}
1024
1024
 
1025
1025
  export const createRecipe = (name, defaultVariants, compoundVariants) => {
1026
- return (variants) => {
1026
+ const getRecipeStyles = (variants) => {
1027
+ return {
1028
+ [name]: '__ignore__',
1029
+ ...defaultVariants,
1030
+ ...compact(variants),
1031
+ };
1032
+ };
1033
+
1034
+ const recipeFn = (variants, withCompoundVariants = true) => {
1027
1035
  const transform = (prop, value) => {
1028
1036
  assertCompoundVariant(name, compoundVariants, variants, prop)
1029
1037
 
@@ -1043,16 +1051,21 @@ function generateRecipes(ctx) {
1043
1051
  }
1044
1052
  })
1045
1053
 
1046
- const recipeStyles = {
1047
- [name]: '__ignore__',
1048
- ...defaultVariants,
1049
- ...compact(variants),
1050
- }
1054
+ const recipeStyles = getRecipeStyles(variants)
1051
1055
 
1052
- const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
1056
+ if (withCompoundVariants) {
1057
+ const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
1058
+ return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
1059
+ }
1053
1060
 
1054
- return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
1061
+ return recipeCss(recipeStyles)
1055
1062
  }
1063
+
1064
+ return Object.assign(recipeFn, {
1065
+ __getCompoundVariantCss__: (variants) => {
1066
+ return getCompoundVariantCss(compoundVariants, getRecipeStyles(variants));
1067
+ },
1068
+ })
1056
1069
  }
1057
1070
  `
1058
1071
  };
@@ -1249,7 +1262,7 @@ function generatePreactJsxFactory(ctx) {
1249
1262
  import { h } from 'preact'
1250
1263
  import { forwardRef } from 'preact/compat'
1251
1264
  import { useMemo } from 'preact/hooks'
1252
- ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1265
+ ${ctx.file.import("css, cx, cva", "../css/index")}
1253
1266
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
1254
1267
  ${ctx.file.import("isCssProperty", "./is-valid-prop")}
1255
1268
 
@@ -1265,15 +1278,14 @@ function generatePreactJsxFactory(ctx) {
1265
1278
 
1266
1279
  function recipeClass() {
1267
1280
  const { css: cssStyles, ...propStyles } = styleProps
1268
- const styles = assignCss(propStyles, cssStyles)
1269
- return cx(cvaFn(variantProps), css(styles), elementProps.className, elementProps.class)
1281
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1282
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className, elementProps.class)
1270
1283
  }
1271
1284
 
1272
1285
  function cvaClass() {
1273
1286
  const { css: cssStyles, ...propStyles } = styleProps
1274
1287
  const cvaStyles = cvaFn.raw(variantProps)
1275
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
1276
- return cx(css(styles), elementProps.className, elementProps.class)
1288
+ return cx(css(cvaStyles, propStyles, cssStyles), elementProps.className, elementProps.class)
1277
1289
  }
1278
1290
 
1279
1291
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -1494,7 +1506,7 @@ function generateQwikJsxFactory(ctx) {
1494
1506
  return {
1495
1507
  js: outdent19`
1496
1508
  import { h } from '@builder.io/qwik'
1497
- ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1509
+ ${ctx.file.import("css, cx, cva", "../css/index")}
1498
1510
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
1499
1511
  ${ctx.file.import("isCssProperty", "./is-valid-prop")}
1500
1512
 
@@ -1510,14 +1522,13 @@ function generateQwikJsxFactory(ctx) {
1510
1522
  const { css: cssStyles, ...propStyles } = styleProps
1511
1523
 
1512
1524
  function recipeClass() {
1513
- const styles = assignCss(propStyles, cssStyles)
1514
- return cx(cvaFn(variantProps), css(styles), elementProps.class)
1525
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1526
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.class)
1515
1527
  }
1516
1528
 
1517
1529
  function cvaClass() {
1518
1530
  const cvaStyles = cvaFn.raw(variantProps)
1519
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
1520
- return cx(css(styles), elementProps.class)
1531
+ return cx(css(cvaStyles, propStyles, cssStyles), elementProps.class)
1521
1532
  }
1522
1533
 
1523
1534
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -1745,7 +1756,7 @@ function generateReactJsxFactory(ctx) {
1745
1756
  return {
1746
1757
  js: outdent24`
1747
1758
  import { createElement, forwardRef, useMemo } from 'react'
1748
- ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1759
+ ${ctx.file.import("css, cx, cva", "../css/index")}
1749
1760
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
1750
1761
  ${ctx.jsx.styleProps === "all" ? ctx.file.import("isCssProperty", "./is-valid-prop") : ""}
1751
1762
 
@@ -1763,15 +1774,14 @@ function generateReactJsxFactory(ctx) {
1763
1774
 
1764
1775
  function recipeClass() {
1765
1776
  const { css: cssStyles, ...propStyles } = styleProps
1766
- const styles = assignCss(propStyles, cssStyles)
1767
- return cx(cvaFn(variantProps), css(styles), elementProps.className)
1777
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1778
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className)
1768
1779
  }
1769
1780
 
1770
1781
  function cvaClass() {
1771
1782
  const { css: cssStyles, ...propStyles } = styleProps
1772
1783
  const cvaStyles = cvaFn.raw(variantProps)
1773
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
1774
- return cx(css(styles), elementProps.className)
1784
+ return cx(css(cvaStyles, propStyles, cssStyles), elementProps.className)
1775
1785
  }`;
1776
1786
  }).with("minimal", () => {
1777
1787
  return outdent24`
@@ -1780,13 +1790,13 @@ function generateReactJsxFactory(ctx) {
1780
1790
  }, [restProps])
1781
1791
 
1782
1792
  function recipeClass() {
1783
- return cx(cvaFn(variantProps), css(assignCss(elementProps.css)), elementProps.className)
1793
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1794
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, elementProps.css), elementProps.className)
1784
1795
  }
1785
1796
 
1786
1797
  function cvaClass() {
1787
1798
  const cvaStyles = cvaFn.raw(variantProps)
1788
- const styles = assignCss(cvaStyles, elementProps.css)
1789
- return cx(css(styles), elementProps.className)
1799
+ return cx(css(cvaStyles, elementProps.css), elementProps.className)
1790
1800
  }`;
1791
1801
  }).with("none", () => {
1792
1802
  return outdent24`
@@ -1795,13 +1805,13 @@ function generateReactJsxFactory(ctx) {
1795
1805
  }, [restProps])
1796
1806
 
1797
1807
  function recipeClass() {
1798
- return cx(cvaFn(variantProps), elementProps.className)
1808
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
1809
+ return cx(cvaFn(variantProps, false), elementProps.className)
1799
1810
  }
1800
1811
 
1801
1812
  function cvaClass() {
1802
1813
  const cvaStyles = cvaFn.raw(variantProps)
1803
- const styles = assignCss(cvaStyles)
1804
- return cx(css(styles), elementProps.className)
1814
+ return cx(css(cvaStyles), elementProps.className)
1805
1815
  }`;
1806
1816
  }).run()}
1807
1817
 
@@ -2051,15 +2061,13 @@ function generateSolidJsxFactory(ctx) {
2051
2061
 
2052
2062
  function recipeClass() {
2053
2063
  const { css: cssStyles, ...propStyles } = styleProps
2054
- const styles = assignCss(propStyles, cssStyles)
2055
- return cx(cvaFn(variantProps), css(styles), localProps.class)
2064
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), localProps.class)
2056
2065
  }
2057
2066
 
2058
2067
  function cvaClass() {
2059
2068
  const { css: cssStyles, ...propStyles } = styleProps
2060
2069
  const cvaStyles = cvaFn.raw(variantProps)
2061
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
2062
- return cx(css(styles), localProps.class)
2070
+ return cx(css(cvaStyles, propStyles, cssStyles), localProps.class)
2063
2071
  }
2064
2072
 
2065
2073
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -2310,15 +2318,14 @@ function generateVueJsxFactory(ctx) {
2310
2318
  const recipeClass = computed(() => {
2311
2319
  const [variantProps, styleProps, _htmlProps, elementProps] = splittedProps.value
2312
2320
  const { css: cssStyles, ...propStyles } = styleProps
2313
- const styles = assignCss(propStyles, cssStyles)
2314
- return cx(cvaFn(variantProps), css(styles), elementProps.className)
2321
+ const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
2322
+ return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className)
2315
2323
  })
2316
2324
 
2317
2325
  const cvaClass = computed(() => {
2318
2326
  const [variantProps, styleProps, _htmlProps, elementProps] = splittedProps.value
2319
2327
  const { css: cssStyles, ...propStyles } = styleProps
2320
- const styles = assignCss(propStyles, cssStyles)
2321
- return cx(cvaFn(variantProps), css(styles), elementProps.className)
2328
+ return cx(cvaFn(variantProps), css(propStyles, cssStyles), elementProps.className)
2322
2329
  })
2323
2330
 
2324
2331
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
@@ -2341,17 +2348,12 @@ function generateVueJsxFactory(ctx) {
2341
2348
  }
2342
2349
 
2343
2350
  function createJsxFactory() {
2344
- const cache = new Map()
2345
-
2346
2351
  return new Proxy(styledFn, {
2347
2352
  apply(_, __, args) {
2348
2353
  return styledFn(...args)
2349
2354
  },
2350
2355
  get(_, el) {
2351
- if (!cache.has(el)) {
2352
- cache.set(el, styledFn(el))
2353
- }
2354
- return cache.get(el)
2356
+ return styledFn(el)
2355
2357
  },
2356
2358
  })
2357
2359
  }
@@ -2666,7 +2668,7 @@ var composition_d_ts_default = {
2666
2668
 
2667
2669
  // src/artifacts/generated/recipe.d.ts.json
2668
2670
  var recipe_d_ts_default = {
2669
- 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 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\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 interface 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\ninterface 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 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 extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface 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"
2671
+ 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 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]>>\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface 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\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 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 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<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\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"
2670
2672
  };
2671
2673
 
2672
2674
  // src/artifacts/generated/pattern.d.ts.json
@@ -3405,6 +3407,7 @@ var getPatternEngine = (config) => {
3405
3407
  };
3406
3408
  });
3407
3409
  return {
3410
+ keys: Object.keys(patterns),
3408
3411
  getConfig: (name) => patterns[name],
3409
3412
  transform: (name, data) => {
3410
3413
  return patterns[name]?.transform?.(data, helpers2) ?? {};
@@ -3484,11 +3487,11 @@ var defaults = (conf) => ({
3484
3487
  }
3485
3488
  }
3486
3489
  });
3487
- var getImportMap = (outdir) => ({
3488
- css: [outdir, "css"],
3489
- recipe: [outdir, "recipes"],
3490
- pattern: [outdir, "patterns"],
3491
- jsx: [outdir, "jsx"]
3490
+ var getImportMap = (outdir, configImportMap) => ({
3491
+ css: configImportMap?.css ? [configImportMap.css] : [outdir, "css"],
3492
+ recipe: configImportMap?.recipes ? [configImportMap.recipes] : [outdir, "recipes"],
3493
+ pattern: configImportMap?.patterns ? [configImportMap.patterns] : [outdir, "patterns"],
3494
+ jsx: configImportMap?.jsx ? [configImportMap.jsx] : [outdir, "jsx"]
3492
3495
  });
3493
3496
  var createGenerator = (conf) => {
3494
3497
  const ctx = getEngine(defaults(conf));
@@ -3504,13 +3507,16 @@ var createGenerator = (conf) => {
3504
3507
  getParserCss: generateParserCss(ctx),
3505
3508
  messages: getMessages(ctx),
3506
3509
  parserOptions: {
3507
- importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
3510
+ importMap: getImportMap(config.outdir.replace(relativeBaseUrl, ""), config.importMap),
3508
3511
  jsx: {
3512
+ framework: jsx.framework,
3509
3513
  factory: jsx.factoryName,
3510
3514
  styleProps: jsx.styleProps,
3511
3515
  isStyleProp: isValidProperty,
3512
3516
  nodes: [...patterns.details, ...recipes.details]
3513
3517
  },
3518
+ patternKeys: patterns.keys,
3519
+ recipeKeys: recipes.keys,
3514
3520
  getRecipesByJsxName: recipes.filter,
3515
3521
  getPatternsByJsxName: patterns.filter,
3516
3522
  compilerOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
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.5",
23
- "@pandacss/core": "0.15.2",
24
- "@pandacss/is-valid-prop": "0.15.2",
25
- "@pandacss/logger": "0.15.2",
26
- "@pandacss/shared": "0.15.2",
27
- "@pandacss/token-dictionary": "0.15.2",
28
- "@pandacss/types": "0.15.2"
23
+ "@pandacss/core": "0.15.3",
24
+ "@pandacss/is-valid-prop": "0.15.3",
25
+ "@pandacss/shared": "0.15.3",
26
+ "@pandacss/logger": "0.15.3",
27
+ "@pandacss/token-dictionary": "0.15.3",
28
+ "@pandacss/types": "0.15.3"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.30",
32
32
  "hookable": "5.5.3",
33
- "@pandacss/fixture": "0.15.2"
33
+ "@pandacss/fixture": "0.15.3"
34
34
  },
35
35
  "scripts": {
36
36
  "prebuild": "tsx scripts/prebuild.ts",