@pandacss/generator 0.11.1 → 0.12.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.js CHANGED
@@ -974,8 +974,9 @@ function generatePattern(ctx) {
974
974
  name: dashName,
975
975
  dts: import_outdent10.outdent`
976
976
  import type { SystemStyleObject, ConditionalValue } from '../types'
977
- import type { PropertyValue } from '../types/prop-type'
978
977
  import type { Properties } from '../types/csstype'
978
+ import type { PropertyValue } from '../types/prop-type'
979
+ import type { DistributiveOmit } from '../types/system-types'
979
980
  import type { Tokens } from '../tokens'
980
981
 
981
982
  export type ${upperName}Properties = {
@@ -996,13 +997,13 @@ function generatePattern(ctx) {
996
997
  }).join("\n ")}
997
998
  }
998
999
 
999
- ${strict ? import_outdent10.outdent`export declare function ${baseName}(options: ${upperName}Properties): string` : import_outdent10.outdent`
1000
+ ${strict ? import_outdent10.outdent`export declare function ${baseName}(styles: ${upperName}Properties): string` : import_outdent10.outdent`
1000
1001
 
1001
- type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
1002
+ type ${upperName}Styles = ${upperName}Properties & DistributiveOmit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
1002
1003
 
1003
1004
  interface ${upperName}PatternFn {
1004
- (options?: ${upperName}Options): string
1005
- raw: (options: ${upperName}Options) => ${upperName}Options
1005
+ (styles?: ${upperName}Styles): string
1006
+ raw: (styles: ${upperName}Styles) => ${upperName}Styles
1006
1007
  }
1007
1008
 
1008
1009
  ${description ? `/** ${description} */` : ""}
@@ -1145,6 +1146,7 @@ function generateRecipes(ctx) {
1145
1146
  dts: import_outdent11.outdent`
1146
1147
  import type { ConditionalValue } from '../types'
1147
1148
  import type { Pretty } from '../types/helpers'
1149
+ import type { DistributiveOmit } from '../types/system-types'
1148
1150
 
1149
1151
  type ${upperName}Variant = {
1150
1152
  ${Object.keys(variantKeyMap).map((key) => {
@@ -1169,7 +1171,7 @@ function generateRecipes(ctx) {
1169
1171
  raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
1170
1172
  variantMap: ${upperName}VariantMap
1171
1173
  variantKeys: Array<keyof ${upperName}Variant>
1172
- splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<Omit<Props, keyof ${upperName}VariantProps>>]
1174
+ splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<DistributiveOmit<Props, keyof ${upperName}VariantProps>>]
1173
1175
  }
1174
1176
 
1175
1177
  ${description ? `/** ${description} */` : ""}
@@ -1359,8 +1361,9 @@ function generatePreactJsxPattern(ctx) {
1359
1361
  import type { FunctionComponent } from 'preact'
1360
1362
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1361
1363
  import type { ${typeName} } from '../types/jsx'
1364
+ import type { DistributiveOmit } from '../types/system-types'
1362
1365
 
1363
- export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1366
+ export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1364
1367
 
1365
1368
  ${description ? `/** ${description} */` : ""}
1366
1369
  export declare const ${jsxName}: FunctionComponent<${upperName}Props>
@@ -1596,18 +1599,15 @@ function generateQwikJsxPattern(ctx) {
1596
1599
  }
1597
1600
  `,
1598
1601
  dts: import_outdent20.outdent`
1599
- import type { FunctionComponent } from '@builder.io/qwik'
1602
+ import type { Component } from '@builder.io/qwik'
1600
1603
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1601
1604
  import type { ${typeName} } from '../types/jsx'
1602
-
1603
- type Assign<T, U> = {
1604
- [K in keyof T]?: K extends keyof T ? (K extends keyof U ? T[K] & U[K] : T[K]) : never
1605
- } & U
1605
+ import type { Assign, DistributiveOmit } from '../types/system-types'
1606
1606
 
1607
- export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, Omit<${upperName}Properties, ${blocklistType || '""'}>>
1607
+ export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>>
1608
1608
 
1609
1609
  ${description ? `/** ${description} */` : ""}
1610
- export declare const ${jsxName}: FunctionComponent<${upperName}Props>
1610
+ export declare const ${jsxName}: Component<${upperName}Props>
1611
1611
  `
1612
1612
  };
1613
1613
  });
@@ -1623,37 +1623,21 @@ import { ${upperName} } from '../types/jsx'
1623
1623
  export declare const ${factoryName}: ${upperName}
1624
1624
  `,
1625
1625
  jsxType: import_outdent21.outdent`
1626
- import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
1627
- import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
1626
+ import type { Component, QwikIntrinsicElements } from '@builder.io/qwik'
1627
+ import type { Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
1628
1628
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
1629
1629
 
1630
- type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
1630
+ type ElementType = keyof QwikIntrinsicElements | Component<any>
1631
1631
 
1632
1632
  type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
1633
1633
  ? QwikIntrinsicElements[T]
1634
- : T extends FunctionComponent<infer P>
1634
+ : T extends Component<infer P>
1635
1635
  ? P
1636
1636
  : never
1637
1637
 
1638
1638
  type Dict = Record<string, unknown>
1639
1639
 
1640
- type Omitted = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'
1641
-
1642
- // Patch due to Omit<T, K> not working with Qwik JSX Types
1643
-
1644
- type Assign<T, U> = {
1645
- [K in keyof T]?: K extends Omitted
1646
- ? K extends keyof U
1647
- ? U[K]
1648
- : never
1649
- : K extends keyof T
1650
- ? K extends keyof U
1651
- ? T[K] & U[K]
1652
- : T[K]
1653
- : never
1654
- } & U & PatchedHTMLProps
1655
-
1656
- export type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionComponent<Assign<ComponentProps<T>, _Assign<JsxStyleProps, P>>>
1640
+ export type ${componentName}<T extends ElementType, P extends Dict = {}> = Component<Assign<ComponentProps<T> & PatchedHTMLProps, Assign<JsxStyleProps, P>>>
1657
1641
 
1658
1642
  type RecipeFn = { __type: any }
1659
1643
 
@@ -1734,13 +1718,13 @@ import { ${upperName} } from '../types/jsx'
1734
1718
  export declare const ${factoryName}: ${upperName}
1735
1719
  `,
1736
1720
  jsxType: import_outdent23.outdent`
1737
- import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
1721
+ import type { Component, QwikIntrinsicElements } from '@builder.io/qwik'
1738
1722
 
1739
- type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
1723
+ type ElementType = keyof QwikIntrinsicElements | Component<any>
1740
1724
 
1741
1725
  type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
1742
1726
  ? QwikIntrinsicElements[T]
1743
- : T extends FunctionComponent<infer P>
1727
+ : T extends Component<infer P>
1744
1728
  ? P
1745
1729
  : never
1746
1730
 
@@ -1903,8 +1887,9 @@ function generateReactJsxPattern(ctx) {
1903
1887
  import type { FunctionComponent } from 'react'
1904
1888
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1905
1889
  import type { ${typeName} } from '../types/jsx'
1890
+ import type { DistributiveOmit } from '../types/system-types'
1906
1891
 
1907
- export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1892
+ export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1908
1893
 
1909
1894
  ${description ? `/** ${description} */` : ""}
1910
1895
  export declare const ${jsxName}: FunctionComponent<${upperName}Props>
@@ -1924,12 +1909,12 @@ export declare const ${factoryName}: ${upperName}
1924
1909
  `,
1925
1910
  jsxType: import_outdent26.outdent`
1926
1911
  import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
1927
- import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1912
+ import type { Assign, DistributiveOmit, JsxStyleProps, JsxHTMLProps } from './system-types'
1928
1913
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
1929
1914
 
1930
1915
  type Dict = Record<string, unknown>
1931
1916
 
1932
- type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
1917
+ type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
1933
1918
  ref?: Ref<ElementRef<T>>
1934
1919
  }
1935
1920
 
@@ -2019,10 +2004,11 @@ export declare const ${factoryName}: ${upperName}
2019
2004
  `,
2020
2005
  jsxType: import_outdent28.outdent`
2021
2006
  import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
2007
+ import type { DistributiveOmit } from '../types/system-types'
2022
2008
 
2023
2009
  type Dict = Record<string, unknown>
2024
2010
 
2025
- type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
2011
+ type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
2026
2012
  ref?: Ref<ElementRef<T>>
2027
2013
  }
2028
2014
 
@@ -2058,7 +2044,7 @@ function generateSolidJsxFactory(ctx) {
2058
2044
  ${ctx.file.import("allCssProperties", "./is-valid-prop")}
2059
2045
 
2060
2046
  function styledFn(element, configOrCva = {}) {
2061
- const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
2047
+ const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
2062
2048
 
2063
2049
  return function ${componentName}(props) {
2064
2050
  const mergedProps = mergeProps({ as: element }, props)
@@ -2161,8 +2147,9 @@ function generateSolidJsxPattern(ctx) {
2161
2147
  import { Component } from 'solid-js'
2162
2148
  import { ${upperName}Properties } from '../patterns/${dashName}'
2163
2149
  import { ${typeName} } from '../types/jsx'
2150
+ import { DistributiveOmit } from '../types/system-types'
2164
2151
 
2165
- export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2152
+ export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2166
2153
 
2167
2154
  ${description ? `/** ${description} */` : ""}
2168
2155
  export declare const ${jsxName}: Component<${upperName}Props>
@@ -2468,8 +2455,9 @@ function generateVueJsxPattern(ctx) {
2468
2455
  import { FunctionalComponent } from 'vue'
2469
2456
  import { ${upperName}Properties } from '../patterns/${dashName}'
2470
2457
  import { ${typeName} } from '../types/jsx'
2458
+ import { DistributiveOmit } from '../types/system-types'
2471
2459
 
2472
- export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2460
+ export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2473
2461
 
2474
2462
  ${description ? `/** ${description} */` : ""}
2475
2463
  export declare const ${jsxName}: FunctionalComponent<${upperName}Props>
@@ -2906,7 +2894,7 @@ var csstype_d_ts_default = {
2906
2894
 
2907
2895
  // src/artifacts/generated/system-types.d.ts.json
2908
2896
  var system_types_d_ts_default = {
2909
- content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ntype WithCss = { css?: SystemStyleObject }\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport type Assign<T, U> = Omit<T, keyof U> & U\n\nexport type PatchedHTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'\n\ntype WithHTMLProps<T> = Omit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
2897
+ content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ntype WithCss = { css?: SystemStyleObject }\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\nexport type PatchedHTMLProps = {\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
2910
2898
  };
2911
2899
 
2912
2900
  // src/artifacts/generated/composition.d.ts.json
@@ -2916,7 +2904,7 @@ var composition_d_ts_default = {
2916
2904
 
2917
2905
  // src/artifacts/generated/recipe.d.ts.json
2918
2906
  var recipe_d_ts_default = {
2919
- content: "import type { SystemStyleObject } 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 resolve: (props: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<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"
2907
+ 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 resolve: (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"
2920
2908
  };
2921
2909
 
2922
2910
  // src/artifacts/generated/pattern.d.ts.json
@@ -3071,7 +3059,10 @@ var categories = [
3071
3059
  "assets"
3072
3060
  ];
3073
3061
  function generateTokenTypes(ctx) {
3074
- const { tokens } = ctx;
3062
+ const {
3063
+ tokens,
3064
+ config: { theme }
3065
+ } = ctx;
3075
3066
  const set = /* @__PURE__ */ new Set();
3076
3067
  set.add(`export type Token = ${tokens.isEmpty ? "string" : (0, import_shared3.unionType)(tokens.allNames)}`);
3077
3068
  const result = /* @__PURE__ */ new Set(["export type Tokens = {"]);
@@ -3087,6 +3078,9 @@ function generateTokenTypes(ctx) {
3087
3078
  set.add(`export type ${typeName}Token = ${(0, import_shared3.unionType)(value.keys())}`);
3088
3079
  result.add(` ${key}: ${typeName}Token`);
3089
3080
  }
3081
+ const keyframes = Object.keys(theme?.keyframes ?? {});
3082
+ set.add(`export type AnimationName = ${(0, import_shared3.unionType)(keyframes)}`);
3083
+ result.add(` animationName: AnimationName`);
3090
3084
  }
3091
3085
  result.add("} & { [token: string]: never }");
3092
3086
  set.add(Array.from(result).join("\n"));
package/dist/index.mjs CHANGED
@@ -943,8 +943,9 @@ function generatePattern(ctx) {
943
943
  name: dashName,
944
944
  dts: outdent10`
945
945
  import type { SystemStyleObject, ConditionalValue } from '../types'
946
- import type { PropertyValue } from '../types/prop-type'
947
946
  import type { Properties } from '../types/csstype'
947
+ import type { PropertyValue } from '../types/prop-type'
948
+ import type { DistributiveOmit } from '../types/system-types'
948
949
  import type { Tokens } from '../tokens'
949
950
 
950
951
  export type ${upperName}Properties = {
@@ -965,13 +966,13 @@ function generatePattern(ctx) {
965
966
  }).join("\n ")}
966
967
  }
967
968
 
968
- ${strict ? outdent10`export declare function ${baseName}(options: ${upperName}Properties): string` : outdent10`
969
+ ${strict ? outdent10`export declare function ${baseName}(styles: ${upperName}Properties): string` : outdent10`
969
970
 
970
- type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
971
+ type ${upperName}Styles = ${upperName}Properties & DistributiveOmit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
971
972
 
972
973
  interface ${upperName}PatternFn {
973
- (options?: ${upperName}Options): string
974
- raw: (options: ${upperName}Options) => ${upperName}Options
974
+ (styles?: ${upperName}Styles): string
975
+ raw: (styles: ${upperName}Styles) => ${upperName}Styles
975
976
  }
976
977
 
977
978
  ${description ? `/** ${description} */` : ""}
@@ -1114,6 +1115,7 @@ function generateRecipes(ctx) {
1114
1115
  dts: outdent11`
1115
1116
  import type { ConditionalValue } from '../types'
1116
1117
  import type { Pretty } from '../types/helpers'
1118
+ import type { DistributiveOmit } from '../types/system-types'
1117
1119
 
1118
1120
  type ${upperName}Variant = {
1119
1121
  ${Object.keys(variantKeyMap).map((key) => {
@@ -1138,7 +1140,7 @@ function generateRecipes(ctx) {
1138
1140
  raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
1139
1141
  variantMap: ${upperName}VariantMap
1140
1142
  variantKeys: Array<keyof ${upperName}Variant>
1141
- splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<Omit<Props, keyof ${upperName}VariantProps>>]
1143
+ splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<DistributiveOmit<Props, keyof ${upperName}VariantProps>>]
1142
1144
  }
1143
1145
 
1144
1146
  ${description ? `/** ${description} */` : ""}
@@ -1328,8 +1330,9 @@ function generatePreactJsxPattern(ctx) {
1328
1330
  import type { FunctionComponent } from 'preact'
1329
1331
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1330
1332
  import type { ${typeName} } from '../types/jsx'
1333
+ import type { DistributiveOmit } from '../types/system-types'
1331
1334
 
1332
- export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1335
+ export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1333
1336
 
1334
1337
  ${description ? `/** ${description} */` : ""}
1335
1338
  export declare const ${jsxName}: FunctionComponent<${upperName}Props>
@@ -1565,18 +1568,15 @@ function generateQwikJsxPattern(ctx) {
1565
1568
  }
1566
1569
  `,
1567
1570
  dts: outdent20`
1568
- import type { FunctionComponent } from '@builder.io/qwik'
1571
+ import type { Component } from '@builder.io/qwik'
1569
1572
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1570
1573
  import type { ${typeName} } from '../types/jsx'
1571
-
1572
- type Assign<T, U> = {
1573
- [K in keyof T]?: K extends keyof T ? (K extends keyof U ? T[K] & U[K] : T[K]) : never
1574
- } & U
1574
+ import type { Assign, DistributiveOmit } from '../types/system-types'
1575
1575
 
1576
- export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, Omit<${upperName}Properties, ${blocklistType || '""'}>>
1576
+ export type ${upperName}Props = Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>>
1577
1577
 
1578
1578
  ${description ? `/** ${description} */` : ""}
1579
- export declare const ${jsxName}: FunctionComponent<${upperName}Props>
1579
+ export declare const ${jsxName}: Component<${upperName}Props>
1580
1580
  `
1581
1581
  };
1582
1582
  });
@@ -1592,37 +1592,21 @@ import { ${upperName} } from '../types/jsx'
1592
1592
  export declare const ${factoryName}: ${upperName}
1593
1593
  `,
1594
1594
  jsxType: outdent21`
1595
- import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
1596
- import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
1595
+ import type { Component, QwikIntrinsicElements } from '@builder.io/qwik'
1596
+ import type { Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
1597
1597
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
1598
1598
 
1599
- type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
1599
+ type ElementType = keyof QwikIntrinsicElements | Component<any>
1600
1600
 
1601
1601
  type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
1602
1602
  ? QwikIntrinsicElements[T]
1603
- : T extends FunctionComponent<infer P>
1603
+ : T extends Component<infer P>
1604
1604
  ? P
1605
1605
  : never
1606
1606
 
1607
1607
  type Dict = Record<string, unknown>
1608
1608
 
1609
- type Omitted = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'
1610
-
1611
- // Patch due to Omit<T, K> not working with Qwik JSX Types
1612
-
1613
- type Assign<T, U> = {
1614
- [K in keyof T]?: K extends Omitted
1615
- ? K extends keyof U
1616
- ? U[K]
1617
- : never
1618
- : K extends keyof T
1619
- ? K extends keyof U
1620
- ? T[K] & U[K]
1621
- : T[K]
1622
- : never
1623
- } & U & PatchedHTMLProps
1624
-
1625
- export type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionComponent<Assign<ComponentProps<T>, _Assign<JsxStyleProps, P>>>
1609
+ export type ${componentName}<T extends ElementType, P extends Dict = {}> = Component<Assign<ComponentProps<T> & PatchedHTMLProps, Assign<JsxStyleProps, P>>>
1626
1610
 
1627
1611
  type RecipeFn = { __type: any }
1628
1612
 
@@ -1703,13 +1687,13 @@ import { ${upperName} } from '../types/jsx'
1703
1687
  export declare const ${factoryName}: ${upperName}
1704
1688
  `,
1705
1689
  jsxType: outdent23`
1706
- import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
1690
+ import type { Component, QwikIntrinsicElements } from '@builder.io/qwik'
1707
1691
 
1708
- type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
1692
+ type ElementType = keyof QwikIntrinsicElements | Component<any>
1709
1693
 
1710
1694
  type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
1711
1695
  ? QwikIntrinsicElements[T]
1712
- : T extends FunctionComponent<infer P>
1696
+ : T extends Component<infer P>
1713
1697
  ? P
1714
1698
  : never
1715
1699
 
@@ -1872,8 +1856,9 @@ function generateReactJsxPattern(ctx) {
1872
1856
  import type { FunctionComponent } from 'react'
1873
1857
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1874
1858
  import type { ${typeName} } from '../types/jsx'
1859
+ import type { DistributiveOmit } from '../types/system-types'
1875
1860
 
1876
- export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1861
+ export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
1877
1862
 
1878
1863
  ${description ? `/** ${description} */` : ""}
1879
1864
  export declare const ${jsxName}: FunctionComponent<${upperName}Props>
@@ -1893,12 +1878,12 @@ export declare const ${factoryName}: ${upperName}
1893
1878
  `,
1894
1879
  jsxType: outdent26`
1895
1880
  import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
1896
- import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1881
+ import type { Assign, DistributiveOmit, JsxStyleProps, JsxHTMLProps } from './system-types'
1897
1882
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
1898
1883
 
1899
1884
  type Dict = Record<string, unknown>
1900
1885
 
1901
- type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
1886
+ type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
1902
1887
  ref?: Ref<ElementRef<T>>
1903
1888
  }
1904
1889
 
@@ -1988,10 +1973,11 @@ export declare const ${factoryName}: ${upperName}
1988
1973
  `,
1989
1974
  jsxType: outdent28`
1990
1975
  import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
1976
+ import type { DistributiveOmit } from '../types/system-types'
1991
1977
 
1992
1978
  type Dict = Record<string, unknown>
1993
1979
 
1994
- type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
1980
+ type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
1995
1981
  ref?: Ref<ElementRef<T>>
1996
1982
  }
1997
1983
 
@@ -2027,7 +2013,7 @@ function generateSolidJsxFactory(ctx) {
2027
2013
  ${ctx.file.import("allCssProperties", "./is-valid-prop")}
2028
2014
 
2029
2015
  function styledFn(element, configOrCva = {}) {
2030
- const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
2016
+ const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
2031
2017
 
2032
2018
  return function ${componentName}(props) {
2033
2019
  const mergedProps = mergeProps({ as: element }, props)
@@ -2130,8 +2116,9 @@ function generateSolidJsxPattern(ctx) {
2130
2116
  import { Component } from 'solid-js'
2131
2117
  import { ${upperName}Properties } from '../patterns/${dashName}'
2132
2118
  import { ${typeName} } from '../types/jsx'
2119
+ import { DistributiveOmit } from '../types/system-types'
2133
2120
 
2134
- export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2121
+ export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2135
2122
 
2136
2123
  ${description ? `/** ${description} */` : ""}
2137
2124
  export declare const ${jsxName}: Component<${upperName}Props>
@@ -2437,8 +2424,9 @@ function generateVueJsxPattern(ctx) {
2437
2424
  import { FunctionalComponent } from 'vue'
2438
2425
  import { ${upperName}Properties } from '../patterns/${dashName}'
2439
2426
  import { ${typeName} } from '../types/jsx'
2427
+ import { DistributiveOmit } from '../types/system-types'
2440
2428
 
2441
- export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2429
+ export type ${upperName}Props = ${upperName}Properties & DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
2442
2430
 
2443
2431
  ${description ? `/** ${description} */` : ""}
2444
2432
  export declare const ${jsxName}: FunctionalComponent<${upperName}Props>
@@ -2875,7 +2863,7 @@ var csstype_d_ts_default = {
2875
2863
 
2876
2864
  // src/artifacts/generated/system-types.d.ts.json
2877
2865
  var system_types_d_ts_default = {
2878
- content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ntype WithCss = { css?: SystemStyleObject }\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport type Assign<T, U> = Omit<T, keyof U> & U\n\nexport type PatchedHTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'\n\ntype WithHTMLProps<T> = Omit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
2866
+ content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ntype WithCss = { css?: SystemStyleObject }\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\nexport type PatchedHTMLProps = {\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
2879
2867
  };
2880
2868
 
2881
2869
  // src/artifacts/generated/composition.d.ts.json
@@ -2885,7 +2873,7 @@ var composition_d_ts_default = {
2885
2873
 
2886
2874
  // src/artifacts/generated/recipe.d.ts.json
2887
2875
  var recipe_d_ts_default = {
2888
- content: "import type { SystemStyleObject } 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 resolve: (props: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<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"
2876
+ 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 resolve: (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"
2889
2877
  };
2890
2878
 
2891
2879
  // src/artifacts/generated/pattern.d.ts.json
@@ -3040,7 +3028,10 @@ var categories = [
3040
3028
  "assets"
3041
3029
  ];
3042
3030
  function generateTokenTypes(ctx) {
3043
- const { tokens } = ctx;
3031
+ const {
3032
+ tokens,
3033
+ config: { theme }
3034
+ } = ctx;
3044
3035
  const set = /* @__PURE__ */ new Set();
3045
3036
  set.add(`export type Token = ${tokens.isEmpty ? "string" : unionType3(tokens.allNames)}`);
3046
3037
  const result = /* @__PURE__ */ new Set(["export type Tokens = {"]);
@@ -3056,6 +3047,9 @@ function generateTokenTypes(ctx) {
3056
3047
  set.add(`export type ${typeName}Token = ${unionType3(value.keys())}`);
3057
3048
  result.add(` ${key}: ${typeName}Token`);
3058
3049
  }
3050
+ const keyframes = Object.keys(theme?.keyframes ?? {});
3051
+ set.add(`export type AnimationName = ${unionType3(keyframes)}`);
3052
+ result.add(` animationName: AnimationName`);
3059
3053
  }
3060
3054
  result.add("} & { [token: string]: never }");
3061
3055
  set.add(Array.from(result).join("\n"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,17 +20,17 @@
20
20
  "pluralize": "8.0.0",
21
21
  "postcss": "8.4.27",
22
22
  "ts-pattern": "5.0.4",
23
- "@pandacss/core": "0.11.1",
24
- "@pandacss/is-valid-prop": "0.11.1",
25
- "@pandacss/logger": "0.11.1",
26
- "@pandacss/shared": "0.11.1",
27
- "@pandacss/token-dictionary": "0.11.1",
28
- "@pandacss/types": "0.11.1"
23
+ "@pandacss/core": "0.12.0",
24
+ "@pandacss/is-valid-prop": "0.12.0",
25
+ "@pandacss/logger": "0.12.0",
26
+ "@pandacss/shared": "0.12.0",
27
+ "@pandacss/token-dictionary": "0.12.0",
28
+ "@pandacss/types": "0.12.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.30",
32
32
  "hookable": "5.5.3",
33
- "@pandacss/fixture": "0.11.1"
33
+ "@pandacss/fixture": "0.12.0"
34
34
  },
35
35
  "scripts": {
36
36
  "prebuild": "tsx scripts/prebuild.ts",