@pandacss/generator 0.5.0 → 0.5.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.d.mts CHANGED
@@ -1,9 +1,8 @@
1
1
  import * as _pandacss_types_dist_shared from '@pandacss/types/dist/shared';
2
2
  import * as _pandacss_core from '@pandacss/core';
3
3
  import * as _pandacss_token_dictionary from '@pandacss/token-dictionary';
4
- import * as _pandacss_types_dist_config from '@pandacss/types/dist/config';
5
4
  import * as _pandacss_types from '@pandacss/types';
6
- import { ConfigResultWithHooks } from '@pandacss/types';
5
+ import { ConfigResultWithHooks, TSConfig } from '@pandacss/types';
7
6
 
8
7
  declare const getEngine: (conf: ConfigResultWithHooks) => {
9
8
  patterns: {
@@ -41,7 +40,7 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
41
40
  upperName: string;
42
41
  typeName: string;
43
42
  componentName: string;
44
- framework: _pandacss_types_dist_config.JsxFramework | undefined;
43
+ framework: ("solid" | "react" | "preact" | "vue" | "qwik") | undefined;
45
44
  };
46
45
  paths: {
47
46
  get: (file?: string | undefined) => string[];
@@ -88,6 +87,8 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
88
87
  hooks: _pandacss_types.PandaHookable;
89
88
  path: string;
90
89
  config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
90
+ tsconfig?: TSConfig | undefined;
91
+ tsconfigFile?: string | undefined;
91
92
  dependencies: string[];
92
93
  };
93
94
  type Context = ReturnType<typeof getEngine>;
@@ -135,27 +136,49 @@ declare namespace messages {
135
136
  }
136
137
 
137
138
  declare const createGenerator: (conf: ConfigResultWithHooks) => {
138
- config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
139
- path: string;
140
- conditions: _pandacss_core.Conditions;
141
- utility: _pandacss_core.Utility;
142
- hash: {
143
- tokens: boolean | undefined;
144
- className: boolean | undefined;
145
- };
146
- prefix: {
147
- tokens: string | undefined;
148
- className: string | undefined;
139
+ getArtifacts: () => _pandacss_types.Artifact[];
140
+ getCss: (options: {
141
+ files: string[];
142
+ resolve?: boolean | undefined;
143
+ }) => string;
144
+ getParserCss: (result: _pandacss_types.ParserResultType) => string | undefined;
145
+ messages: {
146
+ artifactsGenerated: () => string;
147
+ configExists: (cmd: string) => string;
148
+ thankYou: () => string;
149
+ codegenComplete: () => string;
150
+ noExtract: () => string;
151
+ watch: () => string;
152
+ buildComplete: (count: number) => string;
153
+ configWatch: () => string;
149
154
  };
150
- tokens: _pandacss_token_dictionary.TokenDictionary;
151
- jsx: {
152
- factoryName: string;
153
- upperName: string;
154
- typeName: string;
155
- componentName: string;
156
- framework: _pandacss_types_dist_config.JsxFramework | undefined;
155
+ parserOptions: {
156
+ importMap: {
157
+ css: string;
158
+ recipe: string;
159
+ pattern: string;
160
+ jsx: string;
161
+ };
162
+ jsx: {
163
+ factory: string;
164
+ isStyleProp: (key: string) => boolean;
165
+ nodes: ({
166
+ type: "pattern";
167
+ name: string;
168
+ props: string[];
169
+ baseName: string;
170
+ } | {
171
+ type: "recipe";
172
+ name: string;
173
+ props: string[];
174
+ baseName: string;
175
+ jsx: (string | RegExp)[];
176
+ match: RegExp;
177
+ })[];
178
+ };
179
+ getRecipeName: (jsxName: string) => string;
180
+ getRecipeByName: (name: string) => _pandacss_types.RecipeConfig | undefined;
157
181
  };
158
- recipes: _pandacss_core.Recipes;
159
182
  patterns: {
160
183
  transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
161
184
  nodes: {
@@ -186,32 +209,12 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
186
209
  getFnName: (jsx: string) => string;
187
210
  isEmpty: () => boolean;
188
211
  };
189
- studio: {
190
- outdir: string;
191
- logo?: string | undefined;
192
- inject?: {
193
- head?: string | undefined;
194
- body?: string | undefined;
195
- } | undefined;
196
- };
197
- hooks: _pandacss_types.PandaHookable;
198
- createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
199
- properties: string[];
200
- getArtifacts: () => _pandacss_types.Artifact[];
201
- getCss: (options: {
202
- files: string[];
203
- resolve?: boolean | undefined;
204
- }) => string;
205
- getParserCss: (result: _pandacss_types.ParserResultType) => string | undefined;
206
- messages: {
207
- artifactsGenerated: () => string;
208
- configExists: (cmd: string) => string;
209
- thankYou: () => string;
210
- codegenComplete: () => string;
211
- noExtract: () => string;
212
- watch: () => string;
213
- buildComplete: (count: number) => string;
214
- configWatch: () => string;
212
+ jsx: {
213
+ factoryName: string;
214
+ upperName: string;
215
+ typeName: string;
216
+ componentName: string;
217
+ framework: ("solid" | "react" | "preact" | "vue" | "qwik") | undefined;
215
218
  };
216
219
  paths: {
217
220
  get: (file?: string | undefined) => string[];
@@ -231,36 +234,36 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
231
234
  export(file: string): string;
232
235
  };
233
236
  isTemplateLiteralSyntax: boolean;
237
+ studio: {
238
+ outdir: string;
239
+ logo?: string | undefined;
240
+ inject?: {
241
+ head?: string | undefined;
242
+ body?: string | undefined;
243
+ } | undefined;
244
+ };
245
+ hash: {
246
+ tokens: boolean | undefined;
247
+ className: boolean | undefined;
248
+ };
249
+ prefix: {
250
+ tokens: string | undefined;
251
+ className: string | undefined;
252
+ };
253
+ tokens: _pandacss_token_dictionary.TokenDictionary;
254
+ utility: _pandacss_core.Utility;
255
+ properties: string[];
234
256
  isValidProperty: (key: string) => boolean;
257
+ recipes: _pandacss_core.Recipes;
258
+ conditions: _pandacss_core.Conditions;
235
259
  createSheetContext: () => _pandacss_core.StylesheetContext;
260
+ createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
261
+ hooks: _pandacss_types.PandaHookable;
262
+ path: string;
263
+ config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
264
+ tsconfig?: TSConfig | undefined;
265
+ tsconfigFile?: string | undefined;
236
266
  dependencies: string[];
237
- parserOptions: {
238
- importMap: {
239
- css: string;
240
- recipe: string;
241
- pattern: string;
242
- jsx: string;
243
- };
244
- jsx: {
245
- factory: string;
246
- isStyleProp: (key: string) => boolean;
247
- nodes: ({
248
- type: "pattern";
249
- name: string;
250
- props: string[];
251
- baseName: string;
252
- } | {
253
- type: "recipe";
254
- name: string;
255
- props: string[];
256
- baseName: string;
257
- jsx: (string | RegExp)[];
258
- match: RegExp;
259
- })[];
260
- };
261
- getRecipeName: (jsxName: string) => string;
262
- getRecipeByName: (name: string) => _pandacss_types.RecipeConfig | undefined;
263
- };
264
267
  };
265
268
  type Generator = ReturnType<typeof createGenerator>;
266
269
 
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import * as _pandacss_types_dist_shared from '@pandacss/types/dist/shared';
2
2
  import * as _pandacss_core from '@pandacss/core';
3
3
  import * as _pandacss_token_dictionary from '@pandacss/token-dictionary';
4
- import * as _pandacss_types_dist_config from '@pandacss/types/dist/config';
5
4
  import * as _pandacss_types from '@pandacss/types';
6
- import { ConfigResultWithHooks } from '@pandacss/types';
5
+ import { ConfigResultWithHooks, TSConfig } from '@pandacss/types';
7
6
 
8
7
  declare const getEngine: (conf: ConfigResultWithHooks) => {
9
8
  patterns: {
@@ -41,7 +40,7 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
41
40
  upperName: string;
42
41
  typeName: string;
43
42
  componentName: string;
44
- framework: _pandacss_types_dist_config.JsxFramework | undefined;
43
+ framework: ("solid" | "react" | "preact" | "vue" | "qwik") | undefined;
45
44
  };
46
45
  paths: {
47
46
  get: (file?: string | undefined) => string[];
@@ -88,6 +87,8 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
88
87
  hooks: _pandacss_types.PandaHookable;
89
88
  path: string;
90
89
  config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
90
+ tsconfig?: TSConfig | undefined;
91
+ tsconfigFile?: string | undefined;
91
92
  dependencies: string[];
92
93
  };
93
94
  type Context = ReturnType<typeof getEngine>;
@@ -135,27 +136,49 @@ declare namespace messages {
135
136
  }
136
137
 
137
138
  declare const createGenerator: (conf: ConfigResultWithHooks) => {
138
- config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
139
- path: string;
140
- conditions: _pandacss_core.Conditions;
141
- utility: _pandacss_core.Utility;
142
- hash: {
143
- tokens: boolean | undefined;
144
- className: boolean | undefined;
145
- };
146
- prefix: {
147
- tokens: string | undefined;
148
- className: string | undefined;
139
+ getArtifacts: () => _pandacss_types.Artifact[];
140
+ getCss: (options: {
141
+ files: string[];
142
+ resolve?: boolean | undefined;
143
+ }) => string;
144
+ getParserCss: (result: _pandacss_types.ParserResultType) => string | undefined;
145
+ messages: {
146
+ artifactsGenerated: () => string;
147
+ configExists: (cmd: string) => string;
148
+ thankYou: () => string;
149
+ codegenComplete: () => string;
150
+ noExtract: () => string;
151
+ watch: () => string;
152
+ buildComplete: (count: number) => string;
153
+ configWatch: () => string;
149
154
  };
150
- tokens: _pandacss_token_dictionary.TokenDictionary;
151
- jsx: {
152
- factoryName: string;
153
- upperName: string;
154
- typeName: string;
155
- componentName: string;
156
- framework: _pandacss_types_dist_config.JsxFramework | undefined;
155
+ parserOptions: {
156
+ importMap: {
157
+ css: string;
158
+ recipe: string;
159
+ pattern: string;
160
+ jsx: string;
161
+ };
162
+ jsx: {
163
+ factory: string;
164
+ isStyleProp: (key: string) => boolean;
165
+ nodes: ({
166
+ type: "pattern";
167
+ name: string;
168
+ props: string[];
169
+ baseName: string;
170
+ } | {
171
+ type: "recipe";
172
+ name: string;
173
+ props: string[];
174
+ baseName: string;
175
+ jsx: (string | RegExp)[];
176
+ match: RegExp;
177
+ })[];
178
+ };
179
+ getRecipeName: (jsxName: string) => string;
180
+ getRecipeByName: (name: string) => _pandacss_types.RecipeConfig | undefined;
157
181
  };
158
- recipes: _pandacss_core.Recipes;
159
182
  patterns: {
160
183
  transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
161
184
  nodes: {
@@ -186,32 +209,12 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
186
209
  getFnName: (jsx: string) => string;
187
210
  isEmpty: () => boolean;
188
211
  };
189
- studio: {
190
- outdir: string;
191
- logo?: string | undefined;
192
- inject?: {
193
- head?: string | undefined;
194
- body?: string | undefined;
195
- } | undefined;
196
- };
197
- hooks: _pandacss_types.PandaHookable;
198
- createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
199
- properties: string[];
200
- getArtifacts: () => _pandacss_types.Artifact[];
201
- getCss: (options: {
202
- files: string[];
203
- resolve?: boolean | undefined;
204
- }) => string;
205
- getParserCss: (result: _pandacss_types.ParserResultType) => string | undefined;
206
- messages: {
207
- artifactsGenerated: () => string;
208
- configExists: (cmd: string) => string;
209
- thankYou: () => string;
210
- codegenComplete: () => string;
211
- noExtract: () => string;
212
- watch: () => string;
213
- buildComplete: (count: number) => string;
214
- configWatch: () => string;
212
+ jsx: {
213
+ factoryName: string;
214
+ upperName: string;
215
+ typeName: string;
216
+ componentName: string;
217
+ framework: ("solid" | "react" | "preact" | "vue" | "qwik") | undefined;
215
218
  };
216
219
  paths: {
217
220
  get: (file?: string | undefined) => string[];
@@ -231,36 +234,36 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
231
234
  export(file: string): string;
232
235
  };
233
236
  isTemplateLiteralSyntax: boolean;
237
+ studio: {
238
+ outdir: string;
239
+ logo?: string | undefined;
240
+ inject?: {
241
+ head?: string | undefined;
242
+ body?: string | undefined;
243
+ } | undefined;
244
+ };
245
+ hash: {
246
+ tokens: boolean | undefined;
247
+ className: boolean | undefined;
248
+ };
249
+ prefix: {
250
+ tokens: string | undefined;
251
+ className: string | undefined;
252
+ };
253
+ tokens: _pandacss_token_dictionary.TokenDictionary;
254
+ utility: _pandacss_core.Utility;
255
+ properties: string[];
234
256
  isValidProperty: (key: string) => boolean;
257
+ recipes: _pandacss_core.Recipes;
258
+ conditions: _pandacss_core.Conditions;
235
259
  createSheetContext: () => _pandacss_core.StylesheetContext;
260
+ createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
261
+ hooks: _pandacss_types.PandaHookable;
262
+ path: string;
263
+ config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "include" | "outdir" | "cwd">>;
264
+ tsconfig?: TSConfig | undefined;
265
+ tsconfigFile?: string | undefined;
236
266
  dependencies: string[];
237
- parserOptions: {
238
- importMap: {
239
- css: string;
240
- recipe: string;
241
- pattern: string;
242
- jsx: string;
243
- };
244
- jsx: {
245
- factory: string;
246
- isStyleProp: (key: string) => boolean;
247
- nodes: ({
248
- type: "pattern";
249
- name: string;
250
- props: string[];
251
- baseName: string;
252
- } | {
253
- type: "recipe";
254
- name: string;
255
- props: string[];
256
- baseName: string;
257
- jsx: (string | RegExp)[];
258
- match: RegExp;
259
- })[];
260
- };
261
- getRecipeName: (jsxName: string) => string;
262
- getRecipeByName: (name: string) => _pandacss_types.RecipeConfig | undefined;
263
- };
264
267
  };
265
268
  type Generator = ReturnType<typeof createGenerator>;
266
269
 
package/dist/index.js CHANGED
@@ -73,7 +73,7 @@ var artifactsGenerated = (ctx) => {
73
73
  ${tick} ${(0, import_logger.quote)(outdir, "/recipes")}: functions to create multi-variant styles
74
74
  `,
75
75
  jsx.framework && import_outdent.outdent`
76
- ${tick} ${(0, import_logger.quote)(outdir, "/jsx")}: style prop powered elements for ${jsx.framework}
76
+ ${tick} ${(0, import_logger.quote)(outdir, "/jsx")}: styled jsx elements for ${jsx.framework}
77
77
  `,
78
78
  "\n"
79
79
  ].filter(Boolean).join("\n");
@@ -128,9 +128,6 @@ var getMessages = (ctx) => ({
128
128
  configWatch
129
129
  });
130
130
 
131
- // src/generator.ts
132
- var import_lil_fp3 = require("lil-fp");
133
-
134
131
  // src/artifacts/index.ts
135
132
  var import_shared4 = require("@pandacss/shared");
136
133
  var import_outdent41 = __toESM(require("outdent"));
@@ -415,7 +412,7 @@ var generateStaticCss = (ctx) => {
415
412
  const fn = (0, import_core2.getStaticCss)(staticCss);
416
413
  const results = fn({
417
414
  breakpoints: Object.keys(theme.breakpoints ?? {}),
418
- getPropertyKeys: utility.getPropertyKeys,
415
+ getPropertyKeys: (prop) => utility.getPropertyKeys(prop).filter((key) => !key.startsWith("type:") && !key.startsWith("CssProperties:")),
419
416
  getRecipeKeys: (recipe) => recipes.details.find((detail) => detail.config.name === recipe)?.variantKeyMap ?? {}
420
417
  });
421
418
  results.css.forEach((css2) => {
@@ -750,7 +747,7 @@ function generateCvaFn(ctx) {
750
747
 
751
748
  return Object.assign(cvaFn, {
752
749
  __cva__: true,
753
- variants: variantMap,
750
+ variantMap,
754
751
  variantKeys,
755
752
  resolve,
756
753
  config,
@@ -829,7 +826,7 @@ var import_outdent8 = require("outdent");
829
826
 
830
827
  // src/artifacts/generated/helpers.mjs.json
831
828
  var helpers_mjs_default = {
832
- content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec(val.replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n result[key] = inner(child, childPath);\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate.ts\nvar dashCaseRegex = /[A-Z]/g;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);\n});\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\nexport {\n astish,\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
829
+ content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nvar isNotNullish = (element) => element != null;\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n const next = inner(child, childPath);\n if (isNotNullish(next)) {\n result[key] = next;\n }\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate.ts\nvar dashCaseRegex = /[A-Z]/g;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);\n});\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\nexport {\n astish,\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
833
830
  };
834
831
 
835
832
  // src/artifacts/js/helpers.ts
@@ -3127,9 +3124,9 @@ var generateFlattenedCss = (ctx) => (options) => {
3127
3124
  const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
3128
3125
  const unresolved = [
3129
3126
  "@layer reset, base, tokens, recipes, utilities;",
3127
+ preflight && "@import './reset.css';",
3130
3128
  "@import './global.css';",
3131
3129
  staticCss && "@import './static.css';",
3132
- preflight && "@import './reset.css';",
3133
3130
  !ctx.tokens.isEmpty && "@import './tokens/index.css';",
3134
3131
  keyframes && "@import './tokens/keyframes.css';"
3135
3132
  ].filter(Boolean).join("\n\n");
@@ -3431,25 +3428,31 @@ var getImportMap = (outdir) => ({
3431
3428
  pattern: `${outdir}/patterns`,
3432
3429
  jsx: `${outdir}/jsx`
3433
3430
  });
3434
- var createGenerator = (conf) => (0, import_lil_fp3.pipe)(
3435
- getEngine(defaults(conf)),
3436
- import_lil_fp3.Obj.assign((ctx) => ({
3431
+ var createGenerator = (conf) => {
3432
+ const ctx = getEngine(defaults(conf));
3433
+ const { config, jsx, isValidProperty, patterns, recipes } = ctx;
3434
+ const compilerOptions = conf.tsconfig?.compilerOptions ?? {};
3435
+ const baseUrl = compilerOptions.baseUrl ?? "";
3436
+ const cwd = conf.config.cwd;
3437
+ const relativeBaseUrl = baseUrl ? baseUrl.replace(cwd, "").slice(1) + "/" : cwd;
3438
+ return {
3439
+ ...ctx,
3437
3440
  getArtifacts: generateArtifacts(ctx),
3438
3441
  getCss: generateFlattenedCss(ctx),
3439
3442
  getParserCss: generateParserCss(ctx),
3440
- messages: getMessages(ctx)
3441
- })),
3442
- import_lil_fp3.Obj.bind("parserOptions", ({ config: { outdir }, jsx, isValidProperty, patterns, recipes }) => ({
3443
- importMap: getImportMap(outdir),
3444
- jsx: {
3445
- factory: jsx.factoryName,
3446
- isStyleProp: isValidProperty,
3447
- nodes: [...patterns.nodes, ...recipes.nodes]
3448
- },
3449
- getRecipeName: recipes.getFnName,
3450
- getRecipeByName: recipes.getConfig
3451
- }))
3452
- );
3443
+ messages: getMessages(ctx),
3444
+ parserOptions: {
3445
+ importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
3446
+ jsx: {
3447
+ factory: jsx.factoryName,
3448
+ isStyleProp: isValidProperty,
3449
+ nodes: [...patterns.nodes, ...recipes.nodes]
3450
+ },
3451
+ getRecipeName: recipes.getFnName,
3452
+ getRecipeByName: recipes.getConfig
3453
+ }
3454
+ };
3455
+ };
3453
3456
  // Annotate the CommonJS export names for ESM import in node:
3454
3457
  0 && (module.exports = {
3455
3458
  createGenerator,
package/dist/index.mjs CHANGED
@@ -42,7 +42,7 @@ var artifactsGenerated = (ctx) => {
42
42
  ${tick} ${quote(outdir, "/recipes")}: functions to create multi-variant styles
43
43
  `,
44
44
  jsx.framework && outdent`
45
- ${tick} ${quote(outdir, "/jsx")}: style prop powered elements for ${jsx.framework}
45
+ ${tick} ${quote(outdir, "/jsx")}: styled jsx elements for ${jsx.framework}
46
46
  `,
47
47
  "\n"
48
48
  ].filter(Boolean).join("\n");
@@ -97,9 +97,6 @@ var getMessages = (ctx) => ({
97
97
  configWatch
98
98
  });
99
99
 
100
- // src/generator.ts
101
- import { Obj as Obj2, pipe as pipe3 } from "lil-fp";
102
-
103
100
  // src/artifacts/index.ts
104
101
  import { isObject } from "@pandacss/shared";
105
102
  import outdent41 from "outdent";
@@ -384,7 +381,7 @@ var generateStaticCss = (ctx) => {
384
381
  const fn = getStaticCss(staticCss);
385
382
  const results = fn({
386
383
  breakpoints: Object.keys(theme.breakpoints ?? {}),
387
- getPropertyKeys: utility.getPropertyKeys,
384
+ getPropertyKeys: (prop) => utility.getPropertyKeys(prop).filter((key) => !key.startsWith("type:") && !key.startsWith("CssProperties:")),
388
385
  getRecipeKeys: (recipe) => recipes.details.find((detail) => detail.config.name === recipe)?.variantKeyMap ?? {}
389
386
  });
390
387
  results.css.forEach((css2) => {
@@ -719,7 +716,7 @@ function generateCvaFn(ctx) {
719
716
 
720
717
  return Object.assign(cvaFn, {
721
718
  __cva__: true,
722
- variants: variantMap,
719
+ variantMap,
723
720
  variantKeys,
724
721
  resolve,
725
722
  config,
@@ -798,7 +795,7 @@ import { outdent as outdent8 } from "outdent";
798
795
 
799
796
  // src/artifacts/generated/helpers.mjs.json
800
797
  var helpers_mjs_default = {
801
- content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec(val.replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n result[key] = inner(child, childPath);\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate.ts\nvar dashCaseRegex = /[A-Z]/g;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);\n});\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\nexport {\n astish,\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
798
+ content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nvar isNotNullish = (element) => element != null;\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n const next = inner(child, childPath);\n if (isNotNullish(next)) {\n result[key] = next;\n }\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate.ts\nvar dashCaseRegex = /[A-Z]/g;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(dashCaseRegex, (match) => `-${match.toLowerCase()}`);\n});\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\nexport {\n astish,\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
802
799
  };
803
800
 
804
801
  // src/artifacts/js/helpers.ts
@@ -3096,9 +3093,9 @@ var generateFlattenedCss = (ctx) => (options) => {
3096
3093
  const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
3097
3094
  const unresolved = [
3098
3095
  "@layer reset, base, tokens, recipes, utilities;",
3096
+ preflight && "@import './reset.css';",
3099
3097
  "@import './global.css';",
3100
3098
  staticCss && "@import './static.css';",
3101
- preflight && "@import './reset.css';",
3102
3099
  !ctx.tokens.isEmpty && "@import './tokens/index.css';",
3103
3100
  keyframes && "@import './tokens/keyframes.css';"
3104
3101
  ].filter(Boolean).join("\n\n");
@@ -3406,25 +3403,31 @@ var getImportMap = (outdir) => ({
3406
3403
  pattern: `${outdir}/patterns`,
3407
3404
  jsx: `${outdir}/jsx`
3408
3405
  });
3409
- var createGenerator = (conf) => pipe3(
3410
- getEngine(defaults(conf)),
3411
- Obj2.assign((ctx) => ({
3406
+ var createGenerator = (conf) => {
3407
+ const ctx = getEngine(defaults(conf));
3408
+ const { config, jsx, isValidProperty, patterns, recipes } = ctx;
3409
+ const compilerOptions = conf.tsconfig?.compilerOptions ?? {};
3410
+ const baseUrl = compilerOptions.baseUrl ?? "";
3411
+ const cwd = conf.config.cwd;
3412
+ const relativeBaseUrl = baseUrl ? baseUrl.replace(cwd, "").slice(1) + "/" : cwd;
3413
+ return {
3414
+ ...ctx,
3412
3415
  getArtifacts: generateArtifacts(ctx),
3413
3416
  getCss: generateFlattenedCss(ctx),
3414
3417
  getParserCss: generateParserCss(ctx),
3415
- messages: getMessages(ctx)
3416
- })),
3417
- Obj2.bind("parserOptions", ({ config: { outdir }, jsx, isValidProperty, patterns, recipes }) => ({
3418
- importMap: getImportMap(outdir),
3419
- jsx: {
3420
- factory: jsx.factoryName,
3421
- isStyleProp: isValidProperty,
3422
- nodes: [...patterns.nodes, ...recipes.nodes]
3423
- },
3424
- getRecipeName: recipes.getFnName,
3425
- getRecipeByName: recipes.getConfig
3426
- }))
3427
- );
3418
+ messages: getMessages(ctx),
3419
+ parserOptions: {
3420
+ importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
3421
+ jsx: {
3422
+ factory: jsx.factoryName,
3423
+ isStyleProp: isValidProperty,
3424
+ nodes: [...patterns.nodes, ...recipes.nodes]
3425
+ },
3426
+ getRecipeName: recipes.getFnName,
3427
+ getRecipeByName: recipes.getConfig
3428
+ }
3429
+ };
3430
+ };
3428
3431
  export {
3429
3432
  createGenerator,
3430
3433
  messages_exports as messages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
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.24",
22
22
  "ts-pattern": "4.3.0",
23
- "@pandacss/core": "0.5.0",
24
- "@pandacss/is-valid-prop": "0.5.0",
25
- "@pandacss/logger": "0.5.0",
26
- "@pandacss/shared": "0.5.0",
27
- "@pandacss/token-dictionary": "0.5.0",
28
- "@pandacss/types": "0.5.0"
23
+ "@pandacss/core": "0.5.1",
24
+ "@pandacss/is-valid-prop": "0.5.1",
25
+ "@pandacss/logger": "0.5.1",
26
+ "@pandacss/shared": "0.5.1",
27
+ "@pandacss/token-dictionary": "0.5.1",
28
+ "@pandacss/types": "0.5.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.29",
32
32
  "hookable": "5.5.3",
33
- "@pandacss/fixture": "0.5.0"
33
+ "@pandacss/fixture": "0.5.1"
34
34
  },
35
35
  "scripts": {
36
36
  "prebuild": "tsx scripts/prebuild.ts",