@pandacss/generator 0.0.0-dev-20230212115356 → 0.0.0-dev-20230212130534
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.ts +6 -10
- package/dist/index.js +21 -19
- package/dist/index.mjs +21 -19
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -51,6 +51,9 @@ declare const getEngine: (conf: LoadConfigResult) => {
|
|
|
51
51
|
};
|
|
52
52
|
details: {
|
|
53
53
|
config: _pandacss_types.RecipeConfig<_pandacss_types.RecipeVariantRecord>;
|
|
54
|
+
variantKeyMap: {
|
|
55
|
+
[k: string]: string[];
|
|
56
|
+
};
|
|
54
57
|
upperName: string;
|
|
55
58
|
dashName: string;
|
|
56
59
|
jsxName: string;
|
|
@@ -59,11 +62,6 @@ declare const getEngine: (conf: LoadConfigResult) => {
|
|
|
59
62
|
splitProps: (name: string, props: Record<string, any>) => {
|
|
60
63
|
[x: string]: unknown;
|
|
61
64
|
}[];
|
|
62
|
-
variantKeys: {
|
|
63
|
-
[x: string]: {
|
|
64
|
-
[x: string]: string[];
|
|
65
|
-
}[];
|
|
66
|
-
}[];
|
|
67
65
|
isEmpty: () => boolean;
|
|
68
66
|
};
|
|
69
67
|
jsx: {
|
|
@@ -169,6 +167,9 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
169
167
|
};
|
|
170
168
|
details: {
|
|
171
169
|
config: _pandacss_types.RecipeConfig<_pandacss_types.RecipeVariantRecord>;
|
|
170
|
+
variantKeyMap: {
|
|
171
|
+
[k: string]: string[];
|
|
172
|
+
};
|
|
172
173
|
upperName: string;
|
|
173
174
|
dashName: string;
|
|
174
175
|
jsxName: string;
|
|
@@ -177,11 +178,6 @@ declare const createGenerator: (conf: LoadConfigResult) => {
|
|
|
177
178
|
splitProps: (name: string, props: Record<string, any>) => {
|
|
178
179
|
[x: string]: unknown;
|
|
179
180
|
}[];
|
|
180
|
-
variantKeys: {
|
|
181
|
-
[x: string]: {
|
|
182
|
-
[x: string]: string[];
|
|
183
|
-
}[];
|
|
184
|
-
}[];
|
|
185
181
|
isEmpty: () => boolean;
|
|
186
182
|
};
|
|
187
183
|
patterns: {
|
package/dist/index.js
CHANGED
|
@@ -695,23 +695,29 @@ function generateRecipes(ctx) {
|
|
|
695
695
|
import type { ConditionalValue } from '../types'
|
|
696
696
|
`
|
|
697
697
|
];
|
|
698
|
-
recipes.details.forEach(({ config, upperName }) => {
|
|
699
|
-
const { name, description, defaultVariants
|
|
698
|
+
recipes.details.forEach(({ config, upperName, variantKeyMap }) => {
|
|
699
|
+
const { name, description, defaultVariants } = config;
|
|
700
700
|
js.push(import_outdent8.outdent`
|
|
701
701
|
export const ${name} = createRecipe('${name}', ${JSON.stringify(defaultVariants ?? {})})
|
|
702
|
-
${name}.variants = ${JSON.stringify(
|
|
702
|
+
${name}.variants = ${JSON.stringify(variantKeyMap)}
|
|
703
703
|
`);
|
|
704
704
|
dts.push(import_outdent8.outdent`
|
|
705
|
+
type ${upperName}Variant = {
|
|
706
|
+
${Object.keys(variantKeyMap).map((key) => `${key}: ${(0, import_shared2.unionType)(variantKeyMap[key])}`).join("\n")}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
type ${upperName}VariantMap = {
|
|
710
|
+
[key in keyof ${upperName}Variant]: Array<${upperName}Variant[key]>
|
|
711
|
+
}
|
|
712
|
+
|
|
705
713
|
export type ${upperName}Variants = {
|
|
706
|
-
${
|
|
707
|
-
const value = variants[key];
|
|
708
|
-
const keys = Object.keys(value);
|
|
709
|
-
return `${key}?: ConditionalValue<${(0, import_shared2.unionType)(keys)}>`;
|
|
710
|
-
}).join("\n")}
|
|
714
|
+
[key in keyof ${upperName}Variant]?: ConditionalValue<${upperName}VariantMap[key]>
|
|
711
715
|
}
|
|
712
716
|
|
|
713
717
|
${description ? `/** ${description} */` : ""}
|
|
714
|
-
export declare function ${name}(variants?: ${upperName}Variants): string & {
|
|
718
|
+
export declare function ${name}(variants?: ${upperName}Variants): string & {
|
|
719
|
+
variants: ${upperName}VariantMap
|
|
720
|
+
}
|
|
715
721
|
`);
|
|
716
722
|
});
|
|
717
723
|
return {
|
|
@@ -1444,7 +1450,7 @@ function generateVueLayoutGrid() {
|
|
|
1444
1450
|
export declare const LayoutGrid: FunctionalComponent<LayoutGridProps>
|
|
1445
1451
|
`,
|
|
1446
1452
|
js: import_outdent23.outdent`
|
|
1447
|
-
import { h, computed } from 'vue'
|
|
1453
|
+
import { h, computed, defineComponent } from 'vue'
|
|
1448
1454
|
|
|
1449
1455
|
export const LayoutGrid = defineComponent({
|
|
1450
1456
|
name: 'LayoutGrid',
|
|
@@ -1689,7 +1695,7 @@ var patternMap = {
|
|
|
1689
1695
|
react: generateReactJsxPattern,
|
|
1690
1696
|
solid: generateSolidJsxPattern,
|
|
1691
1697
|
preact: generatePreactJsxPattern,
|
|
1692
|
-
vue: () => [
|
|
1698
|
+
vue: () => []
|
|
1693
1699
|
};
|
|
1694
1700
|
function generateJsxPatterns(ctx) {
|
|
1695
1701
|
if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
|
|
@@ -2429,14 +2435,10 @@ var getRecipeEngine = (config) => {
|
|
|
2429
2435
|
import_lil_fp3.Obj.bind("details", ({ getNames, recipes }) => {
|
|
2430
2436
|
return Object.entries(recipes).map(([name, recipe]) => ({
|
|
2431
2437
|
...getNames(name),
|
|
2432
|
-
config: recipe
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
return Object.entries(recipes).map(([name, recipe]) => ({
|
|
2437
|
-
[name]: Object.entries(recipe.variants ?? {}).map(([key, value]) => ({
|
|
2438
|
-
[key]: Object.keys(value)
|
|
2439
|
-
}))
|
|
2438
|
+
config: recipe,
|
|
2439
|
+
variantKeyMap: Object.fromEntries(
|
|
2440
|
+
Object.entries(recipe.variants ?? {}).map(([key, value]) => [key, Object.keys(value)])
|
|
2441
|
+
)
|
|
2440
2442
|
}));
|
|
2441
2443
|
}),
|
|
2442
2444
|
import_lil_fp3.Obj.bind("isEmpty", ({ recipes }) => {
|
package/dist/index.mjs
CHANGED
|
@@ -664,23 +664,29 @@ function generateRecipes(ctx) {
|
|
|
664
664
|
import type { ConditionalValue } from '../types'
|
|
665
665
|
`
|
|
666
666
|
];
|
|
667
|
-
recipes.details.forEach(({ config, upperName }) => {
|
|
668
|
-
const { name, description, defaultVariants
|
|
667
|
+
recipes.details.forEach(({ config, upperName, variantKeyMap }) => {
|
|
668
|
+
const { name, description, defaultVariants } = config;
|
|
669
669
|
js.push(outdent8`
|
|
670
670
|
export const ${name} = createRecipe('${name}', ${JSON.stringify(defaultVariants ?? {})})
|
|
671
|
-
${name}.variants = ${JSON.stringify(
|
|
671
|
+
${name}.variants = ${JSON.stringify(variantKeyMap)}
|
|
672
672
|
`);
|
|
673
673
|
dts.push(outdent8`
|
|
674
|
+
type ${upperName}Variant = {
|
|
675
|
+
${Object.keys(variantKeyMap).map((key) => `${key}: ${unionType2(variantKeyMap[key])}`).join("\n")}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
type ${upperName}VariantMap = {
|
|
679
|
+
[key in keyof ${upperName}Variant]: Array<${upperName}Variant[key]>
|
|
680
|
+
}
|
|
681
|
+
|
|
674
682
|
export type ${upperName}Variants = {
|
|
675
|
-
${
|
|
676
|
-
const value = variants[key];
|
|
677
|
-
const keys = Object.keys(value);
|
|
678
|
-
return `${key}?: ConditionalValue<${unionType2(keys)}>`;
|
|
679
|
-
}).join("\n")}
|
|
683
|
+
[key in keyof ${upperName}Variant]?: ConditionalValue<${upperName}VariantMap[key]>
|
|
680
684
|
}
|
|
681
685
|
|
|
682
686
|
${description ? `/** ${description} */` : ""}
|
|
683
|
-
export declare function ${name}(variants?: ${upperName}Variants): string & {
|
|
687
|
+
export declare function ${name}(variants?: ${upperName}Variants): string & {
|
|
688
|
+
variants: ${upperName}VariantMap
|
|
689
|
+
}
|
|
684
690
|
`);
|
|
685
691
|
});
|
|
686
692
|
return {
|
|
@@ -1413,7 +1419,7 @@ function generateVueLayoutGrid() {
|
|
|
1413
1419
|
export declare const LayoutGrid: FunctionalComponent<LayoutGridProps>
|
|
1414
1420
|
`,
|
|
1415
1421
|
js: outdent23`
|
|
1416
|
-
import { h, computed } from 'vue'
|
|
1422
|
+
import { h, computed, defineComponent } from 'vue'
|
|
1417
1423
|
|
|
1418
1424
|
export const LayoutGrid = defineComponent({
|
|
1419
1425
|
name: 'LayoutGrid',
|
|
@@ -1658,7 +1664,7 @@ var patternMap = {
|
|
|
1658
1664
|
react: generateReactJsxPattern,
|
|
1659
1665
|
solid: generateSolidJsxPattern,
|
|
1660
1666
|
preact: generatePreactJsxPattern,
|
|
1661
|
-
vue: () => [
|
|
1667
|
+
vue: () => []
|
|
1662
1668
|
};
|
|
1663
1669
|
function generateJsxPatterns(ctx) {
|
|
1664
1670
|
if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
|
|
@@ -2398,14 +2404,10 @@ var getRecipeEngine = (config) => {
|
|
|
2398
2404
|
Obj3.bind("details", ({ getNames, recipes }) => {
|
|
2399
2405
|
return Object.entries(recipes).map(([name, recipe]) => ({
|
|
2400
2406
|
...getNames(name),
|
|
2401
|
-
config: recipe
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
return Object.entries(recipes).map(([name, recipe]) => ({
|
|
2406
|
-
[name]: Object.entries(recipe.variants ?? {}).map(([key, value]) => ({
|
|
2407
|
-
[key]: Object.keys(value)
|
|
2408
|
-
}))
|
|
2407
|
+
config: recipe,
|
|
2408
|
+
variantKeyMap: Object.fromEntries(
|
|
2409
|
+
Object.entries(recipe.variants ?? {}).map(([key, value]) => [key, Object.keys(value)])
|
|
2410
|
+
)
|
|
2409
2411
|
}));
|
|
2410
2412
|
}),
|
|
2411
2413
|
Obj3.bind("isEmpty", ({ recipes }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230212130534",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"pluralize": "8.0.0",
|
|
21
21
|
"postcss": "8.4.21",
|
|
22
22
|
"ts-pattern": "4.1.4",
|
|
23
|
-
"@pandacss/core": "0.0.0-dev-
|
|
24
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
25
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
26
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
27
|
-
"@pandacss/types": "0.0.0-dev-
|
|
28
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
23
|
+
"@pandacss/core": "0.0.0-dev-20230212130534",
|
|
24
|
+
"@pandacss/logger": "0.0.0-dev-20230212130534",
|
|
25
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230212130534",
|
|
26
|
+
"@pandacss/shared": "0.0.0-dev-20230212130534",
|
|
27
|
+
"@pandacss/types": "0.0.0-dev-20230212130534",
|
|
28
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20230212130534"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.29",
|
|
32
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
32
|
+
"@pandacss/fixture": "0.0.0-dev-20230212130534"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"prebuild": "tsx scripts/prebuild.ts",
|