cva 1.0.0-beta.1 → 1.0.0-beta.11
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/LICENSE +1 -1
- package/dist/config-BnHlj-cB.d.cts +129 -0
- package/dist/config-BnHlj-cB.d.mts +129 -0
- package/dist/config.cjs +235 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +2 -0
- package/dist/config.d.mts +2 -0
- package/dist/config.mjs +234 -0
- package/dist/config.mjs.map +1 -0
- package/dist/index.cjs +25 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +21 -1
- package/dist/index.mjs.map +1 -1
- package/dist/tools.cjs +63 -0
- package/dist/tools.cjs.map +1 -0
- package/dist/tools.d.cts +59 -0
- package/dist/tools.d.mts +59 -0
- package/dist/tools.mjs +62 -0
- package/dist/tools.mjs.map +1 -0
- package/dist/utils.cjs +23 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +9 -0
- package/dist/utils.d.mts +9 -0
- package/dist/utils.mjs +23 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +80 -29
- package/dist/index.d.ts +0 -66
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/src/index.ts +0 -238
package/LICENSE
CHANGED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type Uninferred<T> = [T][T extends any ? 0 : never];
|
|
3
|
+
type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
|
|
4
|
+
type InternalVariantKey = `_${string}`;
|
|
5
|
+
type InternalOnlyWarning = "cva's generic parameters are restricted to internal use only.";
|
|
6
|
+
type CVAComponentConfigBase<T extends ClassValue = ClassValue> = {
|
|
7
|
+
base?: T;
|
|
8
|
+
};
|
|
9
|
+
type CVAVariantSchema<V> = { [Variant in keyof V]?: StringToBoolean<keyof V[Variant]> | undefined; };
|
|
10
|
+
type CVACompoundVariantSchema<V> = { [Variant in keyof V]?: StringToBoolean<keyof V[Variant]> | StringToBoolean<keyof V[Variant]>[] | undefined; };
|
|
11
|
+
type CVACompoundVariants<V, T extends ClassValue> = (CVACompoundVariantSchema<V> & CVAClassProp<T>)[];
|
|
12
|
+
type CVAClassProp<T extends ClassValue = ClassValue> = {
|
|
13
|
+
class?: T;
|
|
14
|
+
className?: never;
|
|
15
|
+
} | {
|
|
16
|
+
class?: never;
|
|
17
|
+
className?: T;
|
|
18
|
+
};
|
|
19
|
+
type CVAComponentConfig<Config, Variants, ComposedSingle extends CVAComponentShape | undefined = CVAComponentShape | undefined, ComposedList extends readonly CVAComponentShape[] = readonly CVAComponentShape[], T extends ClassValue = ClassValue, Merged = Variants> = Config & {
|
|
20
|
+
composes?: ComposedSingle | readonly [...ComposedList];
|
|
21
|
+
} & (Variants extends Record<string, Record<string, T>> ? CVAComponentConfigBase<T> & {
|
|
22
|
+
variants?: Variants & {
|
|
23
|
+
__proto__?: never;
|
|
24
|
+
};
|
|
25
|
+
} : CVAComponentConfigBase<T> & {
|
|
26
|
+
variants?: never;
|
|
27
|
+
}) & ([keyof Merged] extends [never] ? {
|
|
28
|
+
compoundVariants?: never;
|
|
29
|
+
defaultVariants?: never;
|
|
30
|
+
} : {
|
|
31
|
+
compoundVariants?: CVACompoundVariants<Uninferred<Merged>, T>;
|
|
32
|
+
defaultVariants?: CVAVariantSchema<Uninferred<Merged>>;
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/config.d.ts
|
|
36
|
+
type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
|
|
37
|
+
type ClassDictionary = Record<string, any>;
|
|
38
|
+
type ClassArray = ClassValue[];
|
|
39
|
+
/**
|
|
40
|
+
* Any function usable as a `cx` concatenator.
|
|
41
|
+
*/
|
|
42
|
+
type AnyCX = (...inputs: any[]) => string;
|
|
43
|
+
type CXInputs<TCX extends AnyCX> = TCX extends ((...inputs: readonly [...infer Inputs]) => string) ? Inputs : never;
|
|
44
|
+
type CXInputElement<TCX extends AnyCX> = CXInputs<TCX>[number];
|
|
45
|
+
type CXHasSafeArity<TCX extends AnyCX> = CXInputs<TCX> extends (infer Inputs) ? Inputs extends readonly unknown[] ? Inputs extends [] ? true : [] extends Inputs ? number extends Inputs["length"] ? true : false : false : false : false;
|
|
46
|
+
type CXConstraint<TCX extends AnyCX> = false extends CXHasSafeArity<TCX> ? "cva's cx must accept zero arguments and an unbounded rest parameter." : [TCX] extends [(...inputs: (string | CXInput<TCX>)[]) => string] ? unknown : "cva's cx must accept its inferred class values and composed strings.";
|
|
47
|
+
/**
|
|
48
|
+
* The class value type a concatenator accepts, inferred from its
|
|
49
|
+
* parameters — `defineConfig` uses this to type the authoring surface
|
|
50
|
+
* (`base`, variant values, `class`/`className`) against the configured
|
|
51
|
+
* concatenator's own input grammar.
|
|
52
|
+
*/
|
|
53
|
+
type CXInput<TCX extends AnyCX> = CXInputElement<TCX> extends (infer P) ? 0 extends 1 & P ? ClassValue : [P] extends [never] ? ClassValue : [P] extends [ClassValue] ? P : [Extract<P, ClassValue>] extends [never] ? ClassValue : Extract<P, ClassValue> : ClassValue;
|
|
54
|
+
type OmitUndefined<T> = T extends undefined ? never : T;
|
|
55
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
56
|
+
type ComposedTuple<S extends CVAComponentShape | undefined, L extends readonly CVAComponentShape[]> = [S] extends [CVAComponentShape] ? [S] : L;
|
|
57
|
+
type MergedVariants<T extends readonly unknown[]> = UnionToIntersection<{ [K in keyof T]: T[K] extends {
|
|
58
|
+
config: {
|
|
59
|
+
variants?: infer V extends CVAVariantShape;
|
|
60
|
+
};
|
|
61
|
+
} ? V : never; }[number]>;
|
|
62
|
+
type RightMerge<A, B> = { [K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never; };
|
|
63
|
+
type DefaultsOf<Component> = Component extends {
|
|
64
|
+
config: {
|
|
65
|
+
defaultVariants?: infer D;
|
|
66
|
+
};
|
|
67
|
+
} ? D extends undefined ? {} : D : {};
|
|
68
|
+
type MergedDefaultVariants<T extends readonly unknown[]> = T extends readonly [infer Head, ...infer Rest] ? RightMerge<DefaultsOf<Head>, MergedDefaultVariants<Rest>> : {};
|
|
69
|
+
type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className" | InternalVariantKey>;
|
|
70
|
+
interface CX<T extends ClassValue = ClassValue> {
|
|
71
|
+
(...inputs: T[]): string;
|
|
72
|
+
}
|
|
73
|
+
type CXOptions = Parameters<CX>;
|
|
74
|
+
type CXReturn = ReturnType<CX>;
|
|
75
|
+
/**
|
|
76
|
+
* Exported so TypeScript can name this type in your generated declarations
|
|
77
|
+
* (`declaration: true`) — you shouldn't really use it directly.
|
|
78
|
+
*/
|
|
79
|
+
type CVAVariantShape = Record<string, Record<string, ClassValue>>;
|
|
80
|
+
/**
|
|
81
|
+
* Exported so TypeScript can name this type in your generated declarations
|
|
82
|
+
* (`declaration: true`) — you shouldn't really use it directly.
|
|
83
|
+
*/
|
|
84
|
+
interface CVAComponent<Config, Variants, T extends ClassValue = ClassValue> {
|
|
85
|
+
(props?: Variants extends CVAVariantShape ? CVAVariantSchema<Variants> & CVAClassProp<T> : CVAClassProp<T>): string;
|
|
86
|
+
/** @internal */
|
|
87
|
+
config: Config;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Exported so TypeScript can name this type in your generated declarations
|
|
91
|
+
* (`declaration: true`) — you shouldn't really use it directly.
|
|
92
|
+
*/
|
|
93
|
+
type CVAComponentShape = CVAComponent<any, any, any>;
|
|
94
|
+
type CVADefaultVariants<Config> = Config extends {
|
|
95
|
+
defaultVariants?: infer D;
|
|
96
|
+
} ? D : {};
|
|
97
|
+
type AllVariants<Variants, ComposedSingle extends CVAComponentShape | undefined, ComposedList extends readonly CVAComponentShape[]> = [ComposedSingle] extends [undefined] ? [ComposedList] extends [readonly []] ? Variants : Variants & MergedVariants<ComposedList> : Variants & MergedVariants<ComposedTuple<ComposedSingle, ComposedList>>;
|
|
98
|
+
interface CVA<T extends ClassValue = ClassValue> {
|
|
99
|
+
<_ extends InternalOnlyWarning, Config, Variants, ComposedSingle extends CVAComponentShape | undefined = undefined, ComposedList extends readonly CVAComponentShape[] = []>(config: CVAComponentConfig<Config, Variants, ComposedSingle, ComposedList, T, AllVariants<Variants, ComposedSingle, ComposedList>>): CVAComponent<Omit<Config, "defaultVariants"> & {
|
|
100
|
+
variants: AllVariants<Variants, ComposedSingle, ComposedList>;
|
|
101
|
+
defaultVariants: Omit<MergedDefaultVariants<ComposedTuple<ComposedSingle, ComposedList>>, keyof CVADefaultVariants<Config>> & CVADefaultVariants<Config>;
|
|
102
|
+
}, AllVariants<Variants, ComposedSingle, ComposedList>, T>;
|
|
103
|
+
}
|
|
104
|
+
interface DefineConfigOptions<TCX extends AnyCX = CX> {
|
|
105
|
+
/**
|
|
106
|
+
* The class name concatenator used by `cva` and `cx`. It owns the class
|
|
107
|
+
* name grammar entirely: cva assembles the authored values
|
|
108
|
+
* (composed component outputs, `base`, matched variant and compound
|
|
109
|
+
* variant values, `class`/`className`) and passes them through verbatim,
|
|
110
|
+
* one argument each, without interpreting them.
|
|
111
|
+
*
|
|
112
|
+
* The authoring surface adopts the concatenator's own input type
|
|
113
|
+
* automatically (see {@link CXInput}): pass `twMerge` and your variants
|
|
114
|
+
* are checked against tailwind-merge's `ClassNameValue`; pass `clsx` (or
|
|
115
|
+
* any function whose parameters don't narrow further) and you keep the
|
|
116
|
+
* full clsx-flavored `ClassValue` grammar.
|
|
117
|
+
*/
|
|
118
|
+
cx: TCX & CXConstraint<TCX>;
|
|
119
|
+
}
|
|
120
|
+
interface DefineConfig {
|
|
121
|
+
<TCX extends AnyCX>(options: DefineConfigOptions<TCX>): {
|
|
122
|
+
cx: CX<CXInput<TCX>>;
|
|
123
|
+
cva: CVA<CXInput<TCX>>;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
declare const defineConfig: DefineConfig;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { CVAComponentConfig as _, CVAVariantShape as a, StringToBoolean as b, CXOptions as c, ClassDictionary as d, ClassValue as f, defineConfig as g, VariantProps as h, CVAComponentShape as i, CXReturn as l, DefineConfigOptions as m, CVA as n, CX as o, DefineConfig as p, CVAComponent as r, CXInput as s, AnyCX as t, ClassArray as u, InternalOnlyWarning as v, InternalVariantKey as y };
|
|
129
|
+
//# sourceMappingURL=config-BnHlj-cB.d.cts.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type Uninferred<T> = [T][T extends any ? 0 : never];
|
|
3
|
+
type StringToBoolean<T> = T extends "true" | "false" ? boolean : T;
|
|
4
|
+
type InternalVariantKey = `_${string}`;
|
|
5
|
+
type InternalOnlyWarning = "cva's generic parameters are restricted to internal use only.";
|
|
6
|
+
type CVAComponentConfigBase<T extends ClassValue = ClassValue> = {
|
|
7
|
+
base?: T;
|
|
8
|
+
};
|
|
9
|
+
type CVAVariantSchema<V> = { [Variant in keyof V]?: StringToBoolean<keyof V[Variant]> | undefined; };
|
|
10
|
+
type CVACompoundVariantSchema<V> = { [Variant in keyof V]?: StringToBoolean<keyof V[Variant]> | StringToBoolean<keyof V[Variant]>[] | undefined; };
|
|
11
|
+
type CVACompoundVariants<V, T extends ClassValue> = (CVACompoundVariantSchema<V> & CVAClassProp<T>)[];
|
|
12
|
+
type CVAClassProp<T extends ClassValue = ClassValue> = {
|
|
13
|
+
class?: T;
|
|
14
|
+
className?: never;
|
|
15
|
+
} | {
|
|
16
|
+
class?: never;
|
|
17
|
+
className?: T;
|
|
18
|
+
};
|
|
19
|
+
type CVAComponentConfig<Config, Variants, ComposedSingle extends CVAComponentShape | undefined = CVAComponentShape | undefined, ComposedList extends readonly CVAComponentShape[] = readonly CVAComponentShape[], T extends ClassValue = ClassValue, Merged = Variants> = Config & {
|
|
20
|
+
composes?: ComposedSingle | readonly [...ComposedList];
|
|
21
|
+
} & (Variants extends Record<string, Record<string, T>> ? CVAComponentConfigBase<T> & {
|
|
22
|
+
variants?: Variants & {
|
|
23
|
+
__proto__?: never;
|
|
24
|
+
};
|
|
25
|
+
} : CVAComponentConfigBase<T> & {
|
|
26
|
+
variants?: never;
|
|
27
|
+
}) & ([keyof Merged] extends [never] ? {
|
|
28
|
+
compoundVariants?: never;
|
|
29
|
+
defaultVariants?: never;
|
|
30
|
+
} : {
|
|
31
|
+
compoundVariants?: CVACompoundVariants<Uninferred<Merged>, T>;
|
|
32
|
+
defaultVariants?: CVAVariantSchema<Uninferred<Merged>>;
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/config.d.ts
|
|
36
|
+
type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
|
|
37
|
+
type ClassDictionary = Record<string, any>;
|
|
38
|
+
type ClassArray = ClassValue[];
|
|
39
|
+
/**
|
|
40
|
+
* Any function usable as a `cx` concatenator.
|
|
41
|
+
*/
|
|
42
|
+
type AnyCX = (...inputs: any[]) => string;
|
|
43
|
+
type CXInputs<TCX extends AnyCX> = TCX extends ((...inputs: readonly [...infer Inputs]) => string) ? Inputs : never;
|
|
44
|
+
type CXInputElement<TCX extends AnyCX> = CXInputs<TCX>[number];
|
|
45
|
+
type CXHasSafeArity<TCX extends AnyCX> = CXInputs<TCX> extends (infer Inputs) ? Inputs extends readonly unknown[] ? Inputs extends [] ? true : [] extends Inputs ? number extends Inputs["length"] ? true : false : false : false : false;
|
|
46
|
+
type CXConstraint<TCX extends AnyCX> = false extends CXHasSafeArity<TCX> ? "cva's cx must accept zero arguments and an unbounded rest parameter." : [TCX] extends [(...inputs: (string | CXInput<TCX>)[]) => string] ? unknown : "cva's cx must accept its inferred class values and composed strings.";
|
|
47
|
+
/**
|
|
48
|
+
* The class value type a concatenator accepts, inferred from its
|
|
49
|
+
* parameters — `defineConfig` uses this to type the authoring surface
|
|
50
|
+
* (`base`, variant values, `class`/`className`) against the configured
|
|
51
|
+
* concatenator's own input grammar.
|
|
52
|
+
*/
|
|
53
|
+
type CXInput<TCX extends AnyCX> = CXInputElement<TCX> extends (infer P) ? 0 extends 1 & P ? ClassValue : [P] extends [never] ? ClassValue : [P] extends [ClassValue] ? P : [Extract<P, ClassValue>] extends [never] ? ClassValue : Extract<P, ClassValue> : ClassValue;
|
|
54
|
+
type OmitUndefined<T> = T extends undefined ? never : T;
|
|
55
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
56
|
+
type ComposedTuple<S extends CVAComponentShape | undefined, L extends readonly CVAComponentShape[]> = [S] extends [CVAComponentShape] ? [S] : L;
|
|
57
|
+
type MergedVariants<T extends readonly unknown[]> = UnionToIntersection<{ [K in keyof T]: T[K] extends {
|
|
58
|
+
config: {
|
|
59
|
+
variants?: infer V extends CVAVariantShape;
|
|
60
|
+
};
|
|
61
|
+
} ? V : never; }[number]>;
|
|
62
|
+
type RightMerge<A, B> = { [K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never; };
|
|
63
|
+
type DefaultsOf<Component> = Component extends {
|
|
64
|
+
config: {
|
|
65
|
+
defaultVariants?: infer D;
|
|
66
|
+
};
|
|
67
|
+
} ? D extends undefined ? {} : D : {};
|
|
68
|
+
type MergedDefaultVariants<T extends readonly unknown[]> = T extends readonly [infer Head, ...infer Rest] ? RightMerge<DefaultsOf<Head>, MergedDefaultVariants<Rest>> : {};
|
|
69
|
+
type VariantProps<Component extends (...args: any) => any> = Omit<OmitUndefined<Parameters<Component>[0]>, "class" | "className" | InternalVariantKey>;
|
|
70
|
+
interface CX<T extends ClassValue = ClassValue> {
|
|
71
|
+
(...inputs: T[]): string;
|
|
72
|
+
}
|
|
73
|
+
type CXOptions = Parameters<CX>;
|
|
74
|
+
type CXReturn = ReturnType<CX>;
|
|
75
|
+
/**
|
|
76
|
+
* Exported so TypeScript can name this type in your generated declarations
|
|
77
|
+
* (`declaration: true`) — you shouldn't really use it directly.
|
|
78
|
+
*/
|
|
79
|
+
type CVAVariantShape = Record<string, Record<string, ClassValue>>;
|
|
80
|
+
/**
|
|
81
|
+
* Exported so TypeScript can name this type in your generated declarations
|
|
82
|
+
* (`declaration: true`) — you shouldn't really use it directly.
|
|
83
|
+
*/
|
|
84
|
+
interface CVAComponent<Config, Variants, T extends ClassValue = ClassValue> {
|
|
85
|
+
(props?: Variants extends CVAVariantShape ? CVAVariantSchema<Variants> & CVAClassProp<T> : CVAClassProp<T>): string;
|
|
86
|
+
/** @internal */
|
|
87
|
+
config: Config;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Exported so TypeScript can name this type in your generated declarations
|
|
91
|
+
* (`declaration: true`) — you shouldn't really use it directly.
|
|
92
|
+
*/
|
|
93
|
+
type CVAComponentShape = CVAComponent<any, any, any>;
|
|
94
|
+
type CVADefaultVariants<Config> = Config extends {
|
|
95
|
+
defaultVariants?: infer D;
|
|
96
|
+
} ? D : {};
|
|
97
|
+
type AllVariants<Variants, ComposedSingle extends CVAComponentShape | undefined, ComposedList extends readonly CVAComponentShape[]> = [ComposedSingle] extends [undefined] ? [ComposedList] extends [readonly []] ? Variants : Variants & MergedVariants<ComposedList> : Variants & MergedVariants<ComposedTuple<ComposedSingle, ComposedList>>;
|
|
98
|
+
interface CVA<T extends ClassValue = ClassValue> {
|
|
99
|
+
<_ extends InternalOnlyWarning, Config, Variants, ComposedSingle extends CVAComponentShape | undefined = undefined, ComposedList extends readonly CVAComponentShape[] = []>(config: CVAComponentConfig<Config, Variants, ComposedSingle, ComposedList, T, AllVariants<Variants, ComposedSingle, ComposedList>>): CVAComponent<Omit<Config, "defaultVariants"> & {
|
|
100
|
+
variants: AllVariants<Variants, ComposedSingle, ComposedList>;
|
|
101
|
+
defaultVariants: Omit<MergedDefaultVariants<ComposedTuple<ComposedSingle, ComposedList>>, keyof CVADefaultVariants<Config>> & CVADefaultVariants<Config>;
|
|
102
|
+
}, AllVariants<Variants, ComposedSingle, ComposedList>, T>;
|
|
103
|
+
}
|
|
104
|
+
interface DefineConfigOptions<TCX extends AnyCX = CX> {
|
|
105
|
+
/**
|
|
106
|
+
* The class name concatenator used by `cva` and `cx`. It owns the class
|
|
107
|
+
* name grammar entirely: cva assembles the authored values
|
|
108
|
+
* (composed component outputs, `base`, matched variant and compound
|
|
109
|
+
* variant values, `class`/`className`) and passes them through verbatim,
|
|
110
|
+
* one argument each, without interpreting them.
|
|
111
|
+
*
|
|
112
|
+
* The authoring surface adopts the concatenator's own input type
|
|
113
|
+
* automatically (see {@link CXInput}): pass `twMerge` and your variants
|
|
114
|
+
* are checked against tailwind-merge's `ClassNameValue`; pass `clsx` (or
|
|
115
|
+
* any function whose parameters don't narrow further) and you keep the
|
|
116
|
+
* full clsx-flavored `ClassValue` grammar.
|
|
117
|
+
*/
|
|
118
|
+
cx: TCX & CXConstraint<TCX>;
|
|
119
|
+
}
|
|
120
|
+
interface DefineConfig {
|
|
121
|
+
<TCX extends AnyCX>(options: DefineConfigOptions<TCX>): {
|
|
122
|
+
cx: CX<CXInput<TCX>>;
|
|
123
|
+
cva: CVA<CXInput<TCX>>;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
declare const defineConfig: DefineConfig;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { CVAComponentConfig as _, CVAVariantShape as a, StringToBoolean as b, CXOptions as c, ClassDictionary as d, ClassValue as f, defineConfig as g, VariantProps as h, CVAComponentShape as i, CXReturn as l, DefineConfigOptions as m, CVA as n, CX as o, DefineConfig as p, CVAComponent as r, CXInput as s, AnyCX as t, ClassArray as u, InternalOnlyWarning as v, InternalVariantKey as y };
|
|
129
|
+
//# sourceMappingURL=config-BnHlj-cB.d.mts.map
|
package/dist/config.cjs
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/config.ts
|
|
3
|
+
const falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
4
|
+
const empty = {};
|
|
5
|
+
const noValues = [];
|
|
6
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
7
|
+
const ownEnumerable = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
const definedProps = (props, seed) => {
|
|
9
|
+
let merged = { ...seed };
|
|
10
|
+
for (const key in props) if (hasOwn.call(props, key)) {
|
|
11
|
+
const value = props[key];
|
|
12
|
+
if (key !== "class" && key !== "className" && value !== void 0) if (key === "__proto__") merged = {
|
|
13
|
+
...merged,
|
|
14
|
+
[key]: value
|
|
15
|
+
};
|
|
16
|
+
else merged[key] = value;
|
|
17
|
+
}
|
|
18
|
+
return merged;
|
|
19
|
+
};
|
|
20
|
+
const pushDefined = (out, value) => {
|
|
21
|
+
if (value !== void 0) out.push(value);
|
|
22
|
+
};
|
|
23
|
+
const pushClassProps = (out, source) => {
|
|
24
|
+
pushDefined(out, source.class);
|
|
25
|
+
pushDefined(out, source.className);
|
|
26
|
+
return out;
|
|
27
|
+
};
|
|
28
|
+
const mergeInto = (merged, source) => {
|
|
29
|
+
const variants = source && source.variants;
|
|
30
|
+
for (const key in variants) if (hasOwn.call(variants, key)) {
|
|
31
|
+
const values = {
|
|
32
|
+
...merged.variants[key],
|
|
33
|
+
...variants[key]
|
|
34
|
+
};
|
|
35
|
+
if (key === "__proto__") merged.variants = {
|
|
36
|
+
...merged.variants,
|
|
37
|
+
[key]: values
|
|
38
|
+
};
|
|
39
|
+
else merged.variants[key] = values;
|
|
40
|
+
}
|
|
41
|
+
merged.defaults = {
|
|
42
|
+
...merged.defaults,
|
|
43
|
+
...source && source.defaultVariants
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const mergeConfig = (children, definition) => {
|
|
47
|
+
const merged = {
|
|
48
|
+
variants: {},
|
|
49
|
+
defaults: {}
|
|
50
|
+
};
|
|
51
|
+
for (let i = 0; i < children.length; i++) mergeInto(merged, children[i].config);
|
|
52
|
+
mergeInto(merged, definition);
|
|
53
|
+
return merged;
|
|
54
|
+
};
|
|
55
|
+
const prepareVariants = (localVariants, defaults) => {
|
|
56
|
+
const names = [];
|
|
57
|
+
const maps = [];
|
|
58
|
+
for (const key in localVariants) if (hasOwn.call(localVariants, key)) {
|
|
59
|
+
names.push(key);
|
|
60
|
+
maps.push(localVariants[key]);
|
|
61
|
+
}
|
|
62
|
+
if (!names.length) return [
|
|
63
|
+
noValues,
|
|
64
|
+
noValues,
|
|
65
|
+
noValues
|
|
66
|
+
];
|
|
67
|
+
return [
|
|
68
|
+
names.slice(),
|
|
69
|
+
maps.slice(),
|
|
70
|
+
names.map((key, i) => maps[i][falsyToString(defaults[key])])
|
|
71
|
+
];
|
|
72
|
+
};
|
|
73
|
+
const compoundMatches = (compound, indexes, selectors, values) => {
|
|
74
|
+
for (let i = compound.start; i < compound.end; i++) {
|
|
75
|
+
const selector = selectors[i];
|
|
76
|
+
const value = values[indexes[i]];
|
|
77
|
+
if (Array.isArray(selector) ? !selector.includes(value) : value !== selector) return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
81
|
+
const prepareCompounds = (compoundVariants, variantKeys, defaults) => {
|
|
82
|
+
const keys = variantKeys.slice();
|
|
83
|
+
const compounds = [];
|
|
84
|
+
const indexes = [];
|
|
85
|
+
const selectors = [];
|
|
86
|
+
for (let i = 0; i < compoundVariants.length; i++) {
|
|
87
|
+
const compound = compoundVariants[i];
|
|
88
|
+
const start = indexes.length;
|
|
89
|
+
let mask = 0;
|
|
90
|
+
for (const key in compound) if (hasOwn.call(compound, key)) {
|
|
91
|
+
const selector = compound[key];
|
|
92
|
+
if (key !== "class" && key !== "className") {
|
|
93
|
+
let index = keys.indexOf(key);
|
|
94
|
+
if (index === -1) index = keys.push(key) - 1;
|
|
95
|
+
indexes.push(index);
|
|
96
|
+
selectors.push(selector);
|
|
97
|
+
mask |= 1 << index;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
compounds.push({
|
|
101
|
+
start,
|
|
102
|
+
end: indexes.length,
|
|
103
|
+
mask,
|
|
104
|
+
matchesDefaults: false,
|
|
105
|
+
class: compound.class,
|
|
106
|
+
className: compound.className
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const defaultValues = keys.map((key) => defaults[key]);
|
|
110
|
+
for (let i = 0; i < compounds.length; i++) compounds[i].matchesDefaults = compoundMatches(compounds[i], indexes, selectors, defaultValues);
|
|
111
|
+
return [
|
|
112
|
+
keys.slice(),
|
|
113
|
+
defaultValues,
|
|
114
|
+
compounds.slice(),
|
|
115
|
+
indexes.slice(),
|
|
116
|
+
selectors.slice()
|
|
117
|
+
];
|
|
118
|
+
};
|
|
119
|
+
const createPlainComponent = (cxArray, defaultOut, singleDefaultClass) => (input) => {
|
|
120
|
+
const props = input || empty;
|
|
121
|
+
const classValue = props.class;
|
|
122
|
+
const classNameValue = props.className;
|
|
123
|
+
if (classValue === void 0 && singleDefaultClass !== void 0) return cxArray(classNameValue === void 0 ? [singleDefaultClass] : [singleDefaultClass, classNameValue]);
|
|
124
|
+
const out = defaultOut.slice();
|
|
125
|
+
pushDefined(out, classValue);
|
|
126
|
+
pushDefined(out, classNameValue);
|
|
127
|
+
return cxArray(out);
|
|
128
|
+
};
|
|
129
|
+
const defineConfig = ((options) => {
|
|
130
|
+
const cxArray = (inputs) => Reflect.apply(options.cx, options, inputs);
|
|
131
|
+
const cx = (...inputs) => cxArray(inputs.filter((input) => input !== void 0));
|
|
132
|
+
const cva = ((config) => {
|
|
133
|
+
const definition = config || empty;
|
|
134
|
+
const composes = definition.composes;
|
|
135
|
+
const base = definition.base;
|
|
136
|
+
const children = composes == null ? noValues : Array.isArray(composes) ? composes.slice() : [composes];
|
|
137
|
+
const childCount = children.length;
|
|
138
|
+
const { variants: mergedVariants, defaults } = mergeConfig(children, definition);
|
|
139
|
+
const preparedVariants = prepareVariants(definition.variants, defaults);
|
|
140
|
+
const variantKeys = preparedVariants[0];
|
|
141
|
+
const variantMaps = preparedVariants[1];
|
|
142
|
+
const defaultClasses = preparedVariants[2];
|
|
143
|
+
const variantCount = variantKeys.length;
|
|
144
|
+
const prepared = definition.compoundVariants ? prepareCompounds(definition.compoundVariants, variantKeys, defaults) : void 0;
|
|
145
|
+
const keys = prepared ? prepared[0] : variantKeys;
|
|
146
|
+
const defaultValues = prepared ? prepared[1] : noValues;
|
|
147
|
+
const compounds = prepared ? prepared[2] : noValues;
|
|
148
|
+
const indexes = prepared ? prepared[3] : noValues;
|
|
149
|
+
const selectors = prepared ? prepared[4] : noValues;
|
|
150
|
+
const keyCount = keys.length;
|
|
151
|
+
const compoundCount = compounds.length;
|
|
152
|
+
const onlyBase = !variantCount && !compoundCount;
|
|
153
|
+
const assembled = onlyBase && base !== void 0 ? [base] : [];
|
|
154
|
+
if (!onlyBase) pushDefined(assembled, base);
|
|
155
|
+
for (let i = 0; i < variantCount; i++) pushDefined(assembled, defaultClasses[i]);
|
|
156
|
+
for (let i = 0; i < compoundCount; i++) {
|
|
157
|
+
const compound = compounds[i];
|
|
158
|
+
if (compound.matchesDefaults) pushClassProps(assembled, compound);
|
|
159
|
+
}
|
|
160
|
+
const defaultOut = onlyBase ? assembled : assembled.slice();
|
|
161
|
+
const singleDefaultClass = defaultOut.length === 1 ? defaultOut[0] : void 0;
|
|
162
|
+
const component = !keyCount && !childCount ? createPlainComponent(cxArray, defaultOut, singleDefaultClass) : (input) => {
|
|
163
|
+
const props = input || empty;
|
|
164
|
+
const classValue = props.class;
|
|
165
|
+
const classNameValue = props.className;
|
|
166
|
+
let supplied = 0;
|
|
167
|
+
const variantClasses = variantCount ? new Array(variantCount) : void 0;
|
|
168
|
+
const resolved = compoundCount ? new Array(keyCount) : void 0;
|
|
169
|
+
for (let i = 0; i < keyCount; i++) {
|
|
170
|
+
const key = keys[i];
|
|
171
|
+
const own = compoundCount !== 0 && ownEnumerable.call(props, key);
|
|
172
|
+
const value = i < variantCount || own ? props[key] : void 0;
|
|
173
|
+
if (value !== void 0) supplied |= i < 31 ? 1 << i : -1;
|
|
174
|
+
if (variantClasses && i < variantCount) {
|
|
175
|
+
const variantKey = falsyToString(value);
|
|
176
|
+
variantClasses[i] = variantKey ? variantMaps[i][variantKey] : defaultClasses[i];
|
|
177
|
+
}
|
|
178
|
+
if (resolved) resolved[i] = own && value !== void 0 ? value : defaultValues[i];
|
|
179
|
+
}
|
|
180
|
+
if (!childCount && !supplied) {
|
|
181
|
+
if (classValue === void 0) {
|
|
182
|
+
if (singleDefaultClass !== void 0) return cxArray(classNameValue === void 0 ? [singleDefaultClass] : [singleDefaultClass, classNameValue]);
|
|
183
|
+
if (classNameValue === void 0) return cxArray(defaultOut);
|
|
184
|
+
}
|
|
185
|
+
const out = defaultOut.slice();
|
|
186
|
+
pushDefined(out, classValue);
|
|
187
|
+
pushDefined(out, classNameValue);
|
|
188
|
+
return cxArray(out);
|
|
189
|
+
}
|
|
190
|
+
const out = [];
|
|
191
|
+
if (childCount) {
|
|
192
|
+
const forwarded = definedProps(props, defaults);
|
|
193
|
+
for (let i = 0; i < childCount; i++) {
|
|
194
|
+
const child = children[i];
|
|
195
|
+
pushDefined(out, child({ ...forwarded }));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
pushDefined(out, base);
|
|
199
|
+
if (variantClasses) for (let i = 0; i < variantCount; i++) pushDefined(out, variantClasses[i]);
|
|
200
|
+
if (resolved) for (let i = 0; i < compoundCount; i++) {
|
|
201
|
+
const compound = compounds[i];
|
|
202
|
+
let matched = compound.matchesDefaults;
|
|
203
|
+
if (supplied & compound.mask) {
|
|
204
|
+
matched = true;
|
|
205
|
+
for (let j = compound.start; j < compound.end; j++) {
|
|
206
|
+
const selector = selectors[j];
|
|
207
|
+
const value = resolved[indexes[j]];
|
|
208
|
+
if (Array.isArray(selector) ? !selector.includes(value) : value !== selector) {
|
|
209
|
+
matched = false;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (matched) pushClassProps(out, compound);
|
|
215
|
+
}
|
|
216
|
+
pushDefined(out, classValue);
|
|
217
|
+
pushDefined(out, classNameValue);
|
|
218
|
+
return cxArray(out);
|
|
219
|
+
};
|
|
220
|
+
component.config = {
|
|
221
|
+
...config,
|
|
222
|
+
variants: mergedVariants,
|
|
223
|
+
defaultVariants: defaults
|
|
224
|
+
};
|
|
225
|
+
return component;
|
|
226
|
+
});
|
|
227
|
+
return {
|
|
228
|
+
cva,
|
|
229
|
+
cx
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
//#endregion
|
|
233
|
+
exports.defineConfig = defineConfig;
|
|
234
|
+
|
|
235
|
+
//# sourceMappingURL=config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.cjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["/**\n * Copyright 2022-present Joe Bell. All rights reserved.\n *\n * This file is licensed to you under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with the\n * License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\nimport type {\n CVAClassProp,\n CVAComponentConfig,\n CVAVariantSchema,\n InternalOnlyWarning,\n InternalVariantKey,\n} from \"./types.js\";\n\n/* Types\n ============================================ */\n\n/* ClassValue\n ---------------------------------- */\n\n// Mirrors clsx's `ClassValue`; local to keep `cva/config` dependency-free\n// (TS2742).\n\nexport type ClassValue =\n | ClassArray\n | ClassDictionary\n | string\n | number\n | bigint\n | null\n | boolean\n | undefined;\nexport type ClassDictionary = Record<string, any>;\nexport type ClassArray = ClassValue[];\n\n/* CXInput\n ---------------------------------- */\n\n/**\n * Any function usable as a `cx` concatenator.\n */\nexport type AnyCX = (...inputs: any[]) => string;\n\n// Infer directly from a readonly rest pattern instead of `Parameters<T>[number]`:\n// the latter is `never` for zero-argument callbacks and loses readonly rest\n// element types.\ntype CXInputs<TCX extends AnyCX> = TCX extends (\n ...inputs: readonly [...infer Inputs]\n) => string\n ? Inputs\n : never;\ntype CXInputElement<TCX extends AnyCX> = CXInputs<TCX>[number];\n\n// cva may call `cx` with no values, or with any number of authored values and\n// composed component strings. A constant callback is safe; every other\n// callback must accept arbitrary lists of its own grammar plus strings.\ntype CXHasSafeArity<TCX extends AnyCX> =\n CXInputs<TCX> extends infer Inputs\n ? Inputs extends readonly unknown[]\n ? Inputs extends []\n ? true\n : [] extends Inputs\n ? number extends Inputs[\"length\"]\n ? true\n : false\n : false\n : false\n : false;\ntype CXConstraint<TCX extends AnyCX> =\n false extends CXHasSafeArity<TCX>\n ? \"cva's cx must accept zero arguments and an unbounded rest parameter.\"\n : [TCX] extends [(...inputs: (string | CXInput<TCX>)[]) => string]\n ? unknown\n : \"cva's cx must accept its inferred class values and composed strings.\";\n\n/**\n * The class value type a concatenator accepts, inferred from its\n * parameters — `defineConfig` uses this to type the authoring surface\n * (`base`, variant values, `class`/`className`) against the configured\n * concatenator's own input grammar.\n */\nexport type CXInput<TCX extends AnyCX> =\n CXInputElement<TCX> extends infer P\n ? // `0 extends 1 & P` detects `any`; `any`/`never` use `ClassValue`.\n 0 extends 1 & P\n ? ClassValue\n : [P] extends [never]\n ? ClassValue\n : [P] extends [ClassValue]\n ? P\n : // A concatenator accepting more than cva's grammar (e.g. `string |\n // URL`) narrows to the subset it shares with it, since the surface\n // can't widen beyond what the concatenator accepts; when nothing is\n // shared (e.g. `unknown`), the full grammar applies.\n [Extract<P, ClassValue>] extends [never]\n ? ClassValue\n : Extract<P, ClassValue>\n : ClassValue;\n\n/* Utils\n ---------------------------------- */\n\ntype OmitUndefined<T> = T extends undefined ? never : T;\ntype UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (\n k: infer I,\n) => void\n ? I\n : never;\n\n// `composes` accepts either a single component or a list of components. A\n// plain union (`CVAComponentShape | CVAComponentShape[]`) collapses an array\n// literal's element type to a union, silently dropping components whose\n// variants are a structural subtype of another composed component's (e.g.\n// `composes: [a, b]` where `b`'s variants are a superset of `a`'s). Splitting\n// inference across two type parameters preserves the array as a real tuple.\ntype ComposedTuple<\n S extends CVAComponentShape | undefined,\n L extends readonly CVAComponentShape[],\n> = [S] extends [CVAComponentShape] ? [S] : L;\n\ntype MergedVariants<T extends readonly unknown[]> = UnionToIntersection<\n {\n [K in keyof T]: T[K] extends {\n config: { variants?: infer V extends CVAVariantShape };\n }\n ? V\n : never;\n }[number]\n>;\n\n// Right-biased merge (`B`'s keys win on conflicts) implemented as a mapped\n// type rather than `Omit<A, keyof B> & B`: the latter stays an unresolved\n// deferred type when `A`/`B` are themselves generic (as they are here, via\n// `ReturnType<CVA>` with no concrete `Config`), which then breaks downstream\n// `any`-narrowing in unrelated code that consumes `ReturnType<CVA>` (e.g. the\n// `composes` and `getSchema` guards). A mapped type resolves eagerly instead.\ntype RightMerge<A, B> = {\n [K in keyof A | keyof B]: K extends keyof B\n ? B[K]\n : K extends keyof A\n ? A[K]\n : never;\n};\n\n// `D` infers as `undefined` (not absent) when a component declares no\n// `defaultVariants` at all. `NonNullable<undefined>` would give `never`,\n// and `keyof never` is `string | number | symbol` (not `never`) — poisoning\n// `RightMerge`'s key union with every possible key. Normalize to `{}` instead,\n// matching a component that contributes nothing to the merge.\ntype DefaultsOf<Component> = Component extends {\n config: { defaultVariants?: infer D };\n}\n ? D extends undefined\n ? {}\n : D\n : {};\n\ntype MergedDefaultVariants<T extends readonly unknown[]> = T extends readonly [\n infer Head,\n ...infer Rest,\n]\n ? RightMerge<DefaultsOf<Head>, MergedDefaultVariants<Rest>>\n : {};\n\n// One `Omit`: nesting the class-prop removal in a helper builds the props twice.\nexport type VariantProps<Component extends (...args: any) => any> = Omit<\n OmitUndefined<Parameters<Component>[0]>,\n \"class\" | \"className\" | InternalVariantKey\n>;\n\n/* cx\n ---------------------------------- */\n\nexport interface CX<T extends ClassValue = ClassValue> {\n (...inputs: T[]): string;\n}\n\nexport type CXOptions = Parameters<CX>;\nexport type CXReturn = ReturnType<CX>;\n\n/* cva\n ============================================ */\n\n/**\n * Exported so TypeScript can name this type in your generated declarations\n * (`declaration: true`) — you shouldn't really use it directly.\n */\nexport type CVAVariantShape = Record<string, Record<string, ClassValue>>;\n/**\n * Exported so TypeScript can name this type in your generated declarations\n * (`declaration: true`) — you shouldn't really use it directly.\n */\nexport interface CVAComponent<\n Config,\n Variants,\n T extends ClassValue = ClassValue,\n> {\n (\n props?: Variants extends CVAVariantShape\n ? CVAVariantSchema<Variants> & CVAClassProp<T>\n : CVAClassProp<T>,\n ): string;\n /** @internal */\n config: Config;\n}\n\n// The loosest form a composable component can take, constraining `composes`\n// and the composition merge helpers above. Deriving it from `CVAComponent`\n// keeps the two from drifting: instantiated with `any`, the props conditional\n// and `config` both collapse to `any` (mapped types over `any` are `any`),\n// i.e. `{ (props?: any): string; config: any }`. The required `config`\n// property is what rejects plain functions.\n//\n// The `any` arguments are deliberate, not lazy typing — a shaped `config`\n// (e.g. `{ variants?: CVAVariantShape }`) was tried and verifiably breaks:\n// a variant-less `cva({ base })` carries `variants: unknown`, and\n// `ReturnType<CVA>` instantiates this constraint inside the `composes` and\n// `GetSchema` guards, where the shaped form rejects every real component via\n// props contravariance.\n//\n// Its class-value parameter must be `any`: narrowed components otherwise fail\n// props contravariance in `composes` and `getSchema`.\n/**\n * Exported so TypeScript can name this type in your generated declarations\n * (`declaration: true`) — you shouldn't really use it directly.\n */\nexport type CVAComponentShape = CVAComponent<any, any, any>;\n\ntype CVADefaultVariants<Config> = Config extends { defaultVariants?: infer D }\n ? D\n : {};\n\n// Nothing composed is the common case: answer with `Variants` and skip the\n// merge machinery.\ntype AllVariants<\n Variants,\n ComposedSingle extends CVAComponentShape | undefined,\n ComposedList extends readonly CVAComponentShape[],\n> = [ComposedSingle] extends [undefined]\n ? [ComposedList] extends [readonly []]\n ? Variants\n : Variants & MergedVariants<ComposedList>\n : Variants & MergedVariants<ComposedTuple<ComposedSingle, ComposedList>>;\n\nexport interface CVA<T extends ClassValue = ClassValue> {\n <\n _ extends InternalOnlyWarning,\n Config,\n Variants,\n ComposedSingle extends CVAComponentShape | undefined = undefined,\n ComposedList extends readonly CVAComponentShape[] = [],\n >(\n config: CVAComponentConfig<\n Config,\n Variants,\n ComposedSingle,\n ComposedList,\n T,\n AllVariants<Variants, ComposedSingle, ComposedList>\n >,\n ): CVAComponent<\n Omit<Config, \"defaultVariants\"> & {\n variants: AllVariants<Variants, ComposedSingle, ComposedList>;\n // Local `defaultVariants` win over composed ones on key conflicts,\n // matching the runtime spread order. A plain intersection would collapse\n // a conflicting key's value to `never` (e.g. `\"sm\" & \"lg\"`), which then\n // silently drops the variant from `getSchema`'s inferred type.\n defaultVariants: Omit<\n MergedDefaultVariants<ComposedTuple<ComposedSingle, ComposedList>>,\n keyof CVADefaultVariants<Config>\n > &\n CVADefaultVariants<Config>;\n },\n AllVariants<Variants, ComposedSingle, ComposedList>,\n T\n >;\n}\n\n/* defineConfig\n ---------------------------------- */\n\nexport interface DefineConfigOptions<TCX extends AnyCX = CX> {\n /**\n * The class name concatenator used by `cva` and `cx`. It owns the class\n * name grammar entirely: cva assembles the authored values\n * (composed component outputs, `base`, matched variant and compound\n * variant values, `class`/`className`) and passes them through verbatim,\n * one argument each, without interpreting them.\n *\n * The authoring surface adopts the concatenator's own input type\n * automatically (see {@link CXInput}): pass `twMerge` and your variants\n * are checked against tailwind-merge's `ClassNameValue`; pass `clsx` (or\n * any function whose parameters don't narrow further) and you keep the\n * full clsx-flavored `ClassValue` grammar.\n */\n cx: TCX & CXConstraint<TCX>;\n}\n\nexport interface DefineConfig {\n <TCX extends AnyCX>(\n options: DefineConfigOptions<TCX>,\n ): {\n cx: CX<CXInput<TCX>>;\n cva: CVA<CXInput<TCX>>;\n };\n}\n\n/* Exports\n ============================================ */\n\nconst falsyToString = <T extends unknown>(value: T) =>\n typeof value === \"boolean\" ? `${value}` : value === 0 ? \"0\" : value;\n\n// Absent objects normalise to this: `x?.y` costs a temporary at ES2019.\nconst empty: Record<string, any> = {};\n\n// The table for a component that has none. Never written to.\nconst noValues: readonly never[] = [];\n\nconst hasOwn = Object.prototype.hasOwnProperty;\n\nconst ownEnumerable = Object.prototype.propertyIsEnumerable;\n\n// The caller's own defined props, minus the class props, over `seed`. An\n// explicit `undefined` keeps the default; an inherited getter is never read.\nconst definedProps = (\n props: Record<string, unknown>,\n seed: Record<string, unknown>,\n): Record<string, unknown> => {\n let merged: Record<string, unknown> = { ...seed };\n for (const key in props) {\n if (hasOwn.call(props, key)) {\n const value = props[key];\n if (key !== \"class\" && key !== \"className\" && value !== undefined) {\n // A computed key creates a data property; `merged.__proto__ =` would\n // hit `Object.prototype`'s setter and reparent the object.\n if (key === \"__proto__\") merged = { ...merged, [key]: value };\n else merged[key] = value;\n }\n }\n }\n return merged;\n};\n\nconst pushDefined = (out: ClassValue[], value: ClassValue) => {\n if (value !== undefined) out.push(value);\n};\n\nconst pushClassProps = (\n out: ClassValue[],\n source: { class?: ClassValue; className?: ClassValue },\n) => {\n pushDefined(out, source.class);\n pushDefined(out, source.className);\n return out;\n};\n\n// A compound's selectors live in the shared arrays, bounded by start and end.\n// `mask` has a bit per key it selects on: a call whose supplied keys miss it\n// reuses `matchesDefaults`, and a hit only means the selectors are compared,\n// since keys past the 31st share bits.\ninterface PreparedCompound {\n start: number;\n end: number;\n mask: number;\n matchesDefaults: boolean;\n class: ClassValue;\n className: ClassValue;\n}\n\ninterface MergedConfig {\n variants: CVAVariantShape;\n defaults: Record<string, unknown>;\n}\n\n// One source folded into the accumulator, so a later source wins.\nconst mergeInto = (\n merged: MergedConfig,\n source: Record<string, any> | undefined,\n) => {\n const variants: CVAVariantShape | undefined = source && source.variants;\n for (const key in variants) {\n if (hasOwn.call(variants, key)) {\n const values = { ...merged.variants[key], ...variants[key] };\n if (key === \"__proto__\") {\n merged.variants = { ...merged.variants, [key]: values };\n } else {\n merged.variants[key] = values;\n }\n }\n }\n merged.defaults = {\n ...merged.defaults,\n ...(source && source.defaultVariants),\n };\n};\n\nconst mergeConfig = (\n children: readonly CVAComponentShape[],\n definition: Record<string, any>,\n) => {\n const merged: MergedConfig = { variants: {}, defaults: {} };\n for (let i = 0; i < children.length; i++) {\n mergeInto(merged, children[i].config);\n }\n mergeInto(merged, definition);\n return merged;\n};\n\ntype PreparedVariants = readonly [\n variantKeys: readonly string[],\n variantMaps: readonly Record<string, ClassValue>[],\n defaultClasses: readonly ClassValue[],\n];\n\nconst prepareVariants = (\n localVariants: CVAVariantShape | undefined,\n defaults: Record<string, unknown>,\n): PreparedVariants => {\n const names: string[] = [];\n const maps: Record<string, ClassValue>[] = [];\n for (const key in localVariants) {\n if (hasOwn.call(localVariants, key)) {\n names.push(key);\n maps.push(localVariants[key]);\n }\n }\n // No variants, no retained tables; the rest are copied to their exact size.\n if (!names.length) return [noValues, noValues, noValues];\n return [\n names.slice(),\n maps.slice(),\n names.map((key, i) => maps[i][falsyToString(defaults[key]) as string]),\n ];\n};\n\nconst compoundMatches = (\n compound: PreparedCompound,\n indexes: readonly number[],\n selectors: readonly unknown[],\n values: readonly unknown[],\n) => {\n for (let i = compound.start; i < compound.end; i++) {\n const selector = selectors[i];\n const value = values[indexes[i]];\n if (\n Array.isArray(selector) ? !selector.includes(value) : value !== selector\n ) {\n return false;\n }\n }\n return true;\n};\n\n// A compound may select on a name no variant declares: the key list ends here.\ntype PreparedCompounds = readonly [\n keys: readonly string[],\n defaultValues: readonly unknown[],\n compounds: readonly PreparedCompound[],\n indexes: readonly number[],\n selectors: readonly unknown[],\n];\n\nconst prepareCompounds = (\n compoundVariants: readonly (CVAClassProp & Record<string, unknown>)[],\n variantKeys: readonly string[],\n defaults: Record<string, unknown>,\n): PreparedCompounds => {\n const keys = variantKeys.slice();\n const compounds: PreparedCompound[] = [];\n const indexes: number[] = [];\n const selectors: unknown[] = [];\n for (let i = 0; i < compoundVariants.length; i++) {\n const compound = compoundVariants[i];\n const start = indexes.length;\n let mask = 0;\n for (const key in compound) {\n if (hasOwn.call(compound, key)) {\n const selector = compound[key];\n if (key !== \"class\" && key !== \"className\") {\n let index = keys.indexOf(key);\n if (index === -1) index = keys.push(key) - 1;\n indexes.push(index);\n selectors.push(selector);\n mask |= 1 << index;\n }\n }\n }\n compounds.push({\n start,\n end: indexes.length,\n mask,\n matchesDefaults: false,\n class: compound.class,\n className: compound.className,\n });\n }\n const defaultValues = keys.map((key) => defaults[key]);\n for (let i = 0; i < compounds.length; i++) {\n compounds[i].matchesDefaults = compoundMatches(\n compounds[i],\n indexes,\n selectors,\n defaultValues,\n );\n }\n return [\n keys.slice(),\n defaultValues,\n compounds.slice(),\n indexes.slice(),\n selectors.slice(),\n ];\n};\n\n// The body of a component with no prop names to read and no children. At\n// module scope, so it captures three values rather than all of `cva`'s.\nconst createPlainComponent =\n (\n cxArray: (inputs: readonly ClassValue[]) => string,\n defaultOut: readonly ClassValue[],\n singleDefaultClass: ClassValue,\n ) =>\n (input?: Record<string, unknown>) => {\n const props: Record<string, unknown> = input || empty;\n const classValue = props.class as ClassValue;\n const classNameValue = props.className as ClassValue;\n // Rebuilding the list as a literal measures faster than sharing one.\n if (classValue === undefined && singleDefaultClass !== undefined) {\n return cxArray(\n classNameValue === undefined\n ? [singleDefaultClass]\n : [singleDefaultClass, classNameValue],\n );\n }\n const out = defaultOut.slice();\n pushDefined(out, classValue);\n pushDefined(out, classNameValue);\n return cxArray(out);\n };\n\n// Cast to `DefineConfig`: runtime uses `ClassValue`; `CXInput` is type-only.\nexport const defineConfig = ((options: DefineConfigOptions) => {\n // `Reflect.apply` hands over the assembled values as separate arguments and\n // keeps `options` as the receiver, whatever `cx`'s own `call`/`apply` say.\n const cxArray = (inputs: readonly ClassValue[]): string =>\n Reflect.apply(options.cx, options, inputs);\n\n const cx: CX = (...inputs) =>\n // Drop absent values so a narrower concatenator never receives `undefined`.\n cxArray(inputs.filter((input) => input !== undefined));\n\n const cva = (<\n _ extends InternalOnlyWarning,\n Config,\n Variants,\n ComposedSingle extends CVAComponentShape | undefined = undefined,\n ComposedList extends readonly CVAComponentShape[] = [],\n >(\n config: CVAComponentConfig<Config, Variants, ComposedSingle, ComposedList>,\n ) => {\n // The configuration is read here, when the component is created; a call\n // reads only the caller's props and `options`. By contract it is\n // immutable afterwards: a change means a new component.\n const definition: Record<string, any> = config || empty;\n const composes = definition.composes;\n const base: ClassValue = definition.base;\n // A copy, so the merge and every call see the same children.\n const children: readonly CVAComponentShape[] =\n composes == null\n ? noValues\n : Array.isArray(composes)\n ? composes.slice()\n : [composes];\n const childCount = children.length;\n\n const { variants: mergedVariants, defaults } = mergeConfig(\n children,\n definition,\n );\n const preparedVariants = prepareVariants(definition.variants, defaults);\n // Named locals keep the tuple readable; indexed access avoids iterator work.\n const variantKeys = preparedVariants[0];\n const variantMaps = preparedVariants[1];\n const defaultClasses = preparedVariants[2];\n const variantCount = variantKeys.length;\n const prepared = definition.compoundVariants\n ? prepareCompounds(definition.compoundVariants, variantKeys, defaults)\n : undefined;\n // Every prop name a call reads: the variant names first, so one index\n // addresses a value map and a default class too, then compound-only names.\n const keys = prepared ? prepared[0] : variantKeys;\n const defaultValues = prepared ? prepared[1] : noValues;\n const compounds = prepared ? prepared[2] : noValues;\n const indexes = prepared ? prepared[3] : noValues;\n const selectors = prepared ? prepared[4] : noValues;\n const keyCount = keys.length;\n const compoundCount = compounds.length;\n\n // The arguments for a call that supplies no known prop and no class prop,\n // and has no child to run. `Reflect.apply` copies it, so it never escapes.\n const onlyBase = !variantCount && !compoundCount;\n const assembled: ClassValue[] =\n onlyBase && base !== undefined ? [base] : [];\n if (!onlyBase) pushDefined(assembled, base);\n for (let i = 0; i < variantCount; i++) {\n pushDefined(assembled, defaultClasses[i]);\n }\n for (let i = 0; i < compoundCount; i++) {\n const compound = compounds[i];\n if (compound.matchesDefaults) pushClassProps(assembled, compound);\n }\n const defaultOut: ClassValue[] = onlyBase ? assembled : assembled.slice();\n // Every element is defined, so `undefined` means \"not a one-element list\".\n const singleDefaultClass: ClassValue =\n defaultOut.length === 1 ? defaultOut[0] : undefined;\n\n const component = (\n !keyCount && !childCount\n ? createPlainComponent(cxArray, defaultOut, singleDefaultClass)\n : (input?: Record<string, unknown>) => {\n const props: Record<string, unknown> = input || empty;\n const classValue = props.class as ClassValue;\n const classNameValue = props.className as ClassValue;\n\n let supplied = 0;\n const variantClasses = variantCount\n ? new Array<ClassValue>(variantCount)\n : undefined;\n const resolved = compoundCount\n ? new Array<unknown>(keyCount)\n : undefined;\n for (let i = 0; i < keyCount; i++) {\n const key = keys[i];\n // A variant name is read straight off `props`; a compound-only\n // name must be an own enumerable prop to count.\n const own = compoundCount !== 0 && ownEnumerable.call(props, key);\n const value = i < variantCount || own ? props[key] : undefined;\n // Past the 31st key, saturate: every compound with selectors is\n // compared.\n if (value !== undefined) supplied |= i < 31 ? 1 << i : -1;\n if (variantClasses && i < variantCount) {\n const variantKey = falsyToString(value);\n variantClasses[i] = variantKey\n ? variantMaps[i][variantKey as string]\n : defaultClasses[i];\n }\n if (resolved) {\n resolved[i] =\n own && value !== undefined ? value : defaultValues[i];\n }\n }\n\n if (!childCount && !supplied) {\n if (classValue === undefined) {\n if (singleDefaultClass !== undefined) {\n return cxArray(\n classNameValue === undefined\n ? [singleDefaultClass]\n : [singleDefaultClass, classNameValue],\n );\n }\n if (classNameValue === undefined) return cxArray(defaultOut);\n }\n const out = defaultOut.slice();\n pushDefined(out, classValue);\n pushDefined(out, classNameValue);\n return cxArray(out);\n }\n\n const out: ClassValue[] = [];\n if (childCount) {\n // A fresh object per child, and the child read out of the array\n // before the call, or it arrives as that child's `this`.\n const forwarded = definedProps(props, defaults);\n for (let i = 0; i < childCount; i++) {\n const child = children[i];\n pushDefined(out, child({ ...forwarded }));\n }\n }\n\n pushDefined(out, base);\n if (variantClasses) {\n for (let i = 0; i < variantCount; i++) {\n pushDefined(out, variantClasses[i]);\n }\n }\n if (resolved) {\n for (let i = 0; i < compoundCount; i++) {\n const compound = compounds[i];\n let matched = compound.matchesDefaults;\n if (supplied & compound.mask) {\n matched = true;\n for (let j = compound.start; j < compound.end; j++) {\n const selector = selectors[j];\n const value = resolved[indexes[j]];\n if (\n Array.isArray(selector)\n ? !selector.includes(value)\n : value !== selector\n ) {\n matched = false;\n break;\n }\n }\n }\n if (matched) pushClassProps(out, compound);\n }\n }\n\n pushDefined(out, classValue);\n pushDefined(out, classNameValue);\n return cxArray(out);\n }\n ) as CVAComponent<typeof config, typeof config.variants>;\n\n component.config = {\n ...config,\n variants: mergedVariants,\n defaultVariants: defaults,\n };\n\n return component as ReturnType<CVA>;\n }) as CVA;\n\n return {\n cva,\n cx,\n };\n}) as DefineConfig;\n"],"mappings":";;AAgUA,MAAM,iBAAoC,UACxC,OAAO,UAAU,YAAY,GAAG,UAAU,UAAU,IAAI,MAAM;AAGhE,MAAM,QAA6B,CAAC;AAGpC,MAAM,WAA6B,CAAC;AAEpC,MAAM,SAAS,OAAO,UAAU;AAEhC,MAAM,gBAAgB,OAAO,UAAU;AAIvC,MAAM,gBACJ,OACA,SAC4B;CAC5B,IAAI,SAAkC,EAAE,GAAG,KAAK;CAChD,KAAK,MAAM,OAAO,OAChB,IAAI,OAAO,KAAK,OAAO,GAAG,GAAG;EAC3B,MAAM,QAAQ,MAAM;EACpB,IAAI,QAAQ,WAAW,QAAQ,eAAe,UAAU,KAAA,GAGtD,IAAI,QAAQ,aAAa,SAAS;GAAE,GAAG;IAAS,MAAM;EAAM;OACvD,OAAO,OAAO;CAEvB;CAEF,OAAO;AACT;AAEA,MAAM,eAAe,KAAmB,UAAsB;CAC5D,IAAI,UAAU,KAAA,GAAW,IAAI,KAAK,KAAK;AACzC;AAEA,MAAM,kBACJ,KACA,WACG;CACH,YAAY,KAAK,OAAO,KAAK;CAC7B,YAAY,KAA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,UAAU;IAC7D;IACA,MAAM,MAAM,WAAW,MAAM;IAC7B,YAAY,KAAK,UAAU;IAC3B,YAAY,KAAK,cAAc;IAC/B,OAAO,QAAQ,GAAG;GACpB;GAEA,MAAM,MAAoB,CAAC;GAC3B,IAAI,YAAY;IAGd,MAAM,YAAY,aAAa,OAAO,QAAQ;IAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,KAAK;KACnC,MAAM,QAAQ,SAAS;KACvB,YAAY,KAAK,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC;IAC1C;GACF;GAEA,YAAY,KAAK,IAAI;GACrB,IAAI,gBACF,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,KAChC,YAAY,KAAK,eAAe,EAAE;GAGtC,IAAI,UACF,KAAK,IAAI,IAAI,GAAG,IAAI,eAAe,KAAK;IACtC,MAAM,WAAW,UAAU;IAC3B,IAAI,UAAU,SAAS;IACvB,IAAI,WAAW,SAAS,MAAM;KAC5B,UAAU;KACV,KAAK,IAAI,IAAI,SAAS,OAAO,IAAI,SAAS,KAAK,KAAK;MAClD,MAAM,WAAW,UAAU;MAC3B,MAAM,QAAQ,SAAS,QAAQ;MAC/B,IACE,MAAM,QAAQ,QAAQ,IAClB,CAAC,SAAS,SAAS,KAAK,IACxB,UAAU,UACd;OACA,UAAU;OACV;MACF;KACF;IACF;IACA,IAAI,SAAS,eAAe,KAAK,QAAQ;GAC3C;GAGF,YAAY,KAAK,UAAU;GAC3B,YAAY,KAAK,cAAc;GAC/B,OAAO,QAAQ,GAAG;EACpB;EAGN,UAAU,SAAS;GACjB,GAAG;GACH,UAAU;GACV,iBAAiB;EACnB;EAEA,OAAO;CACT;CAEA,OAAO;EACL;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as CVAVariantShape, c as CXOptions, d as ClassDictionary, f as ClassValue, g as defineConfig, h as VariantProps, i as CVAComponentShape, l as CXReturn, m as DefineConfigOptions, n as CVA, o as CX, p as DefineConfig, r as CVAComponent, s as CXInput, t as AnyCX, u as ClassArray } from "./config-BnHlj-cB.cjs";
|
|
2
|
+
export { AnyCX, CVA, CVAComponent, CVAComponentShape, CVAVariantShape, CX, CXInput, CXOptions, CXReturn, ClassArray, ClassDictionary, ClassValue, DefineConfig, DefineConfigOptions, VariantProps, defineConfig };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as CVAVariantShape, c as CXOptions, d as ClassDictionary, f as ClassValue, g as defineConfig, h as VariantProps, i as CVAComponentShape, l as CXReturn, m as DefineConfigOptions, n as CVA, o as CX, p as DefineConfig, r as CVAComponent, s as CXInput, t as AnyCX, u as ClassArray } from "./config-BnHlj-cB.mjs";
|
|
2
|
+
export { AnyCX, CVA, CVAComponent, CVAComponentShape, CVAVariantShape, CX, CXInput, CXOptions, CXReturn, ClassArray, ClassDictionary, ClassValue, DefineConfig, DefineConfigOptions, VariantProps, defineConfig };
|