@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.js
CHANGED
|
@@ -555,7 +555,7 @@ function generateConditions(ctx) {
|
|
|
555
555
|
}
|
|
556
556
|
`,
|
|
557
557
|
dts: import_outdent2.default`
|
|
558
|
-
|
|
558
|
+
${ctx.file.importType("AnySelector, Selectors", "./selectors")}
|
|
559
559
|
|
|
560
560
|
export type Conditions = {
|
|
561
561
|
${keys.map((key) => ` ${JSON.stringify(key)}: string`).join("\n")}
|
|
@@ -626,7 +626,7 @@ function generateCssFn(ctx) {
|
|
|
626
626
|
const { separator, getPropShorthands } = utility;
|
|
627
627
|
return {
|
|
628
628
|
dts: import_outdent4.outdent`
|
|
629
|
-
|
|
629
|
+
${ctx.file.importType("SystemStyleObject", "../types/index")}
|
|
630
630
|
|
|
631
631
|
interface CssFunction {
|
|
632
632
|
(...styles: SystemStyleObject[]): string
|
|
@@ -822,12 +822,11 @@ function generateCvaFn(ctx) {
|
|
|
822
822
|
|
|
823
823
|
`,
|
|
824
824
|
dts: import_outdent6.outdent`
|
|
825
|
-
|
|
825
|
+
${ctx.file.importType("RecipeCreatorFn", "../types/recipe")}
|
|
826
826
|
|
|
827
827
|
export declare const cva: RecipeCreatorFn
|
|
828
828
|
|
|
829
|
-
|
|
830
|
-
|
|
829
|
+
${ctx.file.exportType("RecipeVariantProps", "../types/recipe")}
|
|
831
830
|
`
|
|
832
831
|
};
|
|
833
832
|
}
|
|
@@ -957,11 +956,11 @@ function generatePattern(ctx) {
|
|
|
957
956
|
return {
|
|
958
957
|
name: dashName,
|
|
959
958
|
dts: import_outdent10.outdent`
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
959
|
+
${ctx.file.importType("SystemStyleObject, ConditionalValue", "../types/index")}
|
|
960
|
+
${ctx.file.importType("Properties", "../types/csstype")}
|
|
961
|
+
${ctx.file.importType("PropertyValue", "../types/prop-type")}
|
|
962
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
963
|
+
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
965
964
|
|
|
966
965
|
export type ${upperName}Properties = {
|
|
967
966
|
${Object.keys(properties ?? {}).map((key) => {
|
|
@@ -1128,9 +1127,9 @@ function generateRecipes(ctx) {
|
|
|
1128
1127
|
name: dashName,
|
|
1129
1128
|
js: jsCode,
|
|
1130
1129
|
dts: import_outdent11.outdent`
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1130
|
+
${ctx.file.importType("ConditionalValue", "../types/index")}
|
|
1131
|
+
${ctx.file.importType("Pretty", "../types/helpers")}
|
|
1132
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1134
1133
|
|
|
1135
1134
|
type ${upperName}Variant = {
|
|
1136
1135
|
${Object.keys(variantKeyMap).map((key) => {
|
|
@@ -1202,7 +1201,7 @@ function generateSvaFn(ctx) {
|
|
|
1202
1201
|
}
|
|
1203
1202
|
`,
|
|
1204
1203
|
dts: import_outdent12.outdent`
|
|
1205
|
-
|
|
1204
|
+
${ctx.file.importType("SlotRecipeCreatorFn", "../types/recipe")}
|
|
1206
1205
|
|
|
1207
1206
|
export declare const sva: SlotRecipeCreatorFn
|
|
1208
1207
|
`
|
|
@@ -1235,14 +1234,14 @@ function generateTokenJs(ctx) {
|
|
|
1235
1234
|
token.var = tokenVar
|
|
1236
1235
|
`,
|
|
1237
1236
|
dts: import_outdent13.default`
|
|
1238
|
-
|
|
1237
|
+
${ctx.file.importType("Token", "./tokens")}
|
|
1239
1238
|
|
|
1240
1239
|
export declare const token: {
|
|
1241
1240
|
(path: Token, fallback?: string): string
|
|
1242
1241
|
var: (path: Token, fallback?: string) => string
|
|
1243
1242
|
}
|
|
1244
1243
|
|
|
1245
|
-
|
|
1244
|
+
${ctx.file.exportTypeStar("./tokens")}
|
|
1246
1245
|
`
|
|
1247
1246
|
};
|
|
1248
1247
|
}
|
|
@@ -1256,7 +1255,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1256
1255
|
import { h } from 'preact'
|
|
1257
1256
|
import { forwardRef } from 'preact/compat'
|
|
1258
1257
|
import { useMemo } from 'preact/hooks'
|
|
1259
|
-
${ctx.file.import("css, cx, assignCss", "../css/index")}
|
|
1258
|
+
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1260
1259
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1261
1260
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1262
1261
|
|
|
@@ -1352,9 +1351,9 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1352
1351
|
`,
|
|
1353
1352
|
dts: import_outdent15.outdent`
|
|
1354
1353
|
import type { FunctionComponent } from 'preact'
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1354
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1355
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1356
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1358
1357
|
|
|
1359
1358
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1360
1359
|
|
|
@@ -1376,8 +1375,8 @@ export declare const ${factoryName}: ${upperName}
|
|
|
1376
1375
|
`,
|
|
1377
1376
|
jsxType: import_outdent16.outdent`
|
|
1378
1377
|
import type { ComponentProps, JSX } from 'preact'
|
|
1379
|
-
|
|
1380
|
-
|
|
1378
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
1379
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
1381
1380
|
|
|
1382
1381
|
type ElementType = keyof JSX.IntrinsicElements
|
|
1383
1382
|
|
|
@@ -1464,7 +1463,7 @@ function generatePreactJsxStringLiteralTypes(ctx) {
|
|
|
1464
1463
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1465
1464
|
return {
|
|
1466
1465
|
jsxFactory: import_outdent18.outdent`
|
|
1467
|
-
|
|
1466
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1468
1467
|
export declare const ${factoryName}: ${upperName}
|
|
1469
1468
|
`,
|
|
1470
1469
|
jsxType: import_outdent18.outdent`
|
|
@@ -1593,9 +1592,9 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1593
1592
|
`,
|
|
1594
1593
|
dts: import_outdent20.outdent`
|
|
1595
1594
|
import type { Component } from '@builder.io/qwik'
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1595
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1596
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1597
|
+
${ctx.file.importType("Assign, DistributiveOmit", "../types/system-types")}
|
|
1599
1598
|
|
|
1600
1599
|
export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>>
|
|
1601
1600
|
|
|
@@ -1612,7 +1611,7 @@ function generateQwikJsxTypes(ctx) {
|
|
|
1612
1611
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1613
1612
|
return {
|
|
1614
1613
|
jsxFactory: import_outdent21.outdent`
|
|
1615
|
-
|
|
1614
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1616
1615
|
export declare const ${factoryName}: ${upperName}
|
|
1617
1616
|
`,
|
|
1618
1617
|
jsxType: import_outdent21.outdent`
|
|
@@ -1707,7 +1706,7 @@ function generateQwikJsxStringLiteralTypes(ctx) {
|
|
|
1707
1706
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1708
1707
|
return {
|
|
1709
1708
|
jsxFactory: import_outdent23.outdent`
|
|
1710
|
-
|
|
1709
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1711
1710
|
export declare const ${factoryName}: ${upperName}
|
|
1712
1711
|
`,
|
|
1713
1712
|
jsxType: import_outdent23.outdent`
|
|
@@ -1878,9 +1877,9 @@ function generateReactJsxPattern(ctx) {
|
|
|
1878
1877
|
`,
|
|
1879
1878
|
dts: import_outdent25.outdent`
|
|
1880
1879
|
import type { FunctionComponent } from 'react'
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1880
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1881
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1882
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1884
1883
|
|
|
1885
1884
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1886
1885
|
|
|
@@ -1897,13 +1896,13 @@ function generateReactJsxTypes(ctx) {
|
|
|
1897
1896
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1898
1897
|
return {
|
|
1899
1898
|
jsxFactory: import_outdent26.outdent`
|
|
1900
|
-
|
|
1899
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1901
1900
|
export declare const ${factoryName}: ${upperName}
|
|
1902
1901
|
`,
|
|
1903
1902
|
jsxType: import_outdent26.outdent`
|
|
1904
1903
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1905
|
-
|
|
1906
|
-
|
|
1904
|
+
${ctx.file.importType("Assign, DistributiveOmit, JsxHTMLProps, JsxStyleProps", "./system-types")}
|
|
1905
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
1907
1906
|
|
|
1908
1907
|
type Dict = Record<string, unknown>
|
|
1909
1908
|
|
|
@@ -1992,12 +1991,12 @@ function generateReactJsxStringLiteralTypes(ctx) {
|
|
|
1992
1991
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1993
1992
|
return {
|
|
1994
1993
|
jsxFactory: import_outdent28.outdent`
|
|
1995
|
-
|
|
1994
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1996
1995
|
export declare const ${factoryName}: ${upperName}
|
|
1997
1996
|
`,
|
|
1998
1997
|
jsxType: import_outdent28.outdent`
|
|
1999
1998
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
2000
|
-
|
|
1999
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2001
2000
|
|
|
2002
2001
|
type Dict = Record<string, unknown>
|
|
2003
2002
|
|
|
@@ -2137,10 +2136,10 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2137
2136
|
}
|
|
2138
2137
|
`,
|
|
2139
2138
|
dts: import_outdent30.outdent`
|
|
2140
|
-
import { Component } from 'solid-js'
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2139
|
+
import type { Component } from 'solid-js'
|
|
2140
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
2141
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2142
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2144
2143
|
|
|
2145
2144
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
2146
2145
|
|
|
@@ -2157,13 +2156,13 @@ function generateSolidJsxTypes(ctx) {
|
|
|
2157
2156
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2158
2157
|
return {
|
|
2159
2158
|
jsxFactory: import_outdent31.outdent`
|
|
2160
|
-
|
|
2159
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2161
2160
|
export declare const ${factoryName}: ${upperName}
|
|
2162
2161
|
`,
|
|
2163
2162
|
jsxType: import_outdent31.outdent`
|
|
2164
2163
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
2165
|
-
|
|
2166
|
-
|
|
2164
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2165
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2167
2166
|
|
|
2168
2167
|
type Dict = Record<string, unknown>
|
|
2169
2168
|
|
|
@@ -2256,7 +2255,7 @@ function generateSolidJsxStringLiteralTypes(ctx) {
|
|
|
2256
2255
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2257
2256
|
return {
|
|
2258
2257
|
jsxFactory: import_outdent33.outdent`
|
|
2259
|
-
|
|
2258
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2260
2259
|
export declare const ${factoryName}: ${upperName}
|
|
2261
2260
|
`,
|
|
2262
2261
|
jsxType: import_outdent33.outdent`
|
|
@@ -2445,10 +2444,10 @@ function generateVueJsxPattern(ctx) {
|
|
|
2445
2444
|
})
|
|
2446
2445
|
`,
|
|
2447
2446
|
dts: import_outdent36.outdent`
|
|
2448
|
-
import { FunctionalComponent } from 'vue'
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2447
|
+
import type { FunctionalComponent } from 'vue'
|
|
2448
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
2449
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2450
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2452
2451
|
|
|
2453
2452
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
2454
2453
|
|
|
@@ -2465,13 +2464,15 @@ function generateVueJsxTypes(ctx) {
|
|
|
2465
2464
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2466
2465
|
return {
|
|
2467
2466
|
jsxFactory: import_outdent37.outdent`
|
|
2468
|
-
|
|
2467
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2468
|
+
|
|
2469
2469
|
export declare const ${factoryName}: ${upperName}
|
|
2470
2470
|
`,
|
|
2471
2471
|
jsxType: import_outdent37.outdent`
|
|
2472
2472
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2473
|
-
|
|
2474
|
-
|
|
2473
|
+
|
|
2474
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2475
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2475
2476
|
|
|
2476
2477
|
type IntrinsicElement =
|
|
2477
2478
|
| 'a'
|
|
@@ -2630,7 +2631,8 @@ function generateVueJsxStringLiteralTypes(ctx) {
|
|
|
2630
2631
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2631
2632
|
return {
|
|
2632
2633
|
jsxFactory: import_outdent38.outdent`
|
|
2633
|
-
|
|
2634
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2635
|
+
|
|
2634
2636
|
export declare const ${factoryName}: ${upperName}
|
|
2635
2637
|
`,
|
|
2636
2638
|
jsxType: import_outdent38.outdent`
|
|
@@ -2838,7 +2840,7 @@ function generateJsxPatterns(ctx) {
|
|
|
2838
2840
|
// src/artifacts/pkg-json.ts
|
|
2839
2841
|
function generatePackageJson(ctx) {
|
|
2840
2842
|
const {
|
|
2841
|
-
config: { outdir
|
|
2843
|
+
config: { outdir }
|
|
2842
2844
|
} = ctx;
|
|
2843
2845
|
const pkg = {
|
|
2844
2846
|
name: outdir,
|
|
@@ -2847,32 +2849,32 @@ function generatePackageJson(ctx) {
|
|
|
2847
2849
|
type: "module",
|
|
2848
2850
|
exports: {
|
|
2849
2851
|
"./css": {
|
|
2850
|
-
types: "./css/index
|
|
2851
|
-
require: `./css/index
|
|
2852
|
-
import: `./css/index
|
|
2852
|
+
types: ctx.file.extDts("./css/index"),
|
|
2853
|
+
require: ctx.file.ext(`./css/index`),
|
|
2854
|
+
import: ctx.file.ext(`./css/index`)
|
|
2853
2855
|
},
|
|
2854
2856
|
"./jsx": {
|
|
2855
|
-
types: "./jsx/index
|
|
2856
|
-
require: `./jsx/index
|
|
2857
|
-
import: `./jsx/index
|
|
2857
|
+
types: ctx.file.extDts("./jsx/index"),
|
|
2858
|
+
require: ctx.file.ext(`./jsx/index`),
|
|
2859
|
+
import: ctx.file.ext(`./jsx/index`)
|
|
2858
2860
|
},
|
|
2859
2861
|
"./patterns": {
|
|
2860
|
-
types: "./patterns/index
|
|
2861
|
-
require: `./patterns/index
|
|
2862
|
-
import: `./patterns/index
|
|
2862
|
+
types: ctx.file.extDts("./patterns/index"),
|
|
2863
|
+
require: ctx.file.ext(`./patterns/index`),
|
|
2864
|
+
import: ctx.file.ext(`./patterns/index`)
|
|
2863
2865
|
},
|
|
2864
2866
|
"./recipes": {
|
|
2865
|
-
types: "./recipes/index
|
|
2866
|
-
require: `./recipes/index
|
|
2867
|
-
import: `./recipes/index
|
|
2867
|
+
types: ctx.file.extDts("./recipes/index"),
|
|
2868
|
+
require: ctx.file.ext(`./recipes/index`),
|
|
2869
|
+
import: ctx.file.ext(`./recipes/index`)
|
|
2868
2870
|
},
|
|
2869
2871
|
"./tokens": {
|
|
2870
|
-
types: "./tokens/index
|
|
2871
|
-
require: `./tokens/index
|
|
2872
|
-
import: `./tokens/index
|
|
2872
|
+
types: ctx.file.extDts("./tokens/index"),
|
|
2873
|
+
require: ctx.file.ext(`./tokens/index`),
|
|
2874
|
+
import: ctx.file.ext(`./tokens/index`)
|
|
2873
2875
|
},
|
|
2874
2876
|
"./types": {
|
|
2875
|
-
types: "./types/index
|
|
2877
|
+
types: ctx.file.extDts("./types/index")
|
|
2876
2878
|
},
|
|
2877
2879
|
"./styles.css": "./styles.css"
|
|
2878
2880
|
}
|
|
@@ -2919,42 +2921,47 @@ var selectors_d_ts_default = {
|
|
|
2919
2921
|
var import_ts_pattern9 = require("ts-pattern");
|
|
2920
2922
|
var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
|
|
2921
2923
|
function getGeneratedTypes(ctx) {
|
|
2924
|
+
const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
|
|
2922
2925
|
return {
|
|
2923
2926
|
cssType: csstype_d_ts_default.content,
|
|
2924
|
-
recipe: recipe_d_ts_default.content,
|
|
2925
|
-
pattern: pattern_d_ts_default.content,
|
|
2926
|
-
parts: parts_d_ts_default.content,
|
|
2927
|
-
composition: composition_d_ts_default.content,
|
|
2928
|
-
selectors: selectors_d_ts_default.content,
|
|
2929
|
-
system: (
|
|
2927
|
+
recipe: rewriteImports(recipe_d_ts_default.content),
|
|
2928
|
+
pattern: rewriteImports(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
|
|
2929
|
+
parts: rewriteImports(parts_d_ts_default.content),
|
|
2930
|
+
composition: rewriteImports(composition_d_ts_default.content),
|
|
2931
|
+
selectors: rewriteImports(selectors_d_ts_default.content),
|
|
2932
|
+
system: rewriteImports(
|
|
2933
|
+
(0, import_ts_pattern9.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with("minimal", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = WithCss")).with("none", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = {}")).exhaustive()
|
|
2934
|
+
)
|
|
2930
2935
|
};
|
|
2931
2936
|
}
|
|
2932
2937
|
|
|
2933
2938
|
// src/artifacts/types/main.ts
|
|
2934
2939
|
var import_outdent39 = require("outdent");
|
|
2935
|
-
var generateTypesEntry = () => ({
|
|
2940
|
+
var generateTypesEntry = (ctx) => ({
|
|
2936
2941
|
global: import_outdent39.outdent`
|
|
2937
|
-
|
|
2938
|
-
import type {
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
+
// @ts-nocheck
|
|
2943
|
+
import type { TextStyles, LayerStyles } from '@pandacss/dev'
|
|
2944
|
+
${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
|
|
2945
|
+
${ctx.file.importType("Parts", "./parts")}
|
|
2946
|
+
${ctx.file.importType("PatternConfig, PatternProperties", "./pattern")}
|
|
2947
|
+
${ctx.file.importType("GlobalStyleObject, SystemStyleObject", "./system-types")}
|
|
2948
|
+
${ctx.file.importType("CompositionStyles", "./composition")}
|
|
2942
2949
|
|
|
2943
2950
|
declare module '@pandacss/dev' {
|
|
2944
2951
|
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
|
|
2945
2952
|
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): SlotRecipeConfig
|
|
2946
2953
|
export function defineStyles(definition: SystemStyleObject): SystemStyleObject
|
|
2947
2954
|
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2948
|
-
export function defineTextStyles(definition: CompositionStyles['textStyles']):
|
|
2949
|
-
export function defineLayerStyles(definition: CompositionStyles['layerStyles']):
|
|
2955
|
+
export function defineTextStyles(definition: CompositionStyles['textStyles']): TextStyles
|
|
2956
|
+
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): LayerStyles
|
|
2950
2957
|
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2951
2958
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
2952
2959
|
}
|
|
2953
2960
|
`,
|
|
2954
2961
|
index: import_outdent39.outdent`
|
|
2955
|
-
import './global'
|
|
2956
|
-
|
|
2957
|
-
|
|
2962
|
+
import '${ctx.file.extDts("./global")}'
|
|
2963
|
+
${ctx.file.exportType("ConditionalValue", "./conditions")}
|
|
2964
|
+
${ctx.file.exportType("GlobalStyleObject, JsxStyleProps, SystemStyleObject", "./system-types")}
|
|
2958
2965
|
|
|
2959
2966
|
`,
|
|
2960
2967
|
helpers: import_outdent39.outdent`
|
|
@@ -2972,9 +2979,9 @@ function generatePropTypes(ctx) {
|
|
|
2972
2979
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2973
2980
|
const result = [
|
|
2974
2981
|
import_outdent40.outdent`
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2982
|
+
${ctx.file.importType("ConditionalValue", "./conditions")}
|
|
2983
|
+
${ctx.file.importType("CssProperties", "./system-types")}
|
|
2984
|
+
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
2978
2985
|
|
|
2979
2986
|
type PropertyValueTypes = {`
|
|
2980
2987
|
];
|
|
@@ -3011,9 +3018,9 @@ var import_outdent41 = __toESM(require("outdent"));
|
|
|
3011
3018
|
function generateStyleProps(ctx) {
|
|
3012
3019
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()).filter(Boolean));
|
|
3013
3020
|
return import_outdent41.default`
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3021
|
+
${ctx.file.importType("ConditionalValue", "./conditions")}
|
|
3022
|
+
${ctx.file.importType("PropertyValue", "./prop-type")}
|
|
3023
|
+
${ctx.file.importType("Token", "../tokens/index")}
|
|
3017
3024
|
|
|
3018
3025
|
export type CssVarProperties = {
|
|
3019
3026
|
[key in \`--\${string}\`]?: ConditionalValue<Token | (string & {}) | (number & {})>
|
|
@@ -3104,9 +3111,9 @@ function setupDesignTokens(ctx) {
|
|
|
3104
3111
|
dir: ctx.paths.token,
|
|
3105
3112
|
files: [
|
|
3106
3113
|
{ file: "index.css", code: css2 },
|
|
3107
|
-
{ file:
|
|
3114
|
+
{ file: ctx.file.extDts("index"), code: code.dts },
|
|
3108
3115
|
{ file: ctx.file.ext("index"), code: code.js },
|
|
3109
|
-
{ file:
|
|
3116
|
+
{ file: ctx.file.extDts("tokens"), code: generateTokenTypes(ctx) }
|
|
3110
3117
|
]
|
|
3111
3118
|
};
|
|
3112
3119
|
}
|
|
@@ -3114,24 +3121,24 @@ function setupTypes(ctx) {
|
|
|
3114
3121
|
const gen = getGeneratedTypes(ctx);
|
|
3115
3122
|
const conditions = generateConditions(ctx);
|
|
3116
3123
|
const jsx = generateJsxTypes(ctx);
|
|
3117
|
-
const entry = generateTypesEntry();
|
|
3124
|
+
const entry = generateTypesEntry(ctx);
|
|
3118
3125
|
return {
|
|
3119
3126
|
dir: ctx.paths.types,
|
|
3120
3127
|
files: [
|
|
3121
|
-
jsx ? { file:
|
|
3122
|
-
{ file:
|
|
3123
|
-
{ file: "system-types
|
|
3124
|
-
{ file:
|
|
3125
|
-
{ file:
|
|
3126
|
-
{ file:
|
|
3127
|
-
{ file:
|
|
3128
|
-
{ file:
|
|
3129
|
-
{ file:
|
|
3130
|
-
{ file:
|
|
3131
|
-
{ file:
|
|
3132
|
-
{ file: "prop-type
|
|
3133
|
-
{ file: "style-props
|
|
3134
|
-
{ file:
|
|
3128
|
+
jsx ? { file: ctx.file.extDts("jsx"), code: jsx.jsxType } : null,
|
|
3129
|
+
{ file: ctx.file.extDts("csstype"), code: gen.cssType },
|
|
3130
|
+
{ file: ctx.file.extDts("system-types"), code: gen.system },
|
|
3131
|
+
{ file: ctx.file.extDts("selectors"), code: gen.selectors },
|
|
3132
|
+
{ file: ctx.file.extDts("composition"), code: gen.composition },
|
|
3133
|
+
{ file: ctx.file.extDts("global"), code: entry.global },
|
|
3134
|
+
{ file: ctx.file.extDts("helpers"), code: entry.helpers },
|
|
3135
|
+
{ file: ctx.file.extDts("recipe"), code: gen.recipe },
|
|
3136
|
+
{ file: ctx.file.extDts("pattern"), code: gen.pattern },
|
|
3137
|
+
{ file: ctx.file.extDts("parts"), code: gen.parts },
|
|
3138
|
+
{ file: ctx.file.extDts("index"), code: entry.index },
|
|
3139
|
+
{ file: ctx.file.extDts("prop-type"), code: generatePropTypes(ctx) },
|
|
3140
|
+
{ file: ctx.file.extDts("style-props"), code: generateStyleProps(ctx) },
|
|
3141
|
+
{ file: ctx.file.extDts("conditions"), code: conditions.dts }
|
|
3135
3142
|
].filter(Boolean)
|
|
3136
3143
|
};
|
|
3137
3144
|
}
|
|
@@ -3143,7 +3150,7 @@ function setupCss(ctx) {
|
|
|
3143
3150
|
files: [
|
|
3144
3151
|
{ file: ctx.file.ext("conditions"), code: conditions.js },
|
|
3145
3152
|
{ file: ctx.file.ext("css"), code: code.js },
|
|
3146
|
-
{ file:
|
|
3153
|
+
{ file: ctx.file.extDts("css"), code: code.dts }
|
|
3147
3154
|
]
|
|
3148
3155
|
};
|
|
3149
3156
|
}
|
|
@@ -3155,7 +3162,7 @@ function setupCva(ctx) {
|
|
|
3155
3162
|
dir: ctx.paths.css,
|
|
3156
3163
|
files: [
|
|
3157
3164
|
{ file: ctx.file.ext("cva"), code: code.js },
|
|
3158
|
-
{ file:
|
|
3165
|
+
{ file: ctx.file.extDts("cva"), code: code.dts }
|
|
3159
3166
|
]
|
|
3160
3167
|
};
|
|
3161
3168
|
}
|
|
@@ -3167,7 +3174,7 @@ function setupSva(ctx) {
|
|
|
3167
3174
|
dir: ctx.paths.css,
|
|
3168
3175
|
files: [
|
|
3169
3176
|
{ file: ctx.file.ext("sva"), code: code.js },
|
|
3170
|
-
{ file:
|
|
3177
|
+
{ file: ctx.file.extDts("sva"), code: code.dts }
|
|
3171
3178
|
]
|
|
3172
3179
|
};
|
|
3173
3180
|
}
|
|
@@ -3177,7 +3184,7 @@ function setupCx(ctx) {
|
|
|
3177
3184
|
dir: ctx.paths.css,
|
|
3178
3185
|
files: [
|
|
3179
3186
|
{ file: ctx.file.ext("cx"), code: code.js },
|
|
3180
|
-
{ file:
|
|
3187
|
+
{ file: ctx.file.extDts("cx"), code: code.dts }
|
|
3181
3188
|
]
|
|
3182
3189
|
};
|
|
3183
3190
|
}
|
|
@@ -3187,16 +3194,16 @@ function setupRecipes(ctx) {
|
|
|
3187
3194
|
return;
|
|
3188
3195
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
3189
3196
|
const index = {
|
|
3190
|
-
js: import_outdent43.default.string(indexFiles.map((file) => ctx.file.
|
|
3191
|
-
dts: import_outdent43.default.string(indexFiles.map((file) =>
|
|
3197
|
+
js: import_outdent43.default.string(indexFiles.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
|
|
3198
|
+
dts: import_outdent43.default.string(indexFiles.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
|
|
3192
3199
|
};
|
|
3193
3200
|
return {
|
|
3194
3201
|
dir: ctx.paths.recipe,
|
|
3195
3202
|
files: [
|
|
3196
3203
|
...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3197
|
-
...files.map((file) => ({ file:
|
|
3204
|
+
...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3198
3205
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3199
|
-
{ file:
|
|
3206
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3200
3207
|
]
|
|
3201
3208
|
};
|
|
3202
3209
|
}
|
|
@@ -3207,16 +3214,16 @@ function setupPatterns(ctx) {
|
|
|
3207
3214
|
if (!files)
|
|
3208
3215
|
return;
|
|
3209
3216
|
const index = {
|
|
3210
|
-
js: import_outdent43.default.string(files.map((file) => ctx.file.
|
|
3211
|
-
dts: import_outdent43.default.string(files.map((file) =>
|
|
3217
|
+
js: import_outdent43.default.string(files.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
|
|
3218
|
+
dts: import_outdent43.default.string(files.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
|
|
3212
3219
|
};
|
|
3213
3220
|
return {
|
|
3214
3221
|
dir: ctx.paths.pattern,
|
|
3215
3222
|
files: [
|
|
3216
3223
|
...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3217
|
-
...files.map((file) => ({ file:
|
|
3224
|
+
...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3218
3225
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3219
|
-
{ file:
|
|
3226
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3220
3227
|
]
|
|
3221
3228
|
};
|
|
3222
3229
|
}
|
|
@@ -3229,51 +3236,54 @@ function setupJsx(ctx) {
|
|
|
3229
3236
|
const patterns = generateJsxPatterns(ctx);
|
|
3230
3237
|
const index = {
|
|
3231
3238
|
js: import_outdent43.default`
|
|
3232
|
-
${ctx.file.
|
|
3233
|
-
${isValidProp?.js ? ctx.file.
|
|
3234
|
-
${import_outdent43.default.string(patterns.map((file) => ctx.file.
|
|
3239
|
+
${ctx.file.exportStar("./factory")}
|
|
3240
|
+
${isValidProp?.js ? ctx.file.exportStar("./is-valid-prop") : ""}
|
|
3241
|
+
${import_outdent43.default.string(patterns.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n"))}
|
|
3235
3242
|
`,
|
|
3236
3243
|
dts: import_outdent43.default`
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
${
|
|
3240
|
-
|
|
3244
|
+
${ctx.file.exportTypeStar("./factory")}
|
|
3245
|
+
|
|
3246
|
+
${isValidProp?.dts ? ctx.file.exportTypeStar("./is-valid-prop") : ""}
|
|
3247
|
+
|
|
3248
|
+
${import_outdent43.default.string(patterns.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))}
|
|
3249
|
+
|
|
3250
|
+
${ctx.file.exportType(ctx.jsx.typeName, "../types/jsx")}
|
|
3241
3251
|
`
|
|
3242
3252
|
};
|
|
3243
3253
|
return {
|
|
3244
3254
|
dir: ctx.paths.jsx,
|
|
3245
3255
|
files: [
|
|
3246
3256
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3247
|
-
...patterns.map((file) => ({ file:
|
|
3257
|
+
...patterns.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3248
3258
|
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
|
|
3249
|
-
{ file: "is-valid-prop
|
|
3250
|
-
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
3259
|
+
{ file: ctx.file.extDts("is-valid-prop"), code: isValidProp?.dts },
|
|
3251
3260
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
3252
|
-
{ file:
|
|
3253
|
-
{ file: ctx.file.ext("index"), code: index.js }
|
|
3261
|
+
{ file: ctx.file.extDts("factory"), code: types.jsxFactory },
|
|
3262
|
+
{ file: ctx.file.ext("index"), code: index.js },
|
|
3263
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3254
3264
|
]
|
|
3255
3265
|
};
|
|
3256
3266
|
}
|
|
3257
3267
|
function setupCssIndex(ctx) {
|
|
3258
3268
|
const index = {
|
|
3259
3269
|
js: import_outdent43.default`
|
|
3260
|
-
${ctx.file.
|
|
3261
|
-
${ctx.file.
|
|
3262
|
-
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.
|
|
3263
|
-
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.
|
|
3270
|
+
${ctx.file.exportStar("./css")}
|
|
3271
|
+
${ctx.file.exportStar("./cx")}
|
|
3272
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportStar("./cva")}
|
|
3273
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportStar("./sva")}
|
|
3264
3274
|
`,
|
|
3265
3275
|
dts: import_outdent43.default`
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
${ctx.isTemplateLiteralSyntax ? "" :
|
|
3269
|
-
${ctx.isTemplateLiteralSyntax ? "" :
|
|
3276
|
+
${ctx.file.exportTypeStar("./css")}
|
|
3277
|
+
${ctx.file.exportTypeStar("./cx")}
|
|
3278
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportTypeStar("./cva")}
|
|
3279
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportTypeStar("./sva")}
|
|
3270
3280
|
`
|
|
3271
3281
|
};
|
|
3272
3282
|
return {
|
|
3273
3283
|
dir: ctx.paths.css,
|
|
3274
3284
|
files: [
|
|
3275
3285
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3276
|
-
{ file:
|
|
3286
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3277
3287
|
]
|
|
3278
3288
|
};
|
|
3279
3289
|
}
|
|
@@ -3324,7 +3334,7 @@ var generateArtifacts = (ctx) => () => {
|
|
|
3324
3334
|
].filter(Boolean).map((artifact) => {
|
|
3325
3335
|
const files = artifact?.files ?? [];
|
|
3326
3336
|
files.forEach((file) => {
|
|
3327
|
-
if (
|
|
3337
|
+
if (ctx.file.isTypeFile(file.file)) {
|
|
3328
3338
|
file.code = `/* eslint-disable */
|
|
3329
3339
|
${file.code}`;
|
|
3330
3340
|
}
|
|
@@ -3414,7 +3424,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3414
3424
|
for (const pattern of patternSet) {
|
|
3415
3425
|
(0, import_ts_pattern10.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern10.P.string }, ({ name: jsxName }) => {
|
|
3416
3426
|
pattern.data.forEach((data) => {
|
|
3417
|
-
const fnName = patterns.
|
|
3427
|
+
const fnName = patterns.find(jsxName);
|
|
3418
3428
|
const styleProps = patterns.transform(fnName, data);
|
|
3419
3429
|
sheet.processStyleProps(styleProps);
|
|
3420
3430
|
});
|
|
@@ -3613,8 +3623,8 @@ var getPatternEngine = (config) => {
|
|
|
3613
3623
|
},
|
|
3614
3624
|
getNames,
|
|
3615
3625
|
details,
|
|
3616
|
-
|
|
3617
|
-
return details.find((node) => node.jsxName
|
|
3626
|
+
find: (0, import_shared7.memo)((jsxName) => {
|
|
3627
|
+
return details.find((node) => node.match.test(jsxName))?.baseName ?? (0, import_shared7.uncapitalize)(jsxName);
|
|
3618
3628
|
}),
|
|
3619
3629
|
filter: (0, import_shared7.memo)((jsxName) => {
|
|
3620
3630
|
return details.filter((node) => node.match.test(jsxName));
|
|
@@ -3624,23 +3634,46 @@ var getPatternEngine = (config) => {
|
|
|
3624
3634
|
};
|
|
3625
3635
|
|
|
3626
3636
|
// src/engines/index.ts
|
|
3627
|
-
var getEngine = (conf) =>
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3637
|
+
var getEngine = (conf) => {
|
|
3638
|
+
const { config } = conf;
|
|
3639
|
+
const { forceConsistentTypeExtension, outExtension } = config;
|
|
3640
|
+
return {
|
|
3641
|
+
...getBaseEngine(conf),
|
|
3642
|
+
patterns: getPatternEngine(config),
|
|
3643
|
+
jsx: getJsxEngine(config),
|
|
3644
|
+
paths: getPathEngine(config),
|
|
3645
|
+
file: {
|
|
3646
|
+
ext(file) {
|
|
3647
|
+
return `${file}.${outExtension}`;
|
|
3648
|
+
},
|
|
3649
|
+
extDts(file) {
|
|
3650
|
+
const dts = outExtension === "mjs" && forceConsistentTypeExtension ? "d.mts" : "d.ts";
|
|
3651
|
+
return `${file}.${dts}`;
|
|
3652
|
+
},
|
|
3653
|
+
__extDts(file) {
|
|
3654
|
+
return forceConsistentTypeExtension ? this.extDts(file) : file;
|
|
3655
|
+
},
|
|
3656
|
+
import(mod, file) {
|
|
3657
|
+
return `import { ${mod} } from '${this.ext(file)}';`;
|
|
3658
|
+
},
|
|
3659
|
+
importType(mod, file) {
|
|
3660
|
+
return `import type { ${mod} } from '${this.__extDts(file)}';`;
|
|
3661
|
+
},
|
|
3662
|
+
exportType(mod, file) {
|
|
3663
|
+
return `export type { ${mod} } from '${this.__extDts(file)}';`;
|
|
3664
|
+
},
|
|
3665
|
+
exportStar(file) {
|
|
3666
|
+
return `export * from '${this.ext(file)}';`;
|
|
3667
|
+
},
|
|
3668
|
+
exportTypeStar(file) {
|
|
3669
|
+
return `export * from '${this.__extDts(file)}';`;
|
|
3670
|
+
},
|
|
3671
|
+
isTypeFile(file) {
|
|
3672
|
+
return file.endsWith(".d.ts") || file.endsWith(".d.mts");
|
|
3673
|
+
}
|
|
3641
3674
|
}
|
|
3642
|
-
}
|
|
3643
|
-
}
|
|
3675
|
+
};
|
|
3676
|
+
};
|
|
3644
3677
|
|
|
3645
3678
|
// src/generator.ts
|
|
3646
3679
|
var defaults = (conf) => ({
|