import type { SystemStyleObject } from './system-types' type Pretty = T extends infer U ? { [K in keyof U]: U[K] } : never type StringToBoolean = T extends 'true' | 'false' ? boolean : T export type RecipeVariantRecord = Record> export type RecipeSelection = keyof any extends keyof T ? {} : { [K in keyof T]?: StringToBoolean } export type RecipeVariantFn = (props?: RecipeSelection) => string export type RecipeVariantProps> = Pretty[0]> type RecipeVariantMap = { [K in keyof T]: Array } export type RecipeRuntimeFn = RecipeVariantFn & { __type: RecipeSelection variantKeys: (keyof T)[] variantMap: RecipeVariantMap resolve: (props: RecipeSelection) => SystemStyleObject config: RecipeConfig splitVariantProps>( props: Props, ): [RecipeSelection, Pretty>] } export type RecipeCompoundSelection = { [K in keyof T]?: StringToBoolean | Array> } export type RecipeCompoundVariant = RecipeCompoundSelection & { css: SystemStyleObject } export type RecipeDefinition = { /** * The base styles of the recipe. */ base?: SystemStyleObject /** * The multi-variant styles of the recipe. */ variants?: T | RecipeVariantRecord /** * The default variants of the recipe. */ defaultVariants?: RecipeSelection /** * The styles to apply when a combination of variants is selected. */ compoundVariants?: Array> } export type RecipeCreatorFn = (config: RecipeDefinition) => RecipeRuntimeFn export type RecipeConfig = RecipeDefinition & { /** * The name of the recipe. */ name: string /** * The description of the recipe. This will be used in the JSDoc comment. */ description?: string /** * The jsx elements to track for this recipe. Can be string or Regexp. * * @default capitalize(recipe.name) * @example ['Button', 'Link', /Button$/] */ jsx?: Array }