@pandacss/generator 0.0.0-dev-20240405065931 → 0.0.0-dev-20240409220115
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 +20 -17
- package/dist/index.mjs +20 -17
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -544,7 +544,7 @@ function generatePattern(ctx, filters) {
|
|
|
544
544
|
const details = ctx.patterns.filterDetails(filters);
|
|
545
545
|
return details.map((pattern) => {
|
|
546
546
|
const { baseName, config, dashName, upperName, styleFnName, blocklistType } = pattern;
|
|
547
|
-
const { properties, transform, strict, description, defaultValues } = config;
|
|
547
|
+
const { properties, transform, strict, description, defaultValues, deprecated } = config;
|
|
548
548
|
const patternConfigFn = (0, import_javascript_stringify.stringify)((0, import_shared.compact)({ transform, defaultValues })) ?? "";
|
|
549
549
|
const helperImports = ["getPatternStyles, patternFns"];
|
|
550
550
|
if (patternConfigFn.includes("__spreadValues")) {
|
|
@@ -589,7 +589,7 @@ function generatePattern(ctx, filters) {
|
|
|
589
589
|
raw: (styles?: ${upperName}Styles) => SystemStyleObject
|
|
590
590
|
}
|
|
591
591
|
|
|
592
|
-
${description
|
|
592
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
593
593
|
export declare const ${baseName}: ${upperName}PatternFn;
|
|
594
594
|
`}
|
|
595
595
|
|
|
@@ -722,7 +722,7 @@ function generateRecipes(ctx, filters) {
|
|
|
722
722
|
const details = ctx.recipes.filterDetails(filters);
|
|
723
723
|
return details.map((recipe) => {
|
|
724
724
|
const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
|
|
725
|
-
const { description, defaultVariants, compoundVariants } = config;
|
|
725
|
+
const { description, defaultVariants, compoundVariants, deprecated } = config;
|
|
726
726
|
const jsCode = (0, import_ts_pattern4.match)(config).when(
|
|
727
727
|
import_core.Recipes.isSlotRecipeConfig,
|
|
728
728
|
(config2) => import_outdent11.outdent`
|
|
@@ -818,7 +818,7 @@ function generateRecipes(ctx, filters) {
|
|
|
818
818
|
getVariantProps: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
819
819
|
}
|
|
820
820
|
|
|
821
|
-
${description
|
|
821
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
822
822
|
export declare const ${baseName}: ${upperName}Recipe
|
|
823
823
|
`
|
|
824
824
|
};
|
|
@@ -1022,7 +1022,7 @@ function generatePreactJsxPattern(ctx, filters) {
|
|
|
1022
1022
|
const details = ctx.patterns.filterDetails(filters);
|
|
1023
1023
|
return details.map((pattern) => {
|
|
1024
1024
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
1025
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
1025
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
1026
1026
|
return {
|
|
1027
1027
|
name: dashName,
|
|
1028
1028
|
js: import_outdent15.outdent`
|
|
@@ -1076,7 +1076,7 @@ function generatePreactJsxPattern(ctx, filters) {
|
|
|
1076
1076
|
|
|
1077
1077
|
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1078
1078
|
|
|
1079
|
-
${description
|
|
1079
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
1080
1080
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1081
1081
|
`
|
|
1082
1082
|
};
|
|
@@ -1350,7 +1350,7 @@ function generateQwikJsxPattern(ctx, filters) {
|
|
|
1350
1350
|
const details = ctx.patterns.filterDetails(filters);
|
|
1351
1351
|
return details.map((pattern) => {
|
|
1352
1352
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
1353
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
1353
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
1354
1354
|
return {
|
|
1355
1355
|
name: dashName,
|
|
1356
1356
|
js: import_outdent20.outdent`
|
|
@@ -1403,7 +1403,7 @@ function generateQwikJsxPattern(ctx, filters) {
|
|
|
1403
1403
|
|
|
1404
1404
|
export interface ${upperName}Props extends Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>> {}
|
|
1405
1405
|
|
|
1406
|
-
${description
|
|
1406
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
1407
1407
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
1408
1408
|
`
|
|
1409
1409
|
};
|
|
@@ -1684,7 +1684,7 @@ function generateReactJsxPattern(ctx, filters) {
|
|
|
1684
1684
|
const details = ctx.patterns.filterDetails(filters);
|
|
1685
1685
|
return details.map((pattern) => {
|
|
1686
1686
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
1687
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
1687
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
1688
1688
|
return {
|
|
1689
1689
|
name: dashName,
|
|
1690
1690
|
js: import_outdent25.outdent`
|
|
@@ -1737,7 +1737,7 @@ function generateReactJsxPattern(ctx, filters) {
|
|
|
1737
1737
|
|
|
1738
1738
|
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1739
1739
|
|
|
1740
|
-
${description
|
|
1740
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
1741
1741
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1742
1742
|
`
|
|
1743
1743
|
};
|
|
@@ -2061,7 +2061,7 @@ function generateSolidJsxPattern(ctx, filters) {
|
|
|
2061
2061
|
const details = ctx.patterns.filterDetails(filters);
|
|
2062
2062
|
return details.map((pattern) => {
|
|
2063
2063
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
2064
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
2064
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
2065
2065
|
return {
|
|
2066
2066
|
name: dashName,
|
|
2067
2067
|
js: import_outdent30.outdent`
|
|
@@ -2116,7 +2116,7 @@ function generateSolidJsxPattern(ctx, filters) {
|
|
|
2116
2116
|
|
|
2117
2117
|
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2118
2118
|
|
|
2119
|
-
${description
|
|
2119
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
2120
2120
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
2121
2121
|
`
|
|
2122
2122
|
};
|
|
@@ -2516,7 +2516,7 @@ function generateVueJsxPattern(ctx, filters) {
|
|
|
2516
2516
|
const details = ctx.patterns.filterDetails(filters);
|
|
2517
2517
|
return details.map((pattern) => {
|
|
2518
2518
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
2519
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
2519
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
2520
2520
|
return {
|
|
2521
2521
|
name: dashName,
|
|
2522
2522
|
js: import_outdent36.outdent`
|
|
@@ -2577,7 +2577,7 @@ function generateVueJsxPattern(ctx, filters) {
|
|
|
2577
2577
|
|
|
2578
2578
|
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2579
2579
|
|
|
2580
|
-
${description
|
|
2580
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
2581
2581
|
export declare const ${jsxName}: FunctionalComponent<${upperName}Props>
|
|
2582
2582
|
`
|
|
2583
2583
|
};
|
|
@@ -3517,12 +3517,12 @@ var parts_d_ts_default = {
|
|
|
3517
3517
|
|
|
3518
3518
|
// src/artifacts/generated/pattern.d.ts.json
|
|
3519
3519
|
var pattern_d_ts_default = {
|
|
3520
|
-
content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport interface PatternHelpers {\n map: (value: any, fn: (value: string) => string | undefined) => any\n isCssUnit: (value: any) => boolean\n isCssVar: (value: any) => boolean\n isCssFunction: (value: any) => boolean\n}\n\nexport interface PatternProperties {\n [key: string]: PatternProperty\n}\n\ntype InferProps<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternDefaultValue<T> = Partial<InferProps<T>>\n\nexport type PatternDefaultValueFn<T> = (props: InferProps<T>) => PatternDefaultValue<T>\n\nexport interface PatternConfig<T extends PatternProperties = PatternProperties> {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties?: T\n /**\n * The default values of the pattern.\n */\n defaultValues?: PatternDefaultValue<T> | PatternDefaultValueFn<T>\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: InferProps<T>, helpers: PatternHelpers) => SystemStyleObject\n /**\n * The jsx element name this pattern will generate.\n */\n jsxName?: string\n /**\n * The jsx elements to track for this pattern. Can be string or Regexp.\n *\n * @default capitalize(pattern.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<CssProperty>[]\n}\n"
|
|
3520
|
+
content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport interface PatternHelpers {\n map: (value: any, fn: (value: string) => string | undefined) => any\n isCssUnit: (value: any) => boolean\n isCssVar: (value: any) => boolean\n isCssFunction: (value: any) => boolean\n}\n\nexport interface PatternProperties {\n [key: string]: PatternProperty\n}\n\ntype InferProps<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternDefaultValue<T> = Partial<InferProps<T>>\n\nexport type PatternDefaultValueFn<T> = (props: InferProps<T>) => PatternDefaultValue<T>\n\nexport interface PatternConfig<T extends PatternProperties = PatternProperties> {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties?: T\n /**\n * The default values of the pattern.\n */\n defaultValues?: PatternDefaultValue<T> | PatternDefaultValueFn<T>\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: InferProps<T>, helpers: PatternHelpers) => SystemStyleObject\n /**\n * Whether the pattern is deprecated.\n */\n deprecated?: boolean | string\n /**\n * The jsx element name this pattern will generate.\n */\n jsxName?: string\n /**\n * The jsx elements to track for this pattern. Can be string or Regexp.\n *\n * @default capitalize(pattern.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<CssProperty>[]\n}\n"
|
|
3521
3521
|
};
|
|
3522
3522
|
|
|
3523
3523
|
// src/artifacts/generated/recipe.d.ts.json
|
|
3524
3524
|
var recipe_d_ts_default = {
|
|
3525
|
-
content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends 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 getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The class 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 * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends 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>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\n /**\n * An optional class name that can be used to target slots in the DOM.\n */\n className?: string\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<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"
|
|
3525
|
+
content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends 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 getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantRecord> {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * Whether the recipe is deprecated.\n */\n deprecated?: boolean | string\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The class 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 * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends 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>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\n /**\n * An optional class name that can be used to target slots in the DOM.\n */\n className?: string\n /**\n * Whether the recipe is deprecated.\n */\n deprecated?: boolean | string\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<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"
|
|
3526
3526
|
};
|
|
3527
3527
|
|
|
3528
3528
|
// src/artifacts/generated/selectors.d.ts.json
|
|
@@ -3719,7 +3719,10 @@ function generateStyleProps(ctx) {
|
|
|
3719
3719
|
if (!filtered.length) {
|
|
3720
3720
|
filtered.push("string | number");
|
|
3721
3721
|
}
|
|
3722
|
-
|
|
3722
|
+
let comment = csstype_d_ts_default.comments?.[prop] || "";
|
|
3723
|
+
if (ctx.utility.isDeprecated(prop)) {
|
|
3724
|
+
comment = comment ? comment.replace("@see", "@deprecated\n@see") : "/** @deprecated */";
|
|
3725
|
+
}
|
|
3723
3726
|
const value = filtered.filter(Boolean).join(" | ");
|
|
3724
3727
|
const line = `${key}?: ${restrict(prop, value, ctx.config)}`;
|
|
3725
3728
|
return " " + [comment, line].filter(Boolean).join("\n");
|
package/dist/index.mjs
CHANGED
|
@@ -508,7 +508,7 @@ function generatePattern(ctx, filters) {
|
|
|
508
508
|
const details = ctx.patterns.filterDetails(filters);
|
|
509
509
|
return details.map((pattern) => {
|
|
510
510
|
const { baseName, config, dashName, upperName, styleFnName, blocklistType } = pattern;
|
|
511
|
-
const { properties, transform, strict, description, defaultValues } = config;
|
|
511
|
+
const { properties, transform, strict, description, defaultValues, deprecated } = config;
|
|
512
512
|
const patternConfigFn = stringify(compact({ transform, defaultValues })) ?? "";
|
|
513
513
|
const helperImports = ["getPatternStyles, patternFns"];
|
|
514
514
|
if (patternConfigFn.includes("__spreadValues")) {
|
|
@@ -553,7 +553,7 @@ function generatePattern(ctx, filters) {
|
|
|
553
553
|
raw: (styles?: ${upperName}Styles) => SystemStyleObject
|
|
554
554
|
}
|
|
555
555
|
|
|
556
|
-
${description
|
|
556
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
557
557
|
export declare const ${baseName}: ${upperName}PatternFn;
|
|
558
558
|
`}
|
|
559
559
|
|
|
@@ -686,7 +686,7 @@ function generateRecipes(ctx, filters) {
|
|
|
686
686
|
const details = ctx.recipes.filterDetails(filters);
|
|
687
687
|
return details.map((recipe) => {
|
|
688
688
|
const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
|
|
689
|
-
const { description, defaultVariants, compoundVariants } = config;
|
|
689
|
+
const { description, defaultVariants, compoundVariants, deprecated } = config;
|
|
690
690
|
const jsCode = match4(config).when(
|
|
691
691
|
Recipes.isSlotRecipeConfig,
|
|
692
692
|
(config2) => outdent11`
|
|
@@ -782,7 +782,7 @@ function generateRecipes(ctx, filters) {
|
|
|
782
782
|
getVariantProps: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
783
783
|
}
|
|
784
784
|
|
|
785
|
-
${description
|
|
785
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
786
786
|
export declare const ${baseName}: ${upperName}Recipe
|
|
787
787
|
`
|
|
788
788
|
};
|
|
@@ -986,7 +986,7 @@ function generatePreactJsxPattern(ctx, filters) {
|
|
|
986
986
|
const details = ctx.patterns.filterDetails(filters);
|
|
987
987
|
return details.map((pattern) => {
|
|
988
988
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
989
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
989
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
990
990
|
return {
|
|
991
991
|
name: dashName,
|
|
992
992
|
js: outdent15`
|
|
@@ -1040,7 +1040,7 @@ function generatePreactJsxPattern(ctx, filters) {
|
|
|
1040
1040
|
|
|
1041
1041
|
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1042
1042
|
|
|
1043
|
-
${description
|
|
1043
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
1044
1044
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1045
1045
|
`
|
|
1046
1046
|
};
|
|
@@ -1314,7 +1314,7 @@ function generateQwikJsxPattern(ctx, filters) {
|
|
|
1314
1314
|
const details = ctx.patterns.filterDetails(filters);
|
|
1315
1315
|
return details.map((pattern) => {
|
|
1316
1316
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
1317
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
1317
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
1318
1318
|
return {
|
|
1319
1319
|
name: dashName,
|
|
1320
1320
|
js: outdent20`
|
|
@@ -1367,7 +1367,7 @@ function generateQwikJsxPattern(ctx, filters) {
|
|
|
1367
1367
|
|
|
1368
1368
|
export interface ${upperName}Props extends Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>> {}
|
|
1369
1369
|
|
|
1370
|
-
${description
|
|
1370
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
1371
1371
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
1372
1372
|
`
|
|
1373
1373
|
};
|
|
@@ -1648,7 +1648,7 @@ function generateReactJsxPattern(ctx, filters) {
|
|
|
1648
1648
|
const details = ctx.patterns.filterDetails(filters);
|
|
1649
1649
|
return details.map((pattern) => {
|
|
1650
1650
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
1651
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
1651
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
1652
1652
|
return {
|
|
1653
1653
|
name: dashName,
|
|
1654
1654
|
js: outdent25`
|
|
@@ -1701,7 +1701,7 @@ function generateReactJsxPattern(ctx, filters) {
|
|
|
1701
1701
|
|
|
1702
1702
|
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1703
1703
|
|
|
1704
|
-
${description
|
|
1704
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
1705
1705
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1706
1706
|
`
|
|
1707
1707
|
};
|
|
@@ -2025,7 +2025,7 @@ function generateSolidJsxPattern(ctx, filters) {
|
|
|
2025
2025
|
const details = ctx.patterns.filterDetails(filters);
|
|
2026
2026
|
return details.map((pattern) => {
|
|
2027
2027
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
2028
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
2028
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
2029
2029
|
return {
|
|
2030
2030
|
name: dashName,
|
|
2031
2031
|
js: outdent30`
|
|
@@ -2080,7 +2080,7 @@ function generateSolidJsxPattern(ctx, filters) {
|
|
|
2080
2080
|
|
|
2081
2081
|
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2082
2082
|
|
|
2083
|
-
${description
|
|
2083
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
2084
2084
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
2085
2085
|
`
|
|
2086
2086
|
};
|
|
@@ -2480,7 +2480,7 @@ function generateVueJsxPattern(ctx, filters) {
|
|
|
2480
2480
|
const details = ctx.patterns.filterDetails(filters);
|
|
2481
2481
|
return details.map((pattern) => {
|
|
2482
2482
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
2483
|
-
const { description, jsxElement = "div" } = pattern.config;
|
|
2483
|
+
const { description, jsxElement = "div", deprecated } = pattern.config;
|
|
2484
2484
|
return {
|
|
2485
2485
|
name: dashName,
|
|
2486
2486
|
js: outdent36`
|
|
@@ -2541,7 +2541,7 @@ function generateVueJsxPattern(ctx, filters) {
|
|
|
2541
2541
|
|
|
2542
2542
|
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2543
2543
|
|
|
2544
|
-
${description
|
|
2544
|
+
${ctx.file.jsDocComment(description, { deprecated })}
|
|
2545
2545
|
export declare const ${jsxName}: FunctionalComponent<${upperName}Props>
|
|
2546
2546
|
`
|
|
2547
2547
|
};
|
|
@@ -3481,12 +3481,12 @@ var parts_d_ts_default = {
|
|
|
3481
3481
|
|
|
3482
3482
|
// src/artifacts/generated/pattern.d.ts.json
|
|
3483
3483
|
var pattern_d_ts_default = {
|
|
3484
|
-
content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport interface PatternHelpers {\n map: (value: any, fn: (value: string) => string | undefined) => any\n isCssUnit: (value: any) => boolean\n isCssVar: (value: any) => boolean\n isCssFunction: (value: any) => boolean\n}\n\nexport interface PatternProperties {\n [key: string]: PatternProperty\n}\n\ntype InferProps<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternDefaultValue<T> = Partial<InferProps<T>>\n\nexport type PatternDefaultValueFn<T> = (props: InferProps<T>) => PatternDefaultValue<T>\n\nexport interface PatternConfig<T extends PatternProperties = PatternProperties> {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties?: T\n /**\n * The default values of the pattern.\n */\n defaultValues?: PatternDefaultValue<T> | PatternDefaultValueFn<T>\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: InferProps<T>, helpers: PatternHelpers) => SystemStyleObject\n /**\n * The jsx element name this pattern will generate.\n */\n jsxName?: string\n /**\n * The jsx elements to track for this pattern. Can be string or Regexp.\n *\n * @default capitalize(pattern.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<CssProperty>[]\n}\n"
|
|
3484
|
+
content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport interface PatternHelpers {\n map: (value: any, fn: (value: string) => string | undefined) => any\n isCssUnit: (value: any) => boolean\n isCssVar: (value: any) => boolean\n isCssFunction: (value: any) => boolean\n}\n\nexport interface PatternProperties {\n [key: string]: PatternProperty\n}\n\ntype InferProps<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternDefaultValue<T> = Partial<InferProps<T>>\n\nexport type PatternDefaultValueFn<T> = (props: InferProps<T>) => PatternDefaultValue<T>\n\nexport interface PatternConfig<T extends PatternProperties = PatternProperties> {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties?: T\n /**\n * The default values of the pattern.\n */\n defaultValues?: PatternDefaultValue<T> | PatternDefaultValueFn<T>\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: InferProps<T>, helpers: PatternHelpers) => SystemStyleObject\n /**\n * Whether the pattern is deprecated.\n */\n deprecated?: boolean | string\n /**\n * The jsx element name this pattern will generate.\n */\n jsxName?: string\n /**\n * The jsx elements to track for this pattern. Can be string or Regexp.\n *\n * @default capitalize(pattern.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<CssProperty>[]\n}\n"
|
|
3485
3485
|
};
|
|
3486
3486
|
|
|
3487
3487
|
// src/artifacts/generated/recipe.d.ts.json
|
|
3488
3488
|
var recipe_d_ts_default = {
|
|
3489
|
-
content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends 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 getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The class 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 * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends 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>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\n /**\n * An optional class name that can be used to target slots in the DOM.\n */\n className?: string\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<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"
|
|
3489
|
+
content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends 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 getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = RecipeVariantRecord> {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * Whether the recipe is deprecated.\n */\n deprecated?: boolean | string\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The class 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 * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends 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>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n getVariantProps: (props?: RecipeSelection<T>) => RecipeSelection<T>\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\n /**\n * An optional class name that can be used to target slots in the DOM.\n */\n className?: string\n /**\n * Whether the recipe is deprecated.\n */\n deprecated?: boolean | string\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<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"
|
|
3490
3490
|
};
|
|
3491
3491
|
|
|
3492
3492
|
// src/artifacts/generated/selectors.d.ts.json
|
|
@@ -3683,7 +3683,10 @@ function generateStyleProps(ctx) {
|
|
|
3683
3683
|
if (!filtered.length) {
|
|
3684
3684
|
filtered.push("string | number");
|
|
3685
3685
|
}
|
|
3686
|
-
|
|
3686
|
+
let comment = csstype_d_ts_default.comments?.[prop] || "";
|
|
3687
|
+
if (ctx.utility.isDeprecated(prop)) {
|
|
3688
|
+
comment = comment ? comment.replace("@see", "@deprecated\n@see") : "/** @deprecated */";
|
|
3689
|
+
}
|
|
3687
3690
|
const value = filtered.filter(Boolean).join(" | ");
|
|
3688
3691
|
const line = `${key}?: ${restrict(prop, value, ctx.config)}`;
|
|
3689
3692
|
return " " + [comment, line].filter(Boolean).join("\n");
|
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-20240409220115",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"pluralize": "8.0.0",
|
|
38
38
|
"postcss": "8.4.35",
|
|
39
39
|
"ts-pattern": "5.0.8",
|
|
40
|
-
"@pandacss/core": "0.0.0-dev-
|
|
41
|
-
"@pandacss/is-valid-prop": "^0.0.0-dev-
|
|
42
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
43
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
44
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
45
|
-
"@pandacss/types": "0.0.0-dev-
|
|
40
|
+
"@pandacss/core": "0.0.0-dev-20240409220115",
|
|
41
|
+
"@pandacss/is-valid-prop": "^0.0.0-dev-20240409220115",
|
|
42
|
+
"@pandacss/logger": "0.0.0-dev-20240409220115",
|
|
43
|
+
"@pandacss/shared": "0.0.0-dev-20240409220115",
|
|
44
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20240409220115",
|
|
45
|
+
"@pandacss/types": "0.0.0-dev-20240409220115"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/pluralize": "0.0.33"
|