vanilla-extract
vanilla-extract copied to clipboard
Export PatternOptions and VariantGroups types?
Could PatternOptions
and VariantGroups
be exported in @vanilla-extract/recipes
to allow creating extendable recipes?
Example:
const createRecipe = <T extends VariantGroups>(
extension: PatternOptions<T | typeof baseVariants>,
) => {
return recipe({
base: extension.base,
variants: {
...baseVariants,
...extension.variants,
},
compoundVariants: extension.compoundVariants,
defaultVariants: {
...baseDefaultVariants,
...extension.defaultVariants,
},
});
};
const button = createRecipe<typeof buttonVariants>({
variants: buttonVariants,
compoundVariants: [
// mixing variants from baseVariants and buttonVariants here
]
});
There are ways to make it work without them but at the expense of losing auto-suggestions.