@pandacss/generator 0.13.0 → 0.14.0
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 +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +211 -167
- package/dist/index.mjs +211 -167
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -555,10 +555,12 @@ 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
|
-
${keys.map(
|
|
561
|
+
${keys.map(
|
|
562
|
+
(key) => ` ${key === "base" ? `/** The base (=no conditions) styles to apply */` : ctx.conditions.get(key) ? `/** \`${ctx.conditions.get(key)}\` */` : ""}${JSON.stringify(key)}: string`
|
|
563
|
+
).join("\n")}
|
|
562
564
|
}
|
|
563
565
|
|
|
564
566
|
export type Condition = keyof Conditions
|
|
@@ -626,11 +628,11 @@ function generateCssFn(ctx) {
|
|
|
626
628
|
const { separator, getPropShorthands } = utility;
|
|
627
629
|
return {
|
|
628
630
|
dts: import_outdent4.outdent`
|
|
629
|
-
|
|
631
|
+
${ctx.file.importType("SystemStyleObject", "../types/index")}
|
|
630
632
|
|
|
631
633
|
interface CssFunction {
|
|
632
|
-
(...styles: SystemStyleObject
|
|
633
|
-
raw: (styles: SystemStyleObject) => SystemStyleObject
|
|
634
|
+
(...styles: Array<SystemStyleObject | undefined | null | false>): string
|
|
635
|
+
raw: (...styles: Array<SystemStyleObject | undefined | null | false>) => SystemStyleObject
|
|
634
636
|
}
|
|
635
637
|
|
|
636
638
|
export declare const css: CssFunction;
|
|
@@ -697,7 +699,7 @@ function generateCssFn(ctx) {
|
|
|
697
699
|
|
|
698
700
|
const cssFn = createCss(context)
|
|
699
701
|
export const css = (...styles) => cssFn(mergeCss(...styles))
|
|
700
|
-
css.raw = (styles) => styles
|
|
702
|
+
css.raw = (...styles) => mergeCss(...styles)
|
|
701
703
|
|
|
702
704
|
export const { mergeCss, assignCss } = createMergeCss(context)
|
|
703
705
|
`
|
|
@@ -822,12 +824,11 @@ function generateCvaFn(ctx) {
|
|
|
822
824
|
|
|
823
825
|
`,
|
|
824
826
|
dts: import_outdent6.outdent`
|
|
825
|
-
|
|
827
|
+
${ctx.file.importType("RecipeCreatorFn", "../types/recipe")}
|
|
826
828
|
|
|
827
829
|
export declare const cva: RecipeCreatorFn
|
|
828
830
|
|
|
829
|
-
|
|
830
|
-
|
|
831
|
+
${ctx.file.exportType("RecipeVariantProps", "../types/recipe")}
|
|
831
832
|
`
|
|
832
833
|
};
|
|
833
834
|
}
|
|
@@ -957,11 +958,11 @@ function generatePattern(ctx) {
|
|
|
957
958
|
return {
|
|
958
959
|
name: dashName,
|
|
959
960
|
dts: import_outdent10.outdent`
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
961
|
+
${ctx.file.importType("SystemStyleObject, ConditionalValue", "../types/index")}
|
|
962
|
+
${ctx.file.importType("Properties", "../types/csstype")}
|
|
963
|
+
${ctx.file.importType("PropertyValue", "../types/prop-type")}
|
|
964
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
965
|
+
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
965
966
|
|
|
966
967
|
export type ${upperName}Properties = {
|
|
967
968
|
${Object.keys(properties ?? {}).map((key) => {
|
|
@@ -987,7 +988,7 @@ function generatePattern(ctx) {
|
|
|
987
988
|
|
|
988
989
|
interface ${upperName}PatternFn {
|
|
989
990
|
(styles?: ${upperName}Styles): string
|
|
990
|
-
raw: (styles
|
|
991
|
+
raw: (styles?: ${upperName}Styles) => SystemStyleObject
|
|
991
992
|
}
|
|
992
993
|
|
|
993
994
|
${description ? `/** ${description} */` : ""}
|
|
@@ -1128,9 +1129,9 @@ function generateRecipes(ctx) {
|
|
|
1128
1129
|
name: dashName,
|
|
1129
1130
|
js: jsCode,
|
|
1130
1131
|
dts: import_outdent11.outdent`
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1132
|
+
${ctx.file.importType("ConditionalValue", "../types/index")}
|
|
1133
|
+
${ctx.file.importType("Pretty", "../types/helpers")}
|
|
1134
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1134
1135
|
|
|
1135
1136
|
type ${upperName}Variant = {
|
|
1136
1137
|
${Object.keys(variantKeyMap).map((key) => {
|
|
@@ -1176,12 +1177,17 @@ function generateSvaFn(ctx) {
|
|
|
1176
1177
|
|
|
1177
1178
|
export function sva(config) {
|
|
1178
1179
|
const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)])
|
|
1179
|
-
|
|
1180
|
+
|
|
1180
1181
|
function svaFn(props) {
|
|
1181
1182
|
const result = slots.map(([slot, cvaFn]) => [slot, cvaFn(props)])
|
|
1182
1183
|
return Object.fromEntries(result)
|
|
1183
1184
|
}
|
|
1184
1185
|
|
|
1186
|
+
function raw(props) {
|
|
1187
|
+
const result = slots.map(([slot, cvaFn]) => [slot, cvaFn.raw(props)])
|
|
1188
|
+
return Object.fromEntries(result)
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1185
1191
|
const variants = config.variants ?? {};
|
|
1186
1192
|
const variantKeys = Object.keys(variants);
|
|
1187
1193
|
|
|
@@ -1195,6 +1201,7 @@ function generateSvaFn(ctx) {
|
|
|
1195
1201
|
|
|
1196
1202
|
return Object.assign(svaFn, {
|
|
1197
1203
|
__cva__: false,
|
|
1204
|
+
raw,
|
|
1198
1205
|
variantMap,
|
|
1199
1206
|
variantKeys,
|
|
1200
1207
|
splitVariantProps,
|
|
@@ -1202,7 +1209,7 @@ function generateSvaFn(ctx) {
|
|
|
1202
1209
|
}
|
|
1203
1210
|
`,
|
|
1204
1211
|
dts: import_outdent12.outdent`
|
|
1205
|
-
|
|
1212
|
+
${ctx.file.importType("SlotRecipeCreatorFn", "../types/recipe")}
|
|
1206
1213
|
|
|
1207
1214
|
export declare const sva: SlotRecipeCreatorFn
|
|
1208
1215
|
`
|
|
@@ -1235,14 +1242,14 @@ function generateTokenJs(ctx) {
|
|
|
1235
1242
|
token.var = tokenVar
|
|
1236
1243
|
`,
|
|
1237
1244
|
dts: import_outdent13.default`
|
|
1238
|
-
|
|
1245
|
+
${ctx.file.importType("Token", "./tokens")}
|
|
1239
1246
|
|
|
1240
1247
|
export declare const token: {
|
|
1241
1248
|
(path: Token, fallback?: string): string
|
|
1242
1249
|
var: (path: Token, fallback?: string) => string
|
|
1243
1250
|
}
|
|
1244
1251
|
|
|
1245
|
-
|
|
1252
|
+
${ctx.file.exportTypeStar("./tokens")}
|
|
1246
1253
|
`
|
|
1247
1254
|
};
|
|
1248
1255
|
}
|
|
@@ -1256,7 +1263,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1256
1263
|
import { h } from 'preact'
|
|
1257
1264
|
import { forwardRef } from 'preact/compat'
|
|
1258
1265
|
import { useMemo } from 'preact/hooks'
|
|
1259
|
-
${ctx.file.import("css, cx, assignCss", "../css/index")}
|
|
1266
|
+
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1260
1267
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1261
1268
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1262
1269
|
|
|
@@ -1352,9 +1359,9 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1352
1359
|
`,
|
|
1353
1360
|
dts: import_outdent15.outdent`
|
|
1354
1361
|
import type { FunctionComponent } from 'preact'
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1362
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1363
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1364
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1358
1365
|
|
|
1359
1366
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1360
1367
|
|
|
@@ -1376,8 +1383,8 @@ export declare const ${factoryName}: ${upperName}
|
|
|
1376
1383
|
`,
|
|
1377
1384
|
jsxType: import_outdent16.outdent`
|
|
1378
1385
|
import type { ComponentProps, JSX } from 'preact'
|
|
1379
|
-
|
|
1380
|
-
|
|
1386
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
1387
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
1381
1388
|
|
|
1382
1389
|
type ElementType = keyof JSX.IntrinsicElements
|
|
1383
1390
|
|
|
@@ -1464,7 +1471,7 @@ function generatePreactJsxStringLiteralTypes(ctx) {
|
|
|
1464
1471
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1465
1472
|
return {
|
|
1466
1473
|
jsxFactory: import_outdent18.outdent`
|
|
1467
|
-
|
|
1474
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1468
1475
|
export declare const ${factoryName}: ${upperName}
|
|
1469
1476
|
`,
|
|
1470
1477
|
jsxType: import_outdent18.outdent`
|
|
@@ -1593,9 +1600,9 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1593
1600
|
`,
|
|
1594
1601
|
dts: import_outdent20.outdent`
|
|
1595
1602
|
import type { Component } from '@builder.io/qwik'
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1603
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1604
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1605
|
+
${ctx.file.importType("Assign, DistributiveOmit", "../types/system-types")}
|
|
1599
1606
|
|
|
1600
1607
|
export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>>
|
|
1601
1608
|
|
|
@@ -1612,7 +1619,7 @@ function generateQwikJsxTypes(ctx) {
|
|
|
1612
1619
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1613
1620
|
return {
|
|
1614
1621
|
jsxFactory: import_outdent21.outdent`
|
|
1615
|
-
|
|
1622
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1616
1623
|
export declare const ${factoryName}: ${upperName}
|
|
1617
1624
|
`,
|
|
1618
1625
|
jsxType: import_outdent21.outdent`
|
|
@@ -1707,7 +1714,7 @@ function generateQwikJsxStringLiteralTypes(ctx) {
|
|
|
1707
1714
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1708
1715
|
return {
|
|
1709
1716
|
jsxFactory: import_outdent23.outdent`
|
|
1710
|
-
|
|
1717
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1711
1718
|
export declare const ${factoryName}: ${upperName}
|
|
1712
1719
|
`,
|
|
1713
1720
|
jsxType: import_outdent23.outdent`
|
|
@@ -1878,9 +1885,9 @@ function generateReactJsxPattern(ctx) {
|
|
|
1878
1885
|
`,
|
|
1879
1886
|
dts: import_outdent25.outdent`
|
|
1880
1887
|
import type { FunctionComponent } from 'react'
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1888
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
1889
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1890
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1884
1891
|
|
|
1885
1892
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1886
1893
|
|
|
@@ -1897,13 +1904,13 @@ function generateReactJsxTypes(ctx) {
|
|
|
1897
1904
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1898
1905
|
return {
|
|
1899
1906
|
jsxFactory: import_outdent26.outdent`
|
|
1900
|
-
|
|
1907
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1901
1908
|
export declare const ${factoryName}: ${upperName}
|
|
1902
1909
|
`,
|
|
1903
1910
|
jsxType: import_outdent26.outdent`
|
|
1904
1911
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1905
|
-
|
|
1906
|
-
|
|
1912
|
+
${ctx.file.importType("Assign, DistributiveOmit, JsxHTMLProps, JsxStyleProps", "./system-types")}
|
|
1913
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
1907
1914
|
|
|
1908
1915
|
type Dict = Record<string, unknown>
|
|
1909
1916
|
|
|
@@ -1992,12 +1999,12 @@ function generateReactJsxStringLiteralTypes(ctx) {
|
|
|
1992
1999
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1993
2000
|
return {
|
|
1994
2001
|
jsxFactory: import_outdent28.outdent`
|
|
1995
|
-
|
|
2002
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
1996
2003
|
export declare const ${factoryName}: ${upperName}
|
|
1997
2004
|
`,
|
|
1998
2005
|
jsxType: import_outdent28.outdent`
|
|
1999
2006
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
2000
|
-
|
|
2007
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2001
2008
|
|
|
2002
2009
|
type Dict = Record<string, unknown>
|
|
2003
2010
|
|
|
@@ -2137,10 +2144,10 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2137
2144
|
}
|
|
2138
2145
|
`,
|
|
2139
2146
|
dts: import_outdent30.outdent`
|
|
2140
|
-
import { Component } from 'solid-js'
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2147
|
+
import type { Component } from 'solid-js'
|
|
2148
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
2149
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2150
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2144
2151
|
|
|
2145
2152
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
2146
2153
|
|
|
@@ -2157,13 +2164,13 @@ function generateSolidJsxTypes(ctx) {
|
|
|
2157
2164
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2158
2165
|
return {
|
|
2159
2166
|
jsxFactory: import_outdent31.outdent`
|
|
2160
|
-
|
|
2167
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2161
2168
|
export declare const ${factoryName}: ${upperName}
|
|
2162
2169
|
`,
|
|
2163
2170
|
jsxType: import_outdent31.outdent`
|
|
2164
2171
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
2165
|
-
|
|
2166
|
-
|
|
2172
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2173
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2167
2174
|
|
|
2168
2175
|
type Dict = Record<string, unknown>
|
|
2169
2176
|
|
|
@@ -2256,7 +2263,7 @@ function generateSolidJsxStringLiteralTypes(ctx) {
|
|
|
2256
2263
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2257
2264
|
return {
|
|
2258
2265
|
jsxFactory: import_outdent33.outdent`
|
|
2259
|
-
|
|
2266
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2260
2267
|
export declare const ${factoryName}: ${upperName}
|
|
2261
2268
|
`,
|
|
2262
2269
|
jsxType: import_outdent33.outdent`
|
|
@@ -2445,10 +2452,10 @@ function generateVueJsxPattern(ctx) {
|
|
|
2445
2452
|
})
|
|
2446
2453
|
`,
|
|
2447
2454
|
dts: import_outdent36.outdent`
|
|
2448
|
-
import { FunctionalComponent } from 'vue'
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2455
|
+
import type { FunctionalComponent } from 'vue'
|
|
2456
|
+
${ctx.file.importType(`${upperName}Properties`, `../patterns/${dashName}`)}
|
|
2457
|
+
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2458
|
+
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2452
2459
|
|
|
2453
2460
|
export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
2454
2461
|
|
|
@@ -2465,13 +2472,15 @@ function generateVueJsxTypes(ctx) {
|
|
|
2465
2472
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2466
2473
|
return {
|
|
2467
2474
|
jsxFactory: import_outdent37.outdent`
|
|
2468
|
-
|
|
2475
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2476
|
+
|
|
2469
2477
|
export declare const ${factoryName}: ${upperName}
|
|
2470
2478
|
`,
|
|
2471
2479
|
jsxType: import_outdent37.outdent`
|
|
2472
2480
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2473
|
-
|
|
2474
|
-
|
|
2481
|
+
|
|
2482
|
+
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2483
|
+
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2475
2484
|
|
|
2476
2485
|
type IntrinsicElement =
|
|
2477
2486
|
| 'a'
|
|
@@ -2630,7 +2639,8 @@ function generateVueJsxStringLiteralTypes(ctx) {
|
|
|
2630
2639
|
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2631
2640
|
return {
|
|
2632
2641
|
jsxFactory: import_outdent38.outdent`
|
|
2633
|
-
|
|
2642
|
+
${ctx.file.importType(upperName, "../types/jsx")}
|
|
2643
|
+
|
|
2634
2644
|
export declare const ${factoryName}: ${upperName}
|
|
2635
2645
|
`,
|
|
2636
2646
|
jsxType: import_outdent38.outdent`
|
|
@@ -2838,7 +2848,7 @@ function generateJsxPatterns(ctx) {
|
|
|
2838
2848
|
// src/artifacts/pkg-json.ts
|
|
2839
2849
|
function generatePackageJson(ctx) {
|
|
2840
2850
|
const {
|
|
2841
|
-
config: { outdir
|
|
2851
|
+
config: { outdir }
|
|
2842
2852
|
} = ctx;
|
|
2843
2853
|
const pkg = {
|
|
2844
2854
|
name: outdir,
|
|
@@ -2847,32 +2857,32 @@ function generatePackageJson(ctx) {
|
|
|
2847
2857
|
type: "module",
|
|
2848
2858
|
exports: {
|
|
2849
2859
|
"./css": {
|
|
2850
|
-
types: "./css/index
|
|
2851
|
-
require: `./css/index
|
|
2852
|
-
import: `./css/index
|
|
2860
|
+
types: ctx.file.extDts("./css/index"),
|
|
2861
|
+
require: ctx.file.ext(`./css/index`),
|
|
2862
|
+
import: ctx.file.ext(`./css/index`)
|
|
2853
2863
|
},
|
|
2854
2864
|
"./jsx": {
|
|
2855
|
-
types: "./jsx/index
|
|
2856
|
-
require: `./jsx/index
|
|
2857
|
-
import: `./jsx/index
|
|
2865
|
+
types: ctx.file.extDts("./jsx/index"),
|
|
2866
|
+
require: ctx.file.ext(`./jsx/index`),
|
|
2867
|
+
import: ctx.file.ext(`./jsx/index`)
|
|
2858
2868
|
},
|
|
2859
2869
|
"./patterns": {
|
|
2860
|
-
types: "./patterns/index
|
|
2861
|
-
require: `./patterns/index
|
|
2862
|
-
import: `./patterns/index
|
|
2870
|
+
types: ctx.file.extDts("./patterns/index"),
|
|
2871
|
+
require: ctx.file.ext(`./patterns/index`),
|
|
2872
|
+
import: ctx.file.ext(`./patterns/index`)
|
|
2863
2873
|
},
|
|
2864
2874
|
"./recipes": {
|
|
2865
|
-
types: "./recipes/index
|
|
2866
|
-
require: `./recipes/index
|
|
2867
|
-
import: `./recipes/index
|
|
2875
|
+
types: ctx.file.extDts("./recipes/index"),
|
|
2876
|
+
require: ctx.file.ext(`./recipes/index`),
|
|
2877
|
+
import: ctx.file.ext(`./recipes/index`)
|
|
2868
2878
|
},
|
|
2869
2879
|
"./tokens": {
|
|
2870
|
-
types: "./tokens/index
|
|
2871
|
-
require: `./tokens/index
|
|
2872
|
-
import: `./tokens/index
|
|
2880
|
+
types: ctx.file.extDts("./tokens/index"),
|
|
2881
|
+
require: ctx.file.ext(`./tokens/index`),
|
|
2882
|
+
import: ctx.file.ext(`./tokens/index`)
|
|
2873
2883
|
},
|
|
2874
2884
|
"./types": {
|
|
2875
|
-
types: "./types/index
|
|
2885
|
+
types: ctx.file.extDts("./types/index")
|
|
2876
2886
|
},
|
|
2877
2887
|
"./styles.css": "./styles.css"
|
|
2878
2888
|
}
|
|
@@ -2897,7 +2907,7 @@ var composition_d_ts_default = {
|
|
|
2897
2907
|
|
|
2898
2908
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2899
2909
|
var recipe_d_ts_default = {
|
|
2900
|
-
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 type RecipeRuntimeFn<T extends RecipeVariantRecord> = 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\nexport type RecipeCompoundSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type 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 | RecipeVariantRecord\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?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ntype 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 type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & 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 type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = SlotRecipeVariantFn<S, T> & {\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 extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport type 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 | SlotRecipeVariantRecord<S>\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?: Array<SlotRecipeCompoundVariant<S, 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"
|
|
2910
|
+
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 type RecipeRuntimeFn<T extends RecipeVariantRecord> = 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\nexport type RecipeCompoundSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type 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 | RecipeVariantRecord\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?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ntype 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 type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & 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 type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = 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 extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport type 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 | SlotRecipeVariantRecord<S>\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?: Array<SlotRecipeCompoundVariant<S, 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"
|
|
2901
2911
|
};
|
|
2902
2912
|
|
|
2903
2913
|
// src/artifacts/generated/pattern.d.ts.json
|
|
@@ -2919,27 +2929,31 @@ var selectors_d_ts_default = {
|
|
|
2919
2929
|
var import_ts_pattern9 = require("ts-pattern");
|
|
2920
2930
|
var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
|
|
2921
2931
|
function getGeneratedTypes(ctx) {
|
|
2932
|
+
const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
|
|
2922
2933
|
return {
|
|
2923
2934
|
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: (
|
|
2935
|
+
recipe: rewriteImports(recipe_d_ts_default.content),
|
|
2936
|
+
pattern: rewriteImports(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
|
|
2937
|
+
parts: rewriteImports(parts_d_ts_default.content),
|
|
2938
|
+
composition: rewriteImports(composition_d_ts_default.content),
|
|
2939
|
+
selectors: rewriteImports(selectors_d_ts_default.content),
|
|
2940
|
+
system: rewriteImports(
|
|
2941
|
+
(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()
|
|
2942
|
+
)
|
|
2930
2943
|
};
|
|
2931
2944
|
}
|
|
2932
2945
|
|
|
2933
2946
|
// src/artifacts/types/main.ts
|
|
2934
2947
|
var import_outdent39 = require("outdent");
|
|
2935
|
-
var generateTypesEntry = () => ({
|
|
2948
|
+
var generateTypesEntry = (ctx) => ({
|
|
2936
2949
|
global: import_outdent39.outdent`
|
|
2950
|
+
// @ts-nocheck
|
|
2937
2951
|
import type { TextStyles, LayerStyles } from '@pandacss/dev'
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2952
|
+
${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
|
|
2953
|
+
${ctx.file.importType("Parts", "./parts")}
|
|
2954
|
+
${ctx.file.importType("PatternConfig, PatternProperties", "./pattern")}
|
|
2955
|
+
${ctx.file.importType("GlobalStyleObject, SystemStyleObject", "./system-types")}
|
|
2956
|
+
${ctx.file.importType("CompositionStyles", "./composition")}
|
|
2943
2957
|
|
|
2944
2958
|
declare module '@pandacss/dev' {
|
|
2945
2959
|
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
|
|
@@ -2952,10 +2966,13 @@ var generateTypesEntry = () => ({
|
|
|
2952
2966
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
2953
2967
|
}
|
|
2954
2968
|
`,
|
|
2969
|
+
// 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'`
|
|
2955
2970
|
index: import_outdent39.outdent`
|
|
2956
|
-
import './global'
|
|
2957
|
-
|
|
2958
|
-
|
|
2971
|
+
import '${ctx.file.extDts("./global")}'
|
|
2972
|
+
${ctx.file.exportType("ConditionalValue", "./conditions")}
|
|
2973
|
+
${ctx.file.exportType("PatternConfig, PatternProperties", "./pattern")}
|
|
2974
|
+
${ctx.file.exportType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
|
|
2975
|
+
${ctx.file.exportType("GlobalStyleObject, JsxStyleProps, SystemStyleObject", "./system-types")}
|
|
2959
2976
|
|
|
2960
2977
|
`,
|
|
2961
2978
|
helpers: import_outdent39.outdent`
|
|
@@ -2973,9 +2990,9 @@ function generatePropTypes(ctx) {
|
|
|
2973
2990
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2974
2991
|
const result = [
|
|
2975
2992
|
import_outdent40.outdent`
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2993
|
+
${ctx.file.importType("ConditionalValue", "./conditions")}
|
|
2994
|
+
${ctx.file.importType("CssProperties", "./system-types")}
|
|
2995
|
+
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
2979
2996
|
|
|
2980
2997
|
type PropertyValueTypes = {`
|
|
2981
2998
|
];
|
|
@@ -2999,9 +3016,9 @@ function generatePropTypes(ctx) {
|
|
|
2999
3016
|
${result.join("\n")}
|
|
3000
3017
|
|
|
3001
3018
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
3002
|
-
? ConditionalValue<PropertyTypes[T]${strictText} | (string & {})>
|
|
3019
|
+
? ConditionalValue<PropertyTypes[T]${strictText}${!ctx.config.strictTokens ? " | (string & {})" : ""}>
|
|
3003
3020
|
: T extends keyof CssProperties
|
|
3004
|
-
? ConditionalValue<CssProperties[T] | (string & {})>
|
|
3021
|
+
? ConditionalValue<CssProperties[T]${!ctx.config.strictTokens ? " | (string & {})" : ""}>
|
|
3005
3022
|
: ConditionalValue<string | number>
|
|
3006
3023
|
`;
|
|
3007
3024
|
}
|
|
@@ -3012,9 +3029,9 @@ var import_outdent41 = __toESM(require("outdent"));
|
|
|
3012
3029
|
function generateStyleProps(ctx) {
|
|
3013
3030
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()).filter(Boolean));
|
|
3014
3031
|
return import_outdent41.default`
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3032
|
+
${ctx.file.importType("ConditionalValue", "./conditions")}
|
|
3033
|
+
${ctx.file.importType("PropertyValue", "./prop-type")}
|
|
3034
|
+
${ctx.file.importType("Token", "../tokens/index")}
|
|
3018
3035
|
|
|
3019
3036
|
export type CssVarProperties = {
|
|
3020
3037
|
[key in \`--\${string}\`]?: ConditionalValue<Token | (string & {}) | (number & {})>
|
|
@@ -3105,9 +3122,9 @@ function setupDesignTokens(ctx) {
|
|
|
3105
3122
|
dir: ctx.paths.token,
|
|
3106
3123
|
files: [
|
|
3107
3124
|
{ file: "index.css", code: css2 },
|
|
3108
|
-
{ file:
|
|
3125
|
+
{ file: ctx.file.extDts("index"), code: code.dts },
|
|
3109
3126
|
{ file: ctx.file.ext("index"), code: code.js },
|
|
3110
|
-
{ file:
|
|
3127
|
+
{ file: ctx.file.extDts("tokens"), code: generateTokenTypes(ctx) }
|
|
3111
3128
|
]
|
|
3112
3129
|
};
|
|
3113
3130
|
}
|
|
@@ -3115,24 +3132,24 @@ function setupTypes(ctx) {
|
|
|
3115
3132
|
const gen = getGeneratedTypes(ctx);
|
|
3116
3133
|
const conditions = generateConditions(ctx);
|
|
3117
3134
|
const jsx = generateJsxTypes(ctx);
|
|
3118
|
-
const entry = generateTypesEntry();
|
|
3135
|
+
const entry = generateTypesEntry(ctx);
|
|
3119
3136
|
return {
|
|
3120
3137
|
dir: ctx.paths.types,
|
|
3121
3138
|
files: [
|
|
3122
|
-
jsx ? { file:
|
|
3123
|
-
{ file:
|
|
3124
|
-
{ file: "system-types
|
|
3125
|
-
{ file:
|
|
3126
|
-
{ file:
|
|
3127
|
-
{ file:
|
|
3128
|
-
{ file:
|
|
3129
|
-
{ file:
|
|
3130
|
-
{ file:
|
|
3131
|
-
{ file:
|
|
3132
|
-
{ file:
|
|
3133
|
-
{ file: "prop-type
|
|
3134
|
-
{ file: "style-props
|
|
3135
|
-
{ file:
|
|
3139
|
+
jsx ? { file: ctx.file.extDts("jsx"), code: jsx.jsxType } : null,
|
|
3140
|
+
{ file: ctx.file.extDts("csstype"), code: gen.cssType },
|
|
3141
|
+
{ file: ctx.file.extDts("system-types"), code: gen.system },
|
|
3142
|
+
{ file: ctx.file.extDts("selectors"), code: gen.selectors },
|
|
3143
|
+
{ file: ctx.file.extDts("composition"), code: gen.composition },
|
|
3144
|
+
{ file: ctx.file.extDts("global"), code: entry.global },
|
|
3145
|
+
{ file: ctx.file.extDts("helpers"), code: entry.helpers },
|
|
3146
|
+
{ file: ctx.file.extDts("recipe"), code: gen.recipe },
|
|
3147
|
+
{ file: ctx.file.extDts("pattern"), code: gen.pattern },
|
|
3148
|
+
{ file: ctx.file.extDts("parts"), code: gen.parts },
|
|
3149
|
+
{ file: ctx.file.extDts("index"), code: entry.index },
|
|
3150
|
+
{ file: ctx.file.extDts("prop-type"), code: generatePropTypes(ctx) },
|
|
3151
|
+
{ file: ctx.file.extDts("style-props"), code: generateStyleProps(ctx) },
|
|
3152
|
+
{ file: ctx.file.extDts("conditions"), code: conditions.dts }
|
|
3136
3153
|
].filter(Boolean)
|
|
3137
3154
|
};
|
|
3138
3155
|
}
|
|
@@ -3144,7 +3161,7 @@ function setupCss(ctx) {
|
|
|
3144
3161
|
files: [
|
|
3145
3162
|
{ file: ctx.file.ext("conditions"), code: conditions.js },
|
|
3146
3163
|
{ file: ctx.file.ext("css"), code: code.js },
|
|
3147
|
-
{ file:
|
|
3164
|
+
{ file: ctx.file.extDts("css"), code: code.dts }
|
|
3148
3165
|
]
|
|
3149
3166
|
};
|
|
3150
3167
|
}
|
|
@@ -3156,7 +3173,7 @@ function setupCva(ctx) {
|
|
|
3156
3173
|
dir: ctx.paths.css,
|
|
3157
3174
|
files: [
|
|
3158
3175
|
{ file: ctx.file.ext("cva"), code: code.js },
|
|
3159
|
-
{ file:
|
|
3176
|
+
{ file: ctx.file.extDts("cva"), code: code.dts }
|
|
3160
3177
|
]
|
|
3161
3178
|
};
|
|
3162
3179
|
}
|
|
@@ -3168,7 +3185,7 @@ function setupSva(ctx) {
|
|
|
3168
3185
|
dir: ctx.paths.css,
|
|
3169
3186
|
files: [
|
|
3170
3187
|
{ file: ctx.file.ext("sva"), code: code.js },
|
|
3171
|
-
{ file:
|
|
3188
|
+
{ file: ctx.file.extDts("sva"), code: code.dts }
|
|
3172
3189
|
]
|
|
3173
3190
|
};
|
|
3174
3191
|
}
|
|
@@ -3178,7 +3195,7 @@ function setupCx(ctx) {
|
|
|
3178
3195
|
dir: ctx.paths.css,
|
|
3179
3196
|
files: [
|
|
3180
3197
|
{ file: ctx.file.ext("cx"), code: code.js },
|
|
3181
|
-
{ file:
|
|
3198
|
+
{ file: ctx.file.extDts("cx"), code: code.dts }
|
|
3182
3199
|
]
|
|
3183
3200
|
};
|
|
3184
3201
|
}
|
|
@@ -3188,16 +3205,16 @@ function setupRecipes(ctx) {
|
|
|
3188
3205
|
return;
|
|
3189
3206
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
3190
3207
|
const index = {
|
|
3191
|
-
js: import_outdent43.default.string(indexFiles.map((file) => ctx.file.
|
|
3192
|
-
dts: import_outdent43.default.string(indexFiles.map((file) =>
|
|
3208
|
+
js: import_outdent43.default.string(indexFiles.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
|
|
3209
|
+
dts: import_outdent43.default.string(indexFiles.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
|
|
3193
3210
|
};
|
|
3194
3211
|
return {
|
|
3195
3212
|
dir: ctx.paths.recipe,
|
|
3196
3213
|
files: [
|
|
3197
3214
|
...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3198
|
-
...files.map((file) => ({ file:
|
|
3215
|
+
...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3199
3216
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3200
|
-
{ file:
|
|
3217
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3201
3218
|
]
|
|
3202
3219
|
};
|
|
3203
3220
|
}
|
|
@@ -3208,16 +3225,16 @@ function setupPatterns(ctx) {
|
|
|
3208
3225
|
if (!files)
|
|
3209
3226
|
return;
|
|
3210
3227
|
const index = {
|
|
3211
|
-
js: import_outdent43.default.string(files.map((file) => ctx.file.
|
|
3212
|
-
dts: import_outdent43.default.string(files.map((file) =>
|
|
3228
|
+
js: import_outdent43.default.string(files.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n")),
|
|
3229
|
+
dts: import_outdent43.default.string(files.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))
|
|
3213
3230
|
};
|
|
3214
3231
|
return {
|
|
3215
3232
|
dir: ctx.paths.pattern,
|
|
3216
3233
|
files: [
|
|
3217
3234
|
...files.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3218
|
-
...files.map((file) => ({ file:
|
|
3235
|
+
...files.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3219
3236
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3220
|
-
{ file:
|
|
3237
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3221
3238
|
]
|
|
3222
3239
|
};
|
|
3223
3240
|
}
|
|
@@ -3230,51 +3247,54 @@ function setupJsx(ctx) {
|
|
|
3230
3247
|
const patterns = generateJsxPatterns(ctx);
|
|
3231
3248
|
const index = {
|
|
3232
3249
|
js: import_outdent43.default`
|
|
3233
|
-
${ctx.file.
|
|
3234
|
-
${isValidProp?.js ? ctx.file.
|
|
3235
|
-
${import_outdent43.default.string(patterns.map((file) => ctx.file.
|
|
3250
|
+
${ctx.file.exportStar("./factory")}
|
|
3251
|
+
${isValidProp?.js ? ctx.file.exportStar("./is-valid-prop") : ""}
|
|
3252
|
+
${import_outdent43.default.string(patterns.map((file) => ctx.file.exportStar(`./${file.name}`)).join("\n"))}
|
|
3236
3253
|
`,
|
|
3237
3254
|
dts: import_outdent43.default`
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
${
|
|
3241
|
-
|
|
3255
|
+
${ctx.file.exportTypeStar("./factory")}
|
|
3256
|
+
|
|
3257
|
+
${isValidProp?.dts ? ctx.file.exportTypeStar("./is-valid-prop") : ""}
|
|
3258
|
+
|
|
3259
|
+
${import_outdent43.default.string(patterns.map((file) => ctx.file.exportTypeStar(`./${file.name}`)).join("\n"))}
|
|
3260
|
+
|
|
3261
|
+
${ctx.file.exportType([ctx.jsx.typeName, ctx.jsx.componentName].join(", "), "../types/jsx")}
|
|
3242
3262
|
`
|
|
3243
3263
|
};
|
|
3244
3264
|
return {
|
|
3245
3265
|
dir: ctx.paths.jsx,
|
|
3246
3266
|
files: [
|
|
3247
3267
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3248
|
-
...patterns.map((file) => ({ file:
|
|
3268
|
+
...patterns.map((file) => ({ file: ctx.file.extDts(file.name), code: file.dts })),
|
|
3249
3269
|
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
|
|
3250
|
-
{ file: "is-valid-prop
|
|
3251
|
-
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
3270
|
+
{ file: ctx.file.extDts("is-valid-prop"), code: isValidProp?.dts },
|
|
3252
3271
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
3253
|
-
{ file:
|
|
3254
|
-
{ file: ctx.file.ext("index"), code: index.js }
|
|
3272
|
+
{ file: ctx.file.extDts("factory"), code: types.jsxFactory },
|
|
3273
|
+
{ file: ctx.file.ext("index"), code: index.js },
|
|
3274
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3255
3275
|
]
|
|
3256
3276
|
};
|
|
3257
3277
|
}
|
|
3258
3278
|
function setupCssIndex(ctx) {
|
|
3259
3279
|
const index = {
|
|
3260
3280
|
js: import_outdent43.default`
|
|
3261
|
-
${ctx.file.
|
|
3262
|
-
${ctx.file.
|
|
3263
|
-
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.
|
|
3264
|
-
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.
|
|
3281
|
+
${ctx.file.exportStar("./css")}
|
|
3282
|
+
${ctx.file.exportStar("./cx")}
|
|
3283
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportStar("./cva")}
|
|
3284
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportStar("./sva")}
|
|
3265
3285
|
`,
|
|
3266
3286
|
dts: import_outdent43.default`
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
${ctx.isTemplateLiteralSyntax ? "" :
|
|
3270
|
-
${ctx.isTemplateLiteralSyntax ? "" :
|
|
3287
|
+
${ctx.file.exportTypeStar("./css")}
|
|
3288
|
+
${ctx.file.exportTypeStar("./cx")}
|
|
3289
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportTypeStar("./cva")}
|
|
3290
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.exportTypeStar("./sva")}
|
|
3271
3291
|
`
|
|
3272
3292
|
};
|
|
3273
3293
|
return {
|
|
3274
3294
|
dir: ctx.paths.css,
|
|
3275
3295
|
files: [
|
|
3276
3296
|
{ file: ctx.file.ext("index"), code: index.js },
|
|
3277
|
-
{ file:
|
|
3297
|
+
{ file: ctx.file.extDts("index"), code: index.dts }
|
|
3278
3298
|
]
|
|
3279
3299
|
};
|
|
3280
3300
|
}
|
|
@@ -3325,7 +3345,7 @@ var generateArtifacts = (ctx) => () => {
|
|
|
3325
3345
|
].filter(Boolean).map((artifact) => {
|
|
3326
3346
|
const files = artifact?.files ?? [];
|
|
3327
3347
|
files.forEach((file) => {
|
|
3328
|
-
if (
|
|
3348
|
+
if (ctx.file.isTypeFile(file.file)) {
|
|
3329
3349
|
file.code = `/* eslint-disable */
|
|
3330
3350
|
${file.code}`;
|
|
3331
3351
|
}
|
|
@@ -3477,7 +3497,8 @@ var getBaseEngine = (conf) => {
|
|
|
3477
3497
|
tokens,
|
|
3478
3498
|
config: isTemplateLiteralSyntax ? {} : config.utilities,
|
|
3479
3499
|
separator: config.separator,
|
|
3480
|
-
shorthands: config.shorthands
|
|
3500
|
+
shorthands: config.shorthands,
|
|
3501
|
+
strictTokens: config.strictTokens
|
|
3481
3502
|
});
|
|
3482
3503
|
const conditions = new import_core5.Conditions({
|
|
3483
3504
|
conditions: isTemplateLiteralSyntax ? {} : config.conditions,
|
|
@@ -3625,23 +3646,46 @@ var getPatternEngine = (config) => {
|
|
|
3625
3646
|
};
|
|
3626
3647
|
|
|
3627
3648
|
// src/engines/index.ts
|
|
3628
|
-
var getEngine = (conf) =>
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3649
|
+
var getEngine = (conf) => {
|
|
3650
|
+
const { config } = conf;
|
|
3651
|
+
const { forceConsistentTypeExtension, outExtension } = config;
|
|
3652
|
+
return {
|
|
3653
|
+
...getBaseEngine(conf),
|
|
3654
|
+
patterns: getPatternEngine(config),
|
|
3655
|
+
jsx: getJsxEngine(config),
|
|
3656
|
+
paths: getPathEngine(config),
|
|
3657
|
+
file: {
|
|
3658
|
+
ext(file) {
|
|
3659
|
+
return `${file}.${outExtension}`;
|
|
3660
|
+
},
|
|
3661
|
+
extDts(file) {
|
|
3662
|
+
const dts = outExtension === "mjs" && forceConsistentTypeExtension ? "d.mts" : "d.ts";
|
|
3663
|
+
return `${file}.${dts}`;
|
|
3664
|
+
},
|
|
3665
|
+
__extDts(file) {
|
|
3666
|
+
return forceConsistentTypeExtension ? this.extDts(file) : file;
|
|
3667
|
+
},
|
|
3668
|
+
import(mod, file) {
|
|
3669
|
+
return `import { ${mod} } from '${this.ext(file)}';`;
|
|
3670
|
+
},
|
|
3671
|
+
importType(mod, file) {
|
|
3672
|
+
return `import type { ${mod} } from '${this.__extDts(file)}';`;
|
|
3673
|
+
},
|
|
3674
|
+
exportType(mod, file) {
|
|
3675
|
+
return `export type { ${mod} } from '${this.__extDts(file)}';`;
|
|
3676
|
+
},
|
|
3677
|
+
exportStar(file) {
|
|
3678
|
+
return `export * from '${this.ext(file)}';`;
|
|
3679
|
+
},
|
|
3680
|
+
exportTypeStar(file) {
|
|
3681
|
+
return `export * from '${this.__extDts(file)}';`;
|
|
3682
|
+
},
|
|
3683
|
+
isTypeFile(file) {
|
|
3684
|
+
return file.endsWith(".d.ts") || file.endsWith(".d.mts");
|
|
3685
|
+
}
|
|
3642
3686
|
}
|
|
3643
|
-
}
|
|
3644
|
-
}
|
|
3687
|
+
};
|
|
3688
|
+
};
|
|
3645
3689
|
|
|
3646
3690
|
// src/generator.ts
|
|
3647
3691
|
var defaults = (conf) => ({
|