interface ResponsiveArray extends ReadonlyArray { 0: Value; length: Length; } /** * Produces the union `1 | 2 | ... | MaxLength` for a literal `MaxLength`. */ type LengthUpTo = [unknown], Result = never> = Counter['length'] extends MaxLength ? Result | MaxLength : LengthUpTo; type ResponsiveArrayByMaxLength = ResponsiveArray, Value | null>; type ConditionalPropertyValue = { defaultClass: string | undefined; conditions: { [conditionName: string]: string; }; }; type ConditionalWithResponsiveArrayProperty = { responsiveArray: Array; values: { [valueName: string]: ConditionalPropertyValue; }; }; type ConditionalProperty = { values: { [valueName: string]: ConditionalPropertyValue; }; }; type UnconditionalProperty = { values: { [valueName: string]: { defaultClass: string; }; }; }; type ShorthandProperty = { mappings: Array; }; type SprinklesProperties = { styles: { [property: string]: ConditionalWithResponsiveArrayProperty | ConditionalProperty | ShorthandProperty | UnconditionalProperty; }; }; type ResponsiveArrayVariant = ResponsiveArrayByMaxLength; type ConditionalStyle = (Values[keyof Values]['defaultClass'] extends string ? keyof Values : never) | { [Condition in keyof Values[keyof Values]['conditions']]?: keyof Values; } | undefined; type ConditionalStyleWithResponsiveArray = ConditionalStyle | ResponsiveArrayVariant; type ChildSprinkleProps = { [Prop in keyof Sprinkles]?: Sprinkles[Prop] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray : Sprinkles[Prop] extends ConditionalProperty ? ConditionalStyle : Sprinkles[Prop] extends ShorthandProperty ? Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalWithResponsiveArrayProperty ? ConditionalStyleWithResponsiveArray : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends ConditionalProperty ? ConditionalStyle : Sprinkles[Sprinkles[Prop]['mappings'][number]] extends UnconditionalProperty ? keyof Sprinkles[Sprinkles[Prop]['mappings'][number]]['values'] | undefined : never : Sprinkles[Prop] extends UnconditionalProperty ? keyof Sprinkles[Prop]['values'] | undefined : never; }; type SprinkleProps> = Args extends [ infer L, ...infer R ] ? (L extends SprinklesProperties ? ChildSprinkleProps : never) & SprinkleProps : {}; type SprinklesFn> = ((props: SprinkleProps) => string) & { properties: Set>; }; declare const createSprinkles: >(...args: Args) => SprinklesFn; export { createSprinkles as createAtomsFn, createSprinkles };