@pandacss/generator 0.0.0-dev-20240111225338 → 0.0.0-dev-20240112213207

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
@@ -281,7 +281,7 @@ var import_outdent5 = require("outdent");
281
281
  function generateCvaFn(ctx) {
282
282
  return {
283
283
  js: import_outdent5.outdent`
284
- ${ctx.file.import("compact, mergeProps, splitProps, uniq", "../helpers")}
284
+ ${ctx.file.import("compact, mergeProps, memo, splitProps, uniq", "../helpers")}
285
285
  ${ctx.file.import("css, mergeCss", "./css")}
286
286
 
287
287
  const defaults = (conf) => ({
@@ -332,7 +332,7 @@ function generateCvaFn(ctx) {
332
332
 
333
333
  const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]))
334
334
 
335
- return Object.assign(cvaFn, {
335
+ return Object.assign(memo(cvaFn), {
336
336
  __cva__: true,
337
337
  variantMap,
338
338
  variantKeys,
@@ -418,7 +418,7 @@ var astish_mjs_default = {
418
418
 
419
419
  // src/artifacts/generated/helpers.mjs.json
420
420
  var helpers_mjs_default = {
421
- content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\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 objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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-property.ts\nvar wordRegex = /([A-Z])/g;\nvar msRegex = /^ms-/;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();\n});\n\n// src/slot.ts\nvar getSlotRecipes = (recipe = {}) => {\n const init = (slot) => ({\n className: [recipe.className, slot].filter(Boolean).join("__"),\n base: recipe.base?.[slot] ?? {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []\n });\n const slots = recipe.slots ?? [];\n const recipeParts = slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\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}\n\n// src/uniq.ts\nvar uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n splitProps,\n toHash,\n uniq,\n walkObject,\n withoutSpace\n};\n'
421
+ content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\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 = /\\s*!(important)?/i;\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 objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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/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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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 memo((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: memo(mergeCss), assignCss };\n}\n\n// src/hypenate-property.ts\nvar wordRegex = /([A-Z])/g;\nvar msRegex = /^ms-/;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();\n});\n\n// src/slot.ts\nvar getSlotRecipes = (recipe = {}) => {\n const init = (slot) => ({\n className: [recipe.className, slot].filter(Boolean).join("__"),\n base: recipe.base?.[slot] ?? {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []\n });\n const slots = recipe.slots ?? [];\n const recipeParts = slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\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}\n\n// src/uniq.ts\nvar uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n splitProps,\n toHash,\n uniq,\n walkObject,\n withoutSpace\n};\n'
422
422
  };
423
423
 
424
424
  // src/artifacts/generated/normalize-html.mjs.json
@@ -719,7 +719,7 @@ function generateRecipes(ctx, filters) {
719
719
  const jsCode = (0, import_ts_pattern4.match)(config).when(
720
720
  import_core.Recipes.isSlotRecipeConfig,
721
721
  (config2) => import_outdent11.outdent`
722
- ${ctx.file.import("splitProps, getSlotCompoundVariant", "../helpers")}
722
+ ${ctx.file.import("getSlotCompoundVariant, memo, splitProps", "../helpers")}
723
723
  ${ctx.file.import("createRecipe", "./create-recipe")}
724
724
 
725
725
  const ${baseName}DefaultVariants = ${stringify2(defaultVariants ?? {})}
@@ -728,9 +728,9 @@ function generateRecipes(ctx, filters) {
728
728
  const ${baseName}SlotNames = ${stringify2(config2.slots.map((slot) => [slot, `${config2.className}__${slot}`]))}
729
729
  const ${baseName}SlotFns = /* @__PURE__ */ ${baseName}SlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, ${baseName}DefaultVariants, getSlotCompoundVariant(${baseName}CompoundVariants, slotName))])
730
730
 
731
- const ${baseName}Fn = (props = {}) => {
731
+ const ${baseName}Fn = memo((props = {}) => {
732
732
  return Object.fromEntries(${baseName}SlotFns.map(([slotName, slotFn]) => [slotName, slotFn(props)]))
733
- }
733
+ })
734
734
 
735
735
  const ${baseName}VariantKeys = ${stringify2(Object.keys(variantKeyMap))}
736
736
 
