@pandacss/generator 0.12.2 → 0.13.1
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 +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +195 -162
- package/dist/index.mjs +196 -163
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -524,7 +524,7 @@ function generateConditions(ctx) {
|
|
|
524
524
|
}
|
|
525
525
|
`,
|
|
526
526
|
dts: outdent2`
|
|
527
|
-
|
|
527
|
+
${ctx.file.importType("AnySelector, Selectors", "./selectors")}
|
|
528
528
|
|
|
529
529
|
export type Conditions = {
|
|
530
530
|
${keys.map((key) => ` ${JSON.stringify(key)}: string`).join("\n")}
|
|
@@ -595,7 +595,7 @@ function generateCssFn(ctx) {
|
|
|
595
595
|
const { separator, getPropShorthands } = utility;
|
|
596
596
|
return {
|
|
597
597
|
dts: outdent4`
|
|
598
|
-
|
|
598
|
+
${ctx.file.importType("SystemStyleObject", "../types/index")}
|
|
599
599
|
|
|
600
600
|
interface CssFunction {
|
|
601
601
|
(...styles: SystemStyleObject[]): string
|
|
@@ -791,12 +791,11 @@ function generateCvaFn(ctx) {
|
|
|
791
791
|
|
|
792
792
|
`,
|
|
793
793
|
dts: outdent6`
|
|
794
|
-
|
|
794
|
+
${ctx.file.importType("RecipeCreatorFn", "../types/recipe")}
|
|
795
795
|
|
|
796
796
|
export declare const cva: RecipeCreatorFn
|
|
797
797
|
|
|
798
|
-
|
|
799
|
-
|
|
798
|
+
${ctx.file.exportType("RecipeVariantProps", "../types/recipe")}
|
|
800
799
|
`
|
|
801
800
|
};
|
|
802
801
|
}
|
|
@@ -926,11 +925,11 @@ function generatePattern(ctx) {
|
|
|
926
925
|
return {
|
|
927
926
|
name: dashName,
|
|
928
927
|
dts: outdent10`
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
928
|
+
${ctx.file.importType("SystemStyleObject, ConditionalValue", "../types/index")}
|
|
929
|
+
${ctx.file.importType("Properties", "../types/csstype")}
|
|
930
|
+
${ctx.file.importType("PropertyValue", "../types/prop-type")}
|
|
931
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
932
|
+
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
934
933
|
|
|
935
934
|
export type ${upperName}Properties = {
|
|
936
935
|
${Object.keys(properties ?? {}).map((key) => {
|
|
@@ -1097,9 +1096,9 @@ function generateRecipes(ctx) {
|
|
|
1097
1096
|
name: dashName,
|
|
1098
1097
|
js: jsCode,
|
|
1099
1098
|
dts: outdent11`
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1099
|
+
${ctx.file.importType("ConditionalValue", "../types/index")}
|
|
1100
|
+
${ctx.file.importType("Pretty", "../types/helpers")}
|
|
1101
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1103
1102
|
|
|
1104
1103
|
type ${upperName}Variant = {
|
|
1105
1104
|
${Object.keys(variantKeyMap).map((key) => {
|
|
@@ -1171,7 +1170,7 @@ function generateSvaFn(ctx) {
|
|
|
1171
1170
|
}
|
|
1172
1171
|
`,
|
|
1173
1172
|
dts: outdent12`
|
|
1174
|
-
|
|
1173
|
+
${ctx.file.importType("SlotRecipeCreatorFn", "../types/recipe")}
|
|
1175
1174
|
|
|
1176
1175
|
export declare const sva: SlotRecipeCreatorFn
|
|
1177
1176
|
`
|
|
@@ -1204,14 +1203,14 @@ function generateTokenJs(ctx) {
|
|
|
1204
1203
|
token.var = tokenVar
|
|
1205
1204
|
`,
|
|
1206
1205
|
dts: outdent13`
|
|
1207
|
-
|
|
1206
|
+
${ctx.file.importType("Token", "./tokens")}
|
|
1208
1207
|
|
|
1209
1208
|
export declare const token: {
|
|
1210
1209
|
(path: Token, fallback?: string): string
|
|
1211
1210
|
var: (path: Token, fallback?: string) => string
|
|
1212
1211
|
}
|
|
1213
1212
|
|
|
1214
|
-
|
|
1213
|
+
${ctx.file.exportTypeStar("./tokens")}
|
|
1215
1214
|
`
|
|
1216
1215
|
};
|
|
1217
1216
|
}
|
|
@@ -1225,7 +1224,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1225
1224
|
import { h } from 'preact'
|
|
1226
1225
|
import { forwardRef } from 'preact/compat'
|
|
1227
1226
|
import { useMemo } from 'preact/hooks'
|
|
1228
|
-
${ctx.file.import("css, cx, assignCss", "../css/index")}
|
|
1227
|
+
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1229
1228
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1230
1229
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1231
1230
|
|
|
@@ -1321,9 +1320,9 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1321
1320
|
`,
|
|
1322
1321
|
dts: outdent15`
|
|
1323
1322
|
import type { FunctionComponent } from 'preact'
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1323
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1324
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1325
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1327
1326
|
|
|
1328
1327
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1329
1328
|
|
|
@@ -1345,8 +1344,8 @@ export declare const ${factoryName}: ${upperName}
|
|
|
1345
1344
|
`,
|
|
1346
1345
|
jsxType: outdent16`
|
|
1347
1346
|
import type { ComponentProps, JSX } from 'preact'
|
|
1348
|
-
|
|
1349
|
-
|
|
1347
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
1348
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
1350
1349
|
|
|
1351
1350
|
type ElementType = keyof JSX.IntrinsicElements
|
|
1352
1351
|
|
|
@@ -1433,7 +1432,7 @@ function generatePreactJsxStringLiteralTypes(ctx) {
|
|
|
1433
1432
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1434
1433
|
return {
|
|
1435
1434
|
jsxFactory: outdent18`
|
|
1436
|
-
|
|
1435
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1437
1436
|
export declare const ${factoryName}: ${upperName}
|
|
1438
1437
|
`,
|
|
1439
1438
|
jsxType: outdent18`
|
|
@@ -1562,9 +1561,9 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1562
1561
|
`,
|
|
1563
1562
|
dts: outdent20`
|
|
1564
1563
|
import type { Component } from '@builder.io/qwik'
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1564
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1565
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1566
|
+
${ctx.file.importType("Assign, DistributiveOmit", "../types/system-types")}
|
|
1568
1567
|
|
|
1569
1568
|
export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>>
|
|
1570
1569
|
|
|
@@ -1581,7 +1580,7 @@ function generateQwikJsxTypes(ctx) {
|
|
|
1581
1580
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1582
1581
|
return {
|
|
1583
1582
|
jsxFactory: outdent21`
|
|
1584
|
-
|
|
1583
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1585
1584
|
export declare const ${factoryName}: ${upperName}
|
|
1586
1585
|
`,
|
|
1587
1586
|
jsxType: outdent21`
|
|
@@ -1676,7 +1675,7 @@ function generateQwikJsxStringLiteralTypes(ctx) {
|
|
|
1676
1675
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1677
1676
|
return {
|
|
1678
1677
|
jsxFactory: outdent23`
|
|
1679
|
-
|
|
1678
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1680
1679
|
export declare const ${factoryName}: ${upperName}
|
|
1681
1680
|
`,
|
|
1682
1681
|
jsxType: outdent23`
|
|
@@ -1847,9 +1846,9 @@ function generateReactJsxPattern(ctx) {
|
|
|
1847
1846
|
`,
|
|
1848
1847
|
dts: outdent25`
|
|
1849
1848
|
import type { FunctionComponent } from 'react'
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1849
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1850
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1851
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1853
1852
|
|
|
1854
1853
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1855
1854
|
|
|
@@ -1866,13 +1865,13 @@ function generateReactJsxTypes(ctx) {
|
|
|
1866
1865
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1867
1866
|
return {
|
|
1868
1867
|
jsxFactory: outdent26`
|
|
1869
|
-
|
|
1868
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1870
1869
|
export declare const ${factoryName}: ${upperName}
|
|
1871
1870
|
`,
|
|
1872
1871
|
jsxType: outdent26`
|
|
1873
1872
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1874
|
-
|
|
1875
|
-
|
|
1873
|
+
${ctx.file.importType("Assign, DistributiveOmit, JsxHTMLProps, JsxStyleProps", "./system-types")}
|
|
1874
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
1876
1875
|
|
|
1877
1876
|
type Dict = Record<string, unknown>
|
|
1878
1877
|
|
|
@@ -1961,12 +1960,12 @@ function generateReactJsxStringLiteralTypes(ctx) {
|
|
|
1961
1960
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1962
1961
|
return {
|
|
1963
1962
|
jsxFactory: outdent28`
|
|
1964
|
-
|
|
1963
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1965
1964
|
export declare const ${factoryName}: ${upperName}
|
|
1966
1965
|
`,
|
|
1967
1966
|
jsxType: outdent28`
|
|
1968
1967
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1969
|
-
|
|
1968
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1970
1969
|
|
|
1971
1970
|
type Dict = Record<string, unknown>
|
|
1972
1971
|
|
|
@@ -2106,10 +2105,10 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2106
2105
|
}
|
|
2107
2106
|
`,
|
|
2108
2107
|
dts: outdent30`
|
|
2109
|
-
import { Component } from 'solid-js'
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2108
|
+
import type { Component } from 'solid-js'
|
|
2109
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
2110
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2111
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2113
2112
|
|
|
2114
2113
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
2115
2114
|
|
|
@@ -2126,13 +2125,13 @@ function generateSolidJsxTypes(ctx) {
|
|
|
2126
2125
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2127
2126
|
return {
|
|
2128
2127
|
jsxFactory: outdent31`
|
|
2129
|
-
|
|
2128
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2130
2129
|
export declare const ${factoryName}: ${upperName}
|
|
2131
2130
|
`,
|
|
2132
2131
|
jsxType: outdent31`
|
|
2133
2132
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
2134
|
-
|
|
2135
|
-
|
|
2133
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2134
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2136
2135
|
|
|
2137
2136
|
type Dict = Record<string, unknown>
|
|
2138
2137
|
|
|
@@ -2225,7 +2224,7 @@ function generateSolidJsxStringLiteralTypes(ctx) {
|
|
|
2225
2224
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2226
2225
|
return {
|
|
2227
2226
|
jsxFactory: outdent33`
|
|
2228
|
-
|
|
2227
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2229
2228
|
export declare const ${factoryName}: ${upperName}
|
|
2230
2229
|
`,
|
|
2231
2230
|
jsxType: outdent33`
|
|
@@ -2414,10 +2413,10 @@ function generateVueJsxPattern(ctx) {
|
|
|
2414
2413
|
})
|
|
2415
2414
|
`,
|
|
2416
2415
|
dts: outdent36`
|
|
2417
|
-
import { FunctionalComponent } from 'vue'
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2416
|
+
import type { FunctionalComponent } from 'vue'
|
|
2417
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
2418
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2419
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2421
2420
|
|
|
2422
2421
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
2423
2422
|
|
|
@@ -2434,13 +2433,15 @@ function generateVueJsxTypes(ctx) {
|
|
|
2434
2433
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2435
2434
|
return {
|
|
2436
2435
|
jsxFactory: outdent37`
|
|
2437
|
-
|
|
2436
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2437
|
+
|
|
2438
2438
|
export declare const ${factoryName}: ${upperName}
|
|
2439
2439
|
`,
|
|
2440
2440
|
jsxType: outdent37`
|
|
2441
2441
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2442
|
-
|
|
2443
|
-
|
|
2442
|
+
|
|
2443
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2444
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2444
2445
|
|
|
2445
2446
|
type IntrinsicElement =
|
|
2446
2447
|
| 'a'
|
|
@@ -2599,7 +2600,8 @@ function generateVueJsxStringLiteralTypes(ctx) {
|
|
|
2599
2600
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2600
2601
|
return {
|
|
2601
2602
|
jsxFactory: outdent38`
|
|
2602
|
-
|
|
2603
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2604
|
+
|
|
2603
2605
|
export declare const ${factoryName}: ${upperName}
|
|
2604
2606
|
`,
|
|
2605
2607
|
jsxType: outdent38`
|
|
@@ -2807,7 +2809,7 @@ function generateJsxPatterns(ctx) {
|
|
|
2807
2809
|
// src/artifacts/pkg-json.ts
|
|
2808
2810
|
function generatePackageJson(ctx) {
|
|
2809
2811
|
const {
|
|
2810
|
-
config: { outdir
|
|
2812
|
+
config: { outdir }
|
|
2811
2813
|
} = ctx;
|
|
2812
2814
|
const pkg = {
|
|
2813
2815
|
name: outdir,
|
|
@@ -2816,32 +2818,32 @@ function generatePackageJson(ctx) {
|
|
|
2816
2818
|
type: "module",
|
|
2817
2819
|
exports: {
|
|
2818
2820
|
"./css": {
|
|
2819
|
-
types: "./css/index
|
|
2820
|
-
require: `./css/index
|
|
2821
|
-
import: `./css/index
|
|
2821
|
+
types: ctx.file.extDts("./css/index"),
|
|
2822
|
+
require: ctx.file.ext(`./css/index`),
|
|
2823
|
+
import: ctx.file.ext(`./css/index`)
|
|
2822
2824
|
},
|
|
2823
2825
|
"./jsx": {
|
|
2824
|
-
types: "./jsx/index
|
|
2825
|
-
require: `./jsx/index
|
|
2826
|
-
import: `./jsx/index
|
|
2826
|
+
types: ctx.file.extDts("./jsx/index"),
|
|
2827
|
+
require: ctx.file.ext(`./jsx/index`),
|
|
2828
|
+
import: ctx.file.ext(`./jsx/index`)
|
|
2827
2829
|
},
|
|
2828
2830
|
"./patterns": {
|
|
2829
|
-
types: "./patterns/index
|
|
2830
|
-
require: `./patterns/index
|
|
2831
|
-
import: `./patterns/index
|
|
2831
|
+
types: ctx.file.extDts("./patterns/index"),
|
|
2832
|
+
require: ctx.file.ext(`./patterns/index`),
|
|
2833
|
+
import: ctx.file.ext(`./patterns/index`)
|
|
2832
2834
|
},
|
|
2833
2835
|
"./recipes": {
|
|
2834
|
-
types: "./recipes/index
|
|
2835
|
-
require: `./recipes/index
|
|
2836
|
-
import: `./recipes/index
|
|
2836
|
+
types: ctx.file.extDts("./recipes/index"),
|
|
2837
|
+
require: ctx.file.ext(`./recipes/index`),
|
|
2838
|
+
import: ctx.file.ext(`./recipes/index`)
|
|
2837
2839
|
},
|
|
2838
2840
|
"./tokens": {
|
|
2839
|
-
types: "./tokens/index
|
|
2840
|
-
require: `./tokens/index
|
|
2841
|
-
import: `./tokens/index
|
|
2841
|
+
types: ctx.file.extDts("./tokens/index"),
|
|
2842
|
+
require: ctx.file.ext(`./tokens/index`),
|
|
2843
|
+
import: ctx.file.ext(`./tokens/index`)
|
|
2842
2844
|
},
|
|
2843
2845
|
"./types": {
|
|
2844
|
-
types: "./types/index
|
|
2846
|
+
types: ctx.file.extDts("./types/index")
|
|
2845
2847
|
},
|
|
2846
2848
|
"./styles.css": "./styles.css"
|
|
2847
2849
|
}
|
|
@@ -2888,42 +2890,47 @@ var selectors_d_ts_default = {
|
|
|
2888
2890
|
import { match as match9 } from "ts-pattern";
|
|
2889
2891
|
var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
|
|
2890
2892
|
function getGeneratedTypes(ctx) {
|
|
2893
|
+
const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
|
|
2891
2894
|
return {
|
|
2892
2895
|
cssType: csstype_d_ts_default.content,
|
|
2893
|
-
recipe: recipe_d_ts_default.content,
|
|
2894
|
-
pattern: pattern_d_ts_default.content,
|
|
2895
|
-
parts: parts_d_ts_default.content,
|
|
2896
|
-
composition: composition_d_ts_default.content,
|
|
2897
|
-
selectors: selectors_d_ts_default.content,
|
|
2898
|
-
system:
|
|
2896
|
+
recipe: rewriteImports(recipe_d_ts_default.content),
|
|
2897
|
+
pattern: rewriteImports(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
|
|
2898
|
+
parts: rewriteImports(parts_d_ts_default.content),
|
|
2899
|
+
composition: rewriteImports(composition_d_ts_default.content),
|
|
2900
|
+
selectors: rewriteImports(selectors_d_ts_default.content),
|
|
2901
|
+
system: rewriteImports(
|
|
2902
|
+
match9(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()
|
|
2903
|
+
)
|
|
2899
2904
|
};
|
|
2900
2905
|
}
|
|
2901
2906
|
|
|
2902
2907
|
// src/artifacts/types/main.ts
|
|
2903
2908
|
import { outdent as outdent39 } from "outdent";
|
|
2904
|
-
var generateTypesEntry = () => ({
|
|
2909
|
+
var generateTypesEntry = (ctx) => ({
|
|
2905
2910
|
global: outdent39`
|
|
2906
|
-
|
|
2907
|
-
import type {
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
+
// @ts-nocheck
|
|
2912
|
+
import type { TextStyles, LayerStyles } from '@pandacss/dev'
|
|
2913
|
+
${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
|
|
2914
|
+
${ctx.file.importType("Parts", "./parts")}
|
|
2915
|
+
${ctx.file.importType("PatternConfig, PatternProperties", "./pattern")}
|
|
2916
|
+
${ctx.file.importType("GlobalStyleObject, SystemStyleObject", "./system-types")}
|
|
2917
|
+
${ctx.file.importType("CompositionStyles", "./composition")}
|
|
2911
2918
|
|
|
2912
2919
|
declare module '@pandacss/dev' {
|
|
2913
2920
|
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
|
|
2914
2921
|
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): SlotRecipeConfig
|
|
2915
2922
|
export function defineStyles(definition: SystemStyleObject): SystemStyleObject
|
|
2916
2923
|
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2917
|
-
export function defineTextStyles(definition: CompositionStyles['textStyles']):
|
|
2918
|
-
export function defineLayerStyles(definition: CompositionStyles['layerStyles']):
|
|
2924
|
+
export function defineTextStyles(definition: CompositionStyles['textStyles']): TextStyles
|
|
2925
|
+
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): LayerStyles
|
|
2919
2926
|
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2920
2927
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
2921
2928
|
}
|
|
2922
2929
|
`,
|
|
2923
2930
|
index: outdent39`
|
|
2924
|
-
import './global'
|
|
2925
|
-
|
|
2926
|
-
|
|
2931
|
+
import '${ctx.file.extDts("./global")}'
|
|
2932
|
+
${ctx.file.exportType("ConditionalValue", "./conditions")}
|
|
2933
|
+
${ctx.file.exportType("GlobalStyleObject, JsxStyleProps, SystemStyleObject", "./system-types")}
|
|
2927
2934
|
|
|
2928
2935
|
`,
|
|
2929
2936
|
helpers: outdent39`
|
|
@@ -2941,9 +2948,9 @@ function generatePropTypes(ctx) {
|
|
|
2941
2948
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2942
2949
|
const result = [
|
|
2943
2950
|
outdent40`
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2951
|
+
${ctx.file.importType("ConditionalValue", "./conditions")}
|
|
2952
|
+
${ctx.file.importType("CssProperties", "./system-types")}
|
|
2953
|
+
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
2947
2954
|
|
|
2948
2955
|
type PropertyValueTypes = {`
|
|
2949
2956
|
];
|
|
@@ -2980,9 +2987,9 @@ import outdent41 from "outdent";
|
|
|
2980
2987
|
function generateStyleProps(ctx) {
|
|
2981
2988
|
const props = new Set(allCssProperties.concat(ctx.utility.keys()).filter(Boolean));
|
|
2982
2989
|
return outdent41`
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2990
|
+
${ctx.file.importType("ConditionalValue", "./conditions")}
|
|
2991
|
+
${ctx.file.importType("PropertyValue", "./prop-type")}
|
|
2992
|
+
${ctx.file.importType("Token", "../tokens/index")}
|
|
2986
2993
|
|
|
2987
2994
|
export type CssVarProperties = {
|
|
2988
2995
|
[key in \`--\${string}\`]?: ConditionalValue<Token | (string & {}) | (number & {})>
|
|
@@ -3073,9 +3080,9 @@ function setupDesignTokens(ctx) {
|
|
|
3073
3080
|
dir: ctx.paths.token,
|
|
3074
3081
|
files: [
|
|
3075
3082
|
{ file: "index.css", code: css2 },
|
|
3076
|
-
{ file:
|
|
3083
|
+
{ file: ctx.file.extDts("index"), code: code.dts },
|
|
3077
3084
|
{ file: ctx.file.ext("index"), code: code.js },
|
|
3078
|
-
{ file:
|
|
3085
|
+
{ file: ctx.file.extDts("tokens"), code: generateTokenTypes(ctx) }
|
|
3079
3086
|
]
|
|
3080
3087
|
};
|
|
3081
3088
|
}
|
|
@@ -3083,24 +3090,24 @@ function setupTypes(ctx) {
|
|
|
3083
3090
|
const gen = getGeneratedTypes(ctx);
|
|
3084
3091
|
const conditions = generateConditions(ctx);
|
|
3085
3092
|
const jsx = generateJsxTypes(ctx);
|
|
3086
|
-
const entry = generateTypesEntry();
|
|
3093
|
+
const entry = generateTypesEntry(ctx);
|
|
3087
3094
|
return {
|
|
3088
3095
|
dir: ctx.paths.types,
|
|
3089
3096
|
files: [
|
|
3090
|
-
jsx ? { file:
|
|
3091
|
-
{ file:
|
|
3092
|
-
{ file: "system-types
|
|
3093
|
-
{ file:
|
|
3094
|
-
{ file:
|
|
3095
|
-
{ file:
|
|
3096
|
-
{ file:
|
|
3097
|
-
{ file:
|
|
3098
|
-
{ file:
|
|
3099
|
-
{ file:
|
|
3100
|
-
{ file:
|
|
3101
|
-
{ file: "prop-type
|
|
3102
|
-
{ file: "style-props
|
|
3103
|
-
{ file:
|
|
3097
|
+
jsx ? { file: ctx.file.extDts("jsx"), code: jsx.jsxType } : null,
|
|
3098
|
+
{ file: ctx.file.extDts("csstype"), code: gen.cssType },
|
|
3099
|
+
{ file: ctx.file.extDts("system-types"), code: gen.system },
|
|
3100
|
+
{ file: ctx.file.extDts("selectors"), code: gen.selectors },
|
|
3101
|
+
{ file: ctx.file.extDts("composition"), code: gen.composition },
|
|
3102
|
+
{ file: ctx.file.extDts("global"), code: entry.global },
|
|
3103
|
+
{ file: ctx.file.extDts("helpers"), code: entry.helpers },
|
|
3104
|
+
{ file: ctx.file.extDts("recipe"), code: gen.recipe },
|
|
3105
|
+
{ file: ctx.file.extDts("pattern"), code: gen.pattern },
|
|
3106
|
+
{ file: ctx.file.extDts("parts"), code: gen.parts },
|
|
3107
|
+
{ file: ctx.file.extDts("index"), code: entry.index },
|
|
3108
|
+
{ file: ctx.file.extDts("prop-type"), code: generatePropTypes(ctx) },
|
|
3109
|
+
{ file: ctx.file.extDts("style-props"), code: generateStyleProps(ctx) },
|
|
3110
|
+
{ file: ctx.file.extDts("conditions"), code: conditions.dts }
|
|
3104
3111
|
].filter(Boolean)
|
|
3105
3112
|
};
|
|
3106
3113
|
}
|
|
@@ -3112,7 +3119,7 @@ function setupCss(ctx) {
|
|
|
3112
3119
|
files: [
|
|
3113
3120
|
{ file: ctx.file.ext("conditions"), code: conditions.js },
|
|
3114
3121
|
{ file: ctx.file.ext("css"), code: code.js },
|
|
3115
|
-
{ file:
|
|
3122
|
+
{ file: ctx.file.extDts("css"), code: code.dts }
|
|
3116
3123
|
]
|
|
3117
3124
|
};
|
|
3118
3125
|
}
|
|
@@ -3124,7 +3131,7 @@ function setupCva(ctx) {
|
|
|
3124
3131
|
dir: ctx.paths.css,
|
|
3125
3132
|
files: [
|
|
3126
3133
|
{ file: ctx.file.ext("cva"), code: code.js },
|
|
3127
|
-
{ file:
|
|
3134
|
+
{ file: ctx.file.extDts("cva"), code: code.dts }
|
|
3128
3135
|
]
|
|
3129
3136
|
};
|
|
3130
3137
|
}
|
|
@@ -3136,7 +3143,7 @@ function setupSva(ctx) {
|
|
|
3136
3143
|
dir: ctx.paths.css,
|
|
3137
3144
|
files: [
|
|
3138
3145
|
{ file: ctx.file.ext("sva"), code: code.js },
|
|
3139
|
-
{ file:
|
|
3146
|
+
{ file: ctx.file.extDts("sva"), code: code.dts }
|
|
3140
3147
|
]
|
|
3141
3148
|
};
|
|
3142
3149
|
}
|
|
@@ -3146,7 +3153,7 @@ function setupCx(ctx) {
|
|
|
3146
3153
|
dir: ctx.paths.css,
|
|
3147
3154
|
files: [
|
|
3148
3155
|
{ file: ctx.file.ext("cx"), code: code.js },
|
|
3149
|
-
{ file:
|
|
3156
|
+
{ file: ctx.file.extDts("cx"), code: code.dts }
|
|
3150
3157
|
]
|
|
3151
3158
|
};
|
|
3152
3159
|
}
|
|
@@ -3156,16 +3163,16 @@ function setupRecipes(ctx) {
|
|
|
3156
3163
|
return;
|
|
3157
3164
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
3158
3165
|
const index = {
|
|
3159
|
-
js: outdent43.string(indexFiles.map((file) => ctx.file.
|
|
3160
|
-
dts: outdent43.string(indexFiles.map((file) =>
|
|
3166
|
+
js: outdent43.string(indexFiles.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
|
|
3167
|
+
dts: outdent43.string(indexFiles.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
|
|
3161
3168
|
};
|
|
3162
3169
|
return {
|
|
3163
3170
|
dir: ctx.paths.recipe,
|
|
3164
3171
|
files: [
|
|
3165
3172
|
...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3166
|
-
...files.map((file) => ({ file:
|
|
3173
|
+
...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3167
3174
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3168
|
-
{ file:
|
|
3175
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3169
3176
|
]
|
|
3170
3177
|
};
|
|
3171
3178
|
}
|
|
@@ -3176,16 +3183,16 @@ function setupPatterns(ctx) {
|
|
|
3176
3183
|
if (!files)
|
|
3177
3184
|
return;
|
|
3178
3185
|
const index = {
|
|
3179
|
-
js: outdent43.string(files.map((file) => ctx.file.
|
|
3180
|
-
dts: outdent43.string(files.map((file) =>
|
|
3186
|
+
js: outdent43.string(files.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
|
|
3187
|
+
dts: outdent43.string(files.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
|
|
3181
3188
|
};
|
|
3182
3189
|
return {
|
|
3183
3190
|
dir: ctx.paths.pattern,
|
|
3184
3191
|
files: [
|
|
3185
3192
|
...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3186
|
-
...files.map((file) => ({ file:
|
|
3193
|
+
...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3187
3194
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3188
|
-
{ file:
|
|
3195
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3189
3196
|
]
|
|
3190
3197
|
};
|
|
3191
3198
|
}
|
|
@@ -3198,51 +3205,54 @@ function setupJsx(ctx) {
|
|
|
3198
3205
|
const patterns = generateJsxPatterns(ctx);
|
|
3199
3206
|
const index = {
|
|
3200
3207
|
js: outdent43`
|
|
3201
|
-
${ctx.file.
|
|
3202
|
-
${isValidProp?.js ? ctx.file.
|
|
3203
|
-
${outdent43.string(patterns.map((file) => ctx.file.
|
|
3208
|
+
${ctx.file.exportStar("./factory")}
|
|
3209
|
+
${isValidProp?.js ? ctx.file.exportStar("./is-valid-prop") : ""}
|
|
3210
|
+
${outdent43.string(patterns.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n"))}
|
|
3204
3211
|
`,
|
|
3205
3212
|
dts: outdent43`
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
${
|
|
3209
|
-
|
|
3213
|
+
${ctx.file.exportTypeStar("./factory")}
|
|
3214
|
+
|
|
3215
|
+
${isValidProp?.dts ? ctx.file.exportTypeStar("./is-valid-prop") : ""}
|
|
3216
|
+
|
|
3217
|
+
${outdent43.string(patterns.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))}
|
|
3218
|
+
|
|
3219
|
+
${ctx.file.exportType(ctx.jsx.typeName, "../types/jsx")}
|
|
3210
3220
|
`
|
|
3211
3221
|
};
|
|
3212
3222
|
return {
|
|
3213
3223
|
dir: ctx.paths.jsx,
|
|
3214
3224
|
files: [
|
|
3215
3225
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3216
|
-
...patterns.map((file) => ({ file:
|
|
3226
|
+
...patterns.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3217
3227
|
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
|
|
3218
|
-
{ file: "is-valid-prop
|
|
3219
|
-
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
3228
|
+
{ file: ctx.file.extDts("is-valid-prop"), code: isValidProp?.dts },
|
|
3220
3229
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
3221
|
-
{ file:
|
|
3222
|
-
{ file: ctx.file.ext("index"), code: index.js }
|
|
3230
|
+
{ file: ctx.file.extDts("factory"), code: types.jsxFactory },
|
|
3231
|
+
{ file: ctx.file.ext("index"), code: index.js },
|
|
3232
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3223
3233
|
]
|
|
3224
3234
|
};
|
|
3225
3235
|
}
|
|
3226
3236
|
function setupCssIndex(ctx) {
|
|
3227
3237
|
const index = {
|
|
3228
3238
|
js: outdent43`
|
|
3229
|
-
${ctx.file.
|
|
3230
|
-
${ctx.file.
|
|
3231
|
-
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.
|
|
3232
|
-
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.
|
|
3239
|
+
${ctx.file.exportStar("./css")}
|
|
3240
|
+
${ctx.file.exportStar("./cx")}
|
|
3241
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportStar("./cva")}
|
|
3242
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportStar("./sva")}
|
|
3233
3243
|
`,
|
|
3234
3244
|
dts: outdent43`
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
${ctx.isTemplateLiteralSyntax ? "" :
|
|
3238
|
-
${ctx.isTemplateLiteralSyntax ? "" :
|
|
3245
|
+
${ctx.file.exportTypeStar("./css")}
|
|
3246
|
+
${ctx.file.exportTypeStar("./cx")}
|
|
3247
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportTypeStar("./cva")}
|
|
3248
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportTypeStar("./sva")}
|
|
3239
3249
|
`
|
|
3240
3250
|
};
|
|
3241
3251
|
return {
|
|
3242
3252
|
dir: ctx.paths.css,
|
|
3243
3253
|
files: [
|
|
3244
3254
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3245
|
-
{ file:
|
|
3255
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3246
3256
|
]
|
|
3247
3257
|
};
|
|
3248
3258
|
}
|
|
@@ -3293,7 +3303,7 @@ var generateArtifacts = (ctx) => () => {
|
|
|
3293
3303
|
].filter(Boolean).map((artifact) => {
|
|
3294
3304
|
const files = artifact?.files ?? [];
|
|
3295
3305
|
files.forEach((file) => {
|
|
3296
|
-
if (
|
|
3306
|
+
if (ctx.file.isTypeFile(file.file)) {
|
|
3297
3307
|
file.code = `/* eslint-disable */
|
|
3298
3308
|
${file.code}`;
|
|
3299
3309
|
}
|
|
@@ -3383,7 +3393,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3383
3393
|
for (const pattern of patternSet) {
|
|
3384
3394
|
match10(pattern).with({ type: "jsx-pattern", name: P.string }, ({ name: jsxName }) => {
|
|
3385
3395
|
pattern.data.forEach((data) => {
|
|
3386
|
-
const fnName = patterns.
|
|
3396
|
+
const fnName = patterns.find(jsxName);
|
|
3387
3397
|
const styleProps = patterns.transform(fnName, data);
|
|
3388
3398
|
sheet.processStyleProps(styleProps);
|
|
3389
3399
|
});
|
|
@@ -3554,7 +3564,7 @@ var getPathEngine = ({ cwd, emitPackage, outdir }) => {
|
|
|
3554
3564
|
};
|
|
3555
3565
|
|
|
3556
3566
|
// src/engines/pattern.ts
|
|
3557
|
-
import { capitalize as capitalize3, dashCase, mapObject as mapObject2, memo as memo2,
|
|
3567
|
+
import { capitalize as capitalize3, dashCase, mapObject as mapObject2, memo as memo2, createRegex, uncapitalize } from "@pandacss/shared";
|
|
3558
3568
|
var helpers2 = { map: mapObject2 };
|
|
3559
3569
|
var getPatternEngine = (config) => {
|
|
3560
3570
|
const patterns = config.patterns ?? {};
|
|
@@ -3588,8 +3598,8 @@ var getPatternEngine = (config) => {
|
|
|
3588
3598
|
},
|
|
3589
3599
|
getNames,
|
|
3590
3600
|
details,
|
|
3591
|
-
|
|
3592
|
-
return details.find((node) => node.jsxName
|
|
3601
|
+
find: memo2((jsxName) => {
|
|
3602
|
+
return details.find((node) => node.match.test(jsxName))?.baseName ?? uncapitalize(jsxName);
|
|
3593
3603
|
}),
|
|
3594
3604
|
filter: memo2((jsxName) => {
|
|
3595
3605
|
return details.filter((node) => node.match.test(jsxName));
|
|
@@ -3599,23 +3609,46 @@ var getPatternEngine = (config) => {
|
|
|
3599
3609
|
};
|
|
3600
3610
|
|
|
3601
3611
|
// src/engines/index.ts
|
|
3602
|
-
var getEngine = (conf) =>
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3612
|
+
var getEngine = (conf) => {
|
|
3613
|
+
const { config } = conf;
|
|
3614
|
+
const { forceConsistentTypeExtension, outExtension } = config;
|
|
3615
|
+
return {
|
|
3616
|
+
...getBaseEngine(conf),
|
|
3617
|
+
patterns: getPatternEngine(config),
|
|
3618
|
+
jsx: getJsxEngine(config),
|
|
3619
|
+
paths: getPathEngine(config),
|
|
3620
|
+
file: {
|
|
3621
|
+
ext(file) {
|
|
3622
|
+
return `${file}.${outExtension}`;
|
|
3623
|
+
},
|
|
3624
|
+
extDts(file) {
|
|
3625
|
+
const dts = outExtension === "mjs" && forceConsistentTypeExtension ? "d.mts" : "d.ts";
|
|
3626
|
+
return `${file}.${dts}`;
|
|
3627
|
+
},
|
|
3628
|
+
__extDts(file) {
|
|
3629
|
+
return forceConsistentTypeExtension ? this.extDts(file) : file;
|
|
3630
|
+
},
|
|
3631
|
+
import(mod, file) {
|
|
3632
|
+
return `import { ${mod} } from '${this.ext(file)}';`;
|
|
3633
|
+
},
|
|
3634
|
+
importType(mod, file) {
|
|
3635
|
+
return `import type { ${mod} } from '${this.__extDts(file)}';`;
|
|
3636
|
+
},
|
|
3637
|
+
exportType(mod, file) {
|
|
3638
|
+
return `export type { ${mod} } from '${this.__extDts(file)}';`;
|
|
3639
|
+
},
|
|
3640
|
+
exportStar(file) {
|
|
3641
|
+
return `export * from '${this.ext(file)}';`;
|
|
3642
|
+
},
|
|
3643
|
+
exportTypeStar(file) {
|
|
3644
|
+
return `export * from '${this.__extDts(file)}';`;
|
|
3645
|
+
},
|
|
3646
|
+
isTypeFile(file) {
|
|
3647
|
+
return file.endsWith(".d.ts") || file.endsWith(".d.mts");
|
|
3648
|
+
}
|
|
3616
3649
|
}
|
|
3617
|
-
}
|
|
3618
|
-
}
|
|
3650
|
+
};
|
|
3651
|
+
};
|
|
3619
3652
|
|
|
3620
3653
|
// src/generator.ts
|
|
3621
3654
|
var defaults = (conf) => ({
|