@pandacss/generator 0.18.3 → 0.20.1

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
@@ -30,7 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var src_exports = {};
32
32
  __export(src_exports, {
33
- createGenerator: () => createGenerator,
33
+ Generator: () => Generator,
34
34
  messages: () => messages_exports
35
35
  });
36
36
  module.exports = __toCommonJS(src_exports);
@@ -67,7 +67,7 @@ var artifactsGenerated = (ctx) => {
67
67
  ${tick} ${(0, import_logger.quote)(outdir, "/tokens")}: the css variables and js function to query your tokens
68
68
  `,
69
69
  !patterns.isEmpty() && !ctx.isTemplateLiteralSyntax && import_outdent.outdent`
70
- ${tick} ${(0, import_logger.quote)(outdir, "/patterns")}: functions to implement apply common layout patterns
70
+ ${tick} ${(0, import_logger.quote)(outdir, "/patterns")}: functions to implement and apply common layout patterns
71
71
  `,
72
72
  !recipes.isEmpty() && import_outdent.outdent`
73
73
  ${tick} ${(0, import_logger.quote)(outdir, "/recipes")}: functions to create multi-variant styles
@@ -128,7 +128,7 @@ var getMessages = (ctx) => ({
128
128
  configWatch
129
129
  });
130
130
 
131
- // src/artifacts/index.ts
131
+ // src/artifacts/setup-artifacts.ts
132
132
  var import_shared4 = require("@pandacss/shared");
133
133
  var import_outdent44 = __toESM(require("outdent"));
134
134
 
@@ -376,7 +376,7 @@ function generateResetCss(ctx, scope = "") {
376
376
  ${selector}pre {
377
377
  font-size: 1em;
378
378
  --font-mono-fallback: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New';
379
- font-family: var(--global-font-mono, var(--font-fallback));
379
+ font-family: var(--global-font-mono, var(--font-mono-fallback));
380
380
  }
381
381
 
382
382
 
@@ -427,9 +427,9 @@ function generateResetCss(ctx, scope = "") {
427
427
  // src/artifacts/css/static-css.ts
428
428
  var import_core2 = require("@pandacss/core");
429
429
  var generateStaticCss = (ctx) => {
430
- const { config, createSheet, utility, recipes } = ctx;
430
+ const { config, utility, recipes } = ctx;
431
431
  const { staticCss = {}, theme = {}, optimize = true } = config;
432
- const sheet = createSheet();
432
+ const sheet = ctx.createSheet();
433
433
  const fn = (0, import_core2.getStaticCss)(staticCss);
434
434
  const results = fn({
435
435
  breakpoints: Object.keys(theme.breakpoints ?? {}),
@@ -970,7 +970,7 @@ function generateIsValidProp(ctx) {
970
970
  let content = is_valid_prop_mjs_default.content;
971
971
  content = content.replace(
972
972
  'var userGeneratedStr = "";',
973
- `var userGeneratedStr = "${(0, import_ts_pattern.match)(ctx.jsx.styleProps).with("all", () => Array.from(new Set(ctx.properties)).join(",")).with("minimal", () => "css").with("none", () => "").exhaustive()}"`
973
+ `var userGeneratedStr = "${(0, import_ts_pattern.match)(ctx.jsx.styleProps).with("all", () => Array.from(ctx.properties).join(",")).with("minimal", () => "css").with("none", () => "").exhaustive()}"`
974
974
  );
975
975
  content = content.replace(memoFnDeclarationRegex, "var cssPropertySelectorRegex");
976
976
  if (ctx.jsx.styleProps === "minimal" || ctx.jsx.styleProps === "none") {
@@ -1038,10 +1038,11 @@ var import_shared = require("@pandacss/shared");
1038
1038
  var import_javascript_stringify = require("javascript-stringify");
1039
1039
  var import_outdent11 = require("outdent");
1040
1040
  var import_ts_pattern3 = require("ts-pattern");
1041
- function generatePattern(ctx) {
1041
+ function generatePattern(ctx, filters) {
1042
1042
  if (ctx.patterns.isEmpty())
1043
1043
  return;
1044
- return ctx.patterns.details.map((pattern) => {
1044
+ const details = ctx.patterns.filterDetails(filters);
1045
+ return details.map((pattern) => {
1045
1046
  const { baseName, config, dashName, upperName, styleFnName, blocklistType } = pattern;
1046
1047
  const { properties, transform, strict, description } = config;
1047
1048
  const transformFn = (0, import_javascript_stringify.stringify)({ transform }) ?? "";
@@ -1116,18 +1117,21 @@ var import_outdent12 = require("outdent");
1116
1117
  var import_ts_pattern4 = require("ts-pattern");
1117
1118
  var stringify2 = (value) => JSON.stringify(value, null, 2);
1118
1119
  var isBooleanValue = (value) => value === "true" || value === "false";
1119
- function generateRecipes(ctx) {
1120
+ function generateCreateRecipe(ctx) {
1120
1121
  const {
1122
+ conditions,
1121
1123
  recipes,
1122
- utility: { separator },
1123
- config: { prefix, hash }
1124
+ prefix,
1125
+ hash,
1126
+ utility: { separator }
1124
1127
  } = ctx;
1125
1128
  if (recipes.isEmpty())
1126
1129
  return;
1127
- const createRecipeFn = {
1130
+ return {
1128
1131
  name: "create-recipe",
1129
1132
  dts: "",
1130
1133
  js: import_outdent12.outdent`
1134
+ ${ctx.file.import("finalizeConditions, sortConditions", "../css/conditions")}
1131
1135
  ${ctx.file.import("css", "../css/css")}
1132
1136
  ${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
1133
1137
  ${ctx.file.import("cx", "../css/cx")}
@@ -1155,9 +1159,14 @@ function generateRecipes(ctx) {
1155
1159
  }
1156
1160
 
1157
1161
  const recipeCss = createCss({
1158
- ${hash ? "hash: true," : ""}
1162
+ ${hash.className ? "hash: true," : ""}
1163
+ conditions: {
1164
+ shift: sortConditions,
1165
+ finalize: finalizeConditions,
1166
+ breakpoints: { keys: ${JSON.stringify(conditions.breakpoints.keys)} }
1167
+ },
1159
1168
  utility: {
1160
- ${prefix ? "prefix: " + JSON.stringify(prefix) + "," : ""}
1169
+ ${prefix.className ? "prefix: " + JSON.stringify(prefix.className) + "," : ""}
1161
1170
  transform,
1162
1171
  }
1163
1172
  })
@@ -1189,7 +1198,7 @@ function generateRecipes(ctx) {
1189
1198
  acc[key] = uniq(recipeA.variantMap[key], recipeB.variantMap[key])
1190
1199
  return acc
1191
1200
  }, {})
1192
-
1201
+
1193
1202
  return Object.assign(recipeFn, {
1194
1203
  __recipe__: true,
1195
1204
  __name__: \`$\{recipeA.__name__} \${recipeB.__name__}\`,
@@ -1204,14 +1213,18 @@ function generateRecipes(ctx) {
1204
1213
  }
1205
1214
  `
1206
1215
  };
1207
- return [
1208
- createRecipeFn,
1209
- ...ctx.recipes.details.map((recipe) => {
1210
- const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
1211
- const { description, defaultVariants, compoundVariants } = config;
1212
- const jsCode = (0, import_ts_pattern4.match)(config).when(
1213
- import_core4.isSlotRecipe,
1214
- (config2) => import_outdent12.outdent`
1216
+ }
1217
+ function generateRecipes(ctx, filters) {
1218
+ const { recipes } = ctx;
1219
+ if (recipes.isEmpty())
1220
+ return;
1221
+ const details = ctx.recipes.filterDetails(filters);
1222
+ return details.map((recipe) => {
1223
+ const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
1224
+ const { description, defaultVariants, compoundVariants } = config;
1225
+ const jsCode = (0, import_ts_pattern4.match)(config).when(
1226
+ import_core4.isSlotRecipe,
1227
+ (config2) => import_outdent12.outdent`
1215
1228
  ${ctx.file.import("splitProps, getSlotCompoundVariant", "../helpers")}
1216
1229
  ${ctx.file.import("createRecipe", "./create-recipe")}
1217
1230
 
@@ -1238,19 +1251,19 @@ function generateRecipes(ctx) {
1238
1251
  },
1239
1252
  })
1240
1253
  `
1241
- ).otherwise(
1242
- (config2) => import_outdent12.outdent`
1254
+ ).otherwise(
1255
+ (config2) => import_outdent12.outdent`
1243
1256
  ${ctx.file.import("splitProps", "../helpers")}
1244
1257
  ${ctx.file.import("createRecipe, mergeRecipes", "./create-recipe")}
1245
1258
 
1246
1259
  const ${baseName}Fn = /* @__PURE__ */ createRecipe('${config2.className}', ${stringify2(
1247
- defaultVariants ?? {}
1248
- )}, ${stringify2(compoundVariants ?? [])})
1260
+ defaultVariants ?? {}
1261
+ )}, ${stringify2(compoundVariants ?? [])})
1249
1262
 
1250
1263
  const ${baseName}VariantMap = ${stringify2(variantKeyMap)}
1251
-
1264
+
1252
1265
  const ${baseName}VariantKeys = Object.keys(${baseName}VariantMap)
1253
-
1266
+
1254
1267
  export const ${baseName} = /* @__PURE__ */ Object.assign(${baseName}Fn, {
1255
1268
  __recipe__: true,
1256
1269
  __name__: '${baseName}',
@@ -1265,21 +1278,21 @@ function generateRecipes(ctx) {
1265
1278
  },
1266
1279
  })
1267
1280
  `
1268
- );
1269
- return {
1270
- name: dashName,
1271
- js: jsCode,
1272
- dts: import_outdent12.outdent`
1281
+ );
1282
+ return {
1283
+ name: dashName,
1284
+ js: jsCode,
1285
+ dts: import_outdent12.outdent`
1273
1286
  ${ctx.file.importType("ConditionalValue", "../types/index")}
1274
1287
  ${ctx.file.importType("DistributiveOmit, Pretty", "../types/system-types")}
1275
1288
 
1276
1289
  interface ${upperName}Variant {
1277
1290
  ${Object.keys(variantKeyMap).map((key) => {
1278
- const values = variantKeyMap[key];
1279
- if (values.every(isBooleanValue))
1280
- return `${key}: boolean`;
1281
- return `${key}: ${(0, import_shared2.unionType)(values)}`;
1282
- }).join("\n")}
1291
+ const values = variantKeyMap[key];
1292
+ if (values.every(isBooleanValue))
1293
+ return `${key}: boolean`;
1294
+ return `${key}: ${(0, import_shared2.unionType)(values)}`;
1295
+ }).join("\n")}
1283
1296
  }
1284
1297
 
1285
1298
  type ${upperName}VariantMap = {
@@ -1287,7 +1300,7 @@ function generateRecipes(ctx) {
1287
1300
  }
1288
1301
 
1289
1302
  export type ${upperName}VariantProps = {
1290
- [key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`}
1303
+ [key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`} | undefined
1291
1304
  }
1292
1305
 
1293
1306
  export interface ${upperName}Recipe {
@@ -1302,9 +1315,8 @@ function generateRecipes(ctx) {
1302
1315
  ${description ? `/** ${description} */` : ""}
1303
1316
  export declare const ${baseName}: ${upperName}Recipe
1304
1317
  `
1305
- };
1306
- })
1307
- ];
1318
+ };
1319
+ });
1308
1320
  }
1309
1321
 
1310
1322
  // src/artifacts/js/sva.ts
@@ -1492,9 +1504,10 @@ function generatePreactJsxFactory(ctx) {
1492
1504
  // src/artifacts/preact-jsx/pattern.ts
1493
1505
  var import_outdent16 = require("outdent");
1494
1506
  var import_ts_pattern5 = require("ts-pattern");
1495
- function generatePreactJsxPattern(ctx) {
1507
+ function generatePreactJsxPattern(ctx, filters) {
1496
1508
  const { typeName, factoryName } = ctx.jsx;
1497
- return ctx.patterns.details.map((pattern) => {
1509
+ const details = ctx.patterns.filterDetails(filters);
1510
+ return details.map((pattern) => {
1498
1511
  const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
1499
1512
  const { description, jsxElement = "div" } = pattern.config;
1500
1513
  return {
@@ -1797,9 +1810,10 @@ function generateQwikJsxFactory(ctx) {
1797
1810
  // src/artifacts/qwik-jsx/pattern.ts
1798
1811
  var import_outdent21 = require("outdent");
1799
1812
  var import_ts_pattern6 = require("ts-pattern");
1800
- function generateQwikJsxPattern(ctx) {
1813
+ function generateQwikJsxPattern(ctx, filters) {
1801
1814
  const { typeName, factoryName } = ctx.jsx;
1802
- return ctx.patterns.details.map((pattern) => {
1815
+ const details = ctx.patterns.filterDetails(filters);
1816
+ return details.map((pattern) => {
1803
1817
  const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
1804
1818
  const { description, jsxElement = "div" } = pattern.config;
1805
1819
  return {
@@ -2108,9 +2122,10 @@ function generateReactJsxFactory(ctx) {
2108
2122
  // src/artifacts/react-jsx/pattern.ts
2109
2123
  var import_outdent26 = require("outdent");
2110
2124
  var import_ts_pattern7 = require("ts-pattern");
2111
- function generateReactJsxPattern(ctx) {
2125
+ function generateReactJsxPattern(ctx, filters) {
2112
2126
  const { typeName, factoryName } = ctx.jsx;
2113
- return ctx.patterns.details.map((pattern) => {
2127
+ const details = ctx.patterns.filterDetails(filters);
2128
+ return details.map((pattern) => {
2114
2129
  const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
2115
2130
  const { description, jsxElement = "div" } = pattern.config;
2116
2131
  return {
@@ -2443,9 +2458,10 @@ function generateSolidJsxFactory(ctx) {
2443
2458
  // src/artifacts/solid-jsx/pattern.ts
2444
2459
  var import_outdent31 = require("outdent");
2445
2460
  var import_ts_pattern8 = require("ts-pattern");
2446
- function generateSolidJsxPattern(ctx) {
2461
+ function generateSolidJsxPattern(ctx, filters) {
2447
2462
  const { typeName, factoryName } = ctx.jsx;
2448
- return ctx.patterns.details.map((pattern) => {
2463
+ const details = ctx.patterns.filterDetails(filters);
2464
+ return details.map((pattern) => {
2449
2465
  const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
2450
2466
  const { description, jsxElement = "div" } = pattern.config;
2451
2467
  return {
@@ -2824,9 +2840,10 @@ function generateVueJsxStringLiteralFactory(ctx) {
2824
2840
 
2825
2841
  // src/artifacts/vue-jsx/pattern.ts
2826
2842
  var import_outdent37 = require("outdent");
2827
- function generateVueJsxPattern(ctx) {
2843
+ function generateVueJsxPattern(ctx, filters) {
2828
2844
  const { typeName, factoryName } = ctx.jsx;
2829
- return ctx.patterns.details.map((pattern) => {
2845
+ const details = ctx.patterns.filterDetails(filters);
2846
+ return details.map((pattern) => {
2830
2847
  const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
2831
2848
  const { description, jsxElement = "div" } = pattern.config;
2832
2849
  const propList = props.map((v) => JSON.stringify(v)).join(", ");
@@ -3025,12 +3042,10 @@ var patternMap = {
3025
3042
  vue: generateVueJsxPattern,
3026
3043
  qwik: generateQwikJsxPattern
3027
3044
  };
3028
- function generateJsxPatterns(ctx) {
3029
- if (ctx.isTemplateLiteralSyntax)
3030
- return [];
3031
- if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
3045
+ function generateJsxPatterns(ctx, filters) {
3046
+ if (ctx.isTemplateLiteralSyntax || ctx.patterns.isEmpty() || !ctx.jsx.framework)
3032
3047
  return [];
3033
- return patternMap[ctx.jsx.framework](ctx);
3048
+ return patternMap[ctx.jsx.framework](ctx, filters);
3034
3049
  }
3035
3050
 
3036
3051
  // src/artifacts/pkg-json.ts
@@ -3085,7 +3100,7 @@ var csstype_d_ts_default = {
3085
3100
 
3086
3101
  // src/artifacts/generated/system-types.d.ts.json
3087
3102
  var system_types_d_ts_default = {
3088
- content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\nexport type Pretty<T> = { [K in keyof T]: T[K] } & {}\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type DistributiveUnion<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]\n} & DistributiveOmit<U, keyof T>\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties {}\n\nexport interface CssKeyframes {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ninterface GenericProperties {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport interface GlobalStyleObject {\n [selector: string]: SystemStyleObject\n}\nexport interface ExtendableGlobalStyleObject {\n [selector: string]: SystemStyleObject | undefined\n extend?: GlobalStyleObject | undefined\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ninterface WithCss {\n css?: SystemStyleObject\n}\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport interface PatchedHTMLProps {\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
3103
+ content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\nexport type Pretty<T> = { [K in keyof T]: T[K] } & {}\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type DistributiveUnion<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]\n} & DistributiveOmit<U, keyof T>\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties {}\n\nexport interface CssKeyframes {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ninterface GenericProperties {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport interface GlobalStyleObject {\n [selector: string]: SystemStyleObject\n}\nexport interface ExtendableGlobalStyleObject {\n [selector: string]: SystemStyleObject | undefined\n extend?: GlobalStyleObject | undefined\n}\n\ntype FilterStyleObject<P extends string> = {\n [K in P]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<FilterStyleObject<Property> & CssVarProperties>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ninterface WithCss {\n css?: SystemStyleObject\n}\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport interface PatchedHTMLProps {\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
3089
3104
  };
3090
3105
 
3091
3106
  // src/artifacts/generated/composition.d.ts.json
@@ -3095,7 +3110,7 @@ var composition_d_ts_default = {
3095
3110
 
3096
3111
  // src/artifacts/generated/recipe.d.ts.json
3097
3112
  var recipe_d_ts_default = {
3098
- content: "import 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]>\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"
3113
+ content: "import 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\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]>> | undefined\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"
3099
3114
  };
3100
3115
 
3101
3116
  // src/artifacts/generated/pattern.d.ts.json
@@ -3115,7 +3130,6 @@ var selectors_d_ts_default = {
3115
3130
 
3116
3131
  // src/artifacts/types/generated.ts
3117
3132
  var import_ts_pattern9 = require("ts-pattern");
3118
- var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
3119
3133
  function getGeneratedTypes(ctx) {
3120
3134
  const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
3121
3135
  return {
@@ -3124,7 +3138,13 @@ function getGeneratedTypes(ctx) {
3124
3138
  pattern: rewriteImports(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
3125
3139
  parts: rewriteImports(parts_d_ts_default.content),
3126
3140
  composition: rewriteImports(composition_d_ts_default.content),
3127
- selectors: rewriteImports(selectors_d_ts_default.content),
3141
+ selectors: rewriteImports(selectors_d_ts_default.content)
3142
+ };
3143
+ }
3144
+ var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
3145
+ function getGeneratedSystemTypes(ctx) {
3146
+ const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
3147
+ return {
3128
3148
  system: rewriteImports(
3129
3149
  (0, import_ts_pattern9.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with(
3130
3150
  "minimal",
@@ -3187,7 +3207,6 @@ function generatePropTypes(ctx) {
3187
3207
  config: { strictTokens },
3188
3208
  utility
3189
3209
  } = ctx;
3190
- const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
3191
3210
  const result = [
3192
3211
  import_outdent41.outdent`
3193
3212
  ${ctx.file.importType("ConditionalValue", "./conditions")}
@@ -3204,7 +3223,7 @@ function generatePropTypes(ctx) {
3204
3223
  result.push(`
3205
3224
  type CssValue<T> = T extends keyof CssProperties ? CssProperties[T] : never
3206
3225
 
3207
- type Shorthand<T> = T extends keyof PropertyValueTypes ? PropertyValueTypes[T]${strictText} : CssValue<T>
3226
+ type Shorthand<T> = T extends keyof PropertyValueTypes ? PropertyValueTypes[T]${strictTokens ? "" : " | CssValue<T>"} : CssValue<T>
3208
3227
 
3209
3228
  export interface PropertyTypes extends PropertyValueTypes {
3210
3229
  `);
@@ -3215,10 +3234,11 @@ function generatePropTypes(ctx) {
3215
3234
  return import_outdent41.outdent`
3216
3235
  ${result.join("\n")}
3217
3236
 
3237
+ ${strictTokens ? `type FilterString<T> = T extends \`\${infer _}\` ? T : never;` : ""}
3218
3238
  export type PropertyValue<T extends string> = T extends keyof PropertyTypes
3219
- ? ConditionalValue<PropertyTypes[T]${strictText}${!ctx.config.strictTokens ? " | (string & {})" : ""}>
3239
+ ? ConditionalValue<${strictTokens ? "FilterString<PropertyTypes[T]>" : "PropertyTypes[T] | CssValue<T> | (string & {})"}>
3220
3240
  : T extends keyof CssProperties
3221
- ? ConditionalValue<CssProperties[T]${!ctx.config.strictTokens ? " | (string & {})" : ""}>
3241
+ ? ConditionalValue<${strictTokens ? "FilterString<CssProperties[T]>" : "CssProperties[T] | (string & {})"}>
3222
3242
  : ConditionalValue<string | number>
3223
3243
  `;
3224
3244
  }
@@ -3299,16 +3319,18 @@ function generateTokenTypes(ctx) {
3299
3319
  return import_outdent43.outdent.string(Array.from(set).join("\n\n"));
3300
3320
  }
3301
3321
 
3302
- // src/artifacts/index.ts
3322
+ // src/artifacts/setup-artifacts.ts
3303
3323
  function setupHelpers(ctx) {
3304
3324
  const code = generateHelpers(ctx);
3305
3325
  return {
3326
+ id: "helpers",
3306
3327
  files: [{ file: ctx.file.ext("helpers"), code: code.js }]
3307
3328
  };
3308
3329
  }
3309
3330
  function setupKeyframes(ctx) {
3310
3331
  const code = generateKeyframeCss(ctx);
3311
3332
  return {
3333
+ id: "keyframes",
3312
3334
  dir: ctx.paths.token,
3313
3335
  files: [{ file: "keyframes.css", code }]
3314
3336
  };
@@ -3319,6 +3341,7 @@ function setupDesignTokens(ctx) {
3319
3341
  const code = generateTokenJs(ctx);
3320
3342
  const css2 = generateTokenCss(ctx);
3321
3343
  return {
3344
+ id: "design-tokens",
3322
3345
  dir: ctx.paths.token,
3323
3346
  files: [
3324
3347
  { file: "index.css", code: css2 },
@@ -3328,34 +3351,73 @@ function setupDesignTokens(ctx) {
3328
3351
  ]
3329
3352
  };
3330
3353
  }
3331
- function setupTypes(ctx) {
3332
- const gen = getGeneratedTypes(ctx);
3333
- const conditions = generateConditions(ctx);
3354
+ function setupJsxTypes(ctx) {
3355
+ if (!ctx.jsx.framework)
3356
+ return;
3334
3357
  const jsx = generateJsxTypes(ctx);
3335
- const entry = generateTypesEntry(ctx, jsx != null);
3336
3358
  return {
3359
+ id: "types-jsx",
3360
+ dir: ctx.paths.types,
3361
+ files: [{ file: ctx.file.extDts("jsx"), code: jsx.jsxType }]
3362
+ };
3363
+ }
3364
+ function setupEntryTypes(ctx) {
3365
+ const entry = generateTypesEntry(ctx, Boolean(ctx.jsx.framework));
3366
+ return {
3367
+ id: "types-entry",
3368
+ dir: ctx.paths.types,
3369
+ files: [
3370
+ { file: ctx.file.extDts("global"), code: entry.global },
3371
+ { file: ctx.file.extDts("index"), code: entry.index }
3372
+ ]
3373
+ };
3374
+ }
3375
+ function setupStyleTypes(ctx) {
3376
+ return {
3377
+ id: "types-styles",
3378
+ dir: ctx.paths.types,
3379
+ files: [
3380
+ { file: ctx.file.extDts("prop-type"), code: generatePropTypes(ctx) },
3381
+ { file: ctx.file.extDts("style-props"), code: generateStyleProps(ctx) }
3382
+ ]
3383
+ };
3384
+ }
3385
+ function setupConditionsTypes(ctx) {
3386
+ const conditions = generateConditions(ctx);
3387
+ return {
3388
+ id: "types-conditions",
3389
+ dir: ctx.paths.types,
3390
+ files: [{ file: ctx.file.extDts("conditions"), code: conditions.dts }]
3391
+ };
3392
+ }
3393
+ function setupGeneratedTypes(ctx) {
3394
+ const gen = getGeneratedTypes(ctx);
3395
+ return {
3396
+ id: "types-gen",
3337
3397
  dir: ctx.paths.types,
3338
3398
  files: [
3339
- jsx ? { file: ctx.file.extDts("jsx"), code: jsx.jsxType } : null,
3340
3399
  { file: ctx.file.extDts("csstype"), code: gen.cssType },
3341
- { file: ctx.file.extDts("system-types"), code: gen.system },
3342
3400
  { file: ctx.file.extDts("selectors"), code: gen.selectors },
3343
3401
  { file: ctx.file.extDts("composition"), code: gen.composition },
3344
- { file: ctx.file.extDts("global"), code: entry.global },
3345
3402
  { file: ctx.file.extDts("recipe"), code: gen.recipe },
3346
3403
  { file: ctx.file.extDts("pattern"), code: gen.pattern },
3347
- { file: ctx.file.extDts("parts"), code: gen.parts },
3348
- { file: ctx.file.extDts("index"), code: entry.index },
3349
- { file: ctx.file.extDts("prop-type"), code: generatePropTypes(ctx) },
3350
- { file: ctx.file.extDts("style-props"), code: generateStyleProps(ctx) },
3351
- { file: ctx.file.extDts("conditions"), code: conditions.dts }
3352
- ].filter(Boolean)
3404
+ { file: ctx.file.extDts("parts"), code: gen.parts }
3405
+ ]
3406
+ };
3407
+ }
3408
+ function setupGeneratedSystemTypes(ctx) {
3409
+ const gen = getGeneratedSystemTypes(ctx);
3410
+ return {
3411
+ id: "types-gen-system",
3412
+ dir: ctx.paths.types,
3413
+ files: [{ file: ctx.file.extDts("system-types"), code: gen.system }]
3353
3414
  };
3354
3415
  }
3355
3416
  function setupCss(ctx) {
3356
3417
  const code = ctx.isTemplateLiteralSyntax ? generateStringLiteralCssFn(ctx) : generateCssFn(ctx);
3357
3418
  const conditions = ctx.isTemplateLiteralSyntax ? generateStringLiteralConditions(ctx) : generateConditions(ctx);
3358
3419
  return {
3420
+ id: "css-fn",
3359
3421
  dir: ctx.paths.css,
3360
3422
  files: [
3361
3423
  { file: ctx.file.ext("conditions"), code: conditions.js },
@@ -3369,6 +3431,7 @@ function setupCva(ctx) {
3369
3431
  return;
3370
3432
  const code = generateCvaFn(ctx);
3371
3433
  return {
3434
+ id: "cva",
3372
3435
  dir: ctx.paths.css,
3373
3436
  files: [
3374
3437
  { file: ctx.file.ext("cva"), code: code.js },
@@ -3381,6 +3444,7 @@ function setupSva(ctx) {
3381
3444
  return;
3382
3445
  const code = generateSvaFn(ctx);
3383
3446
  return {
3447
+ id: "sva",
3384
3448
  dir: ctx.paths.css,
3385
3449
  files: [
3386
3450
  { file: ctx.file.ext("sva"), code: code.js },
@@ -3391,6 +3455,7 @@ function setupSva(ctx) {
3391
3455
  function setupCx(ctx) {
3392
3456
  const code = generateCx();
3393
3457
  return {
3458
+ id: "cx",
3394
3459
  dir: ctx.paths.css,
3395
3460
  files: [
3396
3461
  { file: ctx.file.ext("cx"), code: code.js },
@@ -3398,79 +3463,160 @@ function setupCx(ctx) {
3398
3463
  ]
3399
3464
  };
3400
3465
  }
3401
- function setupRecipes(ctx) {
3402
- const files = generateRecipes(ctx);
3403
- if (!files)
3466
+ function setupCreateRecipe(ctx) {
3467
+ if (ctx.recipes.isEmpty())
3468
+ return;
3469
+ const createRecipe = generateCreateRecipe(ctx);
3470
+ return {
3471
+ id: "create-recipe",
3472
+ dir: ctx.paths.recipe,
3473
+ files: [
3474
+ { file: ctx.file.ext(createRecipe.name), code: createRecipe.js },
3475
+ { file: ctx.file.extDts(createRecipe.name), code: createRecipe.dts }
3476
+ ]
3477
+ };
3478
+ }
3479
+ function setupRecipesIndex(ctx) {
3480
+ if (ctx.recipes.isEmpty())
3404
3481
  return;
3405
- const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
3482
+ const fileNames = ctx.recipes.details.map((recipe) => recipe.dashName);
3406
3483
  const index = {
3407
- js: import_outdent44.default.string(indexFiles.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
3408
- dts: import_outdent44.default.string(indexFiles.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
3484
+ js: import_outdent44.default.string(fileNames.map((file) => ctx.file.exportStar(`./${file}`)).join("\n")),
3485
+ dts: import_outdent44.default.string(fileNames.map((file) => ctx.file.exportTypeStar(`./${file}`)).join("\n"))
3409
3486
  };
3410
3487
  return {
3488
+ id: "recipes-index",
3411
3489
  dir: ctx.paths.recipe,
3412
3490
  files: [
3413
- ...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
3414
- ...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
3415
3491
  { file: ctx.file.ext("index"), code: index.js },
3416
3492
  { file: ctx.file.extDts("index"), code: index.dts }
3417
3493
  ]
3418
3494
  };
3419
3495
  }
3420
- function setupPatterns(ctx) {
3421
- if (ctx.isTemplateLiteralSyntax)
3496
+ function setupRecipes(ctx, filters) {
3497
+ if (ctx.recipes.isEmpty())
3422
3498
  return;
3423
- const files = generatePattern(ctx);
3499
+ const files = generateRecipes(ctx, filters);
3424
3500
  if (!files)
3425
3501
  return;
3502
+ return {
3503
+ id: "recipes",
3504
+ dir: ctx.paths.recipe,
3505
+ files: files.flatMap((file) => [
3506
+ { file: ctx.file.ext(file.name), code: file.js },
3507
+ { file: ctx.file.extDts(file.name), code: file.dts }
3508
+ ])
3509
+ };
3510
+ }
3511
+ function setupPatternsIndex(ctx) {
3512
+ if (ctx.isTemplateLiteralSyntax)
3513
+ return;
3514
+ const fileNames = ctx.patterns.details.map((pattern) => pattern.dashName);
3426
3515
  const index = {
3427
- js: import_outdent44.default.string(files.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
3428
- dts: import_outdent44.default.string(files.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
3516
+ js: import_outdent44.default.string(fileNames.map((file) => ctx.file.exportStar(`./${file}`)).join("\n")),
3517
+ dts: import_outdent44.default.string(fileNames.map((file) => ctx.file.exportTypeStar(`./${file}`)).join("\n"))
3429
3518
  };
3430
3519
  return {
3520
+ id: "patterns-index",
3431
3521
  dir: ctx.paths.pattern,
3432
3522
  files: [
3433
- ...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
3434
- ...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
3435
3523
  { file: ctx.file.ext("index"), code: index.js },
3436
3524
  { file: ctx.file.extDts("index"), code: index.dts }
3437
3525
  ]
3438
3526
  };
3439
3527
  }
3440
- function setupJsx(ctx) {
3441
- if (!ctx.jsx.framework)
3528
+ function setupPatterns(ctx, filters) {
3529
+ if (ctx.isTemplateLiteralSyntax)
3530
+ return;
3531
+ const files = generatePattern(ctx, filters);
3532
+ if (!files)
3533
+ return;
3534
+ return {
3535
+ id: "patterns",
3536
+ dir: ctx.paths.pattern,
3537
+ files: files.flatMap((file) => [
3538
+ { file: ctx.file.ext(file.name), code: file.js },
3539
+ { file: ctx.file.extDts(file.name), code: file.dts }
3540
+ ])
3541
+ };
3542
+ }
3543
+ function setupJsxIsValidProp(ctx) {
3544
+ if (!ctx.jsx.framework || ctx.isTemplateLiteralSyntax)
3442
3545
  return;
3443
3546
  const isValidProp = generateIsValidProp(ctx);
3547
+ return {
3548
+ id: "jsx-is-valid-prop",
3549
+ dir: ctx.paths.jsx,
3550
+ files: [
3551
+ { file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
3552
+ { file: ctx.file.extDts("is-valid-prop"), code: isValidProp?.dts }
3553
+ ]
3554
+ };
3555
+ }
3556
+ function setupJsxFactory(ctx) {
3557
+ if (!ctx.jsx.framework)
3558
+ return;
3444
3559
  const types = generateJsxTypes(ctx);
3445
3560
  const factory = generateJsxFactory(ctx);
3446
- const patterns = generateJsxPatterns(ctx);
3561
+ return {
3562
+ id: "jsx-factory",
3563
+ dir: ctx.paths.jsx,
3564
+ files: [
3565
+ { file: ctx.file.ext("factory"), code: factory?.js },
3566
+ { file: ctx.file.extDts("factory"), code: types.jsxFactory }
3567
+ ]
3568
+ };
3569
+ }
3570
+ function setupJsxHelpers(ctx) {
3571
+ if (!ctx.jsx.framework)
3572
+ return;
3447
3573
  const helpers3 = generatedJsxHelpers(ctx);
3574
+ return {
3575
+ id: "jsx-helpers",
3576
+ dir: ctx.paths.jsx,
3577
+ files: [{ file: ctx.file.ext("factory-helper"), code: helpers3.js }]
3578
+ };
3579
+ }
3580
+ function setupJsxPatterns(ctx, filters) {
3581
+ if (!ctx.jsx.framework)
3582
+ return;
3583
+ const patterns = generateJsxPatterns(ctx, filters);
3584
+ return {
3585
+ id: "jsx-patterns",
3586
+ dir: ctx.paths.jsx,
3587
+ files: [
3588
+ ...patterns.flatMap((file) => [
3589
+ { file: ctx.file.ext(file.name), code: file.js },
3590
+ { file: ctx.file.extDts(file.name), code: file.dts }
3591
+ ])
3592
+ ]
3593
+ };
3594
+ }
3595
+ function setupJsxPatternsIndex(ctx) {
3596
+ if (!ctx.jsx.framework)
3597
+ return;
3598
+ const isStyleProp = !ctx.isTemplateLiteralSyntax;
3599
+ const patternNames = ctx.patterns.details.map((pattern) => pattern.dashName);
3448
3600
  const index = {
3449
3601
  js: import_outdent44.default`
3450
3602
  ${ctx.file.exportStar("./factory")}
3451
- ${isValidProp?.js ? ctx.file.exportStar("./is-valid-prop") : ""}
3452
- ${import_outdent44.default.string(patterns.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n"))}
3603
+ ${isStyleProp ? ctx.file.exportStar("./is-valid-prop") : ""}
3604
+ ${import_outdent44.default.string(patternNames.map((file) => ctx.file.exportStar(`./${file}`)).join("\n"))}
3453
3605
  `,
3454
3606
  dts: import_outdent44.default`
3455
3607
  ${ctx.file.exportTypeStar("./factory")}
3456
3608
 
3457
- ${isValidProp?.dts ? ctx.file.exportTypeStar("./is-valid-prop") : ""}
3609
+ ${isStyleProp ? ctx.file.exportTypeStar("./is-valid-prop") : ""}
3458
3610
 
3459
- ${import_outdent44.default.string(patterns.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))}
3611
+ ${import_outdent44.default.string(patternNames.map((file) => ctx.file.exportTypeStar(`./${file}`)).join("\n"))}
3460
3612
 
3461
3613
  ${ctx.file.exportType([ctx.jsx.typeName, ctx.jsx.componentName].join(", "), "../types/jsx")}
3462
3614
  `
3463
3615
  };
3464
3616
  return {
3617
+ id: "jsx-patterns-index",
3465
3618
  dir: ctx.paths.jsx,
3466
3619
  files: [
3467
- ...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
3468
- ...patterns.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
3469
- { file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
3470
- { file: ctx.file.extDts("is-valid-prop"), code: isValidProp?.dts },
3471
- { file: ctx.file.ext("factory-helper"), code: helpers3.js },
3472
- { file: ctx.file.ext("factory"), code: factory?.js },
3473
- { file: ctx.file.extDts("factory"), code: types.jsxFactory },
3474
3620
  { file: ctx.file.ext("index"), code: index.js },
3475
3621
  { file: ctx.file.extDts("index"), code: index.dts }
3476
3622
  ]
@@ -3492,6 +3638,7 @@ function setupCssIndex(ctx) {
3492
3638
  `
3493
3639
  };
3494
3640
  return {
3641
+ id: "css-index",
3495
3642
  dir: ctx.paths.css,
3496
3643
  files: [
3497
3644
  { file: ctx.file.ext("index"), code: index.js },
@@ -3505,60 +3652,131 @@ function setupResetCss(ctx) {
3505
3652
  return;
3506
3653
  const scope = (0, import_shared4.isObject)(preflight) ? preflight.scope : void 0;
3507
3654
  const code = generateResetCss(ctx, scope);
3508
- return { files: [{ file: "reset.css", code }] };
3655
+ return { id: "reset.css", files: [{ file: "reset.css", code }] };
3509
3656
  }
3510
3657
  function setupGlobalCss(ctx) {
3511
3658
  const code = generateGlobalCss(ctx);
3512
- return { files: [{ file: "global.css", code }] };
3659
+ return { id: "global.css", files: [{ file: "global.css", code }] };
3513
3660
  }
3514
3661
  function setupStaticCss(ctx) {
3515
3662
  const code = generateStaticCss(ctx);
3516
- return { files: [{ file: "static.css", code }] };
3663
+ return { id: "static.css", files: [{ file: "static.css", code }] };
3517
3664
  }
3518
3665
  function setupPackageJson(ctx) {
3519
3666
  if (!ctx.config.emitPackage)
3520
3667
  return;
3521
3668
  return {
3669
+ id: "package.json",
3522
3670
  files: [{ file: "package.json", code: generatePackageJson(ctx) }]
3523
3671
  };
3524
3672
  }
3525
- var generateArtifacts = (ctx) => () => {
3526
- if (ctx.config.emitTokensOnly) {
3527
- return [setupDesignTokens(ctx)];
3528
- }
3529
- return [
3530
- setupHelpers(ctx),
3531
- setupDesignTokens(ctx),
3532
- setupKeyframes(ctx),
3533
- setupTypes(ctx),
3534
- setupCva(ctx),
3535
- setupSva(ctx),
3536
- setupCx(ctx),
3537
- setupCss(ctx),
3538
- setupRecipes(ctx),
3539
- setupPatterns(ctx),
3540
- setupCssIndex(ctx),
3541
- setupJsx(ctx),
3542
- setupGlobalCss(ctx),
3543
- setupStaticCss(ctx),
3544
- setupResetCss(ctx),
3545
- setupPackageJson(ctx)
3546
- ].filter(Boolean).map((artifact) => {
3673
+ var getAffectedArtifacts = (ids) => {
3674
+ if (!ids)
3675
+ return;
3676
+ const hasSpecificArtifacts = ids.some(
3677
+ (id) => id.startsWith("recipes.") || id.startsWith("slot-recipes.") || id.startsWith("patterns.")
3678
+ );
3679
+ if (!hasSpecificArtifacts)
3680
+ return;
3681
+ return {
3682
+ recipes: ids.filter((id) => id.startsWith("recipes.") || id.startsWith("slot-recipes.")).map((id) => id.replace("slot-recipes.", "").replace("recipes.", "")),
3683
+ patterns: ids.filter((id) => id.startsWith("patterns.")).map((id) => id.replace("patterns.", ""))
3684
+ };
3685
+ };
3686
+ var filterArtifactsFiles = (artifacts, filters) => {
3687
+ const ids = filters?.ids;
3688
+ if (!ids)
3689
+ return artifacts;
3690
+ const affected = filters.affecteds;
3691
+ return artifacts.filter((artifact) => {
3692
+ if (!artifact)
3693
+ return false;
3694
+ return ids.includes(artifact.id);
3695
+ }).map((artifact) => {
3547
3696
  const files = artifact?.files ?? [];
3548
- files.forEach((file) => {
3549
- if (!file)
3697
+ const filtered = files.filter((item) => {
3698
+ if (!item)
3550
3699
  return;
3551
- if (ctx.file.isTypeFile(file.file)) {
3552
- file.code = `/* eslint-disable */
3553
- ${file.code}`;
3700
+ if (!affected)
3701
+ return true;
3702
+ if (affected.recipes && !item.file.includes("index") && artifact?.dir?.includes("recipes")) {
3703
+ const isAffected = affected.recipes.some((recipe) => item.file.includes(recipe));
3704
+ if (!isAffected)
3705
+ return;
3706
+ }
3707
+ if (affected.patterns && !item.file.includes("index") && (artifact?.dir?.includes("patterns") || artifact?.dir?.includes("jsx"))) {
3708
+ const isAffected = affected.patterns.some((pattern) => item.file.includes(pattern));
3709
+ if (!isAffected)
3710
+ return;
3554
3711
  }
3712
+ return true;
3555
3713
  });
3556
- return artifact;
3714
+ return { ...artifact, files: filtered };
3557
3715
  });
3558
3716
  };
3717
+ var entries = [
3718
+ ["helpers", setupHelpers],
3719
+ ["design-tokens", setupDesignTokens],
3720
+ ["keyframes", setupKeyframes],
3721
+ ["types-jsx", setupJsxTypes],
3722
+ ["types-entry", setupEntryTypes],
3723
+ ["types-styles", setupStyleTypes],
3724
+ ["types-conditions", setupConditionsTypes],
3725
+ ["types-gen", setupGeneratedTypes],
3726
+ ["types-gen-system", setupGeneratedSystemTypes],
3727
+ ["css-fn", setupCss],
3728
+ ["cva", setupCva],
3729
+ ["sva", setupSva],
3730
+ ["cx", setupCx],
3731
+ ["create-recipe", setupCreateRecipe],
3732
+ ["recipes-index", setupRecipesIndex],
3733
+ ["recipes", setupRecipes],
3734
+ ["patterns-index", setupPatternsIndex],
3735
+ ["patterns", setupPatterns],
3736
+ ["jsx-is-valid-prop", setupJsxIsValidProp],
3737
+ ["jsx-factory", setupJsxFactory],
3738
+ ["jsx-helpers", setupJsxHelpers],
3739
+ ["jsx-patterns", setupJsxPatterns],
3740
+ ["jsx-patterns-index", setupJsxPatternsIndex],
3741
+ ["css-index", setupCssIndex],
3742
+ ["reset.css", setupResetCss],
3743
+ ["global.css", setupGlobalCss],
3744
+ ["static.css", setupStaticCss],
3745
+ ["package.json", setupPackageJson]
3746
+ ];
3747
+ var getMatchingArtifacts = (ctx, filters) => {
3748
+ const ids = filters?.ids;
3749
+ if (!ids)
3750
+ return entries.map(([_artifactId, fn]) => fn(ctx));
3751
+ return entries.filter(([artifactId]) => ids.includes(artifactId)).map(([_artifactId, fn]) => fn(ctx, filters));
3752
+ };
3753
+ var transformArtifact = (ctx, artifact) => {
3754
+ const files = (artifact?.files ?? []).filter(Boolean).map((item) => {
3755
+ if (ctx.file.isTypeFile(item.file)) {
3756
+ return { ...item, code: `/* eslint-disable */
3757
+ ${item.code}` };
3758
+ }
3759
+ return item;
3760
+ });
3761
+ return { ...artifact, files };
3762
+ };
3763
+ var setupArtifacts = (ctx, ids) => {
3764
+ const affecteds = getAffectedArtifacts(ids);
3765
+ const artifacts = getMatchingArtifacts(ctx, { ids, affecteds });
3766
+ const matches = filterArtifactsFiles(artifacts, { ids, affecteds });
3767
+ return matches.map((artifact) => transformArtifact(ctx, artifact));
3768
+ };
3769
+
3770
+ // src/artifacts/index.ts
3771
+ var generateArtifacts = (ctx, ids) => {
3772
+ if (ctx.config.emitTokensOnly) {
3773
+ return [setupDesignTokens(ctx)];
3774
+ }
3775
+ return setupArtifacts(ctx, ids);
3776
+ };
3559
3777
 
3560
3778
  // src/artifacts/css/flat-css.ts
3561
- var generateFlattenedCss = (ctx) => (options) => {
3779
+ var generateFlattenedCss = (ctx, options) => {
3562
3780
  const { files, resolve } = options;
3563
3781
  const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
3564
3782
  const unresolved = [
@@ -3587,7 +3805,7 @@ var generateFlattenedCss = (ctx) => (options) => {
3587
3805
  // src/artifacts/css/parser-css.ts
3588
3806
  var import_logger2 = require("@pandacss/logger");
3589
3807
  var import_ts_pattern10 = require("ts-pattern");
3590
- var generateParserCss = (ctx) => (result) => {
3808
+ var generateParserCss = (ctx, result) => {
3591
3809
  const { patterns, recipes } = ctx;
3592
3810
  const sheet = ctx.createSheet();
3593
3811
  result.css.forEach((css2) => {
@@ -3671,161 +3889,26 @@ var filterProps = (ctx, props) => {
3671
3889
  return clone;
3672
3890
  };
3673
3891
 
3674
- // src/engines/base.ts
3892
+ // src/engines/index.ts
3675
3893
  var import_core5 = require("@pandacss/core");
3676
3894
  var import_is_valid_prop3 = require("@pandacss/is-valid-prop");
3677
- var import_shared5 = require("@pandacss/shared");
3895
+ var import_shared7 = require("@pandacss/shared");
3678
3896
  var import_token_dictionary = require("@pandacss/token-dictionary");
3679
3897
  var import_lil_fp = require("lil-fp");
3680
3898
  var import_postcss3 = __toESM(require("postcss"));
3681
- var helpers = {
3682
- map: import_shared5.mapObject
3683
- };
3684
- var getBaseEngine = (conf) => {
3685
- const { config } = conf;
3686
- const theme = config.theme ?? {};
3687
- const isTemplateLiteralSyntax = config.syntax === "template-literal";
3688
- const hash = {
3689
- tokens: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.cssVar,
3690
- className: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.className
3691
- };
3692
- const prefix = {
3693
- tokens: (0, import_lil_fp.isStr)(config.prefix) ? config.prefix : config.prefix?.cssVar,
3694
- className: (0, import_lil_fp.isStr)(config.prefix) ? config.prefix : config.prefix?.className
3695
- };
3696
- const tokens = new import_token_dictionary.TokenDictionary({
3697
- breakpoints: theme.breakpoints,
3698
- tokens: theme.tokens,
3699
- semanticTokens: theme.semanticTokens,
3700
- prefix: prefix.tokens,
3701
- hash: hash.tokens
3702
- });
3703
- const utility = new import_core5.Utility({
3704
- prefix: prefix.className,
3705
- tokens,
3706
- config: isTemplateLiteralSyntax ? {} : config.utilities,
3707
- separator: config.separator,
3708
- shorthands: config.shorthands,
3709
- strictTokens: config.strictTokens
3710
- });
3711
- const conditions = new import_core5.Conditions({
3712
- conditions: config.conditions,
3713
- breakpoints: config.theme?.breakpoints
3714
- });
3715
- const { textStyles, layerStyles } = theme;
3716
- const compositions = (0, import_shared5.compact)({
3717
- textStyle: textStyles,
3718
- layerStyle: layerStyles
3719
- });
3720
- const compositionContext = { conditions, utility };
3721
- (0, import_core5.assignCompositions)(compositions, compositionContext);
3722
- const layers = config.layers;
3723
- const layerNames = Object.values(layers);
3724
- const isValidLayerRule = (0, import_shared5.memo)((layerRule) => {
3725
- const names = new Set(layerRule.split(",").map((name) => name.trim()));
3726
- return names.size >= 5 && layerNames.every((name) => names.has(name));
3727
- });
3728
- const layerString = `@layer ${layerNames.join(", ")};`;
3729
- const createSheetContext = () => ({
3730
- root: import_postcss3.default.root(),
3731
- conditions,
3732
- utility,
3733
- hash: hash.className,
3734
- helpers,
3735
- layers
3736
- });
3737
- const createSheet = (options) => {
3738
- const sheetContext = createSheetContext();
3739
- return new import_core5.Stylesheet(sheetContext, {
3740
- content: options?.content,
3741
- recipes: theme?.recipes,
3742
- slotRecipes: theme?.slotRecipes
3743
- });
3744
- };
3745
- const recipeContext = createSheetContext();
3746
- const recipeConfigs = Object.assign({}, theme.recipes ?? {}, theme.slotRecipes ?? {});
3747
- const recipes = new import_core5.Recipes(recipeConfigs, recipeContext);
3748
- recipes.save();
3749
- const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
3750
- const propertyMap = new Map(properties.map((prop) => [prop, true]));
3751
- const isValidProperty = (0, import_shared5.memo)((key) => {
3752
- return propertyMap.has(key) || (0, import_is_valid_prop3.isCssProperty)(key);
3753
- });
3754
- const studio = {
3755
- outdir: `${config.outdir}-studio`,
3756
- ...conf.config.studio
3757
- };
3758
- return {
3759
- ...conf,
3760
- isTemplateLiteralSyntax,
3761
- studio,
3762
- hash,
3763
- prefix,
3764
- tokens,
3765
- utility,
3766
- properties,
3767
- isValidProperty,
3768
- recipes,
3769
- conditions,
3770
- createSheetContext,
3771
- createSheet,
3772
- // cascade layer
3773
- layers,
3774
- isValidLayerRule,
3775
- layerString,
3776
- layerNames
3777
- };
3778
- };
3779
-
3780
- // src/engines/jsx.ts
3781
- var import_shared6 = require("@pandacss/shared");
3782
- var getJsxEngine = (config) => {
3783
- const { jsxFactory, jsxFramework, jsxStyleProps: jsxStyleProps2 } = config;
3784
- return {
3785
- factoryName: jsxFactory,
3786
- upperName: (0, import_shared6.capitalize)(jsxFactory),
3787
- typeName: `HTML${(0, import_shared6.capitalize)(jsxFactory)}Props`,
3788
- variantName: `${(0, import_shared6.capitalize)(jsxFactory)}VariantProps`,
3789
- componentName: `${(0, import_shared6.capitalize)(jsxFactory)}Component`,
3790
- framework: jsxFramework,
3791
- styleProps: jsxStyleProps2 ?? "all"
3792
- };
3793
- };
3794
-
3795
- // src/engines/path.ts
3796
- var getPathEngine = ({ cwd, emitPackage, outdir }) => {
3797
- const get = (file) => [cwd, emitPackage ? "node_modules" : void 0, outdir, file].filter(Boolean);
3798
- return {
3799
- get,
3800
- root: get(),
3801
- css: get("css"),
3802
- token: get("tokens"),
3803
- types: get("types"),
3804
- recipe: get("recipes"),
3805
- pattern: get("patterns"),
3806
- chunk: get("chunks"),
3807
- outCss: get("styles.css"),
3808
- jsx: get("jsx")
3809
- };
3810
- };
3811
3899
 
3812
3900
  // src/engines/pattern.ts
3813
- var import_shared7 = require("@pandacss/shared");
3814
- var helpers2 = { map: import_shared7.mapObject };
3815
- var getPatternEngine = (config) => {
3816
- const patterns = config.patterns ?? {};
3817
- const getNames = (name) => {
3818
- const upperName = (0, import_shared7.capitalize)(name);
3819
- return {
3820
- upperName,
3821
- baseName: name,
3822
- dashName: (0, import_shared7.dashCase)(name),
3823
- styleFnName: `get${upperName}Style`,
3824
- jsxName: patterns[name]?.jsxName ?? upperName
3825
- };
3826
- };
3827
- const details = Object.entries(patterns).map(([name, pattern]) => {
3828
- const names = getNames(name);
3901
+ var import_shared5 = require("@pandacss/shared");
3902
+ var helpers = { map: import_shared5.mapObject };
3903
+ var Patterns = class {
3904
+ patterns;
3905
+ details;
3906
+ constructor(config) {
3907
+ this.patterns = config.patterns ?? {};
3908
+ this.details = Object.entries(this.patterns).map(([name, pattern]) => this.createDetail(name, pattern));
3909
+ }
3910
+ createDetail(name, pattern) {
3911
+ const names = this.getNames(name);
3829
3912
  const jsx = (pattern.jsx ?? []).concat([names.jsxName]);
3830
3913
  return {
3831
3914
  ...names,
@@ -3833,73 +3916,322 @@ var getPatternEngine = (config) => {
3833
3916
  blocklistType: pattern?.blocklist ? `| '${pattern.blocklist.join("' | '")}'` : "",
3834
3917
  config: pattern,
3835
3918
  type: "pattern",
3836
- match: (0, import_shared7.createRegex)(jsx),
3919
+ match: (0, import_shared5.createRegex)(jsx),
3837
3920
  jsx
3838
3921
  };
3922
+ }
3923
+ get keys() {
3924
+ return Object.keys(this.patterns);
3925
+ }
3926
+ getConfig(name) {
3927
+ return this.patterns[name];
3928
+ }
3929
+ transform(name, data) {
3930
+ return this.patterns[name]?.transform?.(data, helpers) ?? {};
3931
+ }
3932
+ getNames(name) {
3933
+ const upperName = (0, import_shared5.capitalize)(name);
3934
+ return {
3935
+ upperName,
3936
+ baseName: name,
3937
+ dashName: (0, import_shared5.dashCase)(name),
3938
+ styleFnName: `get${upperName}Style`,
3939
+ jsxName: this.patterns[name]?.jsxName ?? upperName
3940
+ };
3941
+ }
3942
+ find = (0, import_shared5.memo)((jsxName) => {
3943
+ return this.details.find((node) => node.match.test(jsxName))?.baseName ?? (0, import_shared5.uncapitalize)(jsxName);
3839
3944
  });
3840
- return {
3841
- keys: Object.keys(patterns),
3842
- getConfig: (name) => patterns[name],
3843
- transform: (name, data) => {
3844
- return patterns[name]?.transform?.(data, helpers2) ?? {};
3845
- },
3846
- getNames,
3847
- details,
3848
- find: (0, import_shared7.memo)((jsxName) => {
3849
- return details.find((node) => node.match.test(jsxName))?.baseName ?? (0, import_shared7.uncapitalize)(jsxName);
3850
- }),
3851
- filter: (0, import_shared7.memo)((jsxName) => {
3852
- return details.filter((node) => node.match.test(jsxName));
3853
- }),
3854
- isEmpty: () => Object.keys(patterns).length === 0
3855
- };
3945
+ filter = (0, import_shared5.memo)((jsxName) => {
3946
+ return this.details.filter((node) => node.match.test(jsxName));
3947
+ });
3948
+ isEmpty() {
3949
+ return this.keys.length === 0;
3950
+ }
3951
+ saveOne(name, pattern) {
3952
+ this.patterns[name] = pattern;
3953
+ const detailIndex = this.details.findIndex((detail) => detail.baseName === name);
3954
+ const updated = this.createDetail(name, pattern);
3955
+ if (detailIndex > -1) {
3956
+ this.details[detailIndex] = updated;
3957
+ } else {
3958
+ this.details.push(updated);
3959
+ }
3960
+ }
3961
+ remove(name) {
3962
+ delete this.patterns[name];
3963
+ const detailIndex = this.details.findIndex((detail) => detail.baseName === name);
3964
+ if (detailIndex > -1) {
3965
+ this.details.splice(detailIndex, 1);
3966
+ }
3967
+ }
3968
+ filterDetails(filters) {
3969
+ const patternDiffs = filters?.affecteds?.patterns;
3970
+ return patternDiffs ? this.details.filter((pattern) => patternDiffs.includes(pattern.dashName)) : this.details;
3971
+ }
3972
+ };
3973
+
3974
+ // src/engines/jsx.ts
3975
+ var import_shared6 = require("@pandacss/shared");
3976
+ var JsxEngine = class {
3977
+ constructor(config) {
3978
+ this.config = config;
3979
+ }
3980
+ get jsxFactory() {
3981
+ return this.config.jsxFactory ?? "";
3982
+ }
3983
+ get styleProps() {
3984
+ return this.config.jsxStyleProps ?? "all";
3985
+ }
3986
+ get framework() {
3987
+ return this.config.jsxFramework;
3988
+ }
3989
+ get factoryName() {
3990
+ return this.jsxFactory;
3991
+ }
3992
+ get upperName() {
3993
+ return (0, import_shared6.capitalize)(this.jsxFactory);
3994
+ }
3995
+ get typeName() {
3996
+ return `HTML${(0, import_shared6.capitalize)(this.jsxFactory)}Props`;
3997
+ }
3998
+ get variantName() {
3999
+ return `${(0, import_shared6.capitalize)(this.jsxFactory)}VariantProps`;
4000
+ }
4001
+ get componentName() {
4002
+ return `${(0, import_shared6.capitalize)(this.jsxFactory)}Component`;
4003
+ }
4004
+ };
4005
+
4006
+ // src/engines/path.ts
4007
+ var PathEngine = class {
4008
+ constructor(config) {
4009
+ this.config = config;
4010
+ }
4011
+ get cwd() {
4012
+ return this.config.cwd;
4013
+ }
4014
+ get emitPackage() {
4015
+ return this.config.emitPackage || false;
4016
+ }
4017
+ get outdir() {
4018
+ return this.config.outdir;
4019
+ }
4020
+ getFilePath(file) {
4021
+ return [this.cwd, this.emitPackage ? "node_modules" : void 0, this.outdir, file].filter(Boolean);
4022
+ }
4023
+ get root() {
4024
+ return this.getFilePath();
4025
+ }
4026
+ get css() {
4027
+ return this.getFilePath("css");
4028
+ }
4029
+ get token() {
4030
+ return this.getFilePath("tokens");
4031
+ }
4032
+ get types() {
4033
+ return this.getFilePath("types");
4034
+ }
4035
+ get recipe() {
4036
+ return this.getFilePath("recipes");
4037
+ }
4038
+ get pattern() {
4039
+ return this.getFilePath("patterns");
4040
+ }
4041
+ get chunk() {
4042
+ return this.getFilePath("chunks");
4043
+ }
4044
+ get outCss() {
4045
+ return this.getFilePath("styles.css");
4046
+ }
4047
+ get jsx() {
4048
+ return this.getFilePath("jsx");
4049
+ }
3856
4050
  };
3857
4051
 
3858
4052
  // src/engines/file.ts
3859
- var getFileEngine = (config) => {
3860
- const { forceConsistentTypeExtension, outExtension } = config;
3861
- return {
3862
- ext(file) {
3863
- return `${file}.${outExtension}`;
3864
- },
3865
- extDts(file) {
3866
- const dts = outExtension === "mjs" && forceConsistentTypeExtension ? "d.mts" : "d.ts";
3867
- return `${file}.${dts}`;
3868
- },
3869
- __extDts(file) {
3870
- return forceConsistentTypeExtension ? this.extDts(file) : file;
3871
- },
3872
- import(mod, file) {
3873
- return `import { ${mod} } from '${this.ext(file)}';`;
3874
- },
3875
- importType(mod, file) {
3876
- return `import type { ${mod} } from '${this.__extDts(file)}';`;
3877
- },
3878
- exportType(mod, file) {
3879
- return `export type { ${mod} } from '${this.__extDts(file)}';`;
3880
- },
3881
- exportStar(file) {
3882
- return `export * from '${this.ext(file)}';`;
3883
- },
3884
- exportTypeStar(file) {
3885
- return `export * from '${this.__extDts(file)}';`;
3886
- },
3887
- isTypeFile(file) {
3888
- return file.endsWith(".d.ts") || file.endsWith(".d.mts");
3889
- }
3890
- };
4053
+ var FileEngine = class {
4054
+ constructor(config) {
4055
+ this.config = config;
4056
+ }
4057
+ get forceConsistentTypeExtension() {
4058
+ return this.config.forceConsistentTypeExtension || false;
4059
+ }
4060
+ get outExtension() {
4061
+ return this.config.outExtension;
4062
+ }
4063
+ ext(file) {
4064
+ return `${file}.${this.outExtension}`;
4065
+ }
4066
+ extDts(file) {
4067
+ const dts = this.outExtension === "mjs" && this.forceConsistentTypeExtension ? "d.mts" : "d.ts";
4068
+ return `${file}.${dts}`;
4069
+ }
4070
+ __extDts(file) {
4071
+ return this.forceConsistentTypeExtension ? this.extDts(file) : file;
4072
+ }
4073
+ import(mod, file) {
4074
+ return `import { ${mod} } from '${this.ext(file)}';`;
4075
+ }
4076
+ importType(mod, file) {
4077
+ return `import type { ${mod} } from '${this.__extDts(file)}';`;
4078
+ }
4079
+ exportType(mod, file) {
4080
+ return `export type { ${mod} } from '${this.__extDts(file)}';`;
4081
+ }
4082
+ exportStar(file) {
4083
+ return `export * from '${this.ext(file)}';`;
4084
+ }
4085
+ exportTypeStar(file) {
4086
+ return `export * from '${this.__extDts(file)}';`;
4087
+ }
4088
+ isTypeFile(file) {
4089
+ return file.endsWith(".d.ts") || file.endsWith(".d.mts");
4090
+ }
3891
4091
  };
3892
4092
 
3893
4093
  // src/engines/index.ts
3894
- var getEngine = (conf) => {
3895
- const { config } = conf;
3896
- return {
3897
- ...getBaseEngine(conf),
3898
- patterns: getPatternEngine(config),
3899
- jsx: getJsxEngine(config),
3900
- paths: getPathEngine(config),
3901
- file: getFileEngine(config)
3902
- };
4094
+ var helpers2 = { map: import_shared7.mapObject };
4095
+ var defaults = (config) => ({
4096
+ cssVarRoot: ":where(:root, :host)",
4097
+ jsxFactory: "styled",
4098
+ jsxStyleProps: "all",
4099
+ outExtension: "mjs",
4100
+ shorthands: true,
4101
+ syntax: "object-literal",
4102
+ ...config,
4103
+ layers: {
4104
+ reset: "reset",
4105
+ base: "base",
4106
+ tokens: "tokens",
4107
+ recipes: "recipes",
4108
+ utilities: "utilities",
4109
+ ...config.layers
4110
+ }
4111
+ });
4112
+ var Context = class {
4113
+ constructor(conf) {
4114
+ this.conf = conf;
4115
+ const config = defaults(conf.config);
4116
+ const theme = config.theme ?? {};
4117
+ conf.config = config;
4118
+ this.tokens = this.createTokenDictionary(theme);
4119
+ this.utility = this.createUtility(config);
4120
+ this.conditions = this.createConditions(config);
4121
+ this.patterns = new Patterns(config);
4122
+ this.jsx = new JsxEngine(config);
4123
+ this.paths = new PathEngine(config);
4124
+ this.file = new FileEngine(config);
4125
+ this.studio = { outdir: `${config.outdir}-studio`, ...conf.config.studio };
4126
+ this.setupCompositions(theme);
4127
+ this.setupLayers(config.layers);
4128
+ this.setupProperties();
4129
+ this.recipes = this.createRecipes(theme, this.createSheetContext());
4130
+ }
4131
+ studio;
4132
+ // Engines
4133
+ tokens;
4134
+ utility;
4135
+ recipes;
4136
+ conditions;
4137
+ patterns;
4138
+ jsx;
4139
+ paths;
4140
+ file;
4141
+ // Props
4142
+ properties;
4143
+ isValidProperty;
4144
+ // Layers
4145
+ layers;
4146
+ isValidLayerRule;
4147
+ layerString;
4148
+ layerNames;
4149
+ get config() {
4150
+ return this.conf.config;
4151
+ }
4152
+ get hooks() {
4153
+ return this.conf.hooks;
4154
+ }
4155
+ get isTemplateLiteralSyntax() {
4156
+ return this.config.syntax === "template-literal";
4157
+ }
4158
+ get hash() {
4159
+ return {
4160
+ tokens: (0, import_lil_fp.isBool)(this.config.hash) ? this.config.hash : this.config.hash?.cssVar,
4161
+ className: (0, import_lil_fp.isBool)(this.config.hash) ? this.config.hash : this.config.hash?.className
4162
+ };
4163
+ }
4164
+ get prefix() {
4165
+ return {
4166
+ tokens: (0, import_lil_fp.isStr)(this.config.prefix) ? this.config.prefix : this.config.prefix?.cssVar,
4167
+ className: (0, import_lil_fp.isStr)(this.config.prefix) ? this.config.prefix : this.config.prefix?.className
4168
+ };
4169
+ }
4170
+ createTokenDictionary(theme) {
4171
+ return new import_token_dictionary.TokenDictionary({
4172
+ breakpoints: theme.breakpoints,
4173
+ tokens: theme.tokens,
4174
+ semanticTokens: theme.semanticTokens,
4175
+ prefix: this.prefix.tokens,
4176
+ hash: this.hash.tokens
4177
+ });
4178
+ }
4179
+ createUtility(config) {
4180
+ return new import_core5.Utility({
4181
+ prefix: this.prefix.className,
4182
+ tokens: this.tokens,
4183
+ config: this.isTemplateLiteralSyntax ? {} : config.utilities,
4184
+ separator: config.separator,
4185
+ shorthands: config.shorthands,
4186
+ strictTokens: config.strictTokens
4187
+ });
4188
+ }
4189
+ createConditions(config) {
4190
+ return new import_core5.Conditions({
4191
+ conditions: config.conditions,
4192
+ breakpoints: config.theme?.breakpoints
4193
+ });
4194
+ }
4195
+ setupCompositions(theme) {
4196
+ const { textStyles, layerStyles } = theme;
4197
+ const compositions = (0, import_shared7.compact)({ textStyle: textStyles, layerStyle: layerStyles });
4198
+ (0, import_core5.assignCompositions)(compositions, { conditions: this.conditions, utility: this.utility });
4199
+ }
4200
+ setupLayers(layers) {
4201
+ this.layers = layers;
4202
+ this.layerNames = Object.values(layers);
4203
+ this.isValidLayerRule = (0, import_shared7.memo)((layerRule) => {
4204
+ const names = new Set(layerRule.split(",").map((name) => name.trim()));
4205
+ return names.size >= 5 && this.layerNames.every((name) => names.has(name));
4206
+ });
4207
+ this.layerString = `@layer ${this.layerNames.join(", ")};`;
4208
+ }
4209
+ setupProperties() {
4210
+ this.properties = /* @__PURE__ */ new Set(["css", ...this.utility.keys(), ...this.conditions.keys()]);
4211
+ this.isValidProperty = (0, import_shared7.memo)((key) => this.properties.has(key) || (0, import_is_valid_prop3.isCssProperty)(key));
4212
+ }
4213
+ createSheetContext() {
4214
+ return {
4215
+ root: import_postcss3.default.root(),
4216
+ conditions: this.conditions,
4217
+ utility: this.utility,
4218
+ hash: this.hash.className,
4219
+ layers: this.layers,
4220
+ helpers: helpers2
4221
+ };
4222
+ }
4223
+ createSheet(options) {
4224
+ const sheetContext = this.createSheetContext();
4225
+ return new import_core5.Stylesheet(sheetContext, {
4226
+ content: options?.content,
4227
+ recipes: this.config.theme?.recipes,
4228
+ slotRecipes: this.config.theme?.slotRecipes
4229
+ });
4230
+ }
4231
+ createRecipes(theme, context) {
4232
+ const recipeConfigs = Object.assign({}, theme.recipes ?? {}, theme.slotRecipes ?? {});
4233
+ return new import_core5.Recipes(recipeConfigs, context);
4234
+ }
3903
4235
  };
3904
4236
 
3905
4237
  // src/parser-options.ts
@@ -3913,7 +4245,8 @@ var getImportMap = (outdir, configImportMap) => {
3913
4245
  };
3914
4246
  };
3915
4247
  var getParserOptions = (ctx) => {
3916
- const { config, jsx, isValidProperty, patterns, recipes, tsconfig, tsOptions } = ctx;
4248
+ const { config, jsx, isValidProperty, patterns, recipes } = ctx;
4249
+ const { tsconfig, tsOptions } = ctx.conf;
3917
4250
  const compilerOptions = tsconfig?.compilerOptions ?? {};
3918
4251
  const baseUrl = compilerOptions.baseUrl ?? "";
3919
4252
  const cwd = config.cwd;
@@ -3937,48 +4270,41 @@ var getParserOptions = (ctx) => {
3937
4270
  };
3938
4271
 
3939
4272
  // src/generator.ts
3940
- var defaults = (conf) => ({
3941
- ...conf,
3942
- config: {
3943
- cssVarRoot: ":where(:root, :host)",
3944
- jsxFactory: "styled",
3945
- jsxStyleProps: "all",
3946
- outExtension: "mjs",
3947
- shorthands: true,
3948
- syntax: "object-literal",
3949
- ...conf.config,
3950
- layers: {
3951
- reset: "reset",
3952
- base: "base",
3953
- tokens: "tokens",
3954
- recipes: "recipes",
3955
- utilities: "utilities",
3956
- ...conf.config.layers
3957
- }
4273
+ var Generator = class extends Context {
4274
+ messages;
4275
+ parserOptions;
4276
+ constructor(conf) {
4277
+ super(conf);
4278
+ this.parserOptions = getParserOptions(this);
4279
+ this.messages = getMessages(this);
4280
+ }
4281
+ getArtifacts(ids) {
4282
+ return generateArtifacts(this, ids);
4283
+ }
4284
+ getStaticCss() {
4285
+ return generateStaticCss(this);
4286
+ }
4287
+ getResetCss() {
4288
+ return generateResetCss(this);
4289
+ }
4290
+ getTokenCss() {
4291
+ return generateTokenCss(this);
4292
+ }
4293
+ getKeyframeCss() {
4294
+ return generateKeyframeCss(this);
4295
+ }
4296
+ getGlobalCss() {
4297
+ return generateGlobalCss(this);
4298
+ }
4299
+ getCss(options) {
4300
+ return generateFlattenedCss(this, options);
4301
+ }
4302
+ getParserCss(result) {
4303
+ return generateParserCss(this, result);
3958
4304
  }
3959
- });
3960
- var createGenerator = (conf) => {
3961
- const ctx = getEngine(defaults(conf));
3962
- const parserOptions = getParserOptions(ctx);
3963
- return {
3964
- ...ctx,
3965
- getArtifacts: generateArtifacts(ctx),
3966
- //
3967
- getStaticCss: generateStaticCss,
3968
- getResetCss: generateResetCss,
3969
- getTokenCss: generateTokenCss,
3970
- getKeyframeCss: generateKeyframeCss,
3971
- getGlobalCss: generateGlobalCss,
3972
- //
3973
- getCss: generateFlattenedCss(ctx),
3974
- getParserCss: generateParserCss(ctx),
3975
- //
3976
- messages: getMessages(ctx),
3977
- parserOptions
3978
- };
3979
4305
  };
3980
4306
  // Annotate the CommonJS export names for ESM import in node:
3981
4307
  0 && (module.exports = {
3982
- createGenerator,
4308
+ Generator,
3983
4309
  messages
3984
4310
  });