@@ -747,7 +747,7 @@ function generateRecipes(ctx, filters) {
747
747
  `
748
748
  ).otherwise(
749
749
  (config2) => import_outdent11.outdent`
750
- ${ctx.file.import("splitProps", "../helpers")}
750
+ ${ctx.file.import("memo, splitProps", "../helpers")}
751
751
  ${ctx.file.import("createRecipe, mergeRecipes", "./create-recipe")}
752
752
 
753
753
  const ${baseName}Fn = /* @__PURE__ */ createRecipe('${config2.className}', ${stringify2(
@@ -758,7 +758,7 @@ function generateRecipes(ctx, filters) {
758
758
 
759
759
  const ${baseName}VariantKeys = Object.keys(${baseName}VariantMap)
760
760
 
761
- export const ${baseName} = /* @__PURE__ */ Object.assign(${baseName}Fn, {
761
+ export const ${baseName} = /* @__PURE__ */ Object.assign(memo(${baseName}Fn), {
762
762
  __recipe__: true,
763
763
  __name__: '${baseName}',
764
764
  raw: (props) => props,
@@ -818,7 +818,7 @@ var import_outdent12 = require("outdent");
818
818
  function generateSvaFn(ctx) {
819
819
  return {
820
820
  js: import_outdent12.outdent`
821
- ${ctx.file.import("getSlotRecipes, splitProps", "../helpers")}
821
+ ${ctx.file.import("getSlotRecipes, memo, splitProps", "../helpers")}
822
822
  ${ctx.file.import("cva", "./cva")}
823
823
 
824
824
  export function sva(config) {
@@ -845,7 +845,7 @@ function generateSvaFn(ctx) {
845
845
  Object.entries(variants).map(([key, value]) => [key, Object.keys(value)])
846
846
  );
847
847
 
848
- return Object.assign(svaFn, {
848
+ return Object.assign(memo(svaFn), {
849
849
  __cva__: false,
850
850
  raw,
851
851
  variantMap,
@@ -3506,20 +3506,14 @@ var generateGlobalCss = (ctx, sheet) => {
3506
3506
 
3507
3507
  // src/artifacts/css/keyframe-css.ts
3508
3508
  var import_core2 = require("@pandacss/core");
3509
- var import_postcss = __toESM(require("postcss"));
3510
3509
  function generateKeyframeCss(ctx, sheet) {
3511
3510
  const { keyframes = {} } = ctx.config.theme ?? {};
3512
- const root = import_postcss.default.root();
3511
+ const result = {};
3513
3512
  for (const [name, definition] of Object.entries(keyframes)) {
3514
- root.append(
3515
- import_postcss.default.atRule({
3516
- name: "keyframes",
3517
- params: name,
3518
- nodes: (0, import_core2.toCss)(definition).root.nodes
3519
- })
3520
- );
3513
+ result[`@keyframes ${name}`] = definition;
3521
3514
  }
3522
- sheet.layers.tokens.append(root);
3515
+ const css2 = (0, import_core2.stringify)(sheet.serialize(result));
3516
+ sheet.layers.tokens.append(css2);
3523
3517
  void ctx.hooks.callHook("generator:css", "keyframes.css", "");
3524
3518
  }
3525
3519
 
@@ -3780,7 +3774,7 @@ var generateStaticCss = (ctx, sheet) => {
3780
3774
 
3781
3775
  // src/artifacts/css/token-css.ts
3782
3776
  var import_core3 = require("@pandacss/core");
3783
- var import_postcss2 = __toESM(require("postcss"));
3777
+ var import_postcss = __toESM(require("postcss"));
3784
3778
  function generateTokenCss(ctx, sheet) {
3785
3779
  const {
3786
3780
  config: { cssVarRoot },
@@ -3794,11 +3788,11 @@ function generateTokenCss(ctx, sheet) {
3794
3788
  if (Object.keys(varsObj).length === 0)
3795
3789
  continue;
3796
3790
  if (key === "base") {
3797
- const { css: css3 } = (0, import_core3.toCss)({ [root]: varsObj });
3791
+ const css3 = (0, import_core3.stringify)({ [root]: varsObj });
3798
3792
  results.push(css3);
3799
3793
  } else {
3800
3794
  const keys = key.split(":");
3801
- const { css: css3 } = (0, import_core3.toCss)(varsObj);
3795
+ const css3 = (0, import_core3.stringify)(varsObj);
3802
3796
  const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
3803
3797
  const parent = (0, import_core3.extractParentSelectors)(condition);
3804
3798
  return parent ? `&${parent}` : condition;
@@ -3816,15 +3810,15 @@ function generateTokenCss(ctx, sheet) {
3816
3810
  void ctx.hooks.callHook("generator:css", "tokens.css", "");
3817
3811
  }
3818
3812
  function getDeepestRule(root, selectors) {
3819
- const rule = import_postcss2.default.rule({ selector: "" });
3813
+ const rule = import_postcss.default.rule({ selector: "" });
3820
3814
  for (const selector of selectors) {
3821
3815
  const last = getDeepestNode(rule);
3822
3816
  const node = last ?? rule;
3823
3817
  if (selector.startsWith("@")) {
3824
- const atRule = import_postcss2.default.rule({ selector, nodes: [import_postcss2.default.rule({ selector: `${root}&` })] });
3818
+ const atRule = import_postcss.default.rule({ selector, nodes: [import_postcss.default.rule({ selector: `${root}&` })] });
3825
3819
  node.append(atRule);
3826
3820
  } else {
3827
- node.append(import_postcss2.default.rule({ selector }));
3821
+ node.append(import_postcss.default.rule({ selector }));
3828
3822
  }
3829
3823
  }
3830
3824
  return rule;
@@ -3836,7 +3830,7 @@ function getDeepestNode(node) {
3836
3830
  return node;
3837
3831
  }
3838
3832
  function cleanupSelectors(css2, varSelector) {
3839
- const root = import_postcss2.default.parse(css2);
3833
+ const root = import_postcss.default.parse(css2);
3840
3834
  root.walkRules((rule) => {
3841
3835
  const selectors = [];
3842
3836
  rule.selectors.forEach((selector) => {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/generator.ts
2
- import { Context } from "@pandacss/core";
2
+ import { Context as Context2 } from "@pandacss/core";
3
3
  import { match as match12 } from "ts-pattern";
4
4
 
5
5
  // src/artifacts/setup-artifacts.ts
@@ -245,7 +245,7 @@ import { outdent as outdent5 } from "outdent";
245
245
  function generateCvaFn(ctx) {
246
246
  return {
247
247
  js: outdent5`
248
- ${ctx.file.import("compact, mergeProps, splitProps, uniq", "../helpers")}
248
+ ${ctx.file.import("compact, mergeProps, memo, splitProps, uniq", "../helpers")}
249
249
  ${ctx.file.import("css, mergeCss", "./css")}
250
250
 
251
251
  const defaults = (conf) => ({
@@ -296,7 +296,7 @@ function generateCvaFn(ctx) {
296
296
 
297
297
  const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]))
298
298
 
299
- return Object.assign(cvaFn, {
299
+ return Object.assign(memo(cvaFn), {
300
300
  __cva__: true,
301
301
  variantMap,
302
302
  variantKeys,
@@ -382,7 +382,7 @@ var astish_mjs_default = {
382
382
 
383
383
  // src/artifacts/generated/helpers.mjs.json
384
384
  var helpers_mjs_default = {
385
- content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\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 objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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-property.ts\nvar wordRegex = /([A-Z])/g;\nvar msRegex = /^ms-/;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();\n});\n\n// src/slot.ts\nvar getSlotRecipes = (recipe = {}) => {\n const init = (slot) => ({\n className: [recipe.className, slot].filter(Boolean).join("__"),\n base: recipe.base?.[slot] ?? {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []\n });\n const slots = recipe.slots ?? [];\n const recipeParts = slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\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}\n\n// src/uniq.ts\nvar uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n splitProps,\n toHash,\n uniq,\n walkObject,\n withoutSpace\n};\n'
385
+ content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\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 = /\\s*!(important)?/i;\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 objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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/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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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 memo((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: memo(mergeCss), assignCss };\n}\n\n// src/hypenate-property.ts\nvar wordRegex = /([A-Z])/g;\nvar msRegex = /^ms-/;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();\n});\n\n// src/slot.ts\nvar getSlotRecipes = (recipe = {}) => {\n const init = (slot) => ({\n className: [recipe.className, slot].filter(Boolean).join("__"),\n base: recipe.base?.[slot] ?? {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []\n });\n const slots = recipe.slots ?? [];\n const recipeParts = slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\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}\n\n// src/uniq.ts\nvar uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n splitProps,\n toHash,\n uniq,\n walkObject,\n withoutSpace\n};\n'
386
386
  };
387
387
 
388
388
  // src/artifacts/generated/normalize-html.mjs.json
@@ -683,7 +683,7 @@ function generateRecipes(ctx, filters) {
683
683
  const jsCode = match4(config).when(
684
684
  Recipes.isSlotRecipeConfig,
685
685
  (config2) => outdent11`
686
- ${ctx.file.import("splitProps, getSlotCompoundVariant", "../helpers")}
686
+ ${ctx.file.import("getSlotCompoundVariant, memo, splitProps", "../helpers")}
687
687
  ${ctx.file.import("createRecipe", "./create-recipe")}
688
688
 
689
689
  const ${baseName}DefaultVariants = ${stringify2(defaultVariants ?? {})}
@@ -692,9 +692,9 @@ function generateRecipes(ctx, filters) {
692
692
  const ${baseName}SlotNames = ${stringify2(config2.slots.map((slot) => [slot, `${config2.className}__${slot}`]))}
693
693
  const ${baseName}SlotFns = /* @__PURE__ */ ${baseName}SlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, ${baseName}DefaultVariants, getSlotCompoundVariant(${baseName}CompoundVariants, slotName))])
694
694
 
695
- const ${baseName}Fn = (props = {}) => {
695
+ const ${baseName}Fn = memo((props = {}) => {
696
696
  return Object.fromEntries(${baseName}SlotFns.map(([slotName, slotFn]) => [slotName, slotFn(props)]))
697
- }
697
+ })
698
698
 
699
699
  const ${baseName}VariantKeys = ${stringify2(Object.keys(variantKeyMap))}
700
700
 
@@ -711,7 +711,7 @@ function generateRecipes(ctx, filters) {
711
711
  `
712
712
  ).otherwise(
713
713
  (config2) => outdent11`
714
- ${ctx.file.import("splitProps", "../helpers")}
714
+ ${ctx.file.import("memo, splitProps", "../helpers")}
715
715
  ${ctx.file.import("createRecipe, mergeRecipes", "./create-recipe")}
716
716
 
717
717
  const ${baseName}Fn = /* @__PURE__ */ createRecipe('${config2.className}', ${stringify2(
@@ -722,7 +722,7 @@ function generateRecipes(ctx, filters) {
722
722
 
723
723
  const ${baseName}VariantKeys = Object.keys(${baseName}VariantMap)
724
724
 
725
- export const ${baseName} = /* @__PURE__ */ Object.assign(${baseName}Fn, {
725
+ export const ${baseName} = /* @__PURE__ */ Object.assign(memo(${baseName}Fn), {
726
726
  __recipe__: true,
727
727
  __name__: '${baseName}',
728
728
  raw: (props) => props,
@@ -782,7 +782,7 @@ import { outdent as outdent12 } from "outdent";
782
782
  function generateSvaFn(ctx) {
783
783
  return {
784
784
  js: outdent12`
785
- ${ctx.file.import("getSlotRecipes, splitProps", "../helpers")}
785
+ ${ctx.file.import("getSlotRecipes, memo, splitProps", "../helpers")}
786
786
  ${ctx.file.import("cva", "./cva")}
787
787
 
788
788
  export function sva(config) {
@@ -809,7 +809,7 @@ function generateSvaFn(ctx) {
809
809
  Object.entries(variants).map(([key, value]) => [key, Object.keys(value)])
810
810
  );
811
811
 
812
- return Object.assign(svaFn, {
812
+ return Object.assign(memo(svaFn), {
813
813
  __cva__: false,
814
814
  raw,
815
815
  variantMap,
@@ -3469,21 +3469,15 @@ var generateGlobalCss = (ctx, sheet) => {
3469
3469
  };
3470
3470
 
3471
3471
  // src/artifacts/css/keyframe-css.ts
3472
- import { toCss } from "@pandacss/core";
3473
- import postcss from "postcss";
3472
+ import { stringify as stringify3 } from "@pandacss/core";
3474
3473
  function generateKeyframeCss(ctx, sheet) {
3475
3474
  const { keyframes = {} } = ctx.config.theme ?? {};
3476
- const root = postcss.root();
3475
+ const result = {};
3477
3476
  for (const [name, definition] of Object.entries(keyframes)) {
3478
- root.append(
3479
- postcss.atRule({
3480
- name: "keyframes",
3481
- params: name,
3482
- nodes: toCss(definition).root.nodes
3483
- })
3484
- );
3477
+ result[`@keyframes ${name}`] = definition;
3485
3478
  }
3486
- sheet.layers.tokens.append(root);
3479
+ const css2 = stringify3(sheet.serialize(result));
3480
+ sheet.layers.tokens.append(css2);
3487
3481
  void ctx.hooks.callHook("generator:css", "keyframes.css", "");
3488
3482
  }
3489
3483
 
@@ -3743,8 +3737,8 @@ var generateStaticCss = (ctx, sheet) => {
3743
3737
  };
3744
3738
 
3745
3739
  // src/artifacts/css/token-css.ts
3746
- import { expandNestedCss, extractParentSelectors, toCss as toCss2 } from "@pandacss/core";
3747
- import postcss2 from "postcss";
3740
+ import { expandNestedCss, extractParentSelectors, stringify as stringify4 } from "@pandacss/core";
3741
+ import postcss from "postcss";
3748
3742
  function generateTokenCss(ctx, sheet) {
3749
3743
  const {
3750
3744
  config: { cssVarRoot },
@@ -3758,11 +3752,11 @@ function generateTokenCss(ctx, sheet) {
3758
3752
  if (Object.keys(varsObj).length === 0)
3759
3753
  continue;
3760
3754
  if (key === "base") {
3761
- const { css: css3 } = toCss2({ [root]: varsObj });
3755
+ const css3 = stringify4({ [root]: varsObj });
3762
3756
  results.push(css3);
3763
3757
  } else {
3764
3758
  const keys = key.split(":");
3765
- const { css: css3 } = toCss2(varsObj);
3759
+ const css3 = stringify4(varsObj);
3766
3760
  const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
3767
3761
  const parent = extractParentSelectors(condition);
3768
3762
  return parent ? `&${parent}` : condition;
@@ -3780,15 +3774,15 @@ function generateTokenCss(ctx, sheet) {
3780
3774
  void ctx.hooks.callHook("generator:css", "tokens.css", "");
3781
3775
  }
3782
3776
  function getDeepestRule(root, selectors) {
3783
- const rule = postcss2.rule({ selector: "" });
3777
+ const rule = postcss.rule({ selector: "" });
3784
3778
  for (const selector of selectors) {
3785
3779
  const last = getDeepestNode(rule);
3786
3780
  const node = last ?? rule;
3787
3781
  if (selector.startsWith("@")) {
3788
- const atRule = postcss2.rule({ selector, nodes: [postcss2.rule({ selector: `${root}&` })] });
3782
+ const atRule = postcss.rule({ selector, nodes: [postcss.rule({ selector: `${root}&` })] });
3789
3783
  node.append(atRule);
3790
3784
  } else {
3791
- node.append(postcss2.rule({ selector }));
3785
+ node.append(postcss.rule({ selector }));
3792
3786
  }
3793
3787
  }
3794
3788
  return rule;
@@ -3800,7 +3794,7 @@ function getDeepestNode(node) {
3800
3794
  return node;
3801
3795
  }
3802
3796
  function cleanupSelectors(css2, varSelector) {
3803
- const root = postcss2.parse(css2);
3797
+ const root = postcss.parse(css2);
3804
3798
  root.walkRules((rule) => {
3805
3799
  const selectors = [];
3806
3800
  rule.selectors.forEach((selector) => {
@@ -3826,7 +3820,7 @@ function cleanupSelectors(css2, varSelector) {
3826
3820
  }
3827
3821
 
3828
3822
  // src/generator.ts
3829
- var Generator = class extends Context {
3823
+ var Generator = class extends Context2 {
3830
3824
  constructor(conf) {
3831
3825
  super(conf);
3832
3826
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20240111225338",
3
+ "version": "0.0.0-dev-20240112213207",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -37,12 +37,12 @@
37
37
  "pluralize": "8.0.0",
38
38
  "postcss": "^8.4.31",
39
39
  "ts-pattern": "5.0.5",
40
- "@pandacss/core": "0.0.0-dev-20240111225338",
41
- "@pandacss/is-valid-prop": "^0.0.0-dev-20240111225338",
42
- "@pandacss/logger": "0.0.0-dev-20240111225338",
43
- "@pandacss/shared": "0.0.0-dev-20240111225338",
44
- "@pandacss/token-dictionary": "0.0.0-dev-20240111225338",
45
- "@pandacss/types": "0.0.0-dev-20240111225338"
40
+ "@pandacss/core": "0.0.0-dev-20240112213207",
41
+ "@pandacss/is-valid-prop": "^0.0.0-dev-20240112213207",
42
+ "@pandacss/logger": "0.0.0-dev-20240112213207",
43
+ "@pandacss/shared": "0.0.0-dev-20240112213207",
44
+ "@pandacss/token-dictionary": "0.0.0-dev-20240112213207",
45
+ "@pandacss/types": "0.0.0-dev-20240112213207"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/pluralize": "0.0.33",