/** * Call-site class value — mirrors Svelte 5's `ClassValue` (clsx shape): * strings, nested arrays, `{ class: condition }` records, falsy values * (dropped). Accepted by `cx()` and every `class` input (component props, * slot-function overrides). Config-side values (variants, compound classes) * deliberately do NOT take the record form — there an object is a slot map. */ type ClassInput = string | number | ClassInput[] | Record | undefined | null | false; type VariantPropType = V extends Record ? 'true' extends Extract ? boolean | Exclude, 'true' | 'false'> : Extract : never; type VariantPropsMap>> = { [K in keyof V]?: VariantPropType; }; type SlotFn>> = (props?: VariantPropsMap & { class?: ClassInput; }) => string; /** Per-slot class map used config-side (variant values, compound classes). */ type SlotClassMap = { [K in keyof S]?: string | string[]; }; /** * Validation companion for slot-mode `variants`: intersecting the inferred * `V` with this mapped type turns every slot-map key that is not a declared * slot into an assignability error AT that key — the compiler catches * `wrapeer` typos that structural checking alone would let through. */ type ValidSlotVariants = { [A in keyof V]: { [Q in keyof V[A]]: V[A][Q] extends string | readonly string[] ? unknown : { [K in keyof V[A][Q]]: K extends keyof S ? unknown : ['unknown slot', K]; }; }; }; type CompoundVariant>> = { [K in keyof V]?: VariantPropType | VariantPropType[]; } & { class?: string | string[]; }; type SlotCompoundVariant>, S> = { [K in keyof V]?: VariantPropType | VariantPropType[]; } & { class?: string | string[] | SlotClassMap; }; export type TVProps>> = VariantPropsMap & { class?: ClassInput; }; export type VariantProps unknown> = Omit[0], undefined>, 'class'>; /** * Extracts the slot-name union from a slotted `tv()` config function — the * companion to {@link VariantProps}. The slot-mode overload returns * `(props?) => { [K in keyof S]: SlotFn }`, so `keyof ReturnType` is exactly * the set of slot names a component declares in `tv({ slots: … })`. * * Use it to type a component's `slotClasses` prop from the single source of * truth (its `*.variants.ts`) instead of hand-maintaining a parallel union * that silently drifts when a slot is added or renamed: * * @example * // button.variants.ts * export type ButtonSlots = SlotNames; // 'base' | 'content' | 'spinner' * // index.ts * slotClasses?: Partial>; */ export type SlotNames unknown> = keyof ReturnType & string; /** * Concatenate class inputs into a single string. Accepts strings, nested * arrays, `{ class: condition }` records (Svelte 5 `ClassValue` / clsx * shape — keys with truthy values are included) and falsy values (filtered * out). Trims and joins with single spaces. * * Note: `cx()` does **not** deduplicate — `cx('foo', 'foo bar')` returns * `'foo foo bar'`. Duplicate Tailwind classes are harmless at runtime * (CSS ignores them), but DOM output is longer than after a `twMerge` * pass. See `docs/ARCHITECTURE.md` "tv() engine — explicit trade-offs". */ export declare function cx(...inputs: ClassInput[]): string; /** * Merge class strings with the same Tailwind conflict resolution `tv()` * applies between stages: a later source's classes strip any earlier class * that shares their conflict bucket, so the last source wins per bucket. * Within a single source, order is preserved and conflicts fall through to * the CSS cascade. Falsy / empty sources are skipped. * * Reuses `tokenize` + `stripConflicts`. Powers the BlocksProvider slot-class * cascade (`resolveSlotClasses`) so a conditional `overrides` entry * deterministically defeats an unconditional `slotClasses` entry in the same * bucket — instead of emitting both and leaving the winner to stylesheet * order. */ export declare function resolveClassChain(...sources: (string | null | undefined)[]): string; export declare function matchesCompound(compound: Record, effectiveProps: Record): boolean; /** * Config record exposed on every resolver as `.config` (tooling/linting). * Read-only by convention: it is the live config object — mutating it after * init bypasses validateTvConfig. Tools must treat it as immutable. */ export type TVConfig = { readonly base?: string | string[]; readonly slots?: Record; readonly variants?: Record>; readonly compoundVariants?: Record[]; readonly defaultVariants?: Record; }; export declare function tv> = {}>(config: { base?: string | string[]; variants?: V; compoundVariants?: CompoundVariant[]; defaultVariants?: VariantPropsMap; }): ((props?: TVProps) => string) & { readonly config: TVConfig; }; export declare function tv> = {}, S extends Record = Record>(config: { slots: S; variants?: V & ValidSlotVariants; compoundVariants?: SlotCompoundVariant[]; defaultVariants?: VariantPropsMap; }): ((props?: VariantPropsMap) => { [K in keyof S]: SlotFn; }) & { readonly config: TVConfig; }; export {};