@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.d.mts +123 -534
- package/dist/index.d.ts +123 -534
- package/dist/index.js +217 -185
- package/dist/index.mjs +217 -185
- package/package.json +22 -12
package/dist/index.mjs
CHANGED
|
@@ -268,6 +268,14 @@ function generateResetCss(ctx, scope = "") {
|
|
|
268
268
|
background-image: none;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
${selector}button,
|
|
272
|
+
${selector}input,
|
|
273
|
+
${selector}optgroup,
|
|
274
|
+
${selector}select,
|
|
275
|
+
${selector}textarea {
|
|
276
|
+
color: inherit;
|
|
277
|
+
}
|
|
278
|
+
|
|
271
279
|
${selector}button,
|
|
272
280
|
${selector}select {
|
|
273
281
|
text-transform: none;
|
|
@@ -882,7 +890,7 @@ import { outdent as outdent8 } from "outdent";
|
|
|
882
890
|
|
|
883
891
|
// src/artifacts/generated/helpers.mjs.json
|
|
884
892
|
var helpers_mjs_default = {
|
|
885
|
-
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
|
|
893
|
+
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'
|
|
886
894
|
};
|
|
887
895
|
|
|
888
896
|
// src/artifacts/generated/astish.mjs.json
|
|
@@ -1374,7 +1382,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1374
1382
|
|
|
1375
1383
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1376
1384
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1377
|
-
|
|
1385
|
+
|
|
1378
1386
|
const defaultProps = Object.assign(
|
|
1379
1387
|
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
1380
1388
|
options.defaultProps,
|
|
@@ -1388,8 +1396,8 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1388
1396
|
|
|
1389
1397
|
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
1390
1398
|
|
|
1391
|
-
const [forwardedProps, variantProps, styleProps,
|
|
1392
|
-
return splitProps(combinedProps, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty
|
|
1399
|
+
const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
|
|
1400
|
+
return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
|
|
1393
1401
|
}, [combinedProps])
|
|
1394
1402
|
|
|
1395
1403
|
function recipeClass() {
|
|
@@ -1417,12 +1425,12 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1417
1425
|
})
|
|
1418
1426
|
|
|
1419
1427
|
const name = getDisplayName(Dynamic)
|
|
1420
|
-
|
|
1428
|
+
|
|
1421
1429
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1422
1430
|
${componentName}.__cva__ = cvaFn
|
|
1423
1431
|
${componentName}.__base__ = Dynamic
|
|
1424
1432
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
1425
|
-
|
|
1433
|
+
|
|
1426
1434
|
return ${componentName}
|
|
1427
1435
|
}
|
|
1428
1436
|
|
|
@@ -1678,7 +1686,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1678
1686
|
|
|
1679
1687
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1680
1688
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1681
|
-
|
|
1689
|
+
|
|
1682
1690
|
const defaultProps = Object.assign(
|
|
1683
1691
|
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
1684
1692
|
options.defaultProps,
|
|
@@ -1691,16 +1699,18 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1691
1699
|
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1692
1700
|
|
|
1693
1701
|
const combinedProps = Object.assign({}, defaultProps, restProps)
|
|
1694
|
-
|
|
1695
|
-
const [forwardedProps, variantProps, styleProps,
|
|
1696
|
-
splitProps(combinedProps, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty
|
|
1702
|
+
|
|
1703
|
+
const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] =
|
|
1704
|
+
splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
|
|
1705
|
+
|
|
1706
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1697
1707
|
|
|
1698
1708
|
function recipeClass() {
|
|
1699
1709
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1700
1710
|
const compoundVariantStyles = __cvaFn__.__getCompoundVariantCss__?.(variantProps);
|
|
1701
1711
|
return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.class, className)
|
|
1702
1712
|
}
|
|
1703
|
-
|
|
1713
|
+
|
|
1704
1714
|
function cvaClass() {
|
|
1705
1715
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1706
1716
|
const cvaStyles = __cvaFn__.raw(variantProps)
|
|
@@ -1719,12 +1729,12 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1719
1729
|
}
|
|
1720
1730
|
|
|
1721
1731
|
const name = getDisplayName(Dynamic)
|
|
1722
|
-
|
|
1732
|
+
|
|
1723
1733
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1724
1734
|
${componentName}.__cva__ = cvaFn
|
|
1725
1735
|
${componentName}.__base__ = Dynamic
|
|
1726
1736
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
1727
|
-
|
|
1737
|
+
|
|
1728
1738
|
return ${componentName}
|
|
1729
1739
|
}
|
|
1730
1740
|
|
|
@@ -1987,7 +1997,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1987
1997
|
|
|
1988
1998
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1989
1999
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1990
|
-
|
|
2000
|
+
|
|
1991
2001
|
const defaultProps = Object.assign(
|
|
1992
2002
|
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
1993
2003
|
options.defaultProps,
|
|
@@ -1995,14 +2005,14 @@ function generateReactJsxFactory(ctx) {
|
|
|
1995
2005
|
|
|
1996
2006
|
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1997
2007
|
const { as: Element = Dynamic.__base__ || Dynamic, children, ...restProps } = props
|
|
1998
|
-
|
|
2008
|
+
|
|
1999
2009
|
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
2000
2010
|
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
2001
2011
|
|
|
2002
2012
|
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
2003
2013
|
|
|
2004
|
-
const [forwardedProps, variantProps, styleProps,
|
|
2005
|
-
return splitProps(combinedProps, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty
|
|
2014
|
+
const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
|
|
2015
|
+
return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
|
|
2006
2016
|
}, [combinedProps])
|
|
2007
2017
|
|
|
2008
2018
|
function recipeClass() {
|
|
@@ -2030,12 +2040,12 @@ function generateReactJsxFactory(ctx) {
|
|
|
2030
2040
|
})
|
|
2031
2041
|
|
|
2032
2042
|
const name = getDisplayName(Dynamic)
|
|
2033
|
-
|
|
2043
|
+
|
|
2034
2044
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
2035
2045
|
${componentName}.__cva__ = cvaFn
|
|
2036
2046
|
${componentName}.__base__ = Dynamic
|
|
2037
2047
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
2038
|
-
|
|
2048
|
+
|
|
2039
2049
|
return ${componentName}
|
|
2040
2050
|
}
|
|
2041
2051
|
|
|
@@ -2292,13 +2302,13 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2292
2302
|
${ctx.file.import("isCssProperty, allCssProperties", "./is-valid-prop")}
|
|
2293
2303
|
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
2294
2304
|
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
2295
|
-
|
|
2305
|
+
|
|
2296
2306
|
function styledFn(element, configOrCva = {}, options = {}) {
|
|
2297
2307
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2298
2308
|
|
|
2299
2309
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
2300
2310
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
2301
|
-
|
|
2311
|
+
|
|
2302
2312
|
const defaultProps = Object.assign(
|
|
2303
2313
|
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
2304
2314
|
options.defaultProps,
|
|
@@ -2306,19 +2316,21 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2306
2316
|
|
|
2307
2317
|
const ${componentName} = (props) => {
|
|
2308
2318
|
const mergedProps = mergeProps({ as: element.__base__ || element }, defaultProps, props)
|
|
2309
|
-
|
|
2319
|
+
|
|
2310
2320
|
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
2311
2321
|
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
2312
|
-
|
|
2313
|
-
const forwardedKeys = createMemo(() => Object.keys(props).filter(shouldForwardProp))
|
|
2314
2322
|
|
|
2315
|
-
const
|
|
2323
|
+
const forwardedKeys = createMemo(() =>
|
|
2324
|
+
Object.keys(props).filter((prop) => !normalizeHTMLProps.keys.includes(prop) && shouldForwardProp(prop)),
|
|
2325
|
+
)
|
|
2326
|
+
|
|
2327
|
+
const [localProps, htmlProps, forwardedProps, variantProps, styleProps, elementProps] = splitProps(
|
|
2316
2328
|
mergedProps,
|
|
2317
2329
|
['as', 'class', 'className'],
|
|
2330
|
+
normalizeHTMLProps.keys,
|
|
2318
2331
|
forwardedKeys(),
|
|
2319
2332
|
__cvaFn__.variantKeys,
|
|
2320
2333
|
allCssProperties,
|
|
2321
|
-
normalizeHTMLProps.keys
|
|
2322
2334
|
)
|
|
2323
2335
|
|
|
2324
2336
|
function recipeClass() {
|
|
@@ -2363,7 +2375,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2363
2375
|
${componentName}.__cva__ = cvaFn
|
|
2364
2376
|
${componentName}.__base__ = element
|
|
2365
2377
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
2366
|
-
|
|
2378
|
+
|
|
2367
2379
|
return ${componentName}
|
|
2368
2380
|
}
|
|
2369
2381
|
|
|
@@ -2622,15 +2634,15 @@ function generateVueJsxFactory(ctx) {
|
|
|
2622
2634
|
|
|
2623
2635
|
function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
2624
2636
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2625
|
-
|
|
2637
|
+
|
|
2626
2638
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
2627
2639
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
2628
|
-
|
|
2640
|
+
|
|
2629
2641
|
const defaultProps = Object.assign(
|
|
2630
2642
|
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
2631
2643
|
options.defaultProps,
|
|
2632
2644
|
)
|
|
2633
|
-
|
|
2645
|
+
|
|
2634
2646
|
const name = getDisplayName(Dynamic)
|
|
2635
2647
|
|
|
2636
2648
|
const ${componentName} = defineComponent({
|
|
@@ -2640,22 +2652,22 @@ function generateVueJsxFactory(ctx) {
|
|
|
2640
2652
|
setup(props, { slots, attrs }) {
|
|
2641
2653
|
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
2642
2654
|
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
2643
|
-
|
|
2655
|
+
|
|
2644
2656
|
const combinedProps = computed(() => Object.assign({}, defaultProps, attrs))
|
|
2645
|
-
|
|
2657
|
+
|
|
2646
2658
|
const splittedProps = computed(() => {
|
|
2647
|
-
return splitProps(combinedProps.value, shouldForwardProp, __cvaFn__.variantKeys, isCssProperty
|
|
2659
|
+
return splitProps(combinedProps.value, normalizeHTMLProps.keys, shouldForwardProp, __cvaFn__.variantKeys, isCssProperty)
|
|
2648
2660
|
})
|
|
2649
2661
|
|
|
2650
2662
|
const recipeClass = computed(() => {
|
|
2651
|
-
const [_forwardedProps, variantProps, styleProps,
|
|
2663
|
+
const [_htmlProps, _forwardedProps, variantProps, styleProps, _elementProps] = splittedProps.value
|
|
2652
2664
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
2653
2665
|
const compoundVariantStyles = __cvaFn__.__getCompoundVariantCss__?.(variantProps);
|
|
2654
2666
|
return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.value.className)
|
|
2655
2667
|
})
|
|
2656
2668
|
|
|
2657
2669
|
const cvaClass = computed(() => {
|
|
2658
|
-
const [_forwardedProps, variantProps, styleProps,
|
|
2670
|
+
const [_htmlProps, _forwardedProps, variantProps, styleProps, _elementProps] = splittedProps.value
|
|
2659
2671
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
2660
2672
|
const cvaStyles = __cvaFn__.raw(variantProps)
|
|
2661
2673
|
return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.value.className)
|
|
@@ -2664,7 +2676,7 @@ function generateVueJsxFactory(ctx) {
|
|
|
2664
2676
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2665
2677
|
|
|
2666
2678
|
return () => {
|
|
2667
|
-
const [forwardedProps, _variantProps, _styleProps,
|
|
2679
|
+
const [htmlProps, forwardedProps, _variantProps, _styleProps, elementProps] = splittedProps.value
|
|
2668
2680
|
return h(
|
|
2669
2681
|
props.as,
|
|
2670
2682
|
{
|
|
@@ -2683,7 +2695,7 @@ function generateVueJsxFactory(ctx) {
|
|
|
2683
2695
|
${componentName}.__cva__ = cvaFn
|
|
2684
2696
|
${componentName}.__base__ = Dynamic
|
|
2685
2697
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
2686
|
-
|
|
2698
|
+
|
|
2687
2699
|
return ${componentName}
|
|
2688
2700
|
}
|
|
2689
2701
|
|
|
@@ -3048,12 +3060,12 @@ var recipe_d_ts_default = {
|
|
|
3048
3060
|
|
|
3049
3061
|
// src/artifacts/generated/pattern.d.ts.json
|
|
3050
3062
|
var pattern_d_ts_default = {
|
|
3051
|
-
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
|
|
3063
|
+
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"
|
|
3052
3064
|
};
|
|
3053
3065
|
|
|
3054
3066
|
// src/artifacts/generated/parts.d.ts.json
|
|
3055
3067
|
var parts_d_ts_default = {
|
|
3056
|
-
content: "export interface Part {\n selector: string\n}\n\nexport
|
|
3068
|
+
content: "export interface Part {\n selector: string\n}\n\nexport interface Parts {\n [key: string]: Part\n}\n"
|
|
3057
3069
|
};
|
|
3058
3070
|
|
|
3059
3071
|
// src/artifacts/generated/selectors.d.ts.json
|
|
@@ -3074,15 +3086,32 @@ function getGeneratedTypes(ctx) {
|
|
|
3074
3086
|
composition: rewriteImports(composition_d_ts_default.content),
|
|
3075
3087
|
selectors: rewriteImports(selectors_d_ts_default.content),
|
|
3076
3088
|
system: rewriteImports(
|
|
3077
|
-
match9(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with(
|
|
3089
|
+
match9(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with(
|
|
3090
|
+
"minimal",
|
|
3091
|
+
() => system_types_d_ts_default.content.replace("WithHTMLProps<T>,", "T,").replace(jsxStyleProps, "export type JsxStyleProps = WithCss")
|
|
3092
|
+
).with(
|
|
3093
|
+
"none",
|
|
3094
|
+
() => system_types_d_ts_default.content.replace("WithHTMLProps<T>,", "T,").replace(jsxStyleProps, "export type JsxStyleProps = {}")
|
|
3095
|
+
).exhaustive()
|
|
3078
3096
|
)
|
|
3079
3097
|
};
|
|
3080
3098
|
}
|
|
3081
3099
|
|
|
3082
3100
|
// src/artifacts/types/main.ts
|
|
3083
3101
|
import { outdent as outdent40 } from "outdent";
|
|
3084
|
-
var generateTypesEntry = (ctx) =>
|
|
3085
|
-
|
|
3102
|
+
var generateTypesEntry = (ctx, isJsxRequired) => {
|
|
3103
|
+
const indexExports = [
|
|
3104
|
+
// 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'`
|
|
3105
|
+
`import '${ctx.file.extDts("./global")}'`,
|
|
3106
|
+
ctx.file.exportTypeStar("./conditions"),
|
|
3107
|
+
ctx.file.exportTypeStar("./pattern"),
|
|
3108
|
+
ctx.file.exportTypeStar("./recipe"),
|
|
3109
|
+
ctx.file.exportTypeStar("./system-types"),
|
|
3110
|
+
isJsxRequired && ctx.file.exportTypeStar("./jsx"),
|
|
3111
|
+
ctx.file.exportTypeStar("./style-props")
|
|
3112
|
+
].filter(Boolean);
|
|
3113
|
+
return {
|
|
3114
|
+
global: outdent40`
|
|
3086
3115
|
// @ts-nocheck
|
|
3087
3116
|
import type * as Panda from '@pandacss/dev'
|
|
3088
3117
|
${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
|
|
@@ -3102,21 +3131,14 @@ var generateTypesEntry = (ctx) => ({
|
|
|
3102
3131
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
3103
3132
|
}
|
|
3104
3133
|
`,
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
import '${ctx.file.extDts("./global")}'
|
|
3108
|
-
${ctx.file.exportTypeStar("./conditions")}
|
|
3109
|
-
${ctx.file.exportTypeStar("./pattern")}
|
|
3110
|
-
${ctx.file.exportTypeStar("./recipe")}
|
|
3111
|
-
${ctx.file.exportTypeStar("./system-types")}
|
|
3112
|
-
${ctx.file.exportTypeStar("./jsx")}
|
|
3113
|
-
${ctx.file.exportTypeStar("./style-props")}
|
|
3114
|
-
|
|
3134
|
+
index: outdent40`
|
|
3135
|
+
${indexExports.join("\n")}
|
|
3115
3136
|
`,
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
}
|
|
3137
|
+
helpers: outdent40`
|
|
3138
|
+
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
3139
|
+
`
|
|
3140
|
+
};
|
|
3141
|
+
};
|
|
3120
3142
|
|
|
3121
3143
|
// src/artifacts/types/prop-types.ts
|
|
3122
3144
|
import { outdent as outdent41 } from "outdent";
|
|
@@ -3270,7 +3292,7 @@ function setupTypes(ctx) {
|
|
|
3270
3292
|
const gen = getGeneratedTypes(ctx);
|
|
3271
3293
|
const conditions = generateConditions(ctx);
|
|
3272
3294
|
const jsx = generateJsxTypes(ctx);
|
|
3273
|
-
const entry = generateTypesEntry(ctx);
|
|
3295
|
+
const entry = generateTypesEntry(ctx, jsx != null);
|
|
3274
3296
|
return {
|
|
3275
3297
|
dir: ctx.paths.types,
|
|
3276
3298
|
files: [
|
|
@@ -3524,85 +3546,81 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
3524
3546
|
|
|
3525
3547
|
// src/artifacts/css/parser-css.ts
|
|
3526
3548
|
import { logger } from "@pandacss/logger";
|
|
3527
|
-
import { pipe, tap, tryCatch } from "lil-fp/func";
|
|
3528
3549
|
import { P, match as match10 } from "ts-pattern";
|
|
3529
|
-
var generateParserCss = (ctx) => (result) =>
|
|
3530
|
-
{
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
});
|
|
3550
|
+
var generateParserCss = (ctx) => (result) => {
|
|
3551
|
+
const { patterns, recipes } = ctx;
|
|
3552
|
+
const sheet = ctx.createSheet();
|
|
3553
|
+
result.css.forEach((css2) => {
|
|
3554
|
+
css2.data.forEach((data) => {
|
|
3555
|
+
sheet.processAtomic(data);
|
|
3536
3556
|
});
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3557
|
+
});
|
|
3558
|
+
result.cva.forEach((cva) => {
|
|
3559
|
+
cva.data.forEach((data) => {
|
|
3560
|
+
sheet.processAtomicRecipe(data);
|
|
3541
3561
|
});
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3562
|
+
});
|
|
3563
|
+
result.sva.forEach((sva) => {
|
|
3564
|
+
sva.data.forEach((data) => {
|
|
3565
|
+
sheet.processAtomicSlotRecipe(data);
|
|
3546
3566
|
});
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3567
|
+
});
|
|
3568
|
+
result.jsx.forEach((jsx) => {
|
|
3569
|
+
jsx.data.forEach((data) => {
|
|
3570
|
+
sheet.processStyleProps(filterProps(ctx, data));
|
|
3551
3571
|
});
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
}).otherwise(() => {
|
|
3565
|
-
recipe.data.forEach((data) => {
|
|
3566
|
-
sheet.processRecipe(recipeName, recipeConfig, data);
|
|
3567
|
-
});
|
|
3572
|
+
});
|
|
3573
|
+
result.recipe.forEach((recipeSet, recipeName) => {
|
|
3574
|
+
try {
|
|
3575
|
+
for (const recipe of recipeSet) {
|
|
3576
|
+
const recipeConfig = recipes.getConfig(recipeName);
|
|
3577
|
+
if (!recipeConfig)
|
|
3578
|
+
continue;
|
|
3579
|
+
match10(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3580
|
+
recipe.data.forEach((data) => {
|
|
3581
|
+
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3582
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3583
|
+
sheet.processRecipe(recipeName, recipeConfig, recipeProps);
|
|
3568
3584
|
});
|
|
3569
|
-
}
|
|
3570
|
-
|
|
3571
|
-
|
|
3585
|
+
}).otherwise(() => {
|
|
3586
|
+
recipe.data.forEach((data) => {
|
|
3587
|
+
sheet.processRecipe(recipeName, recipeConfig, data);
|
|
3588
|
+
});
|
|
3589
|
+
});
|
|
3572
3590
|
}
|
|
3573
|
-
})
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
const styleProps = patterns.transform(name, data);
|
|
3586
|
-
sheet.processAtomic(styleProps);
|
|
3587
|
-
});
|
|
3591
|
+
} catch (error) {
|
|
3592
|
+
logger.error("serializer:recipe", error);
|
|
3593
|
+
}
|
|
3594
|
+
});
|
|
3595
|
+
result.pattern.forEach((patternSet, name) => {
|
|
3596
|
+
try {
|
|
3597
|
+
for (const pattern of patternSet) {
|
|
3598
|
+
match10(pattern).with({ type: "jsx-pattern", name: P.string }, ({ name: jsxName }) => {
|
|
3599
|
+
pattern.data.forEach((data) => {
|
|
3600
|
+
const fnName = patterns.find(jsxName);
|
|
3601
|
+
const styleProps = patterns.transform(fnName, data);
|
|
3602
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3588
3603
|
});
|
|
3589
|
-
}
|
|
3590
|
-
|
|
3591
|
-
|
|
3604
|
+
}).otherwise(() => {
|
|
3605
|
+
pattern.data.forEach((data) => {
|
|
3606
|
+
const styleProps = patterns.transform(name, data);
|
|
3607
|
+
sheet.processAtomic(styleProps);
|
|
3608
|
+
});
|
|
3609
|
+
});
|
|
3592
3610
|
}
|
|
3593
|
-
})
|
|
3594
|
-
|
|
3595
|
-
tryCatch(
|
|
3596
|
-
({ sheet, result: result2, config: { minify, optimize } }) => {
|
|
3597
|
-
const css2 = !result2.isEmpty() ? sheet.toCss({ minify, optimize }) : void 0;
|
|
3598
|
-
void ctx.hooks.callHook("parser:css", result2.filePath ?? "", css2);
|
|
3599
|
-
return css2;
|
|
3600
|
-
},
|
|
3601
|
-
(err) => {
|
|
3602
|
-
logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
3611
|
+
} catch (error) {
|
|
3612
|
+
logger.error("serializer:pattern", error);
|
|
3603
3613
|
}
|
|
3604
|
-
)
|
|
3605
|
-
|
|
3614
|
+
});
|
|
3615
|
+
try {
|
|
3616
|
+
const { minify, optimize } = ctx.config;
|
|
3617
|
+
const css2 = !result.isEmpty() ? sheet.toCss({ minify, optimize }) : void 0;
|
|
3618
|
+
void ctx.hooks.callHook("parser:css", result.filePath ?? "", css2);
|
|
3619
|
+
return css2;
|
|
3620
|
+
} catch (err) {
|
|
3621
|
+
logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
3622
|
+
}
|
|
3623
|
+
};
|
|
3606
3624
|
var filterProps = (ctx, props) => {
|
|
3607
3625
|
const clone = {};
|
|
3608
3626
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -3657,7 +3675,7 @@ var getBaseEngine = (conf) => {
|
|
|
3657
3675
|
strictTokens: config.strictTokens
|
|
3658
3676
|
});
|
|
3659
3677
|
const conditions = new Conditions({
|
|
3660
|
-
conditions:
|
|
3678
|
+
conditions: config.conditions,
|
|
3661
3679
|
breakpoints: config.theme?.breakpoints
|
|
3662
3680
|
});
|
|
3663
3681
|
const { textStyles, layerStyles } = theme;
|
|
@@ -3803,45 +3821,84 @@ var getPatternEngine = (config) => {
|
|
|
3803
3821
|
};
|
|
3804
3822
|
};
|
|
3805
3823
|
|
|
3824
|
+
// src/engines/file.ts
|
|
3825
|
+
var getFileEngine = (config) => {
|
|
3826
|
+
const { forceConsistentTypeExtension, outExtension } = config;
|
|
3827
|
+
return {
|
|
3828
|
+
ext(file) {
|
|
3829
|
+
return `${file}.${outExtension}`;
|
|
3830
|
+
},
|
|
3831
|
+
extDts(file) {
|
|
3832
|
+
const dts = outExtension === "mjs" && forceConsistentTypeExtension ? "d.mts" : "d.ts";
|
|
3833
|
+
return `${file}.${dts}`;
|
|
3834
|
+
},
|
|
3835
|
+
__extDts(file) {
|
|
3836
|
+
return forceConsistentTypeExtension ? this.extDts(file) : file;
|
|
3837
|
+
},
|
|
3838
|
+
import(mod, file) {
|
|
3839
|
+
return `import { ${mod} } from '${this.ext(file)}';`;
|
|
3840
|
+
},
|
|
3841
|
+
importType(mod, file) {
|
|
3842
|
+
return `import type { ${mod} } from '${this.__extDts(file)}';`;
|
|
3843
|
+
},
|
|
3844
|
+
exportType(mod, file) {
|
|
3845
|
+
return `export type { ${mod} } from '${this.__extDts(file)}';`;
|
|
3846
|
+
},
|
|
3847
|
+
exportStar(file) {
|
|
3848
|
+
return `export * from '${this.ext(file)}';`;
|
|
3849
|
+
},
|
|
3850
|
+
exportTypeStar(file) {
|
|
3851
|
+
return `export * from '${this.__extDts(file)}';`;
|
|
3852
|
+
},
|
|
3853
|
+
isTypeFile(file) {
|
|
3854
|
+
return file.endsWith(".d.ts") || file.endsWith(".d.mts");
|
|
3855
|
+
}
|
|
3856
|
+
};
|
|
3857
|
+
};
|
|
3858
|
+
|
|
3806
3859
|
// src/engines/index.ts
|
|
3807
3860
|
var getEngine = (conf) => {
|
|
3808
3861
|
const { config } = conf;
|
|
3809
|
-
const { forceConsistentTypeExtension, outExtension } = config;
|
|
3810
3862
|
return {
|
|
3811
3863
|
...getBaseEngine(conf),
|
|
3812
3864
|
patterns: getPatternEngine(config),
|
|
3813
3865
|
jsx: getJsxEngine(config),
|
|
3814
3866
|
paths: getPathEngine(config),
|
|
3815
|
-
file:
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3867
|
+
file: getFileEngine(config)
|
|
3868
|
+
};
|
|
3869
|
+
};
|
|
3870
|
+
|
|
3871
|
+
// src/parser-options.ts
|
|
3872
|
+
var getImportMap = (outdir, configImportMap) => {
|
|
3873
|
+
const { css: css2, recipes, patterns, jsx } = configImportMap ?? {};
|
|
3874
|
+
return {
|
|
3875
|
+
css: css2 ? [css2] : [outdir, "css"],
|
|
3876
|
+
recipe: recipes ? [recipes] : [outdir, "recipes"],
|
|
3877
|
+
pattern: patterns ? [patterns] : [outdir, "patterns"],
|
|
3878
|
+
jsx: jsx ? [jsx] : [outdir, "jsx"]
|
|
3879
|
+
};
|
|
3880
|
+
};
|
|
3881
|
+
var getParserOptions = (ctx) => {
|
|
3882
|
+
const { config, jsx, isValidProperty, patterns, recipes, tsconfig, tsOptions } = ctx;
|
|
3883
|
+
const compilerOptions = tsconfig?.compilerOptions ?? {};
|
|
3884
|
+
const baseUrl = compilerOptions.baseUrl ?? "";
|
|
3885
|
+
const cwd = config.cwd;
|
|
3886
|
+
const relativeBaseUrl = baseUrl !== cwd ? baseUrl.replace(cwd, "").slice(1) : cwd;
|
|
3887
|
+
return {
|
|
3888
|
+
importMap: getImportMap(config.outdir.replace(relativeBaseUrl, ""), config.importMap),
|
|
3889
|
+
jsx: {
|
|
3890
|
+
framework: jsx.framework,
|
|
3891
|
+
factory: jsx.factoryName,
|
|
3892
|
+
styleProps: jsx.styleProps,
|
|
3893
|
+
isStyleProp: isValidProperty,
|
|
3894
|
+
nodes: [...patterns.details, ...recipes.details]
|
|
3895
|
+
},
|
|
3896
|
+
patternKeys: patterns.keys,
|
|
3897
|
+
recipeKeys: recipes.keys,
|
|
3898
|
+
getRecipesByJsxName: recipes.filter,
|
|
3899
|
+
getPatternsByJsxName: patterns.filter,
|
|
3900
|
+
compilerOptions,
|
|
3901
|
+
tsOptions
|
|
3845
3902
|
};
|
|
3846
3903
|
};
|
|
3847
3904
|
|
|
@@ -3866,19 +3923,9 @@ var defaults = (conf) => ({
|
|
|
3866
3923
|
}
|
|
3867
3924
|
}
|
|
3868
3925
|
});
|
|
3869
|
-
var getImportMap = (outdir, configImportMap) => ({
|
|
3870
|
-
css: configImportMap?.css ? [configImportMap.css] : [outdir, "css"],
|
|
3871
|
-
recipe: configImportMap?.recipes ? [configImportMap.recipes] : [outdir, "recipes"],
|
|
3872
|
-
pattern: configImportMap?.patterns ? [configImportMap.patterns] : [outdir, "patterns"],
|
|
3873
|
-
jsx: configImportMap?.jsx ? [configImportMap.jsx] : [outdir, "jsx"]
|
|
3874
|
-
});
|
|
3875
3926
|
var createGenerator = (conf) => {
|
|
3876
3927
|
const ctx = getEngine(defaults(conf));
|
|
3877
|
-
const
|
|
3878
|
-
const compilerOptions = conf.tsconfig?.compilerOptions ?? {};
|
|
3879
|
-
const baseUrl = compilerOptions.baseUrl ?? "";
|
|
3880
|
-
const cwd = conf.config.cwd;
|
|
3881
|
-
const relativeBaseUrl = baseUrl !== cwd ? baseUrl.replace(cwd, "").slice(1) : cwd;
|
|
3928
|
+
const parserOptions = getParserOptions(ctx);
|
|
3882
3929
|
return {
|
|
3883
3930
|
...ctx,
|
|
3884
3931
|
getArtifacts: generateArtifacts(ctx),
|
|
@@ -3893,22 +3940,7 @@ var createGenerator = (conf) => {
|
|
|
3893
3940
|
getParserCss: generateParserCss(ctx),
|
|
3894
3941
|
//
|
|
3895
3942
|
messages: getMessages(ctx),
|
|
3896
|
-
parserOptions
|
|
3897
|
-
importMap: getImportMap(config.outdir.replace(relativeBaseUrl, ""), config.importMap),
|
|
3898
|
-
jsx: {
|
|
3899
|
-
framework: jsx.framework,
|
|
3900
|
-
factory: jsx.factoryName,
|
|
3901
|
-
styleProps: jsx.styleProps,
|
|
3902
|
-
isStyleProp: isValidProperty,
|
|
3903
|
-
nodes: [...patterns.details, ...recipes.details]
|
|
3904
|
-
},
|
|
3905
|
-
patternKeys: patterns.keys,
|
|
3906
|
-
recipeKeys: recipes.keys,
|
|
3907
|
-
getRecipesByJsxName: recipes.filter,
|
|
3908
|
-
getPatternsByJsxName: patterns.filter,
|
|
3909
|
-
compilerOptions,
|
|
3910
|
-
tsOptions: conf.tsOptions
|
|
3911
|
-
}
|
|
3943
|
+
parserOptions
|
|
3912
3944
|
};
|
|
3913
3945
|
};
|
|
3914
3946
|
export {
|