import type { ClassValue, TVVariants, TVCompoundVariants, TVDefaultVariants } from 'tailwind-variants'; /** * Defines the AppConfig object based on the tailwind-variants configuration. */ export type TVConfig> = { [P in keyof T]?: { [K in keyof T[P] as K extends 'base' | 'slots' | 'variants' | 'compoundVariants' | 'defaultVariants' ? K : never]?: K extends 'base' ? ClassValue : K extends 'slots' ? { [S in keyof T[P]['slots']]?: ClassValue; } : K extends 'variants' ? TVVariants : K extends 'compoundVariants' ? TVCompoundVariants : K extends 'defaultVariants' ? TVDefaultVariants : never; }; }; /** * Utility type to flatten intersection types for better IDE hover information. * @template T The type to flatten. */ type Id = {} & { [P in keyof T]: T[P]; }; type ComponentVariants>; }> = { [K in keyof T['variants']]: keyof T['variants'][K]; }; type ComponentSlots; }> = Id<{ [K in keyof T['slots']]?: ClassValue; }>; type ComponentUI; }> = Id<{ [K in keyof Required]: (props?: Record) => string; }>; type GetComponentAppConfig = A extends Record> ? A[U][K] : {}; type ComponentAppConfig, K extends string, U extends string = 'b24ui' | 'b24ui.prose'> = A & (U extends 'b24ui.prose' ? { b24ui?: { prose?: { [k in K]?: Partial; }; }; } : { [key in Exclude]?: { [k in K]?: Partial; }; }); /** * Defines the configuration shape expected for a component. * @template T The component's theme imported from `#build/b24ui/*`. * @template A The base AppConfig type from `@nuxt/schema`. * @template K The key identifying the component (e.g., 'badge'). * @template U The top-level key in AppConfig ('b24ui'). */ export type ComponentConfig, A extends Record, K extends string, U extends 'b24ui' | 'b24ui.prose' = 'b24ui'> = { AppConfig: ComponentAppConfig; variants: ComponentVariants>; slots: ComponentSlots; b24ui: ComponentUI; }; export {};