@pandacss/generator 0.17.0 → 0.17.2

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
@@ -299,6 +299,14 @@ function generateResetCss(ctx, scope = "") {
299
299
  background-image: none;
300
300
  }
301
301
 
302
+ ${selector}button,
303
+ ${selector}input,
304
+ ${selector}optgroup,
305
+ ${selector}select,
306
+ ${selector}textarea {
307
+ color: inherit;
308
+ }
309
+
302
310
  ${selector}button,
303
311
  ${selector}select {
304
312
  text-transform: none;
@@ -913,7 +921,7 @@ var import_outdent8 = require("outdent");
913
921
 
914
922
  // src/artifacts/generated/helpers.mjs.json
915
923
  var helpers_mjs_default = {
916
- 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 __sources = sources.filter(Boolean);\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-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'
924
+ 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 (!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-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'
917
925
  };
918
926
 
919
927
  // src/artifacts/generated/astish.mjs.json
@@ -1405,7 +1413,7 @@ function generatePreactJsxFactory(ctx) {
1405
1413
 
1406
1414
  const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
1407
1415
  const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
1408
-
1416
+
1409
1417
  const defaultProps = Object.assign(
1410
1418
  options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
1411
1419
  options.defaultProps,
@@ -1419,8 +1427,8 @@ function generatePreactJsxFactory(ctx) {
1419
1427
 
1420
1428
  const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
1421
1429
 
1422
- const [forwardedProps, variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
1423
- return splitProps(combinedProps, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty, normalizeHTMLProps.keys)
1430
+ const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
1431
+ return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
1424
1432
  }, [combinedProps])
1425
1433
 
1426
1434
  function recipeClass() {
@@ -1448,12 +1456,12 @@ function generatePreactJsxFactory(ctx) {
1448
1456
  })
1449
1457
 
1450
1458
  const name = getDisplayName(Dynamic)
1451
-
1459
+
1452
1460
  ${componentName}.displayName = \`${factoryName}.\${name}\`
1453
1461
  ${componentName}.__cva__ = cvaFn
1454
1462
  ${componentName}.__base__ = Dynamic
1455
1463
  ${componentName}.__shouldForwardProps__ = shouldForwardProp
1456
-
1464
+
1457
1465
  return ${componentName}
1458
1466
  }
1459
1467
 
@@ -1709,7 +1717,7 @@ function generateQwikJsxFactory(ctx) {
1709
1717
 
1710
1718
  const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
1711
1719
  const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
1712
-
1720
+
1713
1721
  const defaultProps = Object.assign(
1714
1722
  options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
1715
1723
  options.defaultProps,
@@ -1722,16 +1730,18 @@ function generateQwikJsxFactory(ctx) {
1722
1730
  const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
1723
1731
 
1724
1732
  const combinedProps = Object.assign({}, defaultProps, restProps)
1725
-
1726
- const [forwardedProps, variantProps, styleProps, htmlProps, elementProps] =
1727
- splitProps(combinedProps, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty, normalizeHTMLProps.keys)
1733
+
1734
+ const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] =
1735
+ splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
1736
+
1737
+ const { css: cssStyles, ...propStyles } = styleProps
1728
1738
 
1729
1739
  function recipeClass() {
1730
1740
  const { css: cssStyles, ...propStyles } = styleProps
1731
1741
  const compoundVariantStyles = __cvaFn__.__getCompoundVariantCss__?.(variantProps);
1732
1742
  return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.class, className)
1733
1743
  }
1734
-
1744
+
1735
1745
  function cvaClass() {
1736
1746
  const { css: cssStyles, ...propStyles } = styleProps
1737
1747
  const cvaStyles = __cvaFn__.raw(variantProps)
@@ -1750,12 +1760,12 @@ function generateQwikJsxFactory(ctx) {
1750
1760
  }
1751
1761
 
1752
1762
  const name = getDisplayName(Dynamic)
1753
-
1763
+
1754
1764
  ${componentName}.displayName = \`${factoryName}.\${name}\`
1755
1765
  ${componentName}.__cva__ = cvaFn
1756
1766
  ${componentName}.__base__ = Dynamic
1757
1767
  ${componentName}.__shouldForwardProps__ = shouldForwardProp
1758
-
1768
+
1759
1769
  return ${componentName}
1760
1770
  }
1761
1771
 
@@ -2018,7 +2028,7 @@ function generateReactJsxFactory(ctx) {
2018
2028
 
2019
2029
  const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
2020
2030
  const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
2021
-
2031
+
2022
2032
  const defaultProps = Object.assign(
2023
2033
  options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
2024
2034
  options.defaultProps,
@@ -2026,14 +2036,14 @@ function generateReactJsxFactory(ctx) {
2026
2036
 
2027
2037
  const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
2028
2038
  const { as: Element = Dynamic.__base__ || Dynamic, children, ...restProps } = props
2029
-
2039
+
2030
2040
  const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
2031
2041
  const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
2032
2042
 
2033
2043
  const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
2034
2044
 
2035
- const [forwardedProps, variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
2036
- return splitProps(combinedProps, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty, normalizeHTMLProps.keys)
2045
+ const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
2046
+ return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
2037
2047
  }, [combinedProps])
2038
2048
 
2039
2049
  function recipeClass() {
@@ -2061,12 +2071,12 @@ function generateReactJsxFactory(ctx) {
2061
2071
  })
2062
2072
 
2063
2073
  const name = getDisplayName(Dynamic)
2064
-
2074
+
2065
2075
  ${componentName}.displayName = \`${factoryName}.\${name}\`
2066
2076
  ${componentName}.__cva__ = cvaFn
2067
2077
  ${componentName}.__base__ = Dynamic
2068
2078
  ${componentName}.__shouldForwardProps__ = shouldForwardProp
2069
-
2079
+
2070
2080
  return ${componentName}
2071
2081
  }
2072
2082
 
@@ -2323,13 +2333,13 @@ function generateSolidJsxFactory(ctx) {
2323
2333
  ${ctx.file.import("isCssProperty, allCssProperties", "./is-valid-prop")}
2324
2334
  ${ctx.file.import("css, cx, cva", "../css/index")}
2325
2335
  ${ctx.file.import("normalizeHTMLProps", "../helpers")}
2326
-
2336
+
2327
2337
  function styledFn(element, configOrCva = {}, options = {}) {
2328
2338
  const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
2329
2339
 
2330
2340
  const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
2331
2341
  const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
2332
-
2342
+
2333
2343
  const defaultProps = Object.assign(
2334
2344
  options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
2335
2345
  options.defaultProps,
@@ -2337,19 +2347,21 @@ function generateSolidJsxFactory(ctx) {
2337
2347
 
2338
2348
  const ${componentName} = (props) => {
2339
2349
  const mergedProps = mergeProps({ as: element.__base__ || element }, defaultProps, props)
2340
-
2350
+
2341
2351
  const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
2342
2352
  const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
2343
-
2344
- const forwardedKeys = createMemo(() => Object.keys(props).filter(shouldForwardProp))
2345
2353
 
2346
- const [localProps, forwardedProps, variantProps, styleProps, htmlProps, elementProps] = splitProps(
2354
+ const forwardedKeys = createMemo(() =>
2355
+ Object.keys(props).filter((prop) => !normalizeHTMLProps.keys.includes(prop) && shouldForwardProp(prop)),
2356
+ )
2357
+
2358
+ const [localProps, htmlProps, forwardedProps, variantProps, styleProps, elementProps] = splitProps(
2347
2359
  mergedProps,
2348
2360
  ['as', 'class', 'className'],
2361
+ normalizeHTMLProps.keys,
2349
2362
  forwardedKeys(),
2350
2363
  __cvaFn__.variantKeys,
2351
2364
  allCssProperties,
2352
- normalizeHTMLProps.keys
2353
2365
  )
2354
2366
 
2355
2367
  function recipeClass() {
@@ -2394,7 +2406,7 @@ function generateSolidJsxFactory(ctx) {
2394
2406
  ${componentName}.__cva__ = cvaFn
2395
2407
  ${componentName}.__base__ = element
2396
2408
  ${componentName}.__shouldForwardProps__ = shouldForwardProp
2397
-
2409
+
2398
2410
  return ${componentName}
2399
2411
  }
2400
2412
 
@@ -2653,15 +2665,15 @@ function generateVueJsxFactory(ctx) {
2653
2665
 
2654
2666
  function styledFn(Dynamic, configOrCva = {}, options = {}) {
2655
2667
  const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
2656
-
2668
+
2657
2669
  const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
2658
2670
  const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
2659
-
2671
+
2660
2672
  const defaultProps = Object.assign(
2661
2673
  options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
2662
2674
  options.defaultProps,
2663
2675
  )
2664
-
2676
+
2665
2677
  const name = getDisplayName(Dynamic)
2666
2678
 
2667
2679
  const ${componentName} = defineComponent({
@@ -2671,22 +2683,22 @@ function generateVueJsxFactory(ctx) {
2671
2683
  setup(props, { slots, attrs }) {
2672
2684
  const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
2673
2685
  const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
2674
-
2686
+
2675
2687
  const combinedProps = computed(() => Object.assign({}, defaultProps, attrs))
2676
-
2688
+
2677
2689
  const splittedProps = computed(() => {
2678
- return splitProps(combinedProps.value, shouldForwardProp, __cvaFn__.variantKeys, isCssProperty, normalizeHTMLProps.keys)
2690
+ return splitProps(combinedProps.value, normalizeHTMLProps.keys, shouldForwardProp, __cvaFn__.variantKeys, isCssProperty)
2679
2691
  })
2680
2692
 
2681
2693
  const recipeClass = computed(() => {
2682
- const [_forwardedProps, variantProps, styleProps, _htmlProps, _elementProps] = splittedProps.value
2694
+ const [_htmlProps, _forwardedProps, variantProps, styleProps, _elementProps] = splittedProps.value
2683
2695
  const { css: cssStyles, ...propStyles } = styleProps
2684
2696
  const compoundVariantStyles = __cvaFn__.__getCompoundVariantCss__?.(variantProps);
2685
2697
  return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.value.className)
2686
2698
  })
2687
2699
 
2688
2700
  const cvaClass = computed(() => {
2689
- const [_forwardedProps, variantProps, styleProps, _htmlProps, _elementProps] = splittedProps.value
2701
+ const [_htmlProps, _forwardedProps, variantProps, styleProps, _elementProps] = splittedProps.value
2690
2702
  const { css: cssStyles, ...propStyles } = styleProps
2691
2703
  const cvaStyles = __cvaFn__.raw(variantProps)
2692
2704
  return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.value.className)
@@ -2695,7 +2707,7 @@ function generateVueJsxFactory(ctx) {
2695
2707
  const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
2696
2708
 
2697
2709
  return () => {
2698
- const [forwardedProps, _variantProps, _styleProps, htmlProps, elementProps] = splittedProps.value
2710
+ const [htmlProps, forwardedProps, _variantProps, _styleProps, elementProps] = splittedProps.value
2699
2711
  return h(
2700
2712
  props.as,
2701
2713
  {
@@ -2714,7 +2726,7 @@ function generateVueJsxFactory(ctx) {
2714
2726
  ${componentName}.__cva__ = cvaFn
2715
2727
  ${componentName}.__base__ = Dynamic
2716
2728
  ${componentName}.__shouldForwardProps__ = shouldForwardProp
2717
-
2729
+
2718
2730
  return ${componentName}
2719
2731
  }
2720
2732
 
@@ -3079,12 +3091,12 @@ var recipe_d_ts_default = {
3079
3091
 
3080
3092
  // src/artifacts/generated/pattern.d.ts.json
3081
3093
  var pattern_d_ts_default = {
3082
- content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport interface PatternHelpers {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\nexport type PatternProperties = Record<string, PatternProperty>\n\ntype Props<T> = Record<LiteralUnion<keyof T>, any>\n\nexport interface PatternConfig<T extends PatternProperties = PatternProperties> {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties?: T\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: Props<T>, helpers: PatternHelpers) => SystemStyleObject\n /**\n * The jsx element name this pattern will generate.\n */\n jsxName?: string\n /**\n * The jsx elements to track for this pattern. Can be string or Regexp.\n *\n * @default capitalize(pattern.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<CssProperty>[]\n}\n"
3094
+ content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport interface PatternHelpers {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\nexport interface PatternProperties {\n [key: string]: PatternProperty\n}\n\ntype Props<T> = Record<LiteralUnion<keyof T>, any>\n\nexport interface PatternConfig<T extends PatternProperties = PatternProperties> {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties?: T\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: Props<T>, helpers: PatternHelpers) => SystemStyleObject\n /**\n * The jsx element name this pattern will generate.\n */\n jsxName?: string\n /**\n * The jsx elements to track for this pattern. Can be string or Regexp.\n *\n * @default capitalize(pattern.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<CssProperty>[]\n}\n"
3083
3095
  };
3084
3096
 
3085
3097
  // src/artifacts/generated/parts.d.ts.json
3086
3098
  var parts_d_ts_default = {
3087
- content: "export interface Part {\n selector: string\n}\n\nexport type Parts = Record<string, Part>\n"
3099
+ content: "export interface Part {\n selector: string\n}\n\nexport interface Parts {\n [key: string]: Part\n}\n"
3088
3100
  };
3089
3101
 
3090
3102
  // src/artifacts/generated/selectors.d.ts.json
@@ -3105,15 +3117,32 @@ function getGeneratedTypes(ctx) {
3105
3117
  composition: rewriteImports(composition_d_ts_default.content),
3106
3118
  selectors: rewriteImports(selectors_d_ts_default.content),
3107
3119
  system: rewriteImports(
3108
- (0, import_ts_pattern9.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with("minimal", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = WithCss")).with("none", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = {}")).exhaustive()
3120
+ (0, import_ts_pattern9.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with(
3121
+ "minimal",
3122
+ () => system_types_d_ts_default.content.replace("WithHTMLProps<T>,", "T,").replace(jsxStyleProps, "export type JsxStyleProps = WithCss")
3123
+ ).with(
3124
+ "none",
3125
+ () => system_types_d_ts_default.content.replace("WithHTMLProps<T>,", "T,").replace(jsxStyleProps, "export type JsxStyleProps = {}")
3126
+ ).exhaustive()
3109
3127
  )
3110
3128
  };
3111
3129
  }
3112
3130
 
3113
3131
  // src/artifacts/types/main.ts
3114
3132
  var import_outdent40 = require("outdent");
3115
- var generateTypesEntry = (ctx) => ({
3116
- global: import_outdent40.outdent`
3133
+ var generateTypesEntry = (ctx, isJsxRequired) => {
3134
+ const indexExports = [
3135
+ // We need to export types used in the global.d.ts here to avoid TS errors such as `The inferred type of 'xxx' cannot be named without a reference to 'yyy'`
3136
+ `import '${ctx.file.extDts("./global")}'`,
3137
+ ctx.file.exportTypeStar("./conditions"),
3138
+ ctx.file.exportTypeStar("./pattern"),
3139
+ ctx.file.exportTypeStar("./recipe"),
3140
+ ctx.file.exportTypeStar("./system-types"),
3141
+ isJsxRequired && ctx.file.exportTypeStar("./jsx"),
3142
+ ctx.file.exportTypeStar("./style-props")
3143
+ ].filter(Boolean);
3144
+ return {
3145
+ global: import_outdent40.outdent`
3117
3146
  // @ts-nocheck
3118
3147
  import type * as Panda from '@pandacss/dev'
3119
3148
  ${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
@@ -3133,21 +3162,14 @@ var generateTypesEntry = (ctx) => ({
3133
3162
  export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
3134
3163
  }
3135
3164
  `,
3136
- // We need to export types used in the global.d.ts here to avoid TS errors such as `The inferred type of 'xxx' cannot be named without a reference to 'yyy'`
3137
- index: import_outdent40.outdent`
3138
- import '${ctx.file.extDts("./global")}'
3139
- ${ctx.file.exportTypeStar("./conditions")}
3140
- ${ctx.file.exportTypeStar("./pattern")}
3141
- ${ctx.file.exportTypeStar("./recipe")}
3142
- ${ctx.file.exportTypeStar("./system-types")}
3143
- ${ctx.file.exportTypeStar("./jsx")}
3144
- ${ctx.file.exportTypeStar("./style-props")}
3145
-
3165
+ index: import_outdent40.outdent`
3166
+ ${indexExports.join("\n")}
3146
3167
  `,
3147
- helpers: import_outdent40.outdent`
3148
- export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
3149
- `
3150
- });
3168
+ helpers: import_outdent40.outdent`
3169
+ export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
3170
+ `
3171
+ };
3172
+ };
3151
3173
 
3152
3174
  // src/artifacts/types/prop-types.ts
3153
3175
  var import_outdent41 = require("outdent");
@@ -3301,7 +3323,7 @@ function setupTypes(ctx) {
3301
3323
  const gen = getGeneratedTypes(ctx);
3302
3324
  const conditions = generateConditions(ctx);
3303
3325
  const jsx = generateJsxTypes(ctx);
3304
- const entry = generateTypesEntry(ctx);
3326
+ const entry = generateTypesEntry(ctx, jsx != null);
3305
3327
  return {
3306
3328
  dir: ctx.paths.types,
3307
3329
  files: [
@@ -3555,85 +3577,81 @@ var generateFlattenedCss = (ctx) => (options) => {
3555
3577
 
3556
3578
  // src/artifacts/css/parser-css.ts
3557
3579
  var import_logger2 = require("@pandacss/logger");
3558
- var import_func = require("lil-fp/func");
3559
3580
  var import_ts_pattern10 = require("ts-pattern");
3560
- var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
3561
- { ...ctx, sheet: ctx.createSheet(), result },
3562
- (0, import_func.tap)(({ sheet, result: result2, patterns, recipes }) => {
3563
- result2.css.forEach((css2) => {
3564
- css2.data.forEach((data) => {
3565
- sheet.processAtomic(data);
3566
- });
3581
+ var generateParserCss = (ctx) => (result) => {
3582
+ const { patterns, recipes } = ctx;
3583
+ const sheet = ctx.createSheet();
3584
+ result.css.forEach((css2) => {
3585
+ css2.data.forEach((data) => {
3586
+ sheet.processAtomic(data);
3567
3587
  });
3568
- result2.cva.forEach((cva) => {
3569
- cva.data.forEach((data) => {
3570
- sheet.processAtomicRecipe(data);
3571
- });
3588
+ });
3589
+ result.cva.forEach((cva) => {
3590
+ cva.data.forEach((data) => {
3591
+ sheet.processAtomicRecipe(data);
3572
3592
  });
3573
- result2.sva.forEach((sva) => {
3574
- sva.data.forEach((data) => {
3575
- sheet.processAtomicSlotRecipe(data);
3576
- });
3593
+ });
3594
+ result.sva.forEach((sva) => {
3595
+ sva.data.forEach((data) => {
3596
+ sheet.processAtomicSlotRecipe(data);
3577
3597
  });
3578
- result2.jsx.forEach((jsx) => {
3579
- jsx.data.forEach((data) => {
3580
- sheet.processStyleProps(filterProps(ctx, data));
3581
- });
3598
+ });
3599
+ result.jsx.forEach((jsx) => {
3600
+ jsx.data.forEach((data) => {
3601
+ sheet.processStyleProps(filterProps(ctx, data));
3582
3602
  });
3583
- result2.recipe.forEach((recipeSet, recipeName) => {
3584
- try {
3585
- for (const recipe of recipeSet) {
3586
- const recipeConfig = recipes.getConfig(recipeName);
3587
- if (!recipeConfig)
3588
- continue;
3589
- (0, import_ts_pattern10.match)(recipe).with({ type: "jsx-recipe" }, () => {
3590
- recipe.data.forEach((data) => {
3591
- const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
3592
- sheet.processStyleProps(filterProps(ctx, styleProps));
3593
- sheet.processRecipe(recipeName, recipeConfig, recipeProps);
3594
- });
3595
- }).otherwise(() => {
3596
- recipe.data.forEach((data) => {
3597
- sheet.processRecipe(recipeName, recipeConfig, data);
3598
- });
3603
+ });
3604
+ result.recipe.forEach((recipeSet, recipeName) => {
3605
+ try {
3606
+ for (const recipe of recipeSet) {
3607
+ const recipeConfig = recipes.getConfig(recipeName);
3608
+ if (!recipeConfig)
3609
+ continue;
3610
+ (0, import_ts_pattern10.match)(recipe).with({ type: "jsx-recipe" }, () => {
3611
+ recipe.data.forEach((data) => {
3612
+ const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
3613
+ sheet.processStyleProps(filterProps(ctx, styleProps));
3614
+ sheet.processRecipe(recipeName, recipeConfig, recipeProps);
3599
3615
  });
3600
- }
3601
- } catch (error) {
3602
- import_logger2.logger.error("serializer:recipe", error);
3616
+ }).otherwise(() => {
3617
+ recipe.data.forEach((data) => {
3618
+ sheet.processRecipe(recipeName, recipeConfig, data);
3619
+ });
3620
+ });
3603
3621
  }
3604
- });
3605
- result2.pattern.forEach((patternSet, name) => {
3606
- try {
3607
- for (const pattern of patternSet) {
3608
- (0, import_ts_pattern10.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern10.P.string }, ({ name: jsxName }) => {
3609
- pattern.data.forEach((data) => {
3610
- const fnName = patterns.find(jsxName);
3611
- const styleProps = patterns.transform(fnName, data);
3612
- sheet.processStyleProps(filterProps(ctx, styleProps));
3613
- });
3614
- }).otherwise(() => {
3615
- pattern.data.forEach((data) => {
3616
- const styleProps = patterns.transform(name, data);
3617
- sheet.processAtomic(styleProps);
3618
- });
3622
+ } catch (error) {
3623
+ import_logger2.logger.error("serializer:recipe", error);
3624
+ }
3625
+ });
3626
+ result.pattern.forEach((patternSet, name) => {
3627
+ try {
3628
+ for (const pattern of patternSet) {
3629
+ (0, import_ts_pattern10.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern10.P.string }, ({ name: jsxName }) => {
3630
+ pattern.data.forEach((data) => {
3631
+ const fnName = patterns.find(jsxName);
3632
+ const styleProps = patterns.transform(fnName, data);
3633
+ sheet.processStyleProps(filterProps(ctx, styleProps));
3619
3634
  });
3620
- }
3621
- } catch (error) {
3622
- import_logger2.logger.error("serializer:pattern", error);
3635
+ }).otherwise(() => {
3636
+ pattern.data.forEach((data) => {
3637
+ const styleProps = patterns.transform(name, data);
3638
+ sheet.processAtomic(styleProps);
3639
+ });
3640
+ });
3623
3641
  }
3624
- });
3625
- }),
3626
- (0, import_func.tryCatch)(
3627
- ({ sheet, result: result2, config: { minify, optimize } }) => {
3628
- const css2 = !result2.isEmpty() ? sheet.toCss({ minify, optimize }) : void 0;
3629
- void ctx.hooks.callHook("parser:css", result2.filePath ?? "", css2);
3630
- return css2;
3631
- },
3632
- (err) => {
3633
- import_logger2.logger.error("serializer:css", "Failed to serialize CSS: " + err);
3642
+ } catch (error) {
3643
+ import_logger2.logger.error("serializer:pattern", error);
3634
3644
  }
3635
- )
3636
- );
3645
+ });
3646
+ try {
3647
+ const { minify, optimize } = ctx.config;
3648
+ const css2 = !result.isEmpty() ? sheet.toCss({ minify, optimize }) : void 0;
3649
+ void ctx.hooks.callHook("parser:css", result.filePath ?? "", css2);
3650
+ return css2;
3651
+ } catch (err) {
3652
+ import_logger2.logger.error("serializer:css", "Failed to serialize CSS: " + err);
3653
+ }
3654
+ };
3637
3655
  var filterProps = (ctx, props) => {
3638
3656
  const clone = {};
3639
3657
  for (const [key, value] of Object.entries(props)) {
@@ -3682,7 +3700,7 @@ var getBaseEngine = (conf) => {
3682
3700
  strictTokens: config.strictTokens
3683
3701
  });
3684
3702
  const conditions = new import_core5.Conditions({
3685
- conditions: isTemplateLiteralSyntax ? {} : config.conditions,
3703
+ conditions: config.conditions,
3686
3704
  breakpoints: config.theme?.breakpoints
3687
3705
  });
3688
3706
  const { textStyles, layerStyles } = theme;
@@ -3828,45 +3846,84 @@ var getPatternEngine = (config) => {
3828
3846
  };
3829
3847
  };
3830
3848
 
3849
+ // src/engines/file.ts
3850
+ var getFileEngine = (config) => {
3851
+ const { forceConsistentTypeExtension, outExtension } = config;
3852
+ return {
3853
+ ext(file) {
3854
+ return `${file}.${outExtension}`;
3855
+ },
3856
+ extDts(file) {
3857
+ const dts = outExtension === "mjs" && forceConsistentTypeExtension ? "d.mts" : "d.ts";
3858
+ return `${file}.${dts}`;
3859
+ },
3860
+ __extDts(file) {
3861
+ return forceConsistentTypeExtension ? this.extDts(file) : file;
3862
+ },
3863
+ import(mod, file) {
3864
+ return `import { ${mod} } from '${this.ext(file)}';`;
3865
+ },
3866
+ importType(mod, file) {
3867
+ return `import type { ${mod} } from '${this.__extDts(file)}';`;
3868
+ },
3869
+ exportType(mod, file) {
3870
+ return `export type { ${mod} } from '${this.__extDts(file)}';`;
3871
+ },
3872
+ exportStar(file) {
3873
+ return `export * from '${this.ext(file)}';`;
3874
+ },
3875
+ exportTypeStar(file) {
3876
+ return `export * from '${this.__extDts(file)}';`;
3877
+ },
3878
+ isTypeFile(file) {
3879
+ return file.endsWith(".d.ts") || file.endsWith(".d.mts");
3880
+ }
3881
+ };
3882
+ };
3883
+
3831
3884
  // src/engines/index.ts
3832
3885
  var getEngine = (conf) => {
3833
3886
  const { config } = conf;
3834
- const { forceConsistentTypeExtension, outExtension } = config;
3835
3887
  return {
3836
3888
  ...getBaseEngine(conf),
3837
3889
  patterns: getPatternEngine(config),
3838
3890
  jsx: getJsxEngine(config),
3839
3891
  paths: getPathEngine(config),
3840
- file: {
3841
- ext(file) {
3842
- return `${file}.${outExtension}`;
3843
- },
3844
- extDts(file) {
3845
- const dts = outExtension === "mjs" && forceConsistentTypeExtension ? "d.mts" : "d.ts";
3846
- return `${file}.${dts}`;
3847
- },
3848
- __extDts(file) {
3849
- return forceConsistentTypeExtension ? this.extDts(file) : file;
3850
- },
3851
- import(mod, file) {
3852
- return `import { ${mod} } from '${this.ext(file)}';`;
3853
- },
3854
- importType(mod, file) {
3855
- return `import type { ${mod} } from '${this.__extDts(file)}';`;
3856
- },
3857
- exportType(mod, file) {
3858
- return `export type { ${mod} } from '${this.__extDts(file)}';`;
3859
- },
3860
- exportStar(file) {
3861
- return `export * from '${this.ext(file)}';`;
3862
- },
3863
- exportTypeStar(file) {
3864
- return `export * from '${this.__extDts(file)}';`;
3865
- },
3866
- isTypeFile(file) {
3867
- return file.endsWith(".d.ts") || file.endsWith(".d.mts");
3868
- }
3869
- }
3892
+ file: getFileEngine(config)
3893
+ };
3894
+ };
3895
+
3896
+ // src/parser-options.ts
3897
+ var getImportMap = (outdir, configImportMap) => {
3898
+ const { css: css2, recipes, patterns, jsx } = configImportMap ?? {};
3899
+ return {
3900
+ css: css2 ? [css2] : [outdir, "css"],
3901
+ recipe: recipes ? [recipes] : [outdir, "recipes"],
3902
+ pattern: patterns ? [patterns] : [outdir, "patterns"],
3903
+ jsx: jsx ? [jsx] : [outdir, "jsx"]
3904
+ };
3905
+ };
3906
+ var getParserOptions = (ctx) => {
3907
+ const { config, jsx, isValidProperty, patterns, recipes, tsconfig, tsOptions } = ctx;
3908
+ const compilerOptions = tsconfig?.compilerOptions ?? {};
3909
+ const baseUrl = compilerOptions.baseUrl ?? "";
3910
+ const cwd = config.cwd;
3911
+ const relativeBaseUrl = baseUrl !== cwd ? baseUrl.replace(cwd, "").slice(1) : cwd;
3912
+ return {
3913
+ importMap: getImportMap(config.outdir.replace(relativeBaseUrl, ""), config.importMap),
3914
+ jsx: {
3915
+ framework: jsx.framework,
3916
+ factory: jsx.factoryName,
3917
+ styleProps: jsx.styleProps,
3918
+ isStyleProp: isValidProperty,
3919
+ nodes: [...patterns.details, ...recipes.details]
3920
+ },
3921
+ patternKeys: patterns.keys,
3922
+ recipeKeys: recipes.keys,
3923
+ getRecipesByJsxName: recipes.filter,
3924
+ getPatternsByJsxName: patterns.filter,
3925
+ compilerOptions,
3926
+ tsOptions
3870
3927
  };
3871
3928
  };
3872
3929
 
@@ -3891,19 +3948,9 @@ var defaults = (conf) => ({
3891
3948
  }
3892
3949
  }
3893
3950
  });
3894
- var getImportMap = (outdir, configImportMap) => ({
3895
- css: configImportMap?.css ? [configImportMap.css] : [outdir, "css"],
3896
- recipe: configImportMap?.recipes ? [configImportMap.recipes] : [outdir, "recipes"],
3897
- pattern: configImportMap?.patterns ? [configImportMap.patterns] : [outdir, "patterns"],
3898
- jsx: configImportMap?.jsx ? [configImportMap.jsx] : [outdir, "jsx"]
3899
- });
3900
3951
  var createGenerator = (conf) => {
3901
3952
  const ctx = getEngine(defaults(conf));
3902
- const { config, jsx, isValidProperty, patterns, recipes } = ctx;
3903
- const compilerOptions = conf.tsconfig?.compilerOptions ?? {};
3904
- const baseUrl = compilerOptions.baseUrl ?? "";
3905
- const cwd = conf.config.cwd;
3906
- const relativeBaseUrl = baseUrl !== cwd ? baseUrl.replace(cwd, "").slice(1) : cwd;
3953
+ const parserOptions = getParserOptions(ctx);
3907
3954
  return {
3908
3955
  ...ctx,
3909
3956
  getArtifacts: generateArtifacts(ctx),
@@ -3918,22 +3965,7 @@ var createGenerator = (conf) => {
3918
3965
  getParserCss: generateParserCss(ctx),
3919
3966
  //
3920
3967
  messages: getMessages(ctx),
3921
- parserOptions: {
3922
- importMap: getImportMap(config.outdir.replace(relativeBaseUrl, ""), config.importMap),
3923
- jsx: {
3924
- framework: jsx.framework,
3925
- factory: jsx.factoryName,
3926
- styleProps: jsx.styleProps,
3927
- isStyleProp: isValidProperty,
3928
- nodes: [...patterns.details, ...recipes.details]
3929
- },
3930
- patternKeys: patterns.keys,
3931
- recipeKeys: recipes.keys,
3932
- getRecipesByJsxName: recipes.filter,
3933
- getPatternsByJsxName: patterns.filter,
3934
- compilerOptions,
3935
- tsOptions: conf.tsOptions
3936
- }
3968
+ parserOptions
3937
3969
  };
3938
3970
  };
3939
3971
  // Annotate the CommonJS export names for ESM import in node: