@pandacss/generator 0.15.1 → 0.15.3
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 +18 -13
- package/dist/index.d.ts +18 -13
- package/dist/index.js +108 -98
- package/dist/index.mjs +108 -98
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -541,9 +541,11 @@ function generateConditions(ctx) {
|
|
|
541
541
|
dts: outdent2`
|
|
542
542
|
${ctx.file.importType("AnySelector, Selectors", "./selectors")}
|
|
543
543
|
|
|
544
|
-
export
|
|
544
|
+
export interface Conditions {
|
|
545
545
|
${keys.map(
|
|
546
|
-
(key) => ` ${key === "base" ? `/** The base (=no conditions) styles to apply
|
|
546
|
+
(key) => ` ${key === "base" ? `/** The base (=no conditions) styles to apply */
|
|
547
|
+
` : ctx.conditions.get(key) ? `/** \`${ctx.conditions.get(key)}\` */
|
|
548
|
+
` : ""} ${JSON.stringify(key)}: string`
|
|
547
549
|
).join("\n")}
|
|
548
550
|
}
|
|
549
551
|
|
|
@@ -948,7 +950,7 @@ function generatePattern(ctx) {
|
|
|
948
950
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
949
951
|
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
950
952
|
|
|
951
|
-
export
|
|
953
|
+
export interface ${upperName}Properties {
|
|
952
954
|
${Object.keys(properties ?? {}).map((key) => {
|
|
953
955
|
const value = properties[key];
|
|
954
956
|
return match2(value).with({ type: "property" }, (value2) => {
|
|
@@ -968,7 +970,7 @@ function generatePattern(ctx) {
|
|
|
968
970
|
|
|
969
971
|
${strict ? outdent10`export declare function ${baseName}(styles: ${upperName}Properties): string` : outdent10`
|
|
970
972
|
|
|
971
|
-
|
|
973
|
+
interface ${upperName}Styles extends ${upperName}Properties, DistributiveOmit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}> {}
|
|
972
974
|
|
|
973
975
|
interface ${upperName}PatternFn {
|
|
974
976
|
(styles?: ${upperName}Styles): string
|
|
@@ -1021,7 +1023,15 @@ function generateRecipes(ctx) {
|
|
|
1021
1023
|
${ctx.file.import("compact, createCss, withoutSpace", "../helpers")}
|
|
1022
1024
|
|
|
1023
1025
|
export const createRecipe = (name, defaultVariants, compoundVariants) => {
|
|
1024
|
-
|
|
1026
|
+
const getRecipeStyles = (variants) => {
|
|
1027
|
+
return {
|
|
1028
|
+
[name]: '__ignore__',
|
|
1029
|
+
...defaultVariants,
|
|
1030
|
+
...compact(variants),
|
|
1031
|
+
};
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
const recipeFn = (variants, withCompoundVariants = true) => {
|
|
1025
1035
|
const transform = (prop, value) => {
|
|
1026
1036
|
assertCompoundVariant(name, compoundVariants, variants, prop)
|
|
1027
1037
|
|
|
@@ -1041,16 +1051,21 @@ function generateRecipes(ctx) {
|
|
|
1041
1051
|
}
|
|
1042
1052
|
})
|
|
1043
1053
|
|
|
1044
|
-
const recipeStyles =
|
|
1045
|
-
[name]: '__ignore__',
|
|
1046
|
-
...defaultVariants,
|
|
1047
|
-
...compact(variants),
|
|
1048
|
-
}
|
|
1054
|
+
const recipeStyles = getRecipeStyles(variants)
|
|
1049
1055
|
|
|
1050
|
-
|
|
1056
|
+
if (withCompoundVariants) {
|
|
1057
|
+
const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
|
|
1058
|
+
return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
|
|
1059
|
+
}
|
|
1051
1060
|
|
|
1052
|
-
return
|
|
1061
|
+
return recipeCss(recipeStyles)
|
|
1053
1062
|
}
|
|
1063
|
+
|
|
1064
|
+
return Object.assign(recipeFn, {
|
|
1065
|
+
__getCompoundVariantCss__: (variants) => {
|
|
1066
|
+
return getCompoundVariantCss(compoundVariants, getRecipeStyles(variants));
|
|
1067
|
+
},
|
|
1068
|
+
})
|
|
1054
1069
|
}
|
|
1055
1070
|
`
|
|
1056
1071
|
};
|
|
@@ -1117,7 +1132,7 @@ function generateRecipes(ctx) {
|
|
|
1117
1132
|
${ctx.file.importType("Pretty", "../types/helpers")}
|
|
1118
1133
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1119
1134
|
|
|
1120
|
-
|
|
1135
|
+
interface ${upperName}Variant {
|
|
1121
1136
|
${Object.keys(variantKeyMap).map((key) => {
|
|
1122
1137
|
const values = variantKeyMap[key];
|
|
1123
1138
|
if (values.every(isBooleanValue))
|
|
@@ -1134,7 +1149,7 @@ function generateRecipes(ctx) {
|
|
|
1134
1149
|
[key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`}
|
|
1135
1150
|
}
|
|
1136
1151
|
|
|
1137
|
-
interface ${upperName}Recipe {
|
|
1152
|
+
export interface ${upperName}Recipe {
|
|
1138
1153
|
__type: ${upperName}VariantProps
|
|
1139
1154
|
(props?: ${upperName}VariantProps): ${isSlotRecipe(config) ? `Pretty<Record<${unionType2(config.slots)}, string>>` : "string"}
|
|
1140
1155
|
raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
@@ -1247,7 +1262,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1247
1262
|
import { h } from 'preact'
|
|
1248
1263
|
import { forwardRef } from 'preact/compat'
|
|
1249
1264
|
import { useMemo } from 'preact/hooks'
|
|
1250
|
-
${ctx.file.import("css, cx, cva
|
|
1265
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1251
1266
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1252
1267
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1253
1268
|
|
|
@@ -1263,15 +1278,14 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1263
1278
|
|
|
1264
1279
|
function recipeClass() {
|
|
1265
1280
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1266
|
-
const
|
|
1267
|
-
return cx(cvaFn(variantProps), css(
|
|
1281
|
+
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1282
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className, elementProps.class)
|
|
1268
1283
|
}
|
|
1269
1284
|
|
|
1270
1285
|
function cvaClass() {
|
|
1271
1286
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1272
1287
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
1273
|
-
|
|
1274
|
-
return cx(css(styles), elementProps.className, elementProps.class)
|
|
1288
|
+
return cx(css(cvaStyles, propStyles, cssStyles), elementProps.className, elementProps.class)
|
|
1275
1289
|
}
|
|
1276
1290
|
|
|
1277
1291
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
@@ -1348,7 +1362,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1348
1362
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1349
1363
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1350
1364
|
|
|
1351
|
-
export
|
|
1365
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1352
1366
|
|
|
1353
1367
|
${description ? `/** ${description} */` : ""}
|
|
1354
1368
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
@@ -1375,12 +1389,12 @@ type ElementType = keyof JSX.IntrinsicElements
|
|
|
1375
1389
|
|
|
1376
1390
|
type Dict = Record<string, unknown>
|
|
1377
1391
|
|
|
1378
|
-
export
|
|
1392
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
1379
1393
|
(props: JsxHTMLProps<ComponentProps<T>, P> & JsxStyleProps): JSX.Element
|
|
1380
1394
|
displayName?: string
|
|
1381
1395
|
}
|
|
1382
1396
|
|
|
1383
|
-
|
|
1397
|
+
interface RecipeFn = { __type: any }
|
|
1384
1398
|
|
|
1385
1399
|
interface JsxFactory {
|
|
1386
1400
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1492,7 +1506,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1492
1506
|
return {
|
|
1493
1507
|
js: outdent19`
|
|
1494
1508
|
import { h } from '@builder.io/qwik'
|
|
1495
|
-
${ctx.file.import("css, cx, cva
|
|
1509
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1496
1510
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1497
1511
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1498
1512
|
|
|
@@ -1508,14 +1522,13 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1508
1522
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1509
1523
|
|
|
1510
1524
|
function recipeClass() {
|
|
1511
|
-
const
|
|
1512
|
-
return cx(cvaFn(variantProps), css(
|
|
1525
|
+
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1526
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.class)
|
|
1513
1527
|
}
|
|
1514
1528
|
|
|
1515
1529
|
function cvaClass() {
|
|
1516
1530
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
1517
|
-
|
|
1518
|
-
return cx(css(styles), elementProps.class)
|
|
1531
|
+
return cx(css(cvaStyles, propStyles, cssStyles), elementProps.class)
|
|
1519
1532
|
}
|
|
1520
1533
|
|
|
1521
1534
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
@@ -1568,7 +1581,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1568
1581
|
import { h } from '@builder.io/qwik'
|
|
1569
1582
|
${ctx.file.import(factoryName, "./factory")}
|
|
1570
1583
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1571
|
-
|
|
1584
|
+
|
|
1572
1585
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1573
1586
|
${match5(props.length).with(
|
|
1574
1587
|
0,
|
|
@@ -1591,8 +1604,8 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1591
1604
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1592
1605
|
${ctx.file.importType("Assign, DistributiveOmit", "../types/system-types")}
|
|
1593
1606
|
|
|
1594
|
-
export
|
|
1595
|
-
|
|
1607
|
+
export interface ${upperName}Props extends Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>> {}
|
|
1608
|
+
|
|
1596
1609
|
${description ? `/** ${description} */` : ""}
|
|
1597
1610
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
1598
1611
|
`
|
|
@@ -1616,7 +1629,7 @@ import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './r
|
|
|
1616
1629
|
|
|
1617
1630
|
type ElementType = keyof QwikIntrinsicElements | Component<any>
|
|
1618
1631
|
|
|
1619
|
-
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1632
|
+
export type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1620
1633
|
? QwikIntrinsicElements[T]
|
|
1621
1634
|
: T extends Component<infer P>
|
|
1622
1635
|
? P
|
|
@@ -1624,9 +1637,9 @@ type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElemen
|
|
|
1624
1637
|
|
|
1625
1638
|
type Dict = Record<string, unknown>
|
|
1626
1639
|
|
|
1627
|
-
export
|
|
1640
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> extends Component<Assign<ComponentProps<T>, PatchedHTMLProps, Assign<JsxStyleProps, P>>> {}
|
|
1628
1641
|
|
|
1629
|
-
|
|
1642
|
+
interface RecipeFn { __type: any }
|
|
1630
1643
|
|
|
1631
1644
|
interface JsxFactory {
|
|
1632
1645
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1710,7 +1723,7 @@ import type { Component, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
|
1710
1723
|
|
|
1711
1724
|
type ElementType = keyof QwikIntrinsicElements | Component<any>
|
|
1712
1725
|
|
|
1713
|
-
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1726
|
+
export type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1714
1727
|
? QwikIntrinsicElements[T]
|
|
1715
1728
|
: T extends Component<infer P>
|
|
1716
1729
|
? P
|
|
@@ -1743,7 +1756,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1743
1756
|
return {
|
|
1744
1757
|
js: outdent24`
|
|
1745
1758
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1746
|
-
${ctx.file.import("css, cx, cva
|
|
1759
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1747
1760
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1748
1761
|
${ctx.jsx.styleProps === "all" ? ctx.file.import("isCssProperty", "./is-valid-prop") : ""}
|
|
1749
1762
|
|
|
@@ -1761,15 +1774,14 @@ function generateReactJsxFactory(ctx) {
|
|
|
1761
1774
|
|
|
1762
1775
|
function recipeClass() {
|
|
1763
1776
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1764
|
-
const
|
|
1765
|
-
return cx(cvaFn(variantProps), css(
|
|
1777
|
+
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1778
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className)
|
|
1766
1779
|
}
|
|
1767
1780
|
|
|
1768
1781
|
function cvaClass() {
|
|
1769
1782
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1770
1783
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
1771
|
-
|
|
1772
|
-
return cx(css(styles), elementProps.className)
|
|
1784
|
+
return cx(css(cvaStyles, propStyles, cssStyles), elementProps.className)
|
|
1773
1785
|
}`;
|
|
1774
1786
|
}).with("minimal", () => {
|
|
1775
1787
|
return outdent24`
|
|
@@ -1778,13 +1790,13 @@ function generateReactJsxFactory(ctx) {
|
|
|
1778
1790
|
}, [restProps])
|
|
1779
1791
|
|
|
1780
1792
|
function recipeClass() {
|
|
1781
|
-
|
|
1793
|
+
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1794
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, elementProps.css), elementProps.className)
|
|
1782
1795
|
}
|
|
1783
1796
|
|
|
1784
1797
|
function cvaClass() {
|
|
1785
1798
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
1786
|
-
|
|
1787
|
-
return cx(css(styles), elementProps.className)
|
|
1799
|
+
return cx(css(cvaStyles, elementProps.css), elementProps.className)
|
|
1788
1800
|
}`;
|
|
1789
1801
|
}).with("none", () => {
|
|
1790
1802
|
return outdent24`
|
|
@@ -1793,13 +1805,13 @@ function generateReactJsxFactory(ctx) {
|
|
|
1793
1805
|
}, [restProps])
|
|
1794
1806
|
|
|
1795
1807
|
function recipeClass() {
|
|
1796
|
-
|
|
1808
|
+
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
1809
|
+
return cx(cvaFn(variantProps, false), elementProps.className)
|
|
1797
1810
|
}
|
|
1798
1811
|
|
|
1799
1812
|
function cvaClass() {
|
|
1800
1813
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
1801
|
-
|
|
1802
|
-
return cx(css(styles), elementProps.className)
|
|
1814
|
+
return cx(css(cvaStyles), elementProps.className)
|
|
1803
1815
|
}`;
|
|
1804
1816
|
}).run()}
|
|
1805
1817
|
|
|
@@ -1878,7 +1890,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1878
1890
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1879
1891
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1880
1892
|
|
|
1881
|
-
export
|
|
1893
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1882
1894
|
|
|
1883
1895
|
${description ? `/** ${description} */` : ""}
|
|
1884
1896
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
@@ -1903,16 +1915,16 @@ ${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord",
|
|
|
1903
1915
|
|
|
1904
1916
|
type Dict = Record<string, unknown>
|
|
1905
1917
|
|
|
1906
|
-
type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1918
|
+
export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1907
1919
|
ref?: Ref<ElementRef<T>>
|
|
1908
1920
|
}
|
|
1909
1921
|
|
|
1910
|
-
export
|
|
1922
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
1911
1923
|
(props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
|
|
1912
1924
|
displayName?: string
|
|
1913
1925
|
}
|
|
1914
1926
|
|
|
1915
|
-
|
|
1927
|
+
interface RecipeFn { __type: any }
|
|
1916
1928
|
|
|
1917
1929
|
interface JsxFactory {
|
|
1918
1930
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1998,7 +2010,7 @@ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
|
1998
2010
|
|
|
1999
2011
|
type Dict = Record<string, unknown>
|
|
2000
2012
|
|
|
2001
|
-
type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
2013
|
+
export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
2002
2014
|
ref?: Ref<ElementRef<T>>
|
|
2003
2015
|
}
|
|
2004
2016
|
|
|
@@ -2049,15 +2061,13 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2049
2061
|
|
|
2050
2062
|
function recipeClass() {
|
|
2051
2063
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
2052
|
-
|
|
2053
|
-
return cx(cvaFn(variantProps), css(styles), localProps.class)
|
|
2064
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), localProps.class)
|
|
2054
2065
|
}
|
|
2055
2066
|
|
|
2056
2067
|
function cvaClass() {
|
|
2057
2068
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
2058
2069
|
const cvaStyles = cvaFn.raw(variantProps)
|
|
2059
|
-
|
|
2060
|
-
return cx(css(styles), localProps.class)
|
|
2070
|
+
return cx(css(cvaStyles, propStyles, cssStyles), localProps.class)
|
|
2061
2071
|
}
|
|
2062
2072
|
|
|
2063
2073
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
@@ -2139,7 +2149,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2139
2149
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2140
2150
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2141
2151
|
|
|
2142
|
-
export
|
|
2152
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2143
2153
|
|
|
2144
2154
|
${description ? `/** ${description} */` : ""}
|
|
2145
2155
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
@@ -2166,12 +2176,12 @@ type Dict = Record<string, unknown>
|
|
|
2166
2176
|
|
|
2167
2177
|
type ElementType<P = any> = keyof JSX.IntrinsicElements | Component<P>
|
|
2168
2178
|
|
|
2169
|
-
export
|
|
2179
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
2170
2180
|
(props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
|
|
2171
2181
|
displayName?: string
|
|
2172
2182
|
}
|
|
2173
2183
|
|
|
2174
|
-
|
|
2184
|
+
interface RecipeFn { __type: any }
|
|
2175
2185
|
|
|
2176
2186
|
interface JsxFactory {
|
|
2177
2187
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -2308,15 +2318,14 @@ function generateVueJsxFactory(ctx) {
|
|
|
2308
2318
|
const recipeClass = computed(() => {
|
|
2309
2319
|
const [variantProps, styleProps, _htmlProps, elementProps] = splittedProps.value
|
|
2310
2320
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
2311
|
-
const
|
|
2312
|
-
return cx(cvaFn(variantProps), css(
|
|
2321
|
+
const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
|
|
2322
|
+
return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), elementProps.className)
|
|
2313
2323
|
})
|
|
2314
2324
|
|
|
2315
2325
|
const cvaClass = computed(() => {
|
|
2316
2326
|
const [variantProps, styleProps, _htmlProps, elementProps] = splittedProps.value
|
|
2317
2327
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
2318
|
-
|
|
2319
|
-
return cx(cvaFn(variantProps), css(styles), elementProps.className)
|
|
2328
|
+
return cx(cvaFn(variantProps), css(propStyles, cssStyles), elementProps.className)
|
|
2320
2329
|
})
|
|
2321
2330
|
|
|
2322
2331
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
@@ -2339,17 +2348,12 @@ function generateVueJsxFactory(ctx) {
|
|
|
2339
2348
|
}
|
|
2340
2349
|
|
|
2341
2350
|
function createJsxFactory() {
|
|
2342
|
-
const cache = new Map()
|
|
2343
|
-
|
|
2344
2351
|
return new Proxy(styledFn, {
|
|
2345
2352
|
apply(_, __, args) {
|
|
2346
2353
|
return styledFn(...args)
|
|
2347
2354
|
},
|
|
2348
2355
|
get(_, el) {
|
|
2349
|
-
|
|
2350
|
-
cache.set(el, styledFn(el))
|
|
2351
|
-
}
|
|
2352
|
-
return cache.get(el)
|
|
2356
|
+
return styledFn(el)
|
|
2353
2357
|
},
|
|
2354
2358
|
})
|
|
2355
2359
|
}
|
|
@@ -2450,7 +2454,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2450
2454
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2451
2455
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2452
2456
|
|
|
2453
|
-
export
|
|
2457
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2454
2458
|
|
|
2455
2459
|
${description ? `/** ${description} */` : ""}
|
|
2456
2460
|
export declare const ${jsxName}: FunctionalComponent<${upperName}Props>
|
|
@@ -2478,17 +2482,17 @@ ${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
|
2478
2482
|
type IntrinsicElement = keyof NativeElements
|
|
2479
2483
|
type ElementType = IntrinsicElement | Component
|
|
2480
2484
|
|
|
2481
|
-
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2485
|
+
export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2482
2486
|
? NativeElements[T]
|
|
2483
2487
|
: T extends Component<infer Props>
|
|
2484
2488
|
? Props
|
|
2485
2489
|
: never
|
|
2486
2490
|
|
|
2487
|
-
|
|
2491
|
+
interface ${componentName}<T extends ElementType, P extends Dict = {}> extends FunctionalComponent<
|
|
2488
2492
|
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2489
|
-
>
|
|
2493
|
+
> {}
|
|
2490
2494
|
|
|
2491
|
-
|
|
2495
|
+
interface RecipeFn = { __type: any }
|
|
2492
2496
|
|
|
2493
2497
|
interface JsxFactory {
|
|
2494
2498
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -2524,7 +2528,7 @@ import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
|
2524
2528
|
type IntrinsicElement = keyof NativeElements
|
|
2525
2529
|
type ElementType = IntrinsicElement | Component
|
|
2526
2530
|
|
|
2527
|
-
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2531
|
+
export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2528
2532
|
? NativeElements[T]
|
|
2529
2533
|
: T extends Component<infer Props>
|
|
2530
2534
|
? Props
|
|
@@ -2654,27 +2658,27 @@ var csstype_d_ts_default = {
|
|
|
2654
2658
|
|
|
2655
2659
|
// src/artifacts/generated/system-types.d.ts.json
|
|
2656
2660
|
var system_types_d_ts_default = {
|
|
2657
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport
|
|
2661
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties {}\n\nexport interface CssKeyframes {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ninterface GenericProperties {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport interface GlobalStyleObject {\n [selector: string]: SystemStyleObject\n}\nexport interface ExtendableGlobalStyleObject {\n [selector: string]: SystemStyleObject | undefined\n extend?: GlobalStyleObject | undefined\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ninterface WithCss {\n css?: SystemStyleObject\n}\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\nexport interface PatchedHTMLProps {\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
2658
2662
|
};
|
|
2659
2663
|
|
|
2660
2664
|
// src/artifacts/generated/composition.d.ts.json
|
|
2661
2665
|
var composition_d_ts_default = {
|
|
2662
|
-
content: "import type { CompositionStyleObject } from './system-types'\n\
|
|
2666
|
+
content: "import type { CompositionStyleObject } from './system-types'\n\ninterface Recursive<T> {\n [key: string]: Recursive<T> | T\n}\n\nexport interface Token<Value = any> {\n value: Value\n description?: string\n}\n\n/* -----------------------------------------------------------------------------\n * Text styles\n * -----------------------------------------------------------------------------*/\n\ntype TextStyleProperty =\n | 'fontSize'\n | 'fontSizeAdjust'\n | 'fontVariationSettings'\n | 'fontVariantPosition'\n | 'fontVariantCaps'\n | 'fontVariantNumeric'\n | 'fontVariantAlternates'\n | 'fontVariantLigatures'\n | 'fontFamily'\n | 'fontWeight'\n | 'fontSynthesis'\n | 'fontStyle'\n | 'fontVariant'\n | 'lineHeight'\n | 'letterSpacing'\n | 'textDecoration'\n | 'textTransform'\n | 'textIndent'\n | 'textDecorationColor'\n | 'textDecorationLine'\n | 'textDecorationStyle'\n | 'textEmphasisColor'\n | 'textEmphasisPosition'\n | 'textEmphasisStyle'\n | 'hyphenateCharacter'\n | 'textOrientation'\n | 'textOverflow'\n | 'textRendering'\n\nexport type TextStyle = CompositionStyleObject<TextStyleProperty>\n\nexport type TextStyles = Recursive<Token<TextStyle>>\n\n/* -----------------------------------------------------------------------------\n * Layer styles\n * -----------------------------------------------------------------------------*/\n\ntype Placement =\n | 'Top'\n | 'Right'\n | 'Bottom'\n | 'Left'\n | 'Inline'\n | 'Block'\n | 'InlineStart'\n | 'InlineEnd'\n | 'BlockStart'\n | 'BlockEnd'\n\ntype Radius =\n | `Top${'Right' | 'Left'}`\n | `Bottom${'Right' | 'Left'}`\n | `Start${'Start' | 'End'}`\n | `End${'Start' | 'End'}`\n\ntype LayerStyleProperty =\n | 'background'\n | 'backgroundColor'\n | 'backgroundImage'\n | 'borderRadius'\n | 'border'\n | 'borderWidth'\n | 'borderColor'\n | 'borderStyle'\n | 'boxShadow'\n | 'filter'\n | 'backdropFilter'\n | 'transform'\n | 'color'\n | 'opacity'\n | 'backgroundBlendMode'\n | 'backgroundAttachment'\n | 'backgroundClip'\n | 'backgroundOrigin'\n | 'backgroundPosition'\n | 'backgroundRepeat'\n | 'backgroundSize'\n | `border${Placement}`\n | `border${Placement}Width`\n | 'borderRadius'\n | `border${Radius}Radius`\n | `border${Placement}Color`\n | `border${Placement}Style`\n | 'padding'\n | `padding${Placement}`\n\nexport type LayerStyle = CompositionStyleObject<LayerStyleProperty>\n\nexport type LayerStyles = Recursive<Token<LayerStyle>>\n\nexport interface CompositionStyles {\n textStyles: TextStyles\n layerStyles: LayerStyles\n}\n"
|
|
2663
2667
|
};
|
|
2664
2668
|
|
|
2665
2669
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2666
2670
|
var recipe_d_ts_default = {
|
|
2667
|
-
content: "import type { SystemStyleObject, DistributiveOmit } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport
|
|
2671
|
+
content: "import type { SystemStyleObject, DistributiveOmit } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVariantFn<T> {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n raw: (props?: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord> {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The name of the recipe.\n */\n className: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n RecipeConfigMeta {}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Slot\n * -----------------------------------------------------------------------------*/\n\ntype SlotRecord<S extends string, T> = Partial<Record<S, T>>\n\nexport type SlotRecipeVariantRecord<S extends string> = Record<any, Record<any, SlotRecord<S, SystemStyleObject>>>\n\nexport type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord> = (\n props?: RecipeSelection<T>,\n) => SlotRecord<S, string>\n\nexport interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> {\n /**\n * The parts/slots of the recipe.\n */\n slots: S[] | Readonly<S[]>\n /**\n * The base styles of the recipe.\n */\n base?: SlotRecord<S, SystemStyleObject>\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]\n}\n\nexport type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(\n config: SlotRecipeDefinition<S, T>,\n) => SlotRecipeRuntimeFn<S, T>\n\nexport type SlotRecipeConfig<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> = SlotRecipeDefinition<S, T> & RecipeConfigMeta\n"
|
|
2668
2672
|
};
|
|
2669
2673
|
|
|
2670
2674
|
// src/artifacts/generated/pattern.d.ts.json
|
|
2671
2675
|
var pattern_d_ts_default = {
|
|
2672
|
-
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
|
|
2676
|
+
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"
|
|
2673
2677
|
};
|
|
2674
2678
|
|
|
2675
2679
|
// src/artifacts/generated/parts.d.ts.json
|
|
2676
2680
|
var parts_d_ts_default = {
|
|
2677
|
-
content: "export
|
|
2681
|
+
content: "export interface Part {\n selector: string\n}\n\nexport type Parts = Record<string, Part>\n"
|
|
2678
2682
|
};
|
|
2679
2683
|
|
|
2680
2684
|
// src/artifacts/generated/selectors.d.ts.json
|
|
@@ -2705,7 +2709,7 @@ import { outdent as outdent39 } from "outdent";
|
|
|
2705
2709
|
var generateTypesEntry = (ctx) => ({
|
|
2706
2710
|
global: outdent39`
|
|
2707
2711
|
// @ts-nocheck
|
|
2708
|
-
import type
|
|
2712
|
+
import type * as Panda from '@pandacss/dev'
|
|
2709
2713
|
${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
|
|
2710
2714
|
${ctx.file.importType("Parts", "./parts")}
|
|
2711
2715
|
${ctx.file.importType("PatternConfig, PatternProperties", "./pattern")}
|
|
@@ -2713,23 +2717,25 @@ var generateTypesEntry = (ctx) => ({
|
|
|
2713
2717
|
${ctx.file.importType("CompositionStyles", "./composition")}
|
|
2714
2718
|
|
|
2715
2719
|
declare module '@pandacss/dev' {
|
|
2716
|
-
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
|
|
2717
|
-
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): SlotRecipeConfig
|
|
2720
|
+
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): Panda.RecipeConfig
|
|
2721
|
+
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): Panda.SlotRecipeConfig
|
|
2718
2722
|
export function defineStyles(definition: SystemStyleObject): SystemStyleObject
|
|
2719
|
-
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2720
|
-
export function defineTextStyles(definition: CompositionStyles['textStyles']): TextStyles
|
|
2721
|
-
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): LayerStyles
|
|
2722
|
-
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2723
|
+
export function defineGlobalStyles(definition: GlobalStyleObject): Panda.GlobalStyleObject
|
|
2724
|
+
export function defineTextStyles(definition: CompositionStyles['textStyles']): Panda.TextStyles
|
|
2725
|
+
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): Panda.LayerStyles
|
|
2726
|
+
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): Panda.PatternConfig
|
|
2723
2727
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
2724
2728
|
}
|
|
2725
2729
|
`,
|
|
2726
2730
|
// 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'`
|
|
2727
2731
|
index: outdent39`
|
|
2728
2732
|
import '${ctx.file.extDts("./global")}'
|
|
2729
|
-
${ctx.file.
|
|
2730
|
-
${ctx.file.
|
|
2731
|
-
${ctx.file.
|
|
2732
|
-
${ctx.file.
|
|
2733
|
+
${ctx.file.exportTypeStar("./conditions")}
|
|
2734
|
+
${ctx.file.exportTypeStar("./pattern")}
|
|
2735
|
+
${ctx.file.exportTypeStar("./recipe")}
|
|
2736
|
+
${ctx.file.exportTypeStar("./system-types")}
|
|
2737
|
+
${ctx.file.exportTypeStar("./jsx")}
|
|
2738
|
+
${ctx.file.exportTypeStar("./style-props")}
|
|
2733
2739
|
|
|
2734
2740
|
`,
|
|
2735
2741
|
helpers: outdent39`
|
|
@@ -2751,7 +2757,7 @@ function generatePropTypes(ctx) {
|
|
|
2751
2757
|
${ctx.file.importType("CssProperties", "./system-types")}
|
|
2752
2758
|
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
2753
2759
|
|
|
2754
|
-
|
|
2760
|
+
interface PropertyValueTypes {`
|
|
2755
2761
|
];
|
|
2756
2762
|
const types = utility.getTypes();
|
|
2757
2763
|
for (const [prop, values] of types.entries()) {
|
|
@@ -2763,7 +2769,7 @@ function generatePropTypes(ctx) {
|
|
|
2763
2769
|
|
|
2764
2770
|
type Shorthand<T> = T extends keyof PropertyValueTypes ? PropertyValueTypes[T]${strictText} : CssValue<T>
|
|
2765
2771
|
|
|
2766
|
-
export
|
|
2772
|
+
export interface PropertyTypes extends PropertyValueTypes {
|
|
2767
2773
|
`);
|
|
2768
2774
|
utility.shorthands.forEach((value, key) => {
|
|
2769
2775
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
@@ -2794,7 +2800,7 @@ function generateStyleProps(ctx) {
|
|
|
2794
2800
|
[key in \`--\${string}\`]?: ConditionalValue<Token | (string & {}) | (number & {})>
|
|
2795
2801
|
}
|
|
2796
2802
|
|
|
2797
|
-
export
|
|
2803
|
+
export interface SystemProperties {
|
|
2798
2804
|
${Array.from(props).map((v) => ` ${v}?: PropertyValue<'${v}'>`).join("\n")}
|
|
2799
2805
|
}
|
|
2800
2806
|
`;
|
|
@@ -3401,6 +3407,7 @@ var getPatternEngine = (config) => {
|
|
|
3401
3407
|
};
|
|
3402
3408
|
});
|
|
3403
3409
|
return {
|
|
3410
|
+
keys: Object.keys(patterns),
|
|
3404
3411
|
getConfig: (name) => patterns[name],
|
|
3405
3412
|
transform: (name, data) => {
|
|
3406
3413
|
return patterns[name]?.transform?.(data, helpers2) ?? {};
|
|
@@ -3480,11 +3487,11 @@ var defaults = (conf) => ({
|
|
|
3480
3487
|
}
|
|
3481
3488
|
}
|
|
3482
3489
|
});
|
|
3483
|
-
var getImportMap = (outdir) => ({
|
|
3484
|
-
css: [outdir, "css"],
|
|
3485
|
-
recipe: [outdir, "recipes"],
|
|
3486
|
-
pattern: [outdir, "patterns"],
|
|
3487
|
-
jsx: [outdir, "jsx"]
|
|
3490
|
+
var getImportMap = (outdir, configImportMap) => ({
|
|
3491
|
+
css: configImportMap?.css ? [configImportMap.css] : [outdir, "css"],
|
|
3492
|
+
recipe: configImportMap?.recipes ? [configImportMap.recipes] : [outdir, "recipes"],
|
|
3493
|
+
pattern: configImportMap?.patterns ? [configImportMap.patterns] : [outdir, "patterns"],
|
|
3494
|
+
jsx: configImportMap?.jsx ? [configImportMap.jsx] : [outdir, "jsx"]
|
|
3488
3495
|
});
|
|
3489
3496
|
var createGenerator = (conf) => {
|
|
3490
3497
|
const ctx = getEngine(defaults(conf));
|
|
@@ -3500,13 +3507,16 @@ var createGenerator = (conf) => {
|
|
|
3500
3507
|
getParserCss: generateParserCss(ctx),
|
|
3501
3508
|
messages: getMessages(ctx),
|
|
3502
3509
|
parserOptions: {
|
|
3503
|
-
importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
|
|
3510
|
+
importMap: getImportMap(config.outdir.replace(relativeBaseUrl, ""), config.importMap),
|
|
3504
3511
|
jsx: {
|
|
3512
|
+
framework: jsx.framework,
|
|
3505
3513
|
factory: jsx.factoryName,
|
|
3506
3514
|
styleProps: jsx.styleProps,
|
|
3507
3515
|
isStyleProp: isValidProperty,
|
|
3508
3516
|
nodes: [...patterns.details, ...recipes.details]
|
|
3509
3517
|
},
|
|
3518
|
+
patternKeys: patterns.keys,
|
|
3519
|
+
recipeKeys: recipes.keys,
|
|
3510
3520
|
getRecipesByJsxName: recipes.filter,
|
|
3511
3521
|
getPatternsByJsxName: patterns.filter,
|
|
3512
3522
|
compilerOptions,
|