@pandacss/generator 0.0.0-dev-20230421141155 → 0.0.0-dev-20230421145003
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.js +21 -6
- package/dist/index.mjs +21 -6
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -705,6 +705,7 @@ transform`)}
|
|
|
705
705
|
// src/artifacts/js/recipe.ts
|
|
706
706
|
var import_shared2 = require("@pandacss/shared");
|
|
707
707
|
var import_outdent9 = require("outdent");
|
|
708
|
+
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
708
709
|
function generateRecipes(ctx) {
|
|
709
710
|
const {
|
|
710
711
|
recipes,
|
|
@@ -764,15 +765,21 @@ function generateRecipes(ctx) {
|
|
|
764
765
|
return {
|
|
765
766
|
name: dashName,
|
|
766
767
|
js: import_outdent9.outdent`
|
|
768
|
+
${ctx.file.import("splitProps", "../helpers")}
|
|
767
769
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
768
770
|
|
|
769
|
-
export const ${name} = createRecipe('${name}', ${
|
|
771
|
+
export const ${name} = createRecipe('${name}', ${stringify3(defaultVariants ?? {})}, ${stringify3(
|
|
770
772
|
compoundVariants ?? []
|
|
771
773
|
)})
|
|
772
|
-
|
|
774
|
+
|
|
775
|
+
${name}.variants = ${stringify3(variantKeyMap)}
|
|
776
|
+
|
|
777
|
+
const variantKeys = ${stringify3(Object.keys(variantKeyMap))}
|
|
778
|
+
${name}.splitVariantProps = (props) => splitProps(props, variantKeys)
|
|
773
779
|
`,
|
|
774
780
|
dts: import_outdent9.outdent`
|
|
775
781
|
import type { ConditionalValue } from '../types'
|
|
782
|
+
import type { Pretty } from '../types/helpers'
|
|
776
783
|
|
|
777
784
|
type ${upperName}Variant = {
|
|
778
785
|
${Object.keys(variantKeyMap).map((key) => `${key}: ${(0, import_shared2.unionType)(variantKeyMap[key])}`).join("\n")}
|
|
@@ -782,14 +789,18 @@ function generateRecipes(ctx) {
|
|
|
782
789
|
[key in keyof ${upperName}Variant]: Array<${upperName}Variant[key]>
|
|
783
790
|
}
|
|
784
791
|
|
|
785
|
-
export type ${upperName}
|
|
792
|
+
export type ${upperName}VariantProps = {
|
|
786
793
|
[key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`}
|
|
787
794
|
}
|
|
788
795
|
|
|
789
|
-
|
|
790
|
-
|
|
796
|
+
interface ${upperName}Recipe {
|
|
797
|
+
(variants?: ${upperName}Variants): string
|
|
791
798
|
variants: ${upperName}VariantMap
|
|
799
|
+
splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<Omit<Props, keyof ${upperName}VariantProps>>]
|
|
792
800
|
}
|
|
801
|
+
|
|
802
|
+
${description ? `/** ${description} */` : ""}
|
|
803
|
+
export declare const ${name}: ${upperName}Recipe
|
|
793
804
|
`
|
|
794
805
|
};
|
|
795
806
|
})
|
|
@@ -1851,7 +1862,10 @@ var generateTypesEntry = () => ({
|
|
|
1851
1862
|
export { ConditionalValue } from './conditions'
|
|
1852
1863
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
1853
1864
|
|
|
1854
|
-
|
|
1865
|
+
`,
|
|
1866
|
+
helpers: import_outdent26.outdent`
|
|
1867
|
+
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
1868
|
+
`
|
|
1855
1869
|
});
|
|
1856
1870
|
|
|
1857
1871
|
// src/artifacts/types/prop-types.ts
|
|
@@ -2052,6 +2066,7 @@ function setupTypes(ctx) {
|
|
|
2052
2066
|
{ file: "selectors.d.ts", code: gen.selectors },
|
|
2053
2067
|
{ file: "composition.d.ts", code: gen.composition },
|
|
2054
2068
|
{ file: "global.d.ts", code: entry.global },
|
|
2069
|
+
{ file: "helpers.d.ts", code: entry.helpers },
|
|
2055
2070
|
{ file: "recipe.d.ts", code: gen.recipe },
|
|
2056
2071
|
{ file: "pattern.d.ts", code: gen.pattern },
|
|
2057
2072
|
{ file: "parts.d.ts", code: gen.parts },
|
package/dist/index.mjs
CHANGED
|
@@ -674,6 +674,7 @@ transform`)}
|
|
|
674
674
|
// src/artifacts/js/recipe.ts
|
|
675
675
|
import { unionType as unionType2 } from "@pandacss/shared";
|
|
676
676
|
import { outdent as outdent9 } from "outdent";
|
|
677
|
+
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
677
678
|
function generateRecipes(ctx) {
|
|
678
679
|
const {
|
|
679
680
|
recipes,
|
|
@@ -733,15 +734,21 @@ function generateRecipes(ctx) {
|
|
|
733
734
|
return {
|
|
734
735
|
name: dashName,
|
|
735
736
|
js: outdent9`
|
|
737
|
+
${ctx.file.import("splitProps", "../helpers")}
|
|
736
738
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
737
739
|
|
|
738
|
-
export const ${name} = createRecipe('${name}', ${
|
|
740
|
+
export const ${name} = createRecipe('${name}', ${stringify3(defaultVariants ?? {})}, ${stringify3(
|
|
739
741
|
compoundVariants ?? []
|
|
740
742
|
)})
|
|
741
|
-
|
|
743
|
+
|
|
744
|
+
${name}.variants = ${stringify3(variantKeyMap)}
|
|
745
|
+
|
|
746
|
+
const variantKeys = ${stringify3(Object.keys(variantKeyMap))}
|
|
747
|
+
${name}.splitVariantProps = (props) => splitProps(props, variantKeys)
|
|
742
748
|
`,
|
|
743
749
|
dts: outdent9`
|
|
744
750
|
import type { ConditionalValue } from '../types'
|
|
751
|
+
import type { Pretty } from '../types/helpers'
|
|
745
752
|
|
|
746
753
|
type ${upperName}Variant = {
|
|
747
754
|
${Object.keys(variantKeyMap).map((key) => `${key}: ${unionType2(variantKeyMap[key])}`).join("\n")}
|
|
@@ -751,14 +758,18 @@ function generateRecipes(ctx) {
|
|
|
751
758
|
[key in keyof ${upperName}Variant]: Array<${upperName}Variant[key]>
|
|
752
759
|
}
|
|
753
760
|
|
|
754
|
-
export type ${upperName}
|
|
761
|
+
export type ${upperName}VariantProps = {
|
|
755
762
|
[key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`}
|
|
756
763
|
}
|
|
757
764
|
|
|
758
|
-
|
|
759
|
-
|
|
765
|
+
interface ${upperName}Recipe {
|
|
766
|
+
(variants?: ${upperName}Variants): string
|
|
760
767
|
variants: ${upperName}VariantMap
|
|
768
|
+
splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<Omit<Props, keyof ${upperName}VariantProps>>]
|
|
761
769
|
}
|
|
770
|
+
|
|
771
|
+
${description ? `/** ${description} */` : ""}
|
|
772
|
+
export declare const ${name}: ${upperName}Recipe
|
|
762
773
|
`
|
|
763
774
|
};
|
|
764
775
|
})
|
|
@@ -1820,7 +1831,10 @@ var generateTypesEntry = () => ({
|
|
|
1820
1831
|
export { ConditionalValue } from './conditions'
|
|
1821
1832
|
export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
1822
1833
|
|
|
1823
|
-
|
|
1834
|
+
`,
|
|
1835
|
+
helpers: outdent26`
|
|
1836
|
+
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
1837
|
+
`
|
|
1824
1838
|
});
|
|
1825
1839
|
|
|
1826
1840
|
// src/artifacts/types/prop-types.ts
|
|
@@ -2021,6 +2035,7 @@ function setupTypes(ctx) {
|
|
|
2021
2035
|
{ file: "selectors.d.ts", code: gen.selectors },
|
|
2022
2036
|
{ file: "composition.d.ts", code: gen.composition },
|
|
2023
2037
|
{ file: "global.d.ts", code: entry.global },
|
|
2038
|
+
{ file: "helpers.d.ts", code: entry.helpers },
|
|
2024
2039
|
{ file: "recipe.d.ts", code: gen.recipe },
|
|
2025
2040
|
{ file: "pattern.d.ts", code: gen.pattern },
|
|
2026
2041
|
{ file: "parts.d.ts", code: gen.parts },
|
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-20230421145003",
|
|
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.23",
|
|
22
22
|
"ts-pattern": "4.2.2",
|
|
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-20230421145003",
|
|
24
|
+
"@pandacss/logger": "0.0.0-dev-20230421145003",
|
|
25
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230421145003",
|
|
26
|
+
"@pandacss/shared": "0.0.0-dev-20230421145003",
|
|
27
|
+
"@pandacss/types": "0.0.0-dev-20230421145003",
|
|
28
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20230421145003"
|
|
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-20230421145003"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"prebuild": "tsx scripts/prebuild.ts",
|