@pandacss/generator 0.0.0-dev-20230928113341 → 0.0.0-dev-20230930093547
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 +204 -125
- package/dist/index.mjs +204 -125
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1094,6 +1094,7 @@ function generateRecipes(ctx) {
|
|
|
1094
1094
|
|
|
1095
1095
|
export const ${baseName} = Object.assign(${baseName}Fn, {
|
|
1096
1096
|
__recipe__: false,
|
|
1097
|
+
__name__: '${baseName}',
|
|
1097
1098
|
raw: (props) => props,
|
|
1098
1099
|
variantKeys: ${baseName}VariantKeys,
|
|
1099
1100
|
variantMap: ${stringify2(variantKeyMap)},
|
|
@@ -1115,6 +1116,7 @@ function generateRecipes(ctx) {
|
|
|
1115
1116
|
const ${baseName}VariantKeys = Object.keys(${baseName}VariantMap)
|
|
1116
1117
|
export const ${baseName} = Object.assign(${baseName}Fn, {
|
|
1117
1118
|
__recipe__: true,
|
|
1119
|
+
__name__: '${baseName}',
|
|
1118
1120
|
raw: (props) => props,
|
|
1119
1121
|
variantKeys: ${baseName}VariantKeys,
|
|
1120
1122
|
variantMap: ${baseName}VariantMap,
|
|
@@ -1266,33 +1268,47 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1266
1268
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1267
1269
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1268
1270
|
|
|
1269
|
-
|
|
1271
|
+
const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
|
|
1272
|
+
|
|
1273
|
+
function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
1270
1274
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1271
1275
|
|
|
1276
|
+
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1277
|
+
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1278
|
+
|
|
1279
|
+
const defaultProps = Object.assign(
|
|
1280
|
+
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
1281
|
+
options.defaultProps,
|
|
1282
|
+
)
|
|
1283
|
+
|
|
1272
1284
|
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1273
|
-
const { as: Element = Dynamic, ...restProps } = props
|
|
1285
|
+
const { as: Element = Dynamic, children, ...restProps } = props
|
|
1286
|
+
|
|
1287
|
+
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
1274
1288
|
|
|
1275
|
-
const [variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1276
|
-
return splitProps(
|
|
1277
|
-
}, [
|
|
1289
|
+
const [forwardedProps, variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1290
|
+
return splitProps(combinedProps, shouldForwardProp, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1291
|
+
}, [combinedProps])
|
|
1278
1292
|
|
|
1279
1293
|
function recipeClass() {
|
|
1280
1294
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1281
1295
|
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1282
|
-
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles),
|
|
1296
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.class, combinedProps.className)
|
|
1283
1297
|
}
|
|
1284
1298
|
|
|
1285
1299
|
function cvaClass() {
|
|
1286
1300
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1287
1301
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
1288
|
-
return cx(css(cvaStyles, propStyles, cssStyles),
|
|
1302
|
+
return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.class, combinedProps.className)
|
|
1289
1303
|
}
|
|
1290
1304
|
|
|
1291
1305
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1292
1306
|
|
|
1293
1307
|
return h(Element, {
|
|
1308
|
+
...forwardedProps,
|
|
1294
1309
|
...elementProps,
|
|
1295
1310
|
...normalizeHTMLProps(htmlProps),
|
|
1311
|
+
children,
|
|
1296
1312
|
ref,
|
|
1297
1313
|
className: classes()
|
|
1298
1314
|
})
|
|
@@ -1374,7 +1390,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1374
1390
|
// src/artifacts/preact-jsx/types.ts
|
|
1375
1391
|
import { outdent as outdent16 } from "outdent";
|
|
1376
1392
|
function generatePreactJsxTypes(ctx) {
|
|
1377
|
-
const { factoryName,
|
|
1393
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1378
1394
|
return {
|
|
1379
1395
|
jsxFactory: outdent16`
|
|
1380
1396
|
import type { ${upperName} } from '../types/jsx'
|
|
@@ -1394,20 +1410,28 @@ export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
|
1394
1410
|
displayName?: string
|
|
1395
1411
|
}
|
|
1396
1412
|
|
|
1397
|
-
interface RecipeFn
|
|
1413
|
+
interface RecipeFn { __type: any }
|
|
1414
|
+
|
|
1415
|
+
interface JsxFactoryOptions<TProps extends Dict> {
|
|
1416
|
+
dataAttr?: boolean
|
|
1417
|
+
defaultProps?: TProps
|
|
1418
|
+
shouldForwardProp?(prop: string, variantKeys: string[]): boolean
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T>, P>;
|
|
1398
1422
|
|
|
1399
1423
|
interface JsxFactory {
|
|
1400
|
-
|
|
1401
|
-
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P
|
|
1424
|
+
<T extends ElementType>(component: T): ${componentName}<T, {}>
|
|
1425
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): ${componentName}<
|
|
1402
1426
|
T,
|
|
1403
1427
|
RecipeSelection<P>
|
|
1404
1428
|
>
|
|
1405
|
-
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
1429
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P, options?: JsxFactoryOptions<JsxRecipeProps<T, P['__type']>>): ${componentName}<T, P['__type']>
|
|
1406
1430
|
}
|
|
1407
1431
|
|
|
1408
1432
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
1409
1433
|
|
|
1410
|
-
export type ${upperName} = JsxFactory
|
|
1434
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1411
1435
|
|
|
1412
1436
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
1413
1437
|
`
|
|
@@ -1468,7 +1492,7 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1468
1492
|
// src/artifacts/preact-jsx/types.string-literal.ts
|
|
1469
1493
|
import { outdent as outdent18 } from "outdent";
|
|
1470
1494
|
function generatePreactJsxStringLiteralTypes(ctx) {
|
|
1471
|
-
const { factoryName,
|
|
1495
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1472
1496
|
return {
|
|
1473
1497
|
jsxFactory: outdent18`
|
|
1474
1498
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -1492,7 +1516,7 @@ interface JsxFactory {
|
|
|
1492
1516
|
|
|
1493
1517
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1494
1518
|
|
|
1495
|
-
export type ${upperName} = JsxFactory
|
|
1519
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1496
1520
|
|
|
1497
1521
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1498
1522
|
`
|
|
@@ -1510,32 +1534,46 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1510
1534
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1511
1535
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1512
1536
|
|
|
1513
|
-
|
|
1537
|
+
const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
|
|
1538
|
+
|
|
1539
|
+
function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
1514
1540
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1515
1541
|
|
|
1542
|
+
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1543
|
+
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1544
|
+
|
|
1545
|
+
const defaultProps = Object.assign(
|
|
1546
|
+
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
1547
|
+
options.defaultProps,
|
|
1548
|
+
)
|
|
1549
|
+
|
|
1516
1550
|
const ${componentName} = function ${componentName}(props) {
|
|
1517
|
-
const { as: Element = Dynamic, className, ...restProps } = props
|
|
1551
|
+
const { as: Element = Dynamic, children, className, ...restProps } = props
|
|
1518
1552
|
|
|
1519
|
-
const
|
|
1520
|
-
|
|
1553
|
+
const combinedProps = Object.assign({}, defaultProps, restProps)
|
|
1554
|
+
|
|
1555
|
+
const [forwardedProps, variantProps, styleProps, htmlProps, elementProps] =
|
|
1556
|
+
splitProps(combinedProps, shouldForwardProp, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1521
1557
|
|
|
1522
1558
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1523
1559
|
|
|
1524
1560
|
function recipeClass() {
|
|
1525
1561
|
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1526
|
-
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles),
|
|
1562
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.class, className)
|
|
1527
1563
|
}
|
|
1528
1564
|
|
|
1529
1565
|
function cvaClass() {
|
|
1530
1566
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
1531
|
-
return cx(css(cvaStyles, propStyles, cssStyles),
|
|
1567
|
+
return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.class, className)
|
|
1532
1568
|
}
|
|
1533
1569
|
|
|
1534
1570
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1535
1571
|
|
|
1536
1572
|
return h(Element, {
|
|
1573
|
+
...forwardedProps,
|
|
1537
1574
|
...elementProps,
|
|
1538
1575
|
...normalizeHTMLProps(htmlProps),
|
|
1576
|
+
children,
|
|
1539
1577
|
class: classes(),
|
|
1540
1578
|
})
|
|
1541
1579
|
}
|
|
@@ -1616,7 +1654,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1616
1654
|
// src/artifacts/qwik-jsx/types.ts
|
|
1617
1655
|
import { outdent as outdent21 } from "outdent";
|
|
1618
1656
|
function generateQwikJsxTypes(ctx) {
|
|
1619
|
-
const { factoryName,
|
|
1657
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1620
1658
|
return {
|
|
1621
1659
|
jsxFactory: outdent21`
|
|
1622
1660
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -1641,18 +1679,26 @@ export interface ${componentName}<T extends ElementType, P extends Dict = {}> ex
|
|
|
1641
1679
|
|
|
1642
1680
|
interface RecipeFn { __type: any }
|
|
1643
1681
|
|
|
1682
|
+
interface JsxFactoryOptions<TProps extends Dict> {
|
|
1683
|
+
dataAttr?: boolean
|
|
1684
|
+
defaultProps?: TProps
|
|
1685
|
+
shouldForwardProp?(prop: string, variantKeys: string[]): boolean
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T>, P>;
|
|
1689
|
+
|
|
1644
1690
|
interface JsxFactory {
|
|
1645
|
-
|
|
1646
|
-
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P
|
|
1691
|
+
<T extends ElementType>(component: T): ${componentName}<T, {}>
|
|
1692
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): ${componentName}<
|
|
1647
1693
|
T,
|
|
1648
1694
|
RecipeSelection<P>
|
|
1649
1695
|
>
|
|
1650
|
-
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
1696
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P, options?: JsxFactoryOptions<JsxRecipeProps<T, P['__type']>>): ${componentName}<T, P['__type']>
|
|
1651
1697
|
}
|
|
1652
1698
|
|
|
1653
1699
|
type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K, {}> }
|
|
1654
1700
|
|
|
1655
|
-
export type ${upperName} = JsxFactory
|
|
1701
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1656
1702
|
|
|
1657
1703
|
export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxStyleProps>
|
|
1658
1704
|
`
|
|
@@ -1712,7 +1758,7 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1712
1758
|
// src/artifacts/qwik-jsx/types.string-literal.ts
|
|
1713
1759
|
import { outdent as outdent23 } from "outdent";
|
|
1714
1760
|
function generateQwikJsxStringLiteralTypes(ctx) {
|
|
1715
|
-
const { factoryName,
|
|
1761
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1716
1762
|
return {
|
|
1717
1763
|
jsxFactory: outdent23`
|
|
1718
1764
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -1741,7 +1787,7 @@ interface JsxFactory {
|
|
|
1741
1787
|
|
|
1742
1788
|
type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K> }
|
|
1743
1789
|
|
|
1744
|
-
export type ${upperName} = JsxFactory
|
|
1790
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1745
1791
|
|
|
1746
1792
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1747
1793
|
`
|
|
@@ -1750,7 +1796,6 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1750
1796
|
|
|
1751
1797
|
// src/artifacts/react-jsx/jsx.ts
|
|
1752
1798
|
import { outdent as outdent24 } from "outdent";
|
|
1753
|
-
import { match as match6 } from "ts-pattern";
|
|
1754
1799
|
function generateReactJsxFactory(ctx) {
|
|
1755
1800
|
const { factoryName, componentName } = ctx.jsx;
|
|
1756
1801
|
return {
|
|
@@ -1758,70 +1803,50 @@ function generateReactJsxFactory(ctx) {
|
|
|
1758
1803
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1759
1804
|
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1760
1805
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1761
|
-
${ctx.
|
|
1806
|
+
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1762
1807
|
|
|
1763
|
-
|
|
1808
|
+
const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
|
|
1809
|
+
|
|
1810
|
+
function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
1764
1811
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1765
1812
|
|
|
1813
|
+
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1814
|
+
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1815
|
+
|
|
1816
|
+
const defaultProps = Object.assign(
|
|
1817
|
+
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
1818
|
+
options.defaultProps,
|
|
1819
|
+
)
|
|
1820
|
+
|
|
1766
1821
|
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1767
|
-
const { as: Element = Dynamic, ...restProps } = props
|
|
1822
|
+
const { as: Element = Dynamic, children, ...restProps } = props
|
|
1768
1823
|
|
|
1769
|
-
|
|
1770
|
-
return outdent24`
|
|
1771
|
-
const [variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1772
|
-
return splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1773
|
-
}, [restProps])
|
|
1824
|
+
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
1774
1825
|
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className)
|
|
1779
|
-
}
|
|
1826
|
+
const [forwardedProps, variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1827
|
+
return splitProps(combinedProps, shouldForwardProp, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1828
|
+
}, [combinedProps])
|
|
1780
1829
|
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
}).with("minimal", () => {
|
|
1787
|
-
return outdent24`
|
|
1788
|
-
const [variantProps, htmlProps, elementProps] = useMemo(() => {
|
|
1789
|
-
return splitProps(restProps, cvaFn.variantKeys, normalizeHTMLProps.keys)
|
|
1790
|
-
}, [restProps])
|
|
1791
|
-
|
|
1792
|
-
function recipeClass() {
|
|
1793
|
-
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1794
|
-
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, elementProps.css), elementProps.className)
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
function cvaClass() {
|
|
1798
|
-
const cvaStyles = cvaFn.raw(variantProps)
|
|
1799
|
-
return cx(css(cvaStyles, elementProps.css), elementProps.className)
|
|
1800
|
-
}`;
|
|
1801
|
-
}).with("none", () => {
|
|
1802
|
-
return outdent24`
|
|
1803
|
-
const [variantProps, htmlProps, elementProps] = useMemo(() => {
|
|
1804
|
-
return splitProps(restProps, cvaFn.variantKeys, normalizeHTMLProps.keys)
|
|
1805
|
-
}, [restProps])
|
|
1806
|
-
|
|
1807
|
-
function recipeClass() {
|
|
1808
|
-
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1809
|
-
return cx(cvaFn(variantProps, false), elementProps.className)
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
function cvaClass() {
|
|
1813
|
-
const cvaStyles = cvaFn.raw(variantProps)
|
|
1814
|
-
return cx(css(cvaStyles), elementProps.className)
|
|
1815
|
-
}`;
|
|
1816
|
-
}).run()}
|
|
1830
|
+
function recipeClass() {
|
|
1831
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1832
|
+
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1833
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.className)
|
|
1834
|
+
}
|
|
1817
1835
|
|
|
1836
|
+
function cvaClass() {
|
|
1837
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1838
|
+
const cvaStyles = cvaFn.raw(variantProps)
|
|
1839
|
+
return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.className)
|
|
1840
|
+
}
|
|
1818
1841
|
|
|
1819
1842
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1820
1843
|
|
|
1821
1844
|
return createElement(Element, {
|
|
1822
1845
|
ref,
|
|
1846
|
+
...forwardedProps,
|
|
1823
1847
|
...elementProps,
|
|
1824
1848
|
...normalizeHTMLProps(htmlProps),
|
|
1849
|
+
children,
|
|
1825
1850
|
className: classes(),
|
|
1826
1851
|
})
|
|
1827
1852
|
})
|
|
@@ -1855,7 +1880,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1855
1880
|
|
|
1856
1881
|
// src/artifacts/react-jsx/pattern.ts
|
|
1857
1882
|
import { outdent as outdent25 } from "outdent";
|
|
1858
|
-
import { match as
|
|
1883
|
+
import { match as match6 } from "ts-pattern";
|
|
1859
1884
|
function generateReactJsxPattern(ctx) {
|
|
1860
1885
|
const { typeName, factoryName } = ctx.jsx;
|
|
1861
1886
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1869,7 +1894,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1869
1894
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1870
1895
|
|
|
1871
1896
|
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1872
|
-
${
|
|
1897
|
+
${match6(props.length).with(
|
|
1873
1898
|
0,
|
|
1874
1899
|
() => outdent25`
|
|
1875
1900
|
const styleProps = ${styleFnName}()
|
|
@@ -1902,7 +1927,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1902
1927
|
// src/artifacts/react-jsx/types.ts
|
|
1903
1928
|
import { outdent as outdent26 } from "outdent";
|
|
1904
1929
|
function generateReactJsxTypes(ctx) {
|
|
1905
|
-
const { factoryName,
|
|
1930
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1906
1931
|
return {
|
|
1907
1932
|
jsxFactory: outdent26`
|
|
1908
1933
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -1926,18 +1951,26 @@ export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
|
1926
1951
|
|
|
1927
1952
|
interface RecipeFn { __type: any }
|
|
1928
1953
|
|
|
1954
|
+
interface JsxFactoryOptions<TProps extends Dict> {
|
|
1955
|
+
dataAttr?: boolean
|
|
1956
|
+
defaultProps?: TProps
|
|
1957
|
+
shouldForwardProp?(prop: string, variantKeys: string[]): boolean
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T>, P>;
|
|
1961
|
+
|
|
1929
1962
|
interface JsxFactory {
|
|
1930
|
-
|
|
1931
|
-
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P
|
|
1963
|
+
<T extends ElementType>(component: T): ${componentName}<T, {}>
|
|
1964
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): ${componentName}<
|
|
1932
1965
|
T,
|
|
1933
1966
|
RecipeSelection<P>
|
|
1934
1967
|
>
|
|
1935
|
-
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
1968
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P, options?: JsxFactoryOptions<JsxRecipeProps<T, P['__type']>>): ${componentName}<T, P['__type']>
|
|
1936
1969
|
}
|
|
1937
1970
|
|
|
1938
1971
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
1939
1972
|
|
|
1940
|
-
export type ${upperName} = JsxFactory
|
|
1973
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1941
1974
|
|
|
1942
1975
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
1943
1976
|
`
|
|
@@ -1998,7 +2031,7 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1998
2031
|
// src/artifacts/react-jsx/types.string-literal.ts
|
|
1999
2032
|
import { outdent as outdent28 } from "outdent";
|
|
2000
2033
|
function generateReactJsxStringLiteralTypes(ctx) {
|
|
2001
|
-
const { factoryName,
|
|
2034
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2002
2035
|
return {
|
|
2003
2036
|
jsxFactory: outdent28`
|
|
2004
2037
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -2025,7 +2058,7 @@ interface JsxFactory {
|
|
|
2025
2058
|
|
|
2026
2059
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2027
2060
|
|
|
2028
|
-
export type ${upperName} = JsxFactory
|
|
2061
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
2029
2062
|
|
|
2030
2063
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2031
2064
|
`
|
|
@@ -2039,21 +2072,33 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2039
2072
|
return {
|
|
2040
2073
|
js: outdent29`
|
|
2041
2074
|
import { Dynamic } from 'solid-js/web'
|
|
2042
|
-
import { mergeProps, splitProps } from 'solid-js'
|
|
2075
|
+
import { createMemo, mergeProps, splitProps } from 'solid-js'
|
|
2043
2076
|
import { createComponent } from 'solid-js/web'
|
|
2044
|
-
${ctx.file.import("css, cx, cva
|
|
2077
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
2045
2078
|
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
2046
|
-
${ctx.file.import("allCssProperties", "./is-valid-prop")}
|
|
2047
|
-
|
|
2048
|
-
|
|
2079
|
+
${ctx.file.import("isCssProperty, allCssProperties", "./is-valid-prop")}
|
|
2080
|
+
|
|
2081
|
+
const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
|
|
2082
|
+
|
|
2083
|
+
function styledFn(element, configOrCva = {}, options = {}) {
|
|
2049
2084
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2050
2085
|
|
|
2086
|
+
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
2087
|
+
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
2088
|
+
|
|
2089
|
+
const defaultProps = Object.assign(
|
|
2090
|
+
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
2091
|
+
options.defaultProps,
|
|
2092
|
+
)
|
|
2093
|
+
|
|
2051
2094
|
return function ${componentName}(props) {
|
|
2052
|
-
const mergedProps = mergeProps({ as: element }, props)
|
|
2095
|
+
const mergedProps = mergeProps({ as: element }, defaultProps, props)
|
|
2096
|
+
const forwardedKeys = createMemo(() => Object.keys(props).filter(shouldForwardProp))
|
|
2053
2097
|
|
|
2054
|
-
const [localProps, variantProps, styleProps, htmlProps, elementProps] = splitProps(
|
|
2098
|
+
const [localProps, forwardedProps, variantProps, styleProps, htmlProps, elementProps] = splitProps(
|
|
2055
2099
|
mergedProps,
|
|
2056
2100
|
['as', 'class', 'className'],
|
|
2101
|
+
forwardedKeys(),
|
|
2057
2102
|
cvaFn.variantKeys,
|
|
2058
2103
|
allCssProperties,
|
|
2059
2104
|
normalizeHTMLProps.keys
|
|
@@ -2073,9 +2118,14 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2073
2118
|
|
|
2074
2119
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2075
2120
|
|
|
2121
|
+
if (forwardedProps.className) {
|
|
2122
|
+
delete forwardedProps.className
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2076
2125
|
return createComponent(
|
|
2077
2126
|
Dynamic,
|
|
2078
2127
|
mergeProps(
|
|
2128
|
+
forwardedProps,
|
|
2079
2129
|
elementProps,
|
|
2080
2130
|
normalizeHTMLProps(htmlProps),
|
|
2081
2131
|
{
|
|
@@ -2114,7 +2164,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2114
2164
|
|
|
2115
2165
|
// src/artifacts/solid-jsx/pattern.ts
|
|
2116
2166
|
import { outdent as outdent30 } from "outdent";
|
|
2117
|
-
import { match as
|
|
2167
|
+
import { match as match7 } from "ts-pattern";
|
|
2118
2168
|
function generateSolidJsxPattern(ctx) {
|
|
2119
2169
|
const { typeName, factoryName } = ctx.jsx;
|
|
2120
2170
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -2129,7 +2179,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2129
2179
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
2130
2180
|
|
|
2131
2181
|
export function ${jsxName}(props) {
|
|
2132
|
-
${
|
|
2182
|
+
${match7(props.length).with(
|
|
2133
2183
|
0,
|
|
2134
2184
|
() => outdent30`
|
|
2135
2185
|
const styleProps = ${styleFnName}()
|
|
@@ -2162,7 +2212,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2162
2212
|
// src/artifacts/solid-jsx/types.ts
|
|
2163
2213
|
import { outdent as outdent31 } from "outdent";
|
|
2164
2214
|
function generateSolidJsxTypes(ctx) {
|
|
2165
|
-
const { factoryName,
|
|
2215
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2166
2216
|
return {
|
|
2167
2217
|
jsxFactory: outdent31`
|
|
2168
2218
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -2184,18 +2234,26 @@ export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
|
2184
2234
|
|
|
2185
2235
|
interface RecipeFn { __type: any }
|
|
2186
2236
|
|
|
2237
|
+
interface JsxFactoryOptions<TProps extends Dict> {
|
|
2238
|
+
dataAttr?: boolean
|
|
2239
|
+
defaultProps?: TProps
|
|
2240
|
+
shouldForwardProp?(prop: string, variantKeys: string[]): boolean
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T>, P>;
|
|
2244
|
+
|
|
2187
2245
|
interface JsxFactory {
|
|
2188
|
-
|
|
2189
|
-
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P
|
|
2246
|
+
<T extends ElementType>(component: T): ${componentName}<T, {}>
|
|
2247
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): ${componentName}<
|
|
2190
2248
|
T,
|
|
2191
2249
|
RecipeSelection<P>
|
|
2192
2250
|
>
|
|
2193
|
-
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
2251
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P, options?: JsxFactoryOptions<JsxRecipeProps<T, P['__type']>>): ${componentName}<T, P['__type']>
|
|
2194
2252
|
}
|
|
2195
2253
|
|
|
2196
2254
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
2197
2255
|
|
|
2198
|
-
export type ${upperName} = JsxFactory
|
|
2256
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
2199
2257
|
|
|
2200
2258
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2201
2259
|
`
|
|
@@ -2261,7 +2319,7 @@ export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
|
2261
2319
|
// src/artifacts/solid-jsx/types.string-literal.ts
|
|
2262
2320
|
import { outdent as outdent33 } from "outdent";
|
|
2263
2321
|
function generateSolidJsxStringLiteralTypes(ctx) {
|
|
2264
|
-
const { factoryName,
|
|
2322
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2265
2323
|
return {
|
|
2266
2324
|
jsxFactory: outdent33`
|
|
2267
2325
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -2285,7 +2343,7 @@ interface JsxFactory {
|
|
|
2285
2343
|
|
|
2286
2344
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2287
2345
|
|
|
2288
|
-
export type ${upperName} = JsxFactory
|
|
2346
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
2289
2347
|
|
|
2290
2348
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2291
2349
|
`
|
|
@@ -2299,12 +2357,23 @@ function generateVueJsxFactory(ctx) {
|
|
|
2299
2357
|
return {
|
|
2300
2358
|
js: outdent34`
|
|
2301
2359
|
import { defineComponent, h, computed } from 'vue'
|
|
2302
|
-
${ctx.file.import("css, cx, cva
|
|
2360
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
2303
2361
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
2304
2362
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
2305
2363
|
|
|
2306
|
-
|
|
2364
|
+
const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
|
|
2365
|
+
|
|
2366
|
+
function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
2307
2367
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2368
|
+
|
|
2369
|
+
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
2370
|
+
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
2371
|
+
|
|
2372
|
+
const defaultProps = Object.assign(
|
|
2373
|
+
options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
|
|
2374
|
+
options.defaultProps,
|
|
2375
|
+
)
|
|
2376
|
+
|
|
2308
2377
|
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2309
2378
|
|
|
2310
2379
|
return defineComponent({
|
|
@@ -2312,32 +2381,34 @@ function generateVueJsxFactory(ctx) {
|
|
|
2312
2381
|
inheritAttrs: false,
|
|
2313
2382
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2314
2383
|
setup(props, { slots, attrs }) {
|
|
2384
|
+
const combinedProps = computed(() => Object.assign({}, defaultProps, attrs))
|
|
2385
|
+
|
|
2315
2386
|
const splittedProps = computed(() => {
|
|
2316
|
-
return splitProps(
|
|
2387
|
+
return splitProps(combinedProps.value, shouldForwardProp, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
2317
2388
|
})
|
|
2318
2389
|
|
|
2319
2390
|
const recipeClass = computed(() => {
|
|
2320
|
-
const [variantProps, styleProps, _htmlProps,
|
|
2391
|
+
const [_forwardedProps, variantProps, styleProps, _htmlProps, _elementProps] = splittedProps.value
|
|
2321
2392
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
2322
2393
|
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
2323
|
-
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles),
|
|
2394
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.value.className)
|
|
2324
2395
|
})
|
|
2325
2396
|
|
|
2326
2397
|
const cvaClass = computed(() => {
|
|
2327
|
-
const [variantProps, styleProps, _htmlProps,
|
|
2398
|
+
const [_forwardedProps, variantProps, styleProps, _htmlProps, _elementProps] = splittedProps.value
|
|
2328
2399
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
2329
2400
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
2330
|
-
return cx(css(cvaStyles, propStyles, cssStyles),
|
|
2401
|
+
return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.value.className)
|
|
2331
2402
|
})
|
|
2332
2403
|
|
|
2333
2404
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2334
2405
|
|
|
2335
2406
|
return () => {
|
|
2336
|
-
const [
|
|
2337
|
-
|
|
2407
|
+
const [forwardedProps, _variantProps, _styleProps, htmlProps, elementProps] = splittedProps.value
|
|
2338
2408
|
return h(
|
|
2339
2409
|
props.as,
|
|
2340
2410
|
{
|
|
2411
|
+
...forwardedProps,
|
|
2341
2412
|
...elementProps,
|
|
2342
2413
|
...normalizeHTMLProps(htmlProps),
|
|
2343
2414
|
class: classes.value,
|
|
@@ -2468,7 +2539,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2468
2539
|
// src/artifacts/vue-jsx/types.ts
|
|
2469
2540
|
import { outdent as outdent37 } from "outdent";
|
|
2470
2541
|
function generateVueJsxTypes(ctx) {
|
|
2471
|
-
const { factoryName,
|
|
2542
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2472
2543
|
return {
|
|
2473
2544
|
jsxFactory: outdent37`
|
|
2474
2545
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -2494,20 +2565,28 @@ export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
|
2494
2565
|
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2495
2566
|
> {}
|
|
2496
2567
|
|
|
2497
|
-
interface RecipeFn
|
|
2568
|
+
interface RecipeFn { __type: any }
|
|
2569
|
+
|
|
2570
|
+
interface JsxFactoryOptions<TProps extends Dict> {
|
|
2571
|
+
dataAttr?: boolean
|
|
2572
|
+
defaultProps?: TProps
|
|
2573
|
+
shouldForwardProp?(prop: string, variantKeys: string[]): boolean
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
export type JsxRecipeProps<T extends ElementType, P extends RecipeFn> = JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P['__type']>>;
|
|
2498
2577
|
|
|
2499
2578
|
interface JsxFactory {
|
|
2500
|
-
|
|
2501
|
-
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P
|
|
2579
|
+
<T extends ElementType>(component: T): ${componentName}<T, {}>
|
|
2580
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): ${componentName}<
|
|
2502
2581
|
T,
|
|
2503
2582
|
RecipeSelection<P>
|
|
2504
2583
|
>
|
|
2505
|
-
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
2584
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P, options?: JsxFactoryOptions<JsxRecipeProps<T, P['__type']>> ): ${componentName}<T, P['__type']>
|
|
2506
2585
|
}
|
|
2507
2586
|
|
|
2508
2587
|
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K, {}> }
|
|
2509
2588
|
|
|
2510
|
-
export type ${upperName} = JsxFactory
|
|
2589
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
2511
2590
|
|
|
2512
2591
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2513
2592
|
`
|
|
@@ -2517,7 +2596,7 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
2517
2596
|
// src/artifacts/vue-jsx/types.string-literal.ts
|
|
2518
2597
|
import { outdent as outdent38 } from "outdent";
|
|
2519
2598
|
function generateVueJsxStringLiteralTypes(ctx) {
|
|
2520
|
-
const { factoryName,
|
|
2599
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2521
2600
|
return {
|
|
2522
2601
|
jsxFactory: outdent38`
|
|
2523
2602
|
${ctx.file.importType(upperName, "../types/jsx")}
|
|
@@ -2545,7 +2624,7 @@ interface JsxFactory {
|
|
|
2545
2624
|
|
|
2546
2625
|
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K> }
|
|
2547
2626
|
|
|
2548
|
-
export type ${upperName} = JsxFactory
|
|
2627
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
2549
2628
|
|
|
2550
2629
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2551
2630
|
`
|
|
@@ -2689,7 +2768,7 @@ var selectors_d_ts_default = {
|
|
|
2689
2768
|
};
|
|
2690
2769
|
|
|
2691
2770
|
// src/artifacts/types/generated.ts
|
|
2692
|
-
import { match as
|
|
2771
|
+
import { match as match8 } from "ts-pattern";
|
|
2693
2772
|
var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
|
|
2694
2773
|
function getGeneratedTypes(ctx) {
|
|
2695
2774
|
const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
|
|
@@ -2701,7 +2780,7 @@ function getGeneratedTypes(ctx) {
|
|
|
2701
2780
|
composition: rewriteImports(composition_d_ts_default.content),
|
|
2702
2781
|
selectors: rewriteImports(selectors_d_ts_default.content),
|
|
2703
2782
|
system: rewriteImports(
|
|
2704
|
-
|
|
2783
|
+
match8(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()
|
|
2705
2784
|
)
|
|
2706
2785
|
};
|
|
2707
2786
|
}
|
|
@@ -3149,7 +3228,7 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
3149
3228
|
// src/artifacts/css/parser-css.ts
|
|
3150
3229
|
import { logger } from "@pandacss/logger";
|
|
3151
3230
|
import { pipe, tap, tryCatch } from "lil-fp/func";
|
|
3152
|
-
import { P, match as
|
|
3231
|
+
import { P, match as match9 } from "ts-pattern";
|
|
3153
3232
|
var generateParserCss = (ctx) => (result) => pipe(
|
|
3154
3233
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
3155
3234
|
tap(({ sheet, result: result2, patterns, recipes }) => {
|
|
@@ -3179,7 +3258,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3179
3258
|
const recipeConfig = recipes.getConfig(recipeName);
|
|
3180
3259
|
if (!recipeConfig)
|
|
3181
3260
|
continue;
|
|
3182
|
-
|
|
3261
|
+
match9(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3183
3262
|
recipe.data.forEach((data) => {
|
|
3184
3263
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3185
3264
|
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
@@ -3198,7 +3277,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3198
3277
|
result2.pattern.forEach((patternSet, name) => {
|
|
3199
3278
|
try {
|
|
3200
3279
|
for (const pattern of patternSet) {
|
|
3201
|
-
|
|
3280
|
+
match9(pattern).with({ type: "jsx-pattern", name: P.string }, ({ name: jsxName }) => {
|
|
3202
3281
|
pattern.data.forEach((data) => {
|
|
3203
3282
|
const fnName = patterns.find(jsxName);
|
|
3204
3283
|
const styleProps = patterns.transform(fnName, data);
